/* ============================================================
   SHARED NAV — Canonical navbar + Mega Menu for all PEAK pages

   Usage:
   - Dark hero pages:  <nav class="nav" id="nav">
   - Light pages:      <nav class="nav light" id="nav">
   ============================================================ */

/* Prevent horizontal overflow / dead white strip on mobile */
html, body { overflow-x: hidden; overflow-x: clip; }

/* Base nav — dark translucent (for pages with dark hero) */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(14, 14, 14, 0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 400ms ease, border-bottom-color 400ms ease, box-shadow 400ms ease;
  padding: 0 24px;
}

/* Scrolled state OR light pages (always-light nav) */
.nav.scrolled,
.nav.light {
  background: rgba(250, 250, 248, 0.97);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* Logo — white on dark, dark on scroll / light */
.nav-logo { display: flex; align-items: center; text-decoration: none; }
.nav-logo img { height: 42px; width: auto; }
.nav-logo .logo-dark { display: none; }
.nav-logo .logo-white { display: block; }
.nav.scrolled .nav-logo .logo-dark,
.nav.light .nav-logo .logo-dark { display: block; }
.nav.scrolled .nav-logo .logo-white,
.nav.light .nav-logo .logo-white { display: none; }

/* ============================================================
   NAV LINKS — Desktop top-level items
   ============================================================ */
.nav-links { display: flex; align-items: center; gap: 28px; flex-wrap: nowrap; flex-shrink: 0; }
.nav-links > a,
.nav-links > .mega-trigger {
  font-size: 15px; font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 200ms ease;
  cursor: pointer;
  background: none; border: none;
  font-family: inherit;
  padding: 0;
  display: flex; align-items: center; gap: 4px;
  position: relative;
}
.nav-links > a:hover,
.nav-links > .mega-trigger:hover { color: #fff; }

.nav.scrolled .nav-links > a,
.nav.scrolled .nav-links > .mega-trigger,
.nav.light .nav-links > a,
.nav.light .nav-links > .mega-trigger { color: var(--text-secondary); }
.nav.scrolled .nav-links > a:hover,
.nav.scrolled .nav-links > .mega-trigger:hover,
.nav.light .nav-links > a:hover,
.nav.light .nav-links > .mega-trigger:hover { color: var(--text-primary); }

/* Active underline for open mega trigger */
.mega-trigger[aria-expanded="true"]::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0; right: 0;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 1px;
}

/* Nav CTA button */
.nav-links .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 28px; border-radius: 6px; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  background: rgba(255,255,255,0.15); color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 400ms ease;
}
.nav-links .btn:hover { background: rgba(255,255,255,0.25); }
.nav.scrolled .nav-links .btn,
.nav.light .nav-links .btn {
  background: var(--accent-primary); color: #fff;
  border-color: var(--accent-primary);
}
.nav.scrolled .nav-links .btn:hover,
.nav.light .nav-links .btn:hover { background: var(--accent-primary-hover); color: #fff; }

/* ============================================================
   SEARCH BUTTON — Desktop (inside nav-links)
   ============================================================ */
.nav-search-btn {
  background: none; border: none; cursor: pointer;
  padding: 6px; display: flex; align-items: center;
  color: rgba(255,255,255,0.75);
  transition: color 200ms ease;
  flex-shrink: 0;
}
.nav-search-btn:hover { color: #fff; }
.nav.scrolled .nav-search-btn,
.nav.light .nav-search-btn { color: var(--text-muted); }
.nav.scrolled .nav-search-btn:hover,
.nav.light .nav-search-btn:hover { color: var(--text-primary); }

/* Mobile search button — hidden on desktop, shown below 900px */
.mobile-search-btn { display: none; }

/* ============================================================
   MEGA MENU PANELS — Desktop
   ============================================================ */
.mega-panel {
  display: none;
  position: fixed;
  top: 72px; left: 0; right: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  z-index: 999;
  overflow: hidden;
}
.mega-panel.open {
  display: block;
}

.mega-panel-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  gap: 40px;
}

/* Columns */
.mega-col {
  flex: 1;
  min-width: 0;
}
.mega-col-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mega-panel .mega-col a {
  display: block;
  font-size: 14px;
  font-weight: 450;
  color: var(--text-primary, #1A1A1A);
  text-decoration: none;
  padding: 7px 0;
  transition: color 150ms ease;
  line-height: 1.35;
}
.mega-panel .mega-col a:hover {
  color: var(--accent-primary, #095a4e);
}
.mega-panel .mega-col a .med-subtitle {
  font-size: 12px;
  color: var(--text-muted, #8A8A8A);
  font-weight: 400;
}

/* Provider links with headshots */
.mega-panel .mega-col a.mega-provider-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.mega-provider-link img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mega-provider-link .provider-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mega-provider-link .provider-role {
  font-size: 11px;
  font-weight: 400;
  color: var(--accent-primary, #095a4e);
  line-height: 1.2;
}

/* Featured CTA card inside mega panel */
.mega-featured {
  flex: 0 0 240px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.mega-featured-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-primary);
}
.mega-featured p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.mega-featured .btn {
  margin-top: 4px;
  font-size: 14px;
  padding: 10px 20px;
  align-self: flex-start;
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.mega-featured .btn:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

/* Overlay behind mega panel */
.mega-overlay {
  display: none;
  position: fixed;
  top: 72px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.15);
  z-index: 998;
}
.mega-overlay.open {
  display: block;
}

/* ============================================================
   HAMBURGER — white on dark, dark on scroll / light
   ============================================================ */
.hamburger {
  display: none; background: none; border: none;
  padding: 8px; flex-direction: column; gap: 5px;
  justify-content: center; align-items: center;
  width: 36px; height: 36px; cursor: pointer;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: #fff; transition: all 300ms ease;
}
.nav.scrolled .hamburger span,
.nav.light .hamburger span { background: var(--text-primary); }

/* ============================================================
   MOBILE MENU — Full-screen with accordion mega nav
   ============================================================ */
.mobile-menu {
  display: none; position: fixed;
  top: 60px; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary); z-index: 999;
  padding: 0 0 100px 0;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile: top-level items */
.mobile-menu > a,
.mobile-menu > .mobile-mega-trigger {
  font-size: 17px; font-weight: 500;
  color: var(--text-primary);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
}
.mobile-mega-trigger[aria-expanded="true"] {
  color: var(--accent-primary);
  background: var(--bg-secondary);
}

/* Mobile: accordion sub-panel */
.mobile-mega-panel {
  display: none;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.mobile-mega-panel.open {
  display: block;
}

.mobile-mega-group {
  padding: 8px 24px 16px;
}
.mobile-mega-group-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 0 8px;
  margin: 0;
}
.mobile-mega-group a {
  display: block;
  font-size: 15px;
  font-weight: 450;
  color: var(--text-primary);
  text-decoration: none;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  line-height: 1.35;
}
.mobile-mega-group a:last-child {
  border-bottom: none;
}
.mobile-mega-group a:hover,
.mobile-mega-group a:active {
  color: var(--accent-primary);
}

/* Mobile featured CTA inside accordion */
.mobile-mega-featured {
  margin: 8px 24px 16px;
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
}
.mobile-mega-featured span {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
}
.mobile-mega-featured .arrow {
  font-size: 16px;
  color: var(--accent-primary);
}

/* Mobile CTA button at bottom of menu */
.mobile-menu > .btn {
  margin: 24px;
  border-bottom: none;
  justify-content: center;
}

/* Sticky bottom CTA (mobile) */
.sticky-cta {
  display: none; position: fixed;
  bottom: 0; left: 0; right: 0; z-index: 998;
  background: rgba(250,250,248,0.97);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.sticky-cta .btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 14px; border-radius: 6px;
  font-size: 15px; font-weight: 600;
  background: var(--accent-primary); color: #fff;
  border: none; cursor: pointer; text-decoration: none;
  font-family: var(--font-body);
}
.sticky-cta .btn:hover { background: var(--accent-primary-hover); }
.sticky-cta.hidden { display: none !important; }

/* ============================================================
   NAV SPACER — Offset body content for fixed nav
   ============================================================ */
body { padding-top: 72px; }

/* ============================================================
   RESPONSIVE — Mobile breakpoint
   ============================================================ */
@media (max-width: 900px) {
  .nav-inner { height: 60px; }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .sticky-cta { display: block; }
  body { padding-top: 60px; padding-bottom: 72px; }

  /* Mobile search button */
  .mobile-search-btn {
    display: flex;
    margin-left: auto;
    margin-right: 8px;
    color: var(--text-primary);
  }
  .nav:not(.scrolled):not(.light) .mobile-search-btn {
    color: rgba(255,255,255,0.85);
  }

  /* Hide desktop mega panels on mobile */
  .mega-panel,
  .mega-overlay { display: none !important; }
}

@media (min-width: 901px) {
  /* Hide mobile-only elements on desktop */
  .mobile-menu { display: none !important; }
  .sticky-cta { display: none !important; }
}

/* Tighter desktop — scale nav down to prevent overflow */
@media (min-width: 901px) and (max-width: 1200px) {
  .nav-links { gap: 16px; }
  .nav-links > a,
  .nav-links > .mega-trigger { font-size: 14px; }
  .nav-links .btn { font-size: 14px; padding: 11px 20px; }
}
