/* ==========================================================
   Adaptive header menu. js/nav-fit.js sets one of three states:
     (none)          full menu, font and spacing scale with the screen width
     .nav-compact    smaller type and spacing when the full menu does not fit
     .nav-collapsed  hamburger dropdown when even the compact menu does not fit
   Text never wraps: every label is nowrap, the menu shrinks in steps, not line breaks.
   ========================================================== */

/* Logo and CTA never wrap */
.site-header .logo, .site-header .nav-cta { white-space: nowrap; }
.site-header .logo { font-size: 1.3rem; letter-spacing: .05em; }

/* Desktop menu: flexible, takes the free space, and right-aligns */
@media (min-width: 960px) {
  .site-header .nav-wrap { gap: clamp(8px, 1.2vw, 18px); }
  .site-header .main-nav { flex: 1 1 auto; min-width: 0; justify-content: flex-end; gap: clamp(8px, 1.5vw, 24px); }
  .site-header .main-nav a {
    white-space: nowrap; padding: 8px 2px;
    font-size: clamp(.64rem, 0.25vw + 0.52rem, .8rem);
    letter-spacing: clamp(.02em, 0.08vw, .12em);
  }
  .site-header .nav-cta {
    font-size: clamp(.6rem, 0.2vw + 0.5rem, .72rem);
    letter-spacing: clamp(.04em, 0.08vw, .1em);
    padding: clamp(8px, 0.6vw, 10px) clamp(10px, 1vw, 18px);
  }
}

/* Compact state */
@media (min-width: 960px) {
  .site-header.nav-compact .main-nav { gap: 6px; }
  .site-header.nav-compact .main-nav a { font-size: .6rem; letter-spacing: .02em; padding: 6px 2px; }
  .site-header.nav-compact .nav-wrap { gap: 6px; }
  .site-header.nav-compact .nav-cta { font-size: .58rem; letter-spacing: .03em; padding: 8px 10px; }
  .site-header.nav-compact .logo { font-size: 1.05rem; }
}

/* Collapsed state: hamburger + dropdown, forced at every width */
.site-header.nav-collapsed .menu-toggle { display: block !important; }
.site-header.nav-collapsed .main-nav {
  display: none !important; position: fixed; inset: 68px 0 auto 0; flex-direction: column; gap: 0;
  background: var(--ivory); box-shadow: var(--shadow); flex: none; justify-content: flex-start;
}
.site-header.nav-collapsed .main-nav.open { display: flex !important; }
.site-header.nav-collapsed .main-nav a {
  display: block; padding: 16px 6%; border-bottom: 1px solid var(--beige); border-top: 0;
  font-size: .95rem; letter-spacing: .02em; text-transform: none; white-space: nowrap;
}
.site-header.nav-collapsed .main-nav a.active::after { content: none; }
.site-header.nav-collapsed .nav-wrap { gap: 10px; }
.site-header .menu-toggle { min-width: 44px; min-height: 44px; flex-shrink: 0; }

/* The header container stops growing at 1180px, so above 1280px the menu uses fixed sizes.
   A fluid size there would only make the links grow into the same space and overflow. */
@media (min-width: 1280px) {
  .site-header .logo { font-size: 1.4rem; }
  .site-header .main-nav a { font-size: .72rem; letter-spacing: .08em; padding: 8px 2px; }
  .site-header .nav-cta { font-size: .68rem; letter-spacing: .08em; padding: 10px 18px; }
}

/* Installed app (standalone): keep the header below the phone's status bar and notch */
html.standalone .site-header { padding-top: env(safe-area-inset-top, 0px); }
html.standalone .main-nav.open, html.standalone.nav-collapsed .main-nav.open { top: calc(68px + env(safe-area-inset-top, 0px)); }
