/* ==========================================================================
   ZM Dental Studio — Layout: header, footer, sections, grids
   ========================================================================== */

body.no-scroll {
  overflow: hidden;
}

/* ---- Header ---- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 500;
  padding-block: var(--space-4);
  transition: background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), padding var(--dur-base) var(--ease-out);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  backdrop-filter: blur(0px);
  transition: background var(--dur-base) var(--ease-out), backdrop-filter var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  z-index: -1;
}

.site-header.is-scrolled::before {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 1px 0 rgba(22, 32, 43, 0.06), 0 12px 30px -18px rgba(22, 32, 43, 0.25);
}

.site-header.is-scrolled {
  padding-block: var(--space-3);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand__mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  white-space: nowrap;
}

.brand__text small {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.main-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.main-nav__list a {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding-block: var(--space-2);
  transition: color var(--dur-fast) var(--ease-out);
}

/* The icon tiles and the phone/CTA footer belong to the mobile slide-out
   panel only — hidden here so the desktop bar stays exactly as before. */
.main-nav__icon,
.main-nav__panel-footer {
  display: none;
}

.main-nav__list a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease-out);
}

.main-nav__list a:hover,
.main-nav__list a[aria-current="page"] {
  color: var(--ink);
}

.main-nav__list a:hover::after,
.main-nav__list a[aria-current="page"]::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.header-phone {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  white-space: nowrap;
}

.header-phone img {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.nav-toggle {
  display: none;
  position: relative;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-toggle__bars {
  position: relative;
  width: 18px;
  height: 12px;
}

.nav-toggle__bars span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.35s var(--ease-in-out), opacity 0.25s var(--ease-out), top 0.3s var(--ease-in-out), background-color 0.3s var(--ease-out);
}

.nav-toggle__bars span:nth-child(1) { top: 0; }
.nav-toggle__bars span:nth-child(2) { top: 5px; }
.nav-toggle__bars span:nth-child(3) { top: 10px; }

.nav-open .nav-toggle {
  background: var(--ink);
  border-color: var(--ink);
}

.nav-open .nav-toggle__bars span {
  background: var(--white);
}

.nav-open .nav-toggle__bars span:nth-child(1) {
  top: 5px;
  transform: rotate(45deg);
}
.nav-open .nav-toggle__bars span:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}
.nav-open .nav-toggle__bars span:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: var(--space-5);
}

.breadcrumbs a {
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out);
}

.breadcrumbs a:hover {
  color: var(--accent-dark);
}

.breadcrumbs .is-current {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---- Sections ---- */
.section {
  padding-block: var(--space-9);
}

.section--tight {
  padding-block: var(--space-8);
}

.section--soft {
  background: var(--bg-soft);
}

.page-hero {
  padding-top: calc(var(--space-9) + 4.5rem);
  padding-bottom: var(--space-8);
}

/* ---- Grids ---- */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .grid--3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .grid {
    gap: var(--space-4);
  }
  .grid--2,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .grid--2,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

/* Horizontal snap-scroll on small screens for card rows that would
   otherwise stack too tall (e.g. doctors) — nicer to browse on mobile. */
@media (max-width: 720px) {
  .scroll-row {
    display: flex;
    grid-template-columns: none;
    gap: var(--space-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-2);
    margin-inline: calc(var(--container-pad) * -1);
    padding-inline: var(--container-pad);
    scrollbar-width: none;
    /* claim only horizontal touch panning for this row — a vertical/diagonal
       swipe starting on a card must fall through to the page instead of
       getting stuck here (the classic "carousel traps page scroll" bug) */
    touch-action: pan-x;
    overscroll-behavior-x: contain;
  }
  .scroll-row::-webkit-scrollbar {
    display: none;
  }
  .scroll-row > * {
    scroll-snap-align: start;
    flex: 0 0 78%;
    max-width: 320px;
  }
}

/* ---- Footer (light, matches the reference) ---- */
.site-footer {
  position: relative;
  background: var(--white);
  color: var(--body);
  border-top: 1px solid var(--line-soft);
  padding-block: var(--space-8) var(--space-6);
}

/* Brand hairline: a teal thread fading out along the footer's top edge */
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(47, 143, 138, 0) 70%);
}

.footer-made {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-made::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
  gap: var(--space-7);
  padding-bottom: var(--space-7);
  border-bottom: 1px solid var(--line-soft);
}

.footer-brand .brand {
  color: var(--ink);
}

.footer-brand p {
  margin-top: var(--space-4);
  max-width: 32ch;
  font-size: 0.92rem;
  line-height: 1.7;
}

.footer-social {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.footer-social a {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.footer-social a:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.footer-social a:hover svg {
  color: var(--white);
}

.footer-social svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  color: var(--ink);
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-col h4 {
  color: var(--ink);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col a {
  font-size: 0.92rem;
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-col a:hover {
  color: var(--accent-dark);
}

.footer-contact-item {
  display: flex;
  gap: 0.6rem;
  font-size: 0.92rem;
  align-items: flex-start;
}

.footer-contact-item img {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  opacity: 0.6;
}

.footer-map {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 140px;
  border: 1px solid var(--line-soft);
}

.footer-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  filter: grayscale(0.2);
}

.footer-map__overlay {
  position: absolute;
  inset: 0;
}

.footer-contact-item > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-5);
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.footer-bottom a:hover {
  color: var(--ink);
}

/* ---- Mobile bottom nav ---- */
.mobile-tabbar {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 400;
  padding: 0.4rem var(--space-3) calc(0.5rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(160%);
  border-top: 1px solid rgba(22, 32, 43, 0.08);
}

.mobile-tabbar__list {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-tabbar__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding-block: 0.35rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out);
}

.mobile-tabbar__item img,
.mobile-tabbar__item svg {
  width: 21px;
  height: 21px;
  opacity: 0.55;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}

.mobile-tabbar__item svg {
  stroke: currentColor;
}

.mobile-tabbar__item:active img,
.mobile-tabbar__item:active svg {
  transform: scale(1.18);
}

.mobile-tabbar__item[aria-current="page"],
.mobile-tabbar__item:active {
  color: var(--accent-dark);
}

.mobile-tabbar__item[aria-current="page"] img {
  opacity: 1;
  filter: invert(46%) sepia(59%) saturate(438%) hue-rotate(126deg) brightness(93%) contrast(89%);
}

.mobile-tabbar__item[aria-current="page"] svg {
  opacity: 1;
}

/* Thin teal indicator above the active tab, flush with the bar's top edge */
.mobile-tabbar__item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -0.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

/* Booking tab is the money action — it gets a soft accent chip */
.mobile-tabbar__item--book {
  color: var(--accent-dark);
  font-weight: 700;
}

.mobile-tabbar__item--book img {
  width: 30px;
  height: 30px;
  padding: 5px;
  margin-top: -4px;
  background: var(--accent-soft);
  border-radius: 10px;
  opacity: 1;
}

/* ---- Responsive: nav collapse ---- */
@media (max-width: 960px) {
  .main-nav__panel {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(86vw, 380px);
    height: 100dvh;
    background: var(--white);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: calc(var(--space-9) + 1.5rem) var(--space-5) var(--space-6);
    box-shadow: -30px 0 60px rgba(22, 32, 43, 0.18);
    transform: translateX(100%);
    transition: transform 0.45s var(--ease-out);
    z-index: 90;
  }

  .nav-open .main-nav__panel {
    transform: translateX(0);
  }

  .main-nav__list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
  }

  .main-nav__list li {
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 60ms);
  }

  .nav-open .main-nav__list li {
    opacity: 1;
    transform: translateX(0);
  }

  .main-nav__list a {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.85rem 0.75rem;
    border-radius: var(--radius-md);
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), padding-left var(--dur-fast) var(--ease-out);
  }

  .main-nav__list a::after {
    display: none;
  }

  .main-nav__list a:hover,
  .main-nav__list a:active,
  .main-nav__list a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding-left: 1.1rem;
  }

  .main-nav__icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }

  .main-nav__icon img {
    width: 17px;
    height: 17px;
  }

  .main-nav__list a:hover .main-nav__icon,
  .main-nav__list a[aria-current="page"] .main-nav__icon {
    background: var(--accent);
    transform: scale(1.08) rotate(-4deg);
  }

  .main-nav__list a:hover .main-nav__icon img,
  .main-nav__list a[aria-current="page"] .main-nav__icon img {
    filter: invert(1);
  }

  .main-nav__panel-footer {
    margin-top: auto;
    padding-top: var(--space-5);
    border-top: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 60ms);
  }

  .nav-open .main-nav__panel-footer {
    opacity: 1;
    transform: translateX(0);
  }

  .header-phone--panel {
    justify-content: center;
    font-size: 1rem;
  }

  .header-phone--panel img {
    width: 18px;
    height: 18px;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(22, 32, 43, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s var(--ease-out);
    z-index: 80;
  }

  .nav-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  /* In the top bar the number collapses to an icon-only button;
     the slide-out panel keeps the full number visible. */
  .header-actions .header-phone span {
    display: none;
  }

  /* Icon-only phone button: proper 44px tap target, doesn't get
     squeezed to zero width on narrow screens. */
  .header-actions .header-phone {
    width: 44px;
    height: 44px;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--white);
    flex-shrink: 0;
  }

  .header-actions .header-phone img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .brand {
    font-size: 1.05rem;
    gap: 0.5rem;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
  }

  .brand__text small {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-actions .btn--book-header {
    display: none;
  }

  .mobile-tabbar {
    display: block;
  }

  body {
    padding-bottom: 74px;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
  }

  /* The tabbar and burger already cover navigation — the footer column
     would be the third copy of the same list */
  .footer-col--nav {
    display: none;
  }

  /* No point in a "map coming later" grey box on small screens */
  .footer-map {
    display: none;
  }

  /* Contacts become tappable chips */
  .footer-contact-item {
    align-items: center;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: var(--bg-soft);
  }

  .footer-contact-item + .footer-contact-item {
    margin-top: var(--space-3);
  }

  .footer-contact-item img {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .footer-top {
    grid-template-columns: 1fr;
  }

  .section {
    padding-block: var(--space-8);
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--space-6);
  }
}
