/* ═══════════════════════════════════════════════════════
   NAV.CSS — Three-Tier Navigation System (v10)
   Tier 1: Utility Bar
   Tier 2: Global Nav (mega menu)
   Tier 3: Local Anchors (progress bar)
   ═══════════════════════════════════════════════════════ */

/* ── NAV CONTAINER ───────────────────────────────────── */
.nav-system {
  position: fixed;
  top: 0; /* anchor to viewport top — gradient bar is now an inner pseudo-element */
  left: 0;
  right: 0;
  z-index: 1000;
  isolation: isolate;
  padding-top: 4px; /* reserve space for the rainbow gradient bar (.nav-system::before) */
  /* Graduated purple at top, washing to pure white at the local-nav row */
  background:
    linear-gradient(
      to bottom,
      rgba(57, 55, 143, 0.16) 0%,
      rgba(57, 55, 143, 0.10) 30%,
      rgba(57, 55, 143, 0.04) 55%,
      rgba(255, 255, 255, 1) 70%,
      rgba(255, 255, 255, 1) 100%
    );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 1px 0 rgba(57, 55, 143, 0.05);
}

/* Rainbow gradient accent bar — flush at top of nav-system, no gap */
.nav-system::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #39378f, #e82065 33%, #00ae81 66%, #b6cd2f);
  z-index: 2;
}

/* Suppress the duplicate fixed gradient bar from base.css */
body::before {
  display: none !important;
}

/* Scrolled state: collapse utility + global, keep local sticky */
.nav-system.is-scrolled {
  background: var(--color-purple-mid);
  box-shadow: 0 4px 20px rgba(57, 55, 143, 0.18);
}

.nav-system.is-scrolled .utility-bar,
.nav-system.is-scrolled .global-nav__inner {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  border-bottom-width: 0;
}

.nav-system .utility-bar,
.nav-system .global-nav__inner {
  transition: height 0.35s ease, padding 0.35s ease, opacity 0.3s ease, border-width 0.3s ease;
}

/* ═══════════════════════════════════════════════════════
   TIER 1 — UTILITY BAR (improved contrast for accessibility)
   ═══════════════════════════════════════════════════════ */
.utility-bar {
  background: rgba(57, 55, 143, 0.10);
  border-bottom: 1px solid rgba(57, 55, 143, 0.12);
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--section-padding-x);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-purple);
  letter-spacing: 0.01em;
  transition: background 0.3s ease, color 0.3s ease;
}

.utility-bar__left,
.utility-bar__right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.utility-bar a {
  color: var(--color-purple);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.utility-bar a:hover {
  color: var(--color-coral);
}

.utility-bar__phone {
  font-weight: 700;
  color: var(--color-purple);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(57, 55, 143, 0.4);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.utility-bar__phone:hover {
  color: var(--color-coral);
  text-decoration-color: var(--color-coral);
}

/* On scroll: utility bar goes purple alongside everything else */
.global-nav.is-scrolled ~ .local-nav,
.nav-system.is-scrolled .utility-bar {
  /* placeholder for sibling combinator updates below */
}


/* ═══════════════════════════════════════════════════════
   TIER 2 — GLOBAL NAV (Glassmorphic)
   ═══════════════════════════════════════════════════════ */
.global-nav {
  background: transparent;
  position: relative;
  z-index: 200;
  transition: background 0.3s ease;
}

.global-nav__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 86px;
  gap: 40px;
}

.global-nav__logo {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0; /* prevent flex parent from squishing the logo */
}

.global-nav__logo img {
  height: 36px;
  width: auto;
  max-width: none; /* override base.css img { max-width: 100% } */
}

img.global-nav__logo-color { display: block; }
img.global-nav__logo-white { display: none; }

.nav-system.is-scrolled img.global-nav__logo-color { display: none; }
.nav-system.is-scrolled img.global-nav__logo-white { display: block; }


/* ── Menu (top-level items) ────────────────────────── */
.global-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.global-menu__item {
  position: relative;
}

.global-menu__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 11px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 18px;
  color: var(--color-purple);
  letter-spacing: 0;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.global-menu__link:hover,
.global-menu__item.is-open > .global-menu__link {
  background: rgba(57, 55, 143, 0.06);
  color: var(--color-coral-dark);
}

.nav-system.is-scrolled .global-menu__link {
  color: rgba(255, 255, 255, 0.92);
}

.nav-system.is-scrolled .global-menu__link:hover,
.nav-system.is-scrolled .global-menu__item.is-open > .global-menu__link {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.global-menu__caret {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.global-menu__item.is-open .global-menu__caret {
  transform: rotate(180deg);
}


/* ── Right side actions ─────────────────────────────── */
.global-nav__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-nav__search-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  color: var(--color-purple);
}

.global-nav__search-btn:hover {
  background: rgba(57, 55, 143, 0.08);
}

.nav-system.is-scrolled .global-nav__search-btn {
  color: rgba(255, 255, 255, 0.92);
}

.nav-system.is-scrolled .global-nav__search-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.global-nav__search-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.global-nav__cta {
  background: var(--color-coral);
  color: #ffffff;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.global-nav__cta:hover {
  background: var(--color-coral-dark);
  transform: scale(1.04);
  box-shadow: 0 8px 24px rgba(232, 32, 101, 0.3);
}


/* ═══════════════════════════════════════════════════════
   MEGA MENU PANELS
   ═══════════════════════════════════════════════════════ */
.mega-panel {
  position: absolute;
  top: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px -12px rgba(57, 55, 143, 0.18);
  padding: 28px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
  pointer-events: none;
  z-index: 110;
  overflow: hidden;
}

.mega-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-coral-purple);
  z-index: 1;
}

/* Soft medium-purple wash anchoring the bottom of the panel */
.mega-panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(to bottom, rgba(85, 84, 173, 0) 0%, rgba(85, 84, 173, 0.10) 100%);
  pointer-events: none;
  z-index: 0;
}

.global-menu__item.is-open > .mega-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

/* Single-column flyout (default) — positioned under its item */
.mega-panel--flyout {
  width: 260px;
  padding: 16px 12px 12px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  /* keep base overflow: hidden so the gradient bar clips at rounded corners */
}

.global-menu__item.is-open > .mega-panel--flyout {
  transform: translateX(-50%) translateY(0);
}

/* Pad top of first item to clear the gradient accent bar */
.mega-panel--flyout ul {
  padding-top: 6px;
}

.mega-panel--flyout ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-panel--flyout a {
  display: block;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-body);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.mega-panel--flyout a:hover {
  background: rgba(232, 32, 101, 0.06);
  color: var(--color-coral);
}


/* ── Big "Our Tests" mega panel — centered to viewport ─── */
.mega-panel--tests {
  width: min(920px, calc(100vw - 48px));
  padding: 0;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0;
  /* Center to viewport using fixed positioning + viewport-relative left */
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  top: calc(38px + 72px + 4px + 4px); /* utility + global + accent + small offset */
}

.global-menu__item.is-open > .mega-panel--tests {
  transform: translateX(-50%) translateY(0);
}

.mega-tests__hero {
  padding: 0 0 28px;
  background: linear-gradient(135deg, rgba(57,55,143,0.04) 0%, rgba(232,32,101,0.04) 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid rgba(57, 55, 143, 0.06);
}

.mega-tests__hero-image {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center 72%;
  border-top-left-radius: 16px;
}

.mega-tests__hero-body {
  padding: 4px 32px 0;
}

.mega-tests__hero-tag {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-coral-dark);
  margin-bottom: 12px;
}

.mega-tests__hero-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--on-surface);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.mega-tests__hero-title em {
  color: var(--color-coral-dark);
  font-style: italic;
}

.mega-tests__hero-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--on-surface-variant);
  margin-bottom: 16px;
}

.mega-tests__hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 32px;
  padding: 10px 22px;
  background: var(--color-coral);
  color: #ffffff;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  width: fit-content;
  transition: all 0.2s ease;
}

.mega-tests__hero-cta:hover {
  background: var(--color-coral-dark);
  transform: translateX(2px);
}

.mega-tests__directory {
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: rgba(255, 255, 255, 0.4);
}

.mega-tests__group h5 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-purple);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(57, 55, 143, 0.08);
}

.mega-tests__group ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mega-tests__group a {
  display: block;
  padding: 8px 0;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text-body);
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.mega-tests__group a sup {
  font-size: 0.6em;
  vertical-align: super;
  margin-left: 1px;
}

.mega-tests__group a:hover {
  color: var(--color-coral);
  padding-left: 4px;
}

.mega-tests__footer {
  grid-column: 1 / -1;
  padding: 14px 28px;
  border-top: 1px solid rgba(57, 55, 143, 0.06);
  background: rgba(57, 55, 143, 0.02);
  display: flex;
  justify-content: flex-end;
}

.mega-tests__view-all {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-coral-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s ease;
}

.mega-tests__view-all:hover {
  gap: 8px;
}


/* ═══════════════════════════════════════════════════════
   SEARCH DROPDOWN
   ═══════════════════════════════════════════════════════ */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: var(--section-padding-x);
  width: 360px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(57, 55, 143, 0.15);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
  z-index: 110;
}

.search-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.search-dropdown form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-dropdown input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(57, 55, 143, 0.15);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-dropdown input:focus {
  border-color: var(--color-coral);
}

.search-dropdown button {
  padding: 12px 18px;
  background: var(--color-coral);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-dropdown button:hover {
  background: var(--color-coral-dark);
}


/* ═══════════════════════════════════════════════════════
   TIER 3 — LOCAL NAV (always visible, coral progress bar)
   ═══════════════════════════════════════════════════════ */
.local-nav {
  background: transparent;
  border-top: 1px solid rgba(57, 55, 143, 0.06);
  height: 62px; /* +15% */
  transition: background 0.3s ease, border-color 0.3s ease, height 0.3s ease;
  position: relative;
  z-index: 100;
}

.nav-system.is-scrolled .local-nav {
  border-top-color: rgba(255, 255, 255, 0.12);
  height: 78px; /* +15% on scroll */
}

.local-nav__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--section-padding-x);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  position: relative;
}

/* Logo on local nav — only visible when global nav collapses (in-flow grid item) */
.local-nav__logo {
  display: none;
  align-items: center;
  height: 36px;
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
  text-decoration: none;
  flex-shrink: 0;
}

.local-nav__logo img {
  height: 32px;
  width: auto;
  display: block;
  max-width: none; /* override base.css img { max-width: 100% } */
}

.nav-system.is-scrolled .local-nav__logo {
  display: flex;
  opacity: 1;
}

/* Talk to a Rep — only visible when global nav collapses (in-flow grid item) */
.local-nav__cta {
  display: none;
  background: var(--color-coral);
  color: #ffffff;
  padding: 11px 25px;
  /* fluid: 14px @ 1024 → 16px @ 1440 */
  font-size: clamp(14px, 0.481vw + 9.08px, 16px);
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.3s ease 0.1s;
  white-space: nowrap;
  opacity: 0;
}

.local-nav__cta:hover {
  background: var(--color-coral-dark);
  transform: scale(1.04);
}

.nav-system.is-scrolled .local-nav__cta {
  display: inline-flex;
  align-items: center;
  opacity: 1;
}

/* Switch to grid layout when scrolled so logo + items + CTA each get their own column */
.nav-system.is-scrolled .local-nav__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

.nav-system.is-scrolled .local-nav__items {
  justify-self: center;
}

.local-nav__items {
  display: flex;
  align-items: center;     /* vertical center */
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  height: 100%;
}

.local-nav__items li {
  display: flex;
  align-items: center;
  height: 100%;
}

.local-nav__items a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  color: var(--color-purple);
  text-decoration: none;
  transition: color 0.2s ease, font-weight 0.2s ease;
  /* fluid: 13px @ 1024 → 16px @ 1440 */
  font-size: clamp(13px, 0.721vw + 5.62px, 16px);
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-family: var(--font-body);
  line-height: 1;
}

.local-nav__items a:hover {
  color: var(--color-coral);
  font-weight: 500;
}

/* Active state: bold light pink, same family/size as siblings (no layout shift) */
.local-nav__items a.is-active {
  color: #ff9ec0;
  background: transparent;
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 700;
  font-size: clamp(13px, 0.721vw + 5.62px, 16px);
  letter-spacing: 0.01em;
  line-height: 1;
}

/* Scrolled state — white text */
.nav-system.is-scrolled .local-nav__items a {
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(13px, 0.721vw + 5.62px, 16px);
}

.nav-system.is-scrolled .local-nav__items a:hover {
  color: #ffffff;
  font-weight: 500;
}

.nav-system.is-scrolled .local-nav__items a.is-active {
  color: #ff9ec0;
  background: transparent;
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 700;
  font-size: clamp(13px, 0.721vw + 5.62px, 16px);
}

/* Hide the "current" indicator (was for collapsed state) */
.local-nav__current {
  display: none;
}

/* Coral progress bar — always visible at bottom of local-nav */
.local-nav__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-coral);
  transition: width 0.1s linear;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(232, 32, 101, 0.4);
}


/* ═══════════════════════════════════════════════════════
   PUSH BODY CONTENT DOWN — account for fixed nav height.
   Padding lives on .page-shell (not body) so its background
   extends UP behind the nav and masks the fixed footer when
   the parallax reveal is active.
   At rest: 4 + 42 + 86 + 62 = 194px
   Scrolled (utility + global collapsed): 4 + 0 + 0 + 78 = 82px
   ═══════════════════════════════════════════════════════ */
.page-shell {
  padding-top: 194px;
}


/* ═══════════════════════════════════════════════════════
   LAPTOP RANGE — compress global nav so it fits 1024–1279px
   without clipping. Mobile breakpoint stays at <1024.
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1024px) and (max-width: 1399.98px) {
  .global-nav__inner {
    gap: 12px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .global-nav__logo img {
    height: 26px;
  }
  .global-menu {
    gap: 0;
  }
  .global-menu__link {
    padding: 8px 8px;
    /* fluid: 14px @ 1024 → 18px @ 1400, then desktop styles take over */
    font-size: clamp(14px, 1.06vw + 3.15px, 18px);
  }
  .global-nav__actions {
    gap: 8px;
  }
  .global-nav__search-btn {
    width: 40px;
    height: 40px;
  }
  .global-nav__cta {
    padding: 7px 14px;
    /* 13px @ 1024 → 14px @ 1400 */
    font-size: clamp(13px, 0.266vw + 10.28px, 14px);
  }
  .utility-bar {
    /* 14px @ 1024 → 15px @ 1400 */
    font-size: clamp(14px, 0.266vw + 11.28px, 15px);
    padding: 0 20px;
  }
  .local-nav__inner {
    padding: 0 28px;
  }
  .local-nav__items {
    gap: 4px;
  }
  .local-nav__items a {
    padding: 0 8px;
    /* font-size handled by base clamp */
  }

  /* Scrolled state — local nav becomes the primary row, must not clip */
  .nav-system.is-scrolled .local-nav__inner {
    gap: 20px;
  }
  .nav-system.is-scrolled .local-nav__logo img {
    height: 30px;
  }
  .nav-system.is-scrolled .local-nav__items a,
  .nav-system.is-scrolled .local-nav__items a.is-active {
    padding: 0 6px;
    /* font-size handled by base clamp */
  }
  .nav-system.is-scrolled .local-nav__cta {
    padding: 10px 22px;
    /* font-size handled by base clamp */
  }
}

/* ═══════════════════════════════════════════════════════
   MOBILE BAR — phone + hamburger cluster
   Hidden by default, shown only at <1024px
   ═══════════════════════════════════════════════════════ */
.mobile-bar {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.mobile-bar__phone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--color-purple);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.mobile-bar__phone svg {
  width: 20px;
  height: 20px;
}

.mobile-bar__phone:hover,
.mobile-bar__phone:focus-visible {
  background: rgba(57, 55, 143, 0.08);
  color: var(--color-coral);
}

.nav-system.is-scrolled .mobile-bar__phone {
  color: rgba(255, 255, 255, 0.94);
}
.nav-system.is-scrolled .mobile-bar__phone:hover,
.nav-system.is-scrolled .mobile-bar__phone:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* Hamburger — three lines that morph to X */
.mobile-bar__toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-bar__toggle-bar {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-purple);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.18s ease,
              top 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.2s ease;
}

.mobile-bar__toggle-bar:nth-child(1) { top: 14px; }
.mobile-bar__toggle-bar:nth-child(2) { top: 21px; }
.mobile-bar__toggle-bar:nth-child(3) { top: 28px; }

.nav-system.is-scrolled .mobile-bar__toggle-bar {
  background: #ffffff;
}

/* Open state — morph to X */
.mobile-bar__toggle.is-open .mobile-bar__toggle-bar:nth-child(1) {
  top: 21px;
  transform: rotate(45deg);
}
.mobile-bar__toggle.is-open .mobile-bar__toggle-bar:nth-child(2) {
  opacity: 0;
}
.mobile-bar__toggle.is-open .mobile-bar__toggle-bar:nth-child(3) {
  top: 21px;
  transform: rotate(-45deg);
}

/* ═══════════════════════════════════════════════════════
   MOBILE DRAWER — slide-in from right
   ═══════════════════════════════════════════════════════ */
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 60, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 998;
}

.mobile-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 100vw);
  height: 100dvh;
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  box-shadow: -8px 0 32px rgba(57, 55, 143, 0.18);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer__inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 76px 24px 24px;
  gap: 20px;
}

/* Coral CTA at top */
.mobile-drawer__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  background: var(--color-coral);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 9999px;
  transition: background 0.2s ease;
}

.mobile-drawer__cta:hover,
.mobile-drawer__cta:focus-visible {
  background: var(--color-coral-dark);
}

/* Accordion */
.mobile-accordion {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(57, 55, 143, 0.1);
}

.mobile-accordion__item {
  border-bottom: 1px solid rgba(57, 55, 143, 0.1);
}

.mobile-accordion__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 4px;
  background: transparent;
  border: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-purple);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.mobile-accordion__head:hover,
.mobile-accordion__head:focus-visible {
  color: var(--color-coral);
}

.mobile-accordion__caret {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.28s ease;
}

.mobile-accordion__head[aria-expanded="true"] .mobile-accordion__caret {
  transform: rotate(180deg);
}

.mobile-accordion__panel {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
}

.mobile-accordion__item.is-open .mobile-accordion__panel {
  max-height: 600px;
}

.mobile-accordion__panel li a {
  display: block;
  padding: 10px 4px 10px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-accordion__panel li:last-child a {
  padding-bottom: 16px;
}

.mobile-accordion__panel li a:hover,
.mobile-accordion__panel li a:focus-visible {
  color: var(--color-coral);
  padding-left: 20px;
}

.mobile-accordion__panel sup {
  font-size: 0.65em;
  vertical-align: super;
  margin-left: 1px;
}

/* Utility list at bottom of drawer */
.mobile-drawer__utility {
  list-style: none;
  margin: auto 0 0;
  padding: 20px 0 0;
  border-top: 1px solid rgba(57, 55, 143, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-drawer__utility a {
  display: block;
  padding: 8px 4px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-drawer__utility a:hover,
.mobile-drawer__utility a:focus-visible {
  color: var(--color-coral);
}

.mobile-drawer__phone {
  font-weight: 700;
  color: var(--color-purple) !important;
  letter-spacing: 0.02em;
}

/* Lock body scroll while drawer is open */
body.mobile-menu-open {
  overflow: hidden;
}

/* When drawer is open, give the bar a solid background so the
   dark backdrop doesn't show through the nav-system's translucent gradient. */
body.mobile-menu-open .nav-system {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ═══════════════════════════════════════════════════════
   MOBILE — hide desktop nav, show mobile bar + drawer
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .utility-bar {
    display: none;
  }

  .global-menu,
  .global-nav__search-btn,
  .global-nav__cta,
  .local-nav,
  .mega-panel,
  .search-dropdown {
    display: none;
  }

  .global-nav__inner {
    height: 64px;
    justify-content: space-between;
    padding: 0 16px;
  }

  .global-nav__logo img {
    height: 28px;
  }

  .mobile-bar {
    display: inline-flex;
  }

  .mobile-backdrop,
  .mobile-drawer {
    display: block;
  }

  .page-shell {
    padding-top: 68px;
  }
}

/* ═══════════════════════════════════════════════════════
   AT-FOOTER STATE — only the global nav shows in purple.
   Triggered when the parallax-revealed footer dominates
   the viewport (desktop only).
   ═══════════════════════════════════════════════════════ */
.nav-system.is-at-footer {
  background: var(--color-purple-mid);
  box-shadow: 0 4px 20px rgba(57, 55, 143, 0.18);
}

.nav-system.is-at-footer .utility-bar {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  border-bottom-width: 0;
}

.nav-system.is-at-footer .local-nav {
  height: 0;
  border-top-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* White-on-purple text styling (mirrors is-scrolled) */
.nav-system.is-at-footer img.global-nav__logo-color { display: none; }
.nav-system.is-at-footer img.global-nav__logo-white { display: block; }

.nav-system.is-at-footer .global-menu__link {
  color: rgba(255, 255, 255, 0.92);
}

.nav-system.is-at-footer .global-menu__link:hover,
.nav-system.is-at-footer .global-menu__item.is-open > .global-menu__link {
  color: #ffffff;
}

.nav-system.is-at-footer .global-nav__search-btn {
  color: rgba(255, 255, 255, 0.92);
}

.nav-system.is-at-footer .global-nav__search-btn:hover {
  color: #ffffff;
}

/* In at-footer state, utility + local collapse so the panel's top:100%
   ends up 21px above the visible nav-bottom. Push it down so the
   gradient bar sits flush at the bottom of the visible nav. */
.nav-system.is-at-footer .mega-panel:not(.mega-panel--tests) {
  top: calc(100% + 21px);
}

.nav-system.is-at-footer .mega-panel--tests {
  top: 90px;
}
