/* =========================================================================
   San Luis Oral Surgery — Base layout, header, footer
   Structure verified against Figma v2 frame 372:2/372:3 (Header) and
   Footer node 645:* on the Dental Implants page, 2026-07-24.
   ========================================================================= */

@import url("design-tokens.css");

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-white);
  font-size: var(--text-body);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-teal);
  color: var(--color-white);
  padding: 12px 20px;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */

.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-blue-tint);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px clamp(20px, 3vw, 180px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header__logo img { width: 138px; height: auto; max-width: 100%; }

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Six items plus chevrons no longer fit at mid widths — without this the
   labels wrap to two lines and the header grows. */
.site-header__nav > li { white-space: nowrap; }

.site-header__nav a {
  font-size: var(--text-body);
  color: var(--color-ink);
}

.site-header__nav a:hover,
.site-header__nav a[aria-current="page"] {
  color: var(--color-teal);
}

/* ---------- Primary nav dropdowns ---------- */

.nav-item { position: relative; }

.nav-item__btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: var(--text-body); color: var(--color-ink);
  /* buttons don't inherit body line-height, which made the button rows 5px
     shorter than the plain Case Studies link in the collapsed menu */
  line-height: 1.5;
  background: none; border: none; padding: 0; cursor: pointer;
}
.nav-item__btn:hover,
.nav-item__btn[aria-expanded="true"],
.nav-item__btn[aria-current="page"] { color: var(--color-teal); }

.nav-item__chev {
  width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.15s ease;
}
.nav-item__btn[aria-expanded="true"] .nav-item__chev { transform: rotate(-135deg) translate(-2px, -2px); }

.nav-menu {
  position: absolute; top: calc(100% + 14px); left: -20px; z-index: 200;
  background: var(--color-white);
  border: 1px solid var(--color-blue-tint); border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(23, 33, 29, 0.12);
  padding: 16px 8px; min-width: 264px;
}
/* Bridges the gap so the menu doesn't close as the pointer travels to it */
.nav-menu::before { content: ""; position: absolute; top: -14px; left: 0; right: 0; height: 14px; }
.nav-menu[hidden] { display: none; }
.nav-menu ul { list-style: none; margin: 0; padding: 0; }
.nav-menu a {
  display: block; padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: var(--text-body); color: var(--color-ink); white-space: nowrap;
}
.nav-menu a:hover, .nav-menu a:focus-visible { background: var(--color-teal-tint); color: var(--color-teal); }

/* Anchored left, not centred on the button: Procedures sits near the left edge,
   so a centred 4-column panel hangs off the viewport and loses its first column. */
.nav-menu--mega { left: -20px; transform: none; width: min(940px, calc(100vw - 48px)); padding: 24px 24px 8px; }
.nav-menu__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 20px; }
/* Category headings, not links. --color-body-muted (#4D5752) sat close enough
   to the ink of the real links to read as one, so these step back to ~45% ink
   and pick up a little more tracking. */
.nav-menu__label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(23, 33, 29, 0.45); margin: 0 0 8px; padding: 0 16px;
}
.nav-menu__foot { border-top: 1px solid var(--color-blue-tint); margin-top: 16px; padding-top: 8px; }
.nav-menu__all { display: block; padding: 9px 16px; font-weight: 600; color: var(--color-teal); }

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--text-button);
  border-radius: var(--radius-button);
  padding: 13px 22px;
  border: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--color-sage);
  color: var(--color-white);
}
.btn--primary:hover { background: var(--color-teal); }

.btn--teal {
  background: var(--color-teal);
  color: var(--color-white);
}
.btn--teal:hover { background: var(--color-sage); }

.btn--light {
  background: var(--color-blue-tint);
  color: var(--color-ink);
  font-family: var(--font-body);
}
.btn--light:hover { background: var(--color-cta-light); }

.nav-toggle { display: none; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--color-white);
  border-top: 1px solid var(--color-blue-tint);
  padding: 76px 128px 0;
}

/* Grid, not wrapping flex: as a flex row the 406px logo pushed Patients and
   Practice onto a second line, where space-between threw them to opposite
   edges instead of keeping all four link columns aligned. */
.site-footer__top {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(0, 1fr));
  gap: 40px;
  align-items: start;
  padding-bottom: 60px;
}

/* width-driven, not height-driven: with a fixed height the global
   img{max-width:100%} clamps the width alone and squashes the logo. */
.site-footer__logo img { width: 406px; height: auto; max-width: 100%; }

.site-footer__col h2 {
  font-family: var(--font-body);
  font-size: var(--text-label-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-eyebrow-muted);
  margin-bottom: 16px;
}

.site-footer__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer__col a {
  font-size: var(--text-body);
  color: var(--color-ink);
}
.site-footer__col a:hover { color: var(--color-teal); }

/* Between the two breakpoints the logo needs its own row or the four link
   columns get squeezed to a couple of words wide. */
@media (max-width: 1240px) and (min-width: 901px) {
  .site-footer__top { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .site-footer__logo { grid-column: 1 / -1; }
}

.site-footer__bottom {
  border-top: 1px solid var(--color-blue-tint);
  padding: 32px 0 40px;
  text-align: center;
}

.site-footer__legal {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-footer);
  color: var(--color-eyebrow-muted);
  margin-bottom: 30px;
}
.site-footer__legal a:hover { color: var(--color-teal); text-decoration: underline; }

.site-footer__ctas {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.site-footer__ctas .btn {
  min-width: 340px;
  padding: 12px 22px;
  font-size: 18px;
}

/* ---------- Mobile sticky action bar ----------
   Desktop keeps its header CTA and never shows this. */

.sticky-cta { display: none; }

/* ---------- Skip-to-content target, main landmark ---------- */

main { display: block; }

/* ---------- Header collapse ----------
   The full desktop nav (logo + 5 links + button) only actually fits above
   ~1200px at the Figma-fixed 1440 spacing — any narrower "minimized" desktop
   window wraps ugly. Collapse the LINK LIST to a dropdown earlier than the
   general 900px mobile breakpoint below. The "Request Consultation" button
   stays visible at every width — only the plain links move into the
   dropdown, per Matthew's "button needs to stay there" note (2026-07-24). */

@media (max-width: 1200px) {
  .site-header__nav { display: none; }
  /* Anchored to the toggle as a panel rather than stretched edge-to-edge —
     full-bleed left almost the whole width empty on tablet/laptop widths. */
  .site-header__nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    position: absolute;
    top: calc(100% + 8px);
    left: auto;
    right: clamp(20px, 3vw, 180px);
    width: min(360px, calc(100vw - 40px));
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    background: var(--color-white);
    border: 1px solid var(--color-blue-tint);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(23, 33, 29, 0.16);
    padding: 12px 16px 16px;
  }
  /* Every top-level row gets its padding from the row element itself, so the
     plain links (Case Studies) sit on the same rhythm as the dropdown buttons.
     Previously buttons got li-padding + their own, links only got li-padding. */
  .site-header__nav.is-open > li { padding: 0; }
  .site-header__nav.is-open > li > a,
  .site-header__nav.is-open .nav-item__btn {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 10px 0;
  }

  /* Below this width the dropdowns stop floating and expand inline instead */
  .site-header__nav.is-open .nav-item { padding: 0; }
  .site-header__nav.is-open .nav-menu,
  .site-header__nav.is-open .nav-menu--mega {
    position: static; transform: none; min-width: 0; width: auto;
    border: none; box-shadow: none; border-radius: 0; padding: 0 0 8px 12px;
    border-left: 2px solid var(--color-blue-tint); margin: 0 0 8px;
  }
  .site-header__nav.is-open .nav-menu::before { content: none; }
  .site-header__nav.is-open .nav-menu__grid { grid-template-columns: 1fr; gap: 0; }
  .site-header__nav.is-open .nav-menu a { white-space: normal; padding: 8px 12px; }
  .site-header__nav.is-open .nav-menu__label { padding: 12px 12px 4px; }
  .site-header__nav.is-open .nav-menu__foot { margin-top: 8px; }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    background: none; border: none;
    cursor: pointer;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 900px) {
  .site-header__inner { padding: 12px var(--layout-mobile-padding, 20px); }
  .site-footer { padding: 56px 20px 0; }
  .site-footer__top { grid-template-columns: 1fr 1fr; gap: 32px; padding-bottom: 40px; }
  .site-footer__logo { grid-column: 1 / -1; }
  .site-footer__ctas { flex-direction: column; }
  .site-footer__ctas .btn { min-width: 0; width: 100%; }

  /* The header CTA is 209px and sat in a flex:none group, so on a 390px phone
     the logo absorbed the entire 77px overflow and collapsed to ~61px. Drop the
     CTA here, give the logo the room, and move the action to a sticky bar. */
  .site-header__cta { display: none; }
  .site-header__logo img { width: 180px; }

  .sticky-cta {
    display: flex;
    gap: 10px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 300;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--color-blue-tint);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .sticky-cta .btn { flex: 1; padding: 13px 12px; }
  /* needs to out-specify .sticky-cta .btn above, or Call renders half-width */
  .sticky-cta .btn.sticky-cta__call { flex: 0 0 104px; gap: 8px; }

  /* Keep the bar from covering the last of the footer */
  body { padding-bottom: 76px; }
}
