/* ==========================================================================
   THE ALCHEMY OF LIGHT — styles.css
   Two themes on one set of tokens: light (default) and dark. The theme is set
   on <html data-theme> by the inline script in index.html before first paint.
   Fonts: Melodrama (display), General Sans (text), Noir Pro (header, as on the
   main site).
   ========================================================================== */

@font-face { font-family: 'Melodrama'; src: url('./assets/fonts/melodrama.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Melodrama'; src: url('./assets/fonts/melodrama-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('./assets/fonts/general.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noir Pro'; src: url('./assets/fonts/noirpro-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noir Pro'; src: url('./assets/fonts/noirpro-medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }

/* ---------- Tokens: LIGHT (default) --------------------------------------- */
:root {
  --bg: #f8f6f2;
  --bg-raised: #ffffff;
  --text: #0a0a0a;
  --text-muted: #5f5850;                 /* ≈ 6.6:1 on --bg */
  --accent: #7d6233;                     /* gold for text, ≈ 5:1 on --bg */
  --accent-soft: rgba(125, 98, 51, 0.42);
  --accent-fill: #b89a5e;                /* gold for surfaces (buttons, progress) */
  --accent-fill-hover: #c8ab72;
  --on-accent: #0b0a09;
  --line: rgba(10, 10, 10, 0.12);
  --rail-idle: rgba(10, 10, 10, 0.34);
  --selection: rgba(184, 154, 94, 0.32);

  --stage: radial-gradient(120% 95% at 55% 48%, #ffffff 0%, #f6f3ee 46%, #e9e4dc 100%);
  --stage-failed: radial-gradient(90% 70% at 70% 45%, #ffffff 0%, #f3efe8 50%, #e7e1d8 100%);
  --vignette: rgba(120, 108, 92, 0.14);
  --grain-opacity: 0.045;
  --grain-blend: multiply;
  --floor-0: rgba(248, 246, 242, 0.96);
  --floor-1: rgba(248, 246, 242, 0.78);
  --floor-2: rgba(248, 246, 242, 0);

  --panel-bg: rgba(255, 255, 255, 0.72);
  --panel-border: rgba(125, 98, 51, 0.28);
  --button-line: rgba(10, 10, 10, 0.32);
  --button-line-hover-bg: rgba(10, 10, 10, 0.04);

  /* Header (ported from the main site: white bar, black type) */
  --mark: #0a0a0a;                       /* hero wordmark */
  --mark-sheen: #c4a468;
  --link-line: rgba(10, 10, 10, 0.35);

  --nav-bg: #ffffff;
  --nav-text: #0a0a0a;
  --nav-text-soft: rgba(10, 10, 10, 0.9);
  --nav-text-muted: rgba(10, 10, 10, 0.7);
  --nav-text-faint: rgba(10, 10, 10, 0.5);
  --nav-line: rgba(10, 10, 10, 0.15);
  --nav-control-border: rgba(10, 10, 10, 0.2);
  --nav-on: #0a0a0a;
  --nav-on-text: #ffffff;
  --mega-bg: #f5f5f5;
  --mega-border: rgba(10, 10, 10, 0.1);
  --card-bg: #ffffff;
  --card-border: rgba(10, 10, 10, 0.05);

  --serif: 'Melodrama', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'General Sans', 'Helvetica Neue', Arial, sans-serif;
  --noir: 'Noir Pro', 'General Sans', 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --edge: clamp(22px, 5vw, 88px);
  --header-h: 73px;
  color-scheme: light;
}

/* ---------- Tokens: DARK --------------------------------------------------- */
:root[data-theme="dark"] {
  --bg: #09090b;
  --bg-raised: #121214;
  --text: #ede7dc;
  --text-muted: #a7a199;                 /* ≈ 7.6:1 on --bg */
  --accent: #b89a5e;
  --accent-soft: rgba(184, 154, 94, 0.45);
  --accent-fill: #b89a5e;
  --accent-fill-hover: #cdb07a;
  --on-accent: #0b0a09;
  --line: rgba(237, 231, 220, 0.14);
  --rail-idle: rgba(237, 231, 220, 0.38);
  --selection: rgba(184, 154, 94, 0.35);

  --stage: radial-gradient(120% 95% at 55% 48%, #17150f 0%, #0e0d0c 42%, #09090b 100%);
  --stage-failed: radial-gradient(90% 70% at 70% 45%, #2a251c 0%, #121110 45%, #09090b 100%);
  --vignette: rgba(5, 5, 6, 0.72);
  --grain-opacity: 0.07;
  --grain-blend: overlay;
  --floor-0: rgba(9, 9, 11, 0.94);
  --floor-1: rgba(9, 9, 11, 0.72);
  --floor-2: rgba(9, 9, 11, 0);

  --panel-bg: rgba(14, 13, 12, 0.55);
  --panel-border: rgba(184, 154, 94, 0.32);
  --button-line: rgba(237, 231, 220, 0.3);
  --button-line-hover-bg: rgba(237, 231, 220, 0.05);

  --mark: #ede7dc;
  --mark-sheen: #fff4dc;
  --link-line: rgba(237, 231, 220, 0.35);

  --nav-bg: #09090b;
  --nav-text: #ede7dc;
  --nav-text-soft: rgba(237, 231, 220, 0.9);
  --nav-text-muted: rgba(237, 231, 220, 0.7);
  --nav-text-faint: rgba(237, 231, 220, 0.5);
  --nav-line: rgba(237, 231, 220, 0.15);
  --nav-control-border: rgba(237, 231, 220, 0.24);
  --nav-on: #ede7dc;
  --nav-on-text: #09090b;
  --mega-bg: #121214;
  --mega-border: rgba(237, 231, 220, 0.1);
  --card-bg: #1a1a1c;
  --card-border: rgba(237, 231, 220, 0.06);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--selection); color: var(--text); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 5px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Loader --------------------------------------------------------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 22px;
  background: var(--bg);
}
.loader__mark {
  font-family: var(--serif); font-weight: 300;
  font-size: 15px; letter-spacing: 0.42em; text-transform: uppercase; color: var(--text);
  padding-left: 0.42em; /* optically centre the tracked caps */
}
.loader__bar { width: 160px; height: 1px; background: var(--line); overflow: hidden; }
.loader__bar span {
  display: block; height: 100%; background: var(--accent-fill);
  transform-origin: left; transform: scaleX(var(--load, 0));
  transition: transform 0.4s var(--ease);
}

/* ==========================================================================
   HEADER — ported from the main site (src/components/ui/NavigationClient.tsx)
   ========================================================================== */
.mdp-nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  background: var(--nav-bg); color: var(--nav-text);
  text-rendering: auto; /* same glyph rendering as the main site's header */
}
.mdp-nav__bar--desktop { display: none; }
.mdp-nav__bar--mobile {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 16px 24px;
}

/* Mobile logo */
.mdp-nav__mlogo { display: block; text-align: left; }
.mdp-nav__mlogo-name {
  display: block; font-family: var(--serif); font-weight: 400;
  font-size: 16px; line-height: 1.25; letter-spacing: 0.15em; text-transform: uppercase;
}
.mdp-nav__mlogo-sub {
  display: block; margin-top: 2px; font-family: var(--noir);
  font-size: 0.5rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--nav-text-muted);
}

/* Hamburger */
.mdp-burger { position: relative; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.mdp-burger__lines { width: 24px; height: 16px; display: flex; flex-direction: column; justify-content: space-between; }
.mdp-burger__lines span {
  display: block; height: 1.5px; background: currentColor;
  transition: transform 0.3s, opacity 0.3s; transform-origin: center;
}
.mdp-burger[aria-expanded="true"] .mdp-burger__lines span:nth-child(1) { transform: translateY(7.25px) rotate(45deg); }
.mdp-burger[aria-expanded="true"] .mdp-burger__lines span:nth-child(2) { opacity: 0; transform: scale(0); }
.mdp-burger[aria-expanded="true"] .mdp-burger__lines span:nth-child(3) { transform: translateY(-7.25px) rotate(-45deg); }

/* Desktop bar */
.mdp-nav__side {
  display: flex; align-items: center; justify-content: flex-start; gap: 16px;
  width: 280px; padding: 20px 16px;
}
.mdp-nav__side--end { justify-content: flex-end; }
.mdp-nav__link {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--noir); font-weight: 500;
  font-size: 12px; line-height: 16px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--nav-text-soft); transition: color 0.3s; white-space: nowrap;
}
.mdp-nav__link:hover { color: var(--nav-text); }
.mdp-shop svg { width: 12px; height: 12px; transition: transform 0.3s; }
.mdp-shop[aria-expanded="true"] svg { transform: rotate(180deg); }

.mdp-nav__center { flex: 1; display: flex; align-items: center; justify-content: center; }
.nav-line { align-self: stretch; width: 1px; background: var(--nav-line); }
.mdp-nav__logo {
  padding: 20px 24px;
  font-family: var(--serif); font-weight: 400;
  font-size: 18px; line-height: 28px; letter-spacing: 0.2em; text-transform: uppercase;
}

/* Currency (and theme) segmented toggle */
.mdp-seg { display: inline-flex; align-items: center; border: 1px solid var(--nav-control-border); }
.mdp-seg button {
  font-family: var(--noir); font-size: 11px; line-height: 16.5px; letter-spacing: 0.15em; text-transform: uppercase;
  padding: 4px 8px; color: var(--nav-text-muted); transition: color 0.3s, background-color 0.3s;
}
.mdp-seg button:not(:last-child) { border-right: 1px solid var(--nav-control-border); }
.mdp-seg button:hover { color: var(--nav-text); }
.mdp-seg button[aria-pressed="true"] { background: var(--nav-on); color: var(--nav-on-text); }
.mdp-seg--lg button { font-size: 14px; line-height: 21px; padding: 4px 12px; }

/* Bottom border line; the story progress fills it in gold */
.mdp-nav__rule { position: relative; height: 1px; background: var(--nav-line); }
.mdp-nav__progress {
  position: absolute; inset: 0; background: var(--accent-fill);
  transform-origin: left; transform: scaleX(var(--p, 0)); opacity: 0.85;
}

/* Mega menu */
.mdp-mega {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--mega-bg); border-bottom: 1px solid var(--mega-border);
  max-height: 0; overflow: hidden; opacity: 0; visibility: hidden;
  transition: max-height 0.3s, opacity 0.3s, visibility 0.3s;
}
.mdp-mega.is-open { max-height: 500px; opacity: 1; visibility: visible; }
.mdp-mega__inner {
  max-width: 80rem; margin: 0 auto; padding: 48px 32px;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 48px;
}
.mdp-mega__cats { grid-column: span 3; }
.mdp-mega__cats h3 {
  font-family: var(--noir); font-weight: 400; font-size: 14px; line-height: 20px;
  letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--nav-text);
}
.mdp-mega__cats ul { display: grid; gap: 12px; }
.mdp-mega__cats a {
  font-family: var(--noir); font-size: 14px; line-height: 20px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--nav-text-muted); transition: color 0.3s;
}
.mdp-mega__cats a:hover, .mdp-mega__cats a.is-active { color: var(--nav-text); }
.mdp-mega__cards {
  grid-column: span 9;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
}
.mdp-mega__cards.is-swapping { animation: mdp-fade-in 0.25s ease-out; }
@keyframes mdp-fade-in { from { opacity: 0; } to { opacity: 1; } }
.mdp-card__frame {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
}
.mdp-card__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.mdp-card:hover .mdp-card__frame img { transform: scale(1.05); }
.mdp-card__cta { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--nav-text-faint); transition: color 0.3s; }
.mdp-card:hover .mdp-card__cta { color: var(--nav-text); }
.mdp-card__cta b { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 32px; }
.mdp-card__cta span { font-family: var(--noir); font-size: 10px; letter-spacing: 0.25em; text-transform: uppercase; }
.mdp-card__name {
  margin-top: 16px; text-align: center;
  font-family: var(--noir); font-size: 12px; line-height: 16px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--nav-text); transition: color 0.3s;
}
.mdp-card:hover .mdp-card__name { color: var(--nav-text-muted); }

/* Mobile menu overlay */
.mdp-mobile {
  position: fixed; inset: 61px 0 0; z-index: 40;
  background: var(--nav-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow-y: auto; overscroll-behavior: contain;
}
.mdp-mobile[hidden] { display: none; }
.mdp-mobile__list { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 24px 0; }
.mdp-mobile__group { display: flex; flex-direction: column; align-items: center; }
.mdp-mobile__link {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
  font-family: var(--noir); font-size: 24px; line-height: 32px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--nav-text); transition: color 0.3s;
}
.mdp-mobile__link:hover { color: var(--nav-text-muted); }
.mdp-mobile__link svg { width: 16px; height: 16px; transition: transform 0.3s; }
.mdp-mobile__link[aria-expanded="true"] svg { transform: rotate(180deg); }
.mdp-mobile__sub {
  display: flex; flex-direction: column; align-items: center;
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.3s, opacity 0.3s, margin 0.3s;
}
.mdp-mobile__sub.is-open { max-height: 300px; opacity: 1; margin-top: 8px; }
.mdp-mobile__sub a {
  padding: 8px 0; font-family: var(--noir); font-size: 16px; line-height: 24px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--nav-text-muted); transition: color 0.3s;
}
.mdp-mobile__sub a:hover { color: var(--nav-text); }
.mdp-mobile__sub a.is-all { font-size: 14px; color: var(--nav-text-faint); margin-top: 4px; }
.mdp-mobile__prefs { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; }
.mdp-mobile__prefs > span {
  font-family: var(--noir); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--nav-text-faint);
}
.mdp-mobile__prefs > span + .mdp-seg + span { margin-top: 8px; }

@media (min-width: 768px) {
  .mdp-nav__bar--mobile, .mdp-mobile { display: none !important; }
  .mdp-nav__bar--desktop { display: flex; align-items: stretch; }
  .mdp-mega { display: block; }
}
@media (min-width: 1024px) {
  .mdp-nav__side { width: 380px; padding: 20px 48px; gap: 32px; }
  .mdp-nav__side--end { gap: 24px; }
  .mdp-nav__logo { padding: 20px 48px; font-size: 20px; }
  .mdp-mega__inner { padding: 48px; }
}

/* ---------- The pinned stage ---------------------------------------------- */
.stage {
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: var(--stage);
}
#webgl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, var(--vignette) 100%);
}
/* Film grain: a tiny SVG turbulence tile, barely there */
.stage__grain {
  position: absolute; inset: -50%; pointer-events: none; opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Hero (chapter I) ----------------------------------------------
   A giant wordmark behind the 3D canvas, the ring standing in front of it.
   --mx / --my come from the pointer for a little depth.
   -------------------------------------------------------------------------- */
.hero-mark {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: var(--header-h);
  --depth: -14;
  transform: translate3d(calc(var(--mx, 0) * var(--depth) * 1px), calc(var(--my, 0) * var(--depth) * 0.6px), 0);
}
.hero-mark__line {
  position: relative; display: block; white-space: nowrap;
  font-family: var(--serif); font-weight: 300; text-transform: uppercase;
  font-size: clamp(4.2rem, 14.2vw, 17.5rem); line-height: 0.86; letter-spacing: -0.012em;
  font-kerning: none;                    /* letters are split; keep the sheen copy aligned */
  color: var(--mark);
}
.hero-mark .char { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.04em 0 0.06em; margin: -0.04em 0 -0.06em; }
.hero-mark .char > span { display: inline-block; will-change: transform; }
/* A slow gold sheen across the letters, once they have risen. */
.hero-mark__line::after {
  content: attr(data-text); position: absolute; inset: 0; color: var(--mark-sheen);
  -webkit-mask-image: linear-gradient(105deg, transparent 44%, #000 50%, transparent 56%);
          mask-image: linear-gradient(105deg, transparent 44%, #000 50%, transparent 56%);
  -webkit-mask-size: 300% 100%; mask-size: 300% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 120% 0; mask-position: 120% 0;
  opacity: 0; transition: opacity 0.8s var(--ease);
}
html.is-sheen .hero-mark__line::after { opacity: 1; animation: mark-sheen 8s var(--ease) infinite; }
.hero-mark__line:nth-child(2)::after { animation-delay: 0.35s; }
@keyframes mark-sheen {
  0% { -webkit-mask-position: 120% 0; mask-position: 120% 0; }
  45%, 100% { -webkit-mask-position: -20% 0; mask-position: -20% 0; }
}

.hero-a { position: absolute; inset: var(--header-h) var(--edge) 0; pointer-events: none; }
.hero-a__eyebrow {
  position: absolute; top: 30px; left: 0;
  display: flex; align-items: center; gap: 14px;
  font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent);
}
.hero-a__eyebrow i { width: 28px; height: 1px; background: var(--accent-soft); }
.hero-a__foot {
  position: absolute; left: 0; right: 0; bottom: 92px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 40px;
}
.hero-a__statement { max-width: 28rem; pointer-events: auto; }
.hero-a__title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.9rem, 2.7vw, 3rem); line-height: 1.04; letter-spacing: -0.01em; color: var(--text);
}
.hero-a__body { margin-top: 14px; font-size: 14px; line-height: 1.7; color: var(--text-muted); max-width: 25rem; }
.hero-a__links { display: grid; justify-items: end; gap: 14px; pointer-events: auto; }

.text-link {
  display: inline-flex; align-items: center; gap: 16px; padding-bottom: 8px;
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text);
  border-bottom: 1px solid var(--link-line);
  transition: border-color 0.3s var(--ease), gap 0.4s var(--ease);
}
.text-link svg { width: 18px; height: 18px; }
.text-link:hover { border-color: var(--text); gap: 22px; }

/* ---------- Overlay grid: five text states -------------------------------- */
.overlay { position: absolute; inset: 0; pointer-events: none; }
.chapter {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px;
  align-items: center;
  padding: var(--header-h) var(--edge) 0;
  visibility: hidden; /* GSAP autoAlpha reveals each chapter in turn */
}
.chapter[data-chapter="0"] { visibility: visible; }
.chapter__copy { pointer-events: auto; }
.chapter--left  .chapter__copy { grid-column: 1 / span 5; }
.chapter--right .chapter__copy { grid-column: 8 / span 5; }
.chapter--center { align-items: end; }
.chapter--center .chapter__copy {
  grid-column: 3 / span 8; text-align: center; margin-bottom: 11vh;
  display: flex; flex-direction: column; align-items: center;
}

.chapter__label {
  display: flex; align-items: center; gap: 14px;
  font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 26px;
}
.chapter__label::before { content: ''; width: 28px; height: 1px; background: var(--accent-soft); }
.chapter--center .chapter__label::after { content: ''; width: 28px; height: 1px; background: var(--accent-soft); }

.chapter__title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.7rem, 5.6vw, 6.2rem); line-height: 0.98; letter-spacing: -0.015em;
  color: var(--text);
}
.chapter--center .chapter__title { font-size: clamp(2.4rem, 4.4vw, 4.8rem); }
.line { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.line > span { display: block; will-change: transform; }

.chapter__body {
  margin-top: 28px; max-width: 26rem;
  font-size: 15px; line-height: 1.75; color: var(--text-muted);
}
.chapter--center .chapter__body { max-width: 30rem; }

/* ---------- Finale: call to action ---------------------------------------- */
.cta {
  margin-top: 34px; max-width: 27rem;
  padding: 26px 28px 28px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.cta__specs { display: grid; gap: 12px; margin-bottom: 26px; }
.cta__specs div { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cta__specs dt { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-muted); }
.cta__specs dd { font-size: 14px; color: var(--text); text-align: right; }
.cta__actions { display: grid; gap: 10px; }

.button {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px;
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.button--gold { background: var(--accent-fill); color: var(--on-accent); }
.button--gold:hover { background: var(--accent-fill-hover); }
.button--line { border: 1px solid var(--button-line); color: var(--text); }
.button--line:hover { border-color: var(--text); background: var(--button-line-hover-bg); }

/* ---------- Chapter rail --------------------------------------------------- */
.rail {
  position: absolute; right: calc(var(--edge) * 0.45); top: 50%; transform: translateY(-50%);
  display: grid; gap: 6px; z-index: 5;
}
.rail button {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  min-height: 34px; min-width: 44px;
  font-family: var(--serif); font-size: 12px; letter-spacing: 0.08em; color: var(--rail-idle);
  transition: color 0.4s var(--ease);
}
.rail button::after {
  content: ''; width: 14px; height: 1px; background: currentColor;
  transition: width 0.5s var(--ease), background-color 0.4s var(--ease);
}
.rail button:hover { color: var(--text); }
.rail button.is-active { color: var(--accent); }
.rail button.is-active::after { width: 30px; }

/* ---------- Scroll cue + theme toggle (bottom of the stage) --------------- */
.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 12px; z-index: 5;
  font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--text-muted);
}
.scroll-cue i { display: block; width: 1px; height: 46px; background: linear-gradient(var(--accent-fill), transparent); transform-origin: top; animation: cue 2.4s var(--ease) infinite; }
@keyframes cue {
  0% { transform: scaleY(0); opacity: 0; }
  35% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(16px); opacity: 0; }
}

.theme-toggle {
  position: absolute; left: var(--edge); bottom: 22px; z-index: 6;
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-muted);
  transition: color 0.3s var(--ease);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle__icon {
  width: 14px; height: 14px; border-radius: 50%; border: 1px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* ---------- Footer --------------------------------------------------------- */
.site-footer {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 40px;
  padding: 72px var(--edge);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.wordmark {
  font-family: var(--serif); font-weight: 300;
  font-size: 13px; letter-spacing: 0.42em; text-transform: uppercase; white-space: nowrap;
  padding-left: 0.42em;
}
.site-footer__line { color: var(--text-muted); font-size: 13px; }
.site-footer__links { display: flex; gap: 28px; align-items: center; }
.site-footer__links a, .site-footer__links button {
  font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid transparent; padding-bottom: 3px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.site-footer__links a:hover, .site-footer__links button:hover { color: var(--text); border-color: var(--accent-soft); }

.noscript { position: fixed; inset: auto 0 0; padding: 14px; text-align: center; background: var(--bg-raised); font-size: 13px; z-index: 200; }
.noscript a { text-decoration: underline; }

/* ---------- WebGL / CDN failure: the story still reads ------------------- */
html[data-webgl="failed"] .stage { background: var(--stage-failed); }
html.is-static .loader { display: none; }
html.is-static .stage { height: auto; overflow: visible; background: var(--bg); }
html.is-static .overlay { position: relative; }
html.is-static .chapter { position: relative; visibility: visible; min-height: 80vh; }
html.is-static .rail, html.is-static .scroll-cue, html.is-static #webgl { display: none; }

/* ---------- Large screens -------------------------------------------------- */
@media (min-width: 1800px) {
  .chapter__body { font-size: 16px; max-width: 28rem; }
}

/* ---------- Tablet --------------------------------------------------------- */
@media (max-width: 1024px) {
  .chapter--left  .chapter__copy { grid-column: 1 / span 6; }
  .chapter--right .chapter__copy { grid-column: 7 / span 6; }
  .chapter--center .chapter__copy { grid-column: 2 / span 10; }
}

/* ---------- Phones --------------------------------------------------------- */
@media (max-width: 767px) {
  :root { --header-h: 61px; }
}
@media (max-width: 700px) {
  /* The ring takes the upper half (camera view offset); copy sits below it. */
  .chapter, .chapter--center { align-items: end; padding-bottom: 9vh; }
  .chapter .chapter__copy,
  .chapter--left .chapter__copy,
  .chapter--right .chapter__copy,
  .chapter--center .chapter__copy { grid-column: 1 / -1; text-align: left; align-items: flex-start; margin-bottom: 0; }
  .chapter--center .chapter__label::after { display: none; }
  .chapter__label { margin-bottom: 16px; font-size: 10px; }
  .chapter__title, .chapter--center .chapter__title { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  .chapter__body { margin-top: 16px; font-size: 14px; line-height: 1.65; max-width: 34ch; }

  .chapter--finale { padding-bottom: 4vh; }
  .chapter--finale .chapter__title { font-size: clamp(2.2rem, 10vw, 3rem); }
  .cta { margin-top: 18px; padding: 18px 18px 20px; max-width: none; width: 100%; }
  .cta__specs { gap: 8px; margin-bottom: 16px; }
  .cta__specs div { padding-bottom: 8px; }
  .button { min-height: 48px; }

  /* A soft floor under the copy, so text never sits on bright metal. */
  .overlay::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to top, var(--floor-0) 0%, var(--floor-1) 30%, var(--floor-2) 56%);
  }
  .rail, .theme-toggle { display: none; }   /* phones: theme lives in the menu */

  /* Hero on phones ("Foundation"): one line under the header, the name set large
     under the ring and in front of its band (app.js lowers it), one full-width
     link at the foot. */
  .hero-mark { z-index: 3; align-items: flex-start; justify-content: center; padding: calc(var(--header-h) - 6vh) 16px 0; }
  .hero-mark__line { font-size: 21.6vw; }
  .hero-a { inset: var(--header-h) 22px 0; }
  .hero-a__eyebrow { top: 25px; right: 0; justify-content: space-between; font-size: 10px; letter-spacing: 0.24em; }
  .hero-a__eyebrow i { display: none; }
  .hero-a__statement,
  .hero-a__links a[href="/appointments"] { display: none; }
  .hero-a__foot { bottom: 34px; flex-direction: column; align-items: stretch; gap: 0; }
  .hero-a__links { justify-items: stretch; }
  .hero-a__links .text-link { justify-content: space-between; height: 52px; padding: 0; border-bottom: 0; border-top: 1px solid var(--link-line); font-size: 11px; letter-spacing: 0.22em; }
  .scroll-cue { display: none; }   /* phones: the hero copy fills the foot */

  .site-footer { grid-template-columns: 1fr; gap: 18px; padding: 48px var(--edge); }
  .site-footer__links { flex-wrap: wrap; gap: 18px 24px; }
}

/* ---------- Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-cue i { animation: none; }
  .loader__bar span, .button, .rail button, .rail button::after,
  .mdp-mega, .mdp-mobile__sub, .mdp-burger__lines span, .mdp-card__frame img { transition: none; }
  .mdp-mega__cards.is-swapping { animation: none; }
  html.is-sheen .hero-mark__line::after { animation: none; opacity: 0; }
  .hero-mark { transform: none; }
}
