/* Smooth cross-document navigation (e.g. the Doctors<->Nurses toggle): a subtle, fast cross-fade
   between pages instead of a hard white flash. Progressive enhancement — browsers without support
   just do a normal navigation; reduced-motion users get an instant cut. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.2s; animation-timing-function: ease; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}

/* instant-nav.js moves focus to the new page's <h1>/<main> after a swap (e.g. the
   Doctors<->Nurses toggle) so screen readers announce it. That focus is programmatic
   (tabindex=-1), so hide the default focus box that otherwise flashes around the title.
   Keyboard users tabbing to real controls are unaffected — they have their own outlines. */
[tabindex="-1"]:focus { outline: none; }

.site-header { position: relative; overflow: visible; background: #0f172a; color: #e5e7eb; border-bottom: 1px solid rgba(255,255,255,0.08); }
.site-header,
.site-header * { line-height: 1.2; }
.site-header .shell { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; overflow: visible; }
.site-header .brand { color: #fff; text-decoration: none; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; line-height: 1; }
.site-header .brand-main { font-weight: 700; letter-spacing: 0.2px; font-size: 15px; }
.site-header .brand-tagline { font-size: 11px; font-weight: 500; color: #cbd5e1; white-space: nowrap; }
.site-header .header-nav-shell { position: relative; flex: 1 1 auto; min-width: 0; overflow: visible; margin-left: 18px; }
.site-header nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.site-header nav a,
.site-header .guides-toggle,
.site-header .state-toggle {
  color: #e5e7eb;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.18s ease, color 0.18s ease;
  font-size: 13px;
}
.site-header nav a:hover,
.site-header .guides-item.is-open > .guides-toggle,
.site-header .state-menu-item.is-open > .state-toggle {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.site-header .guides-item,
.site-header .state-menu-item {
  flex: 0 0 auto;
}
.site-header .guides-toggle,
.site-header .state-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  /* inherit the page font FAMILY + weight, but NOT size — the `font:` shorthand would
     reset font-size to the body size and override the 13px set above, making the
     dropdown toggles (Calculators/Doctor pay/Guides) larger than the plain nav links
     (Specialties). Keep them the same size. */
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  user-select: none;
}
.site-header .guides-toggle::after,
.site-header .state-toggle::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.8;
  transition: transform 0.22s ease;
}
.site-header .guides-item.is-open > .guides-toggle::after,
.site-header .state-menu-item.is-open > .state-toggle::after {
  transform: rotate(180deg);
}
.site-header .guides-toggle:focus-visible,
.site-header .guides-panel a:focus-visible,
.site-header .state-toggle:focus-visible,
.site-header .state-menu-panel a:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.site-header .guides-panel,
.site-header .state-menu-panel {
  display: grid;
  gap: 4px;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  margin-top: 0;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: #0f172a;
  box-shadow: 0 14px 28px rgba(0,0,0,0.28);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}
.site-header .state-menu-panel {
  min-width: 200px;
}
.site-header .guides-panel a,
.site-header .state-menu-panel a {
  display: block;
  padding: 8px 10px;
  color: #e5e7eb;
  font-size: 13px; /* panels live outside the nav now, so they don't inherit its type scale */
  text-decoration: none; /* ...nor its link reset */
  white-space: nowrap;
  border-radius: 6px;
}
.site-header .guides-panel a:hover,
.site-header .state-menu-panel a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.site-header .guides-panel.is-open,
.site-header .state-menu-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.site-header .state-menu-panel a:first-child {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 9px;
  margin-bottom: 2px;
}
@media (max-width: 768px) {
  .site-header .shell { padding: 7px 12px; row-gap: 5px; }
  .site-header .brand-main { font-size: 14px; }
  .site-header .brand-tagline { display: none; }
  /* Brand + audience-toggle share row 1; the scrollable nav drops to its own
     full-width row 2 so it no longer fights for space between them. */
  .site-header .header-nav-shell { margin-left: 0; flex: 1 0 100%; order: 3; }
  .site-header nav {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    padding: 2px 0 3px;
    scrollbar-width: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    scroll-padding-inline: 12px;
    /* NOTE: no -webkit-overflow-scrolling:touch here — on iOS Safari it promotes the
       scroller to a clipping composited layer that hides absolutely-positioned dropdown
       panels (menus opened but were invisible on iPhone). Momentum scrolling is default
       on modern iOS anyway. Panels also live OUTSIDE this <nav> in the markup. */
  }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav > * {
    flex: 0 0 auto;
  }
  /* light, compact nav chips — tappable without the bulky 44px filled boxes */
  .site-header nav a,
  .site-header .guides-toggle,
  .site-header .state-toggle {
    font-size: 12.5px;
    white-space: nowrap;
    min-height: 32px;
    padding: 5px 11px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* compact segmented control — a wide pill is tappable without a 44px target */
  .site-header .audience-toggle .at-opt {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    font-size: 12.5px;
  }
  .site-header .guides-item,
  .site-header .state-menu-item {
    width: auto;
  }
  .site-header .guides-panel,
  .site-header .state-menu-panel {
    top: calc(100% + 6px);
    width: min(248px, calc(100vw - 24px));
    min-width: 0;
    max-width: calc(100vw - 24px);
    max-height: min(60vh, 340px);
    padding: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.18);
    z-index: 1000;
  }
  .site-header .guides-panel a,
  .site-header .state-menu-panel a {
    white-space: normal;
    font-size: 13.5px;
    /* compact-but-tappable rows — 44px reads bulky at this panel size (owner feedback);
       ~38px keeps a comfortable thumb target without dominating the screen */
    min-height: 38px;
    padding: 7px 11px;
    display: flex;
    align-items: center;
  }
  /* the two state menus are 9 rows of tiny labels — two columns halve their height.
     "Compare states" (first link) spans the full width as the lead action. */
  .site-header .guides-panel--states {
    grid-template-columns: 1fr 1fr;
    gap: 2px 4px;
  }
  .site-header .guides-panel--states a:first-child {
    grid-column: 1 / -1;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px 6px 0 0;
    margin-bottom: 2px;
  }
}

/* iPad-portrait / small-laptop band (769–1024px): the body is already in
   tablet layout but the header still gets desktop CSS. Give the inline nav its
   own full-width row so the audience-toggle stops pinching it. No scroller here
   — nav keeps flex-wrap:wrap, it just gets the whole row to wrap within. */
@media (min-width: 769px) and (max-width: 1024px) {
  .site-header .header-nav-shell { flex: 1 0 100%; order: 3; margin-left: 0; margin-top: 4px; }
}

/* ── Doctors / Nurses audience toggle ── */
.site-header .audience-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
}
.site-header .audience-toggle .at-opt {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.site-header .audience-toggle .at-opt:hover { color: #fff; }
.site-header .audience-toggle .at-opt.active {
  background: #1e3a8a;
  color: #fff;
}
/* (the former max-width:640px block is gone: brand-tagline is already display:none
   from the 768 block, and the audience-toggle pills are sized in that block too) */
