/*
 * IMAT Quest — Shared Navbar
 * css/navbar.css
 *
 * Faithful implementation of Part 6 (Navbar) spec.
 * Loaded on EVERY page. Covers:
 *   - Desktop navbar (frosted glass, three visual states)
 *   - Nav links with pink underline hover
 *   - Mega menu (680px, 2-column, hover intent)
 *   - Right zone (CTA + Login)
 *   - Hamburger animation
 *   - Mobile drawer (full-screen, slide from right, stagger)
 *   - Mobile courses accordion
 *   - Skip link
 *   - Active page state
 *   - Scroll-direction hide/show
 *   - Accessibility (focus-visible, reduced motion)
 *
 * ES5 constraint applies to navbar.js, not this file.
 *
 * Ω T14 (2026-04-22): text / spacing / color / motion migrated to tokens.css.
 * BRAND-ALIGNMENT values intentionally preserved (untokenised by design):
 *   .brooch sizing, positioning, border, dome/rim gradients, drop-shadows
 *   .wm / .imat / .quest font-variation-settings, letter-spacing, optical adjustments
 *   .card.silk-nav / .card.ink-nav box-shadows (cinematic state values)
 *   .card.silk-nav .wm / .card.ink-nav .wm drop-shadow filters
 *   .substrate padding, .peek geometry — peek-frame art direction
 *   .navbar__inner padding — layout geometry for the card inner zone
 *   .links gap + .links .navbar__list gap — nav chrome spacing (fluid tokens overscale at L1)
 *   .links .nav-link / .login / .cta font-sizes — nav chrome optical sizing (fluid → 23–43% bigger)
 *   .cta padding — button geometry (fluid padding grows with viewport, nav chrome should not)
 *   .actions gap + padding — right-zone geometry (fluid → 56% bigger at L1)
 *   .actions__divider height — divider chrome (fluid → 34px vs 22px original)
 */

/* ============================================================
   SKIP LINK
   ============================================================ */

.skip-link {
  position: absolute;
  inset-block-start: -50px; /* BRAND-ALIGNMENT: hide-above-viewport distance */
  inset-inline-start: var(--space-s); /* ≈16px fluid */
  background: var(--color-pink);
  color: var(--color-white);
  padding: var(--space-xs) var(--space-s); /* ≈12px 20px fluid */
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs); /* ≈14px fluid */
  line-height: var(--lh-tight);
  z-index: var(--z-modal); /* 40 — above overlay, below toast */
  transition: top var(--dur-base) var(--ease-out-quart);
  text-decoration: none;
}

.skip-link:focus {
  inset-block-start: var(--space-xs); /* ≈12px fluid */
}

/* ============================================================
   NAVBAR — LAYERED FRAME (substrate > peek > card)
   ============================================================ */

.navbar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: var(--z-sticky); /* 10 — sits above page, below dropdowns */
  transition: transform var(--dur-slow) var(--ease-out-quart);
}

/* Hide-on-scroll-down (toggled by js/navbar.js) */
.navbar--hidden {
  transform: translateY(-100%);
}

.substrate {
  background: var(--navbar-substrate);
  padding: 22px 24px 0;
  position: relative;
  overflow: visible;
}

.peek {
  block-size: 5px;
  margin: 0 18px;
  border-radius: 2px 2px 0 0;
}
.peek--back {
  background: var(--peek-back);
}
.peek--mid {
  background: var(--peek-mid);
  block-size: 8px;
  margin: 0 12px;
}

.card {
  position: relative;
  border-radius: var(--radius-sm); /* 4px — matches card corner art */
  border: 1px solid var(--silk-card-border);
  transition:
    background var(--dur-crawl) var(--ease-flutter),
    border-color var(--dur-crawl) var(--ease-flutter),
    box-shadow var(--dur-crawl) var(--ease-flutter);
}

.navbar__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 32px 10px 20px;
  min-block-size: 58px;
}

/* --- SILK (over hero) --- */
.card.silk-nav {
  background: var(--silk-card-bg);
  background-size: 220% 100%;
  background-position: 50% 50%;
  box-shadow:
    inset 12px 0 24px -12px rgba(130, 92, 38, 0.22),
    inset -12px 0 24px -12px rgba(130, 92, 38, 0.22),
    0 2px 8px rgba(74, 26, 38, 0.14);
  position: relative;
}

/* Silk cloth noise-grain overlay — subtle fibre texture on the card */
.card.silk-nav::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch' seed='7'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.25  0 0 0 0 0.10  0 0 0 0.65 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

@media (prefers-reduced-motion: reduce) {
  .card.silk-nav::after {
    opacity: 0.18;
  }
}

/* --- INK (past hero) --- */
.card.ink-nav {
  background: var(--ink-card-bg);
  background-size: 160% 100%;
  border-color: var(--ink-card-border);
  box-shadow:
    0 -4px 14px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(232, 196, 201, 0.22),
    inset 0 -1px 0 rgba(74, 26, 38, 0.55),
    inset 0 24px 40px -18px rgba(107, 40, 56, 0.2);
  animation: nav-ink-drift 22s ease-in-out infinite alternate;
}

@media (prefers-reduced-motion: reduce) {
  .card.ink-nav {
    animation: none;
    background-position: 50% 50%;
  }
}

/* ============================================================
   BRAND: brooch badge + wordmark
   ============================================================ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs); /* ≈14px fluid (0.75–1.125rem) */
  text-decoration: none;
  flex-shrink: 0;
}

.brooch {
  position: relative;
  display: inline-block;
  width: 84px;
  height: 84px;
  margin: -20px 0 -30px;
  border-radius: 50%;
  background: var(--brooch-bg);
  border: 1.2px solid var(--brooch-border-color);
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow var(--dur-slow) var(--ease-flutter); /* dur-slow = 400ms */
}

.brooch .logomark {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

/* Dome highlight (specular + broad + burgundy shadow) */
.brooch::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 18% 12% at 28% 18%, rgba(255, 255, 248, 0.85) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 32% 22%, rgba(255, 248, 228, 0.38) 0%, transparent 60%),
    radial-gradient(ellipse 70% 55% at 78% 88%, rgba(74, 26, 38, 0.4) 0%, transparent 65%);
  z-index: 2;
  pointer-events: none;
}

/* Rim emboss — blends logo edge into the burgundy border */
.brooch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow:
    inset 0 2px 0 rgba(255, 250, 232, 0.82),
    inset 0 -6px 14px rgba(74, 26, 38, 0.38),
    inset 0 0 18px rgba(168, 90, 95, 0.2);
  z-index: 3;
  pointer-events: none;
}

/* Drop shadow — silk (pinned) */
.card.silk-nav .brooch {
  box-shadow:
    0 1px 2px rgba(20, 8, 12, 0.45),
    0 3px 6px rgba(74, 26, 38, 0.38),
    0 8px 16px rgba(20, 8, 12, 0.28),
    0 0 0 1px rgba(255, 245, 220, 0.22);
}

/* Drop shadow — ink (deeper) */
.card.ink-nav .brooch {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 3px 6px rgba(74, 26, 38, 0.55),
    0 10px 20px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(232, 196, 201, 0.3);
}

/* ============================================================
   WORDMARK: two-font pairing, constant burgundy colour,
   halo swaps per state
   ============================================================ */

.wm {
  display: inline-flex;
  align-items: baseline;
  gap: 8px; /* BRAND-ALIGNMENT: art-directed baseline separation */
  font-size: 26px; /* BRAND-ALIGNMENT: wordmark optical size — not fluid */
  line-height: var(--lh-tight);
  transition: filter var(--dur-slow) var(--ease-flutter);
}

.wm .imat,
.wm .quest {
  background: var(--wordmark-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.wm .imat {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-variation-settings:
    "opsz" 36,
    "SOFT" 40;
  font-feature-settings:
    "swsh" 1,
    "salt" 1,
    "ss01" 1;
  letter-spacing: 0.01em;
}

.wm .quest {
  font-family: "DM Serif Display", Georgia, serif;
  font-style: italic;
  font-weight: 400;
}

/* Ink state: override wordmark to silk cream (no caramel) — reads as
   satin-on-navy; silk state keeps its burgundy locked ink. */
.card.ink-nav .wm .imat,
.card.ink-nav .wm .quest {
  background: linear-gradient(180deg, #fff5dc 0%, #f4e3bc 48%, #e4cfa2 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Silk halo — warm cream kiss */
.card.silk-nav .wm {
  filter: drop-shadow(0 0.5px 0 rgba(255, 250, 225, 0.72))
    drop-shadow(0 1px 0 rgba(74, 26, 38, 0.35)) drop-shadow(0 2px 3px rgba(40, 15, 22, 0.28));
}

/* Ink halo — stronger warm halo for dark-background legibility */
.card.ink-nav .wm {
  filter: drop-shadow(0 0.5px 0 rgba(255, 220, 200, 0.92))
    drop-shadow(0 1px 0 rgba(20, 8, 18, 0.48)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

/* ============================================================
   LINKS · CTA · SEPARATOR · LOGIN + FOCUS RINGS
   ============================================================ */

/* Links block left-aligned after the wordmark; actions flow naturally right */
.links {
  display: flex;
  margin-inline-start: 28px; /* BRAND-ALIGNMENT: nav chrome spacing — fluid --space-m → 34px at L1 */
}

.links .navbar__list {
  display: flex;
  gap: 32px; /* BRAND-ALIGNMENT: nav item spacing — fluid --space-l → 46px at L1 (+43%) */
  list-style: none;
  margin: 0;
  padding: 0;
}

.links .nav-link {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: 13.5px; /* BRAND-ALIGNMENT: nav chrome optical sizing — fluid --text-xs → 16.65px at L1 */
  text-decoration: none;
  transition:
    color var(--dur-slow) var(--ease-flutter),
    opacity var(--dur-slow) var(--ease-flutter);
}

.card.silk-nav .links .nav-link {
  color: var(--color-navy);
  opacity: 0.88;
}
.card.ink-nav .links .nav-link {
  color: #f4e4d4;
  opacity: 0.92;
} /* BRAND-ALIGNMENT: ink-state warm cream text */

/* Actions block — right-hand cluster of [Book a Session | Login].
   flex:1 with margin-left:auto on the cluster itself keeps the whole
   group right-aligned, and padding-right on .actions insets it from
   the viewport edge so neither button feels jammed. A vertical divider
   separates the two. */
.actions {
  display: flex;
  align-items: center;
  gap: 22px; /* BRAND-ALIGNMENT: right-zone chrome — fluid --space-m → 34px at L1 (+56%) */
  flex: 1;
  justify-content: flex-end;
  padding-inline-end: 18px; /* BRAND-ALIGNMENT: peek-frame inset — fluid --space-s → 23px at L1 */
}

.actions__divider {
  inline-size: 1px;
  block-size: 22px; /* BRAND-ALIGNMENT: divider chrome — fluid --space-m → 34px at L1 (+56%) */
  background: currentColor;
  opacity: 0.32;
  transition: opacity var(--dur-slow) var(--ease-flutter);
  flex-shrink: 0;
}
.card.silk-nav .actions__divider {
  background: var(--color-navy);
  opacity: 0.28;
}
.card.ink-nav .actions__divider {
  background: #f4e4d4;
  opacity: 0.28;
} /* BRAND-ALIGNMENT: ink-state warm cream */

.login {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: 13px; /* BRAND-ALIGNMENT: nav chrome optical sizing — fluid --text-xs → 16.65px at L1 */
  text-decoration: none;
  transition:
    color var(--dur-slow) var(--ease-flutter),
    opacity var(--dur-slow) var(--ease-flutter);
}
.card.silk-nav .login {
  color: var(--color-navy);
  opacity: 0.88;
}
.card.ink-nav .login {
  color: #f4e4d4;
  opacity: 0.92;
} /* BRAND-ALIGNMENT: ink-state warm cream */

.cta {
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: 12.5px; /* BRAND-ALIGNMENT: nav chrome optical sizing — fluid --text-xs → 16.65px at L1 */
  text-decoration: none;
  color: var(--color-white);
  padding: 9px 20px; /* BRAND-ALIGNMENT: CTA button geometry — fluid padding grows with viewport */
  border-radius: var(--radius-sm);
  background: var(--gradient-accent-wide);
  background-size: 200% 100%;
  background-position: 0% 50%;
  transition:
    background-position var(--dur-crawl) var(--ease-flutter),
    transform var(--dur-fast) var(--ease-out-quart);
}
.cta:hover {
  background-position: 100% 50%;
}

@media (prefers-reduced-motion: reduce) {
  .cta {
    transition: none;
  }
}

/* Focus rings */
.brand:focus-visible,
.nav-link:focus-visible,
.cta:focus-visible,
.login:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-xs);
}
.card.ink-nav :focus-visible {
  outline-color: color-mix(
    in oklch,
    var(--color-rose),
    transparent 15%
  ); /* ≈rgba(232,196,201,0.85) */
}

/* ============================================================
   LOGO
   ============================================================ */

.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

/* Vertical divider after logo */
.navbar__logo::after {
  content: "";
  inline-size: 1px;
  block-size: var(--space-m); /* 1.5rem → 24px at 16px base */
  background: color-mix(in oklch, var(--color-white), transparent 90%);
  margin-inline-start: var(--space-4); /* using style.css step token */
}

.navbar__logo-mark {
  width: 36px;
  height: 36px;
}

.navbar__logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.navbar__logo-name {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm); /* ≈18px fluid (1–1.333rem) */
  line-height: var(--lh-tight);
  color: var(--color-white);
  letter-spacing: var(--tracking-tight); /* -0.015em — near -0.01em */
}

/* ============================================================
   NAV LINKS (Desktop)
   ============================================================ */

.navbar__links {
  flex: 1;
}

.navbar__list {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm); /* ≈15px fluid */
  line-height: var(--lh-tight);
  color: color-mix(in oklch, var(--color-white), transparent 25%); /* 75% white */
  text-decoration: none;
  padding: var(--space-2) 0;
  position: relative;
  transition: color var(--dur-fast) var(--ease-out-quart);
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
}

.nav-link:hover {
  color: var(--color-white);
}

/* Pink underline — slides in from left on hover */
.nav-link::after {
  content: "";
  position: absolute;
  inset-block-end: -4px;
  inset-inline-start: 0;
  inline-size: 0;
  block-size: 2px;
  background: var(--color-pink);
  transition: inline-size var(--dur-base) var(--ease-out-quart);
}

.nav-link:hover::after {
  inline-size: 100%;
}

/* Active page — permanent pink underline */
.nav-link--active {
  color: var(--color-white);
}

.nav-link--active::after {
  inline-size: 100%;
}

/* Chevron on mega menu trigger */
.nav-link__chevron {
  transition: transform var(--dur-base) var(--ease-out-quart);
}

.nav-item--mega.is-open .nav-link__chevron {
  transform: rotate(180deg);
}

/* ============================================================
   MEGA MENU
   ============================================================ */

.mega-menu {
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  inline-size: 720px;
  background: var(--color-white);
  border-block-start: 3px solid var(--color-pink);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px color-mix(in oklch, var(--color-black), transparent 96%);
  padding: var(--space-8);

  /* Ω T19: container-type enables @container queries so the internal grid
     can adapt to menu width rather than viewport width.
     container-name scopes queries to avoid nested-container ambiguity.
     At 680px fixed width the 2-col grid always renders; the @container rule
     below collapses it to 1-col for future narrower breakpoints. */
  container-type: inline-size;
  container-name: mega-menu;

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(calc(-1 * var(--move-sm)));
  transition:
    opacity var(--dur-base) var(--ease-out-quart),
    transform var(--dur-base) var(--ease-out-quart);
}

/* Open state */
.nav-item--mega.is-open .mega-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* 3×2 tile grid — 6 course product tiles */
.mega-menu__tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Collapse to 2-col on narrow containers (future-proof for responsive shrink).
   Literal 480px used because @container conditions cannot resolve var(). */
@supports (container-type: inline-size) {
  @container mega-menu (max-width: 480px) {
    .mega-menu__tiles {
      grid-template-columns: repeat(2, 1fr);
    }
  }
}

/* Individual tile */
.mega-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-navy);
  background: var(--color-white);
  transition:
    background var(--dur-fast) var(--ease-out-quart),
    border-color var(--dur-fast) var(--ease-out-quart),
    transform var(--dur-fast) var(--ease-out-quart),
    box-shadow var(--dur-fast) var(--ease-out-quart);
}

.mega-tile:not(.mega-tile--featured):hover {
  background: color-mix(in oklch, var(--color-cream), white 20%);
  border-color: color-mix(in oklch, var(--color-burgundy), transparent 78%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(0 0 0 / 6%);
}

.mega-tile__icon {
  font-size: 20px;
  color: var(--color-navy);
  opacity: 0.6;
  line-height: 1;
}

.mega-tile__title {
  display: block;
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: 13px;
  line-height: var(--lh-snug);
  color: var(--color-navy);
}

.mega-tile__desc {
  display: block;
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
}

/* ── Featured tile: Complete IMAT Processing ── */
/* Fluttering burgundy gradient — flag-in-a-breeze effect.
   background-size: 200% allows position slide to reveal the full ramp. */
.mega-tile--featured {
  background: linear-gradient(
    135deg,
    var(--color-pink) 0%,
    var(--color-burgundy) 60%,
    var(--color-pink) 120%
  );
  background-size: 200% 100%;
  background-position: 0% 50%;
  border-color: transparent;
  color: var(--color-white);
  animation: mega-tile-flutter 3.5s ease-in-out infinite alternate;
}

.mega-tile--featured .mega-tile__icon {
  color: rgb(255 255 255 / 85%);
  opacity: 1;
}

.mega-tile--featured .mega-tile__title {
  color: var(--color-white);
}

.mega-tile--featured .mega-tile__desc {
  color: rgb(255 255 255 / 72%);
}

.mega-tile--featured:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgb(107 40 56 / 32%);
  border-color: transparent;
  background: linear-gradient(
    135deg,
    var(--color-pink) 0%,
    var(--color-burgundy) 60%,
    var(--color-pink) 120%
  );
  background-size: 200% 100%;
}

@keyframes mega-tile-flutter {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mega-tile--featured {
    animation: none;
    background-position: 50% 50%;
  }
}

/* ============================================================
   RIGHT ZONE (CTA + Login)
   ============================================================ */

.navbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  flex-shrink: 0;
}

.navbar__cta.btn-sm {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: 14px;
  line-height: 1;
  block-size: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.navbar__login {
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm); /* ≈15px fluid */
  line-height: var(--lh-tight);
  color: color-mix(in oklch, var(--color-white), transparent 25%); /* 75% white */
  text-decoration: none;
  padding: var(--space-2);
  transition: color var(--dur-fast) var(--ease-out-quart);
}

.navbar__login:hover {
  color: var(--color-white);
}

/* ============================================================
   HAMBURGER (hidden on desktop, visible on mobile)
   ============================================================ */

.hamburger {
  display: none;
  inline-size: var(--touch-target); /* 44px WCAG touch target */
  block-size: var(--touch-target);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  padding: var(--space-xs); /* ≈12px fluid */
}

.hamburger span {
  display: block;
  width: 20px; /* BRAND-ALIGNMENT: hamburger icon geometry */
  height: 2px;
  background: var(--color-white);
  position: absolute;
  left: 12px; /* BRAND-ALIGNMENT: centered in 44px touch target */
  transition:
    transform var(--dur-base) var(--ease-out-quart),
    opacity var(--dur-fast) var(--ease-out-quart);
}

.hamburger span:nth-child(1) {
  top: 15px;
}
.hamburger span:nth-child(2) {
  top: 21px;
}
.hamburger span:nth-child(3) {
  top: 27px;
}

/* Open state: morph to X */
.hamburger.is-active span:nth-child(1) {
  top: 21px;
  transform: rotate(45deg);
}

.hamburger.is-active span:nth-child(2) {
  opacity: 0;
}

.hamburger.is-active span:nth-child(3) {
  top: 21px;
  transform: rotate(-45deg);
}

/* ============================================================
   MOBILE DRAWER
   ============================================================ */

.mobile-nav {
  position: fixed;
  inset-block-start: 0;
  inset-inline-end: 0;
  inset-block-end: 0;
  inline-size: 100%;
  /* Glass recipe — floating overlay above page plane */
  background: var(--glass-fallback); /* solid fallback: parchment cream */
  background: var(--glass-bg); /* rgba ice-tinted glass where supported */
  border-inline-start: var(--glass-border);
  box-shadow: var(--glass-shadow);
  z-index: var(--z-overlay); /* 30 — below modal, above sticky */
  padding: calc(var(--navbar-height-mobile) + var(--space-8) + env(safe-area-inset-top, 0px))
    calc(var(--space-6) + env(safe-area-inset-right, 0px))
    calc(var(--space-10) + env(safe-area-inset-bottom, 0px))
    calc(var(--space-6) + env(safe-area-inset-left, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out-quart);
}

/* Apply blur only where backdrop-filter is supported */
@supports (backdrop-filter: blur(1px)) {
  .mobile-nav {
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .mobile-nav {
    background: var(--glass-fallback); /* solid parchment cream */
  }
}

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

/* Mobile links — navy text on glass/cream overlay */
.mobile-nav a,
.mobile-accordion-trigger {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-md); /* ≈20px fluid */
  line-height: var(--lh-tight);
  color: color-mix(in oklch, var(--color-navy), transparent 25%); /* navy at 75% */
  text-decoration: none;
  padding: var(--space-4) 0;
  min-block-size: var(--touch-target); /* 44px WCAG — 56px actual is fine, keep fluid */
  border-block-end: 1px solid color-mix(in oklch, var(--color-navy), transparent 92%);
}

.mobile-nav a:hover {
  color: var(--color-navy);
}

/* Staggered entrance — links cascade from right */
.mobile-nav a,
.mobile-nav .mobile-accordion {
  opacity: 0;
  transform: translateX(var(--move-lg));
  transition:
    opacity var(--dur-base) var(--ease-out-quart),
    transform var(--dur-base) var(--ease-out-quart);
}

.mobile-nav.is-open a:nth-child(1),
.mobile-nav.is-open .mobile-accordion:nth-child(1) {
  transition-delay: 80ms;
}
.mobile-nav.is-open a:nth-child(2),
.mobile-nav.is-open .mobile-accordion:nth-child(2) {
  transition-delay: 160ms;
}
.mobile-nav.is-open a:nth-child(3),
.mobile-nav.is-open .mobile-accordion:nth-child(3) {
  transition-delay: 240ms;
}
.mobile-nav.is-open a:nth-child(4),
.mobile-nav.is-open .mobile-accordion:nth-child(4) {
  transition-delay: 320ms;
}
.mobile-nav.is-open a:nth-child(5),
.mobile-nav.is-open .mobile-accordion:nth-child(5) {
  transition-delay: 400ms;
}

.mobile-nav.is-open a,
.mobile-nav.is-open .mobile-accordion {
  opacity: 1;
  transform: translateX(0);
}

/* ── Mobile Courses Accordion ── */

.mobile-accordion-trigger {
  inline-size: 100%;
  background: none;
  border: none;
  border-block-end: 1px solid color-mix(in oklch, var(--color-navy), transparent 92%);
  font-family: var(--font-heading);
  font-weight: var(--weight-medium);
  font-size: var(--text-md); /* ≈20px fluid */
  line-height: var(--lh-tight);
  color: color-mix(in oklch, var(--color-navy), transparent 25%); /* navy at 75% */
  text-align: start;
  padding: var(--space-4) 0;
  min-block-size: var(--touch-target); /* 44px WCAG */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-accordion-trigger svg {
  transition: transform var(--dur-base) var(--ease-out-quart);
}

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

.mobile-accordion-content {
  max-block-size: 0;
  overflow: hidden;
  transition: max-block-size var(--dur-slow) var(--ease-out-quart);
}

.mobile-accordion-content.is-open {
  max-block-size: 600px;
}

.mobile-accordion-content a {
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: var(--text-sm); /* ≈16px fluid */
  line-height: var(--lh-tight);
  color: color-mix(in oklch, var(--color-navy), transparent 40%); /* navy at 60% */
  padding: var(--space-3) 0 var(--space-3) var(--space-4);
  min-block-size: var(--touch-target); /* 44px WCAG */
  border-block-end: 1px solid color-mix(in oklch, var(--color-navy), transparent 95%);
}

/* ── Mobile CTA + Login (bottom of drawer) ── */

.mobile-nav__cta {
  inline-size: 100%;
  margin-block-start: var(--space-8);
  height: 52px; /* ω-defer: fixed CTA height — touch UX design intent */
  font-size: var(--text-sm); /* ≈16px fluid */
  border-radius: var(--radius-sm);
}

.mobile-nav__login {
  color: color-mix(in oklch, var(--color-navy), transparent 50%); /* navy at 50% */
  font-size: var(--text-sm); /* ≈16px fluid */
  border-block-end: none;
  margin-block-start: var(--space-4);
  justify-content: center;
}

/* ============================================================
   FOCUS STATES (Keyboard Navigation)
   ============================================================ */

.nav-link:focus-visible,
.navbar__login:focus-visible,
.navbar__cta:focus-visible,
.hamburger:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-pink);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-xs);
}

.nav-link:focus:not(:focus-visible),
.navbar__login:focus:not(:focus-visible),
.hamburger:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   MOBILE BREAKPOINT (≤ 1024px)
   ============================================================ */

@media (max-width: 1024px) {
  .navbar {
    block-size: var(--navbar-height-mobile); /* 60px from style.css */
    background: var(--color-navy);
    border-block-end: 1px solid color-mix(in oklch, var(--color-white), transparent 94%);
  }

  /* No tint layer on mobile — already solid */
  .navbar::before {
    display: none;
  }

  .navbar__inner {
    padding: 0 var(--space-4);
  }

  /* Hide desktop nav chrome — .links / .actions are the live selectors in the current HTML.
     .navbar__links / .navbar__cta were dead selectors from the pre-brooch navbar. */
  .links {
    display: none;
  }
  .actions {
    display: none;
  }

  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .navbar__logo-mark {
    width: 32px; /* BRAND-ALIGNMENT: mobile logo icon size */
    height: 32px;
  }

  .navbar__logo-name {
    font-size: var(--text-sm); /* ≈16px fluid */
  }

  /* Hide logo divider on mobile */
  .navbar__logo::after {
    display: none;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .navbar,
  .navbar::before,
  .nav-link::after,
  .mega-menu,
  .mobile-nav,
  .mobile-nav a,
  .mobile-nav .mobile-accordion,
  .hamburger span,
  .mobile-accordion-content,
  .mobile-accordion-trigger svg,
  .nav-link__chevron,
  .skip-link {
    transition-duration: 0.01ms !important;
  }

  .mega-menu {
    transform: translateX(-50%) translateY(0);
  }

  .navbar--hidden {
    transform: translateY(-100%);
  }

  /* No stagger delays */
  .mobile-nav.is-open a,
  .mobile-nav.is-open .mobile-accordion {
    transition-delay: 0ms !important;
  }
}

/* ============================================================
   WILL-CHANGE HINT (applied via JS during active scroll)
   ============================================================ */

.navbar.is-scrolling {
  will-change: transform;
}

/* ============================================================
   BODY OFFSET (prevents content hiding behind fixed navbar)
   ============================================================ */

body {
  padding-block-start: var(--navbar-height);
}

@media (max-width: 1024px) {
  body {
    padding-block-start: var(--navbar-height-mobile); /* 60px from style.css */
  }
}

/* Anchor scroll offset for fixed navbar */
[id] {
  scroll-margin-top: calc(var(--navbar-height) + var(--space-4));
}

/* ============================================================
   FLOATING NAV OVER HERO VIDEO (added 2026-04-21, Phase A Day 1)
   -----------------------------------------------------------
   Removes ONLY the burgundy peek-frame substrate behind the
   navbar card so the hero video shows through to the top edge.
   The silk card itself (cream background, wordmark, links,
   brooch, borders) is untouched — it appears to float as-is
   on top of the video.
   -----------------------------------------------------------
   REVERT INSTRUCTIONS
   Remove the `nav-video-float` class from <body> in index.html.
   This whole block becomes a no-op (selector never matches)
   and the burgundy peek-frames return instantly.
   -----------------------------------------------------------
   Only applies while .silk-nav is active (i.e. over the hero).
   Past-hero ink-nav state is untouched.
   ============================================================ */

.navbar.is-floating .substrate {
  background: transparent;
}

.navbar.is-floating .peek--back,
.navbar.is-floating .peek--mid {
  display: none;
}

/* Let the hero video reach the very top of the viewport. Normally
   body reserves padding-top: var(--navbar-height) so nothing hides
   behind the fixed navbar — but on pages that opt in to float-nav,
   the hero WANTS to sit under the navbar, and the hero's own internal
   padding-top already pushes its content below the card. */
body.nav-video-float {
  padding-block-start: 0;
}
