/* ===========================================================
   DharmaChart /welcome — v5 "Magical"
   Dark-first cosmic narrative. Warm copper ambient.
   =========================================================== */

/* ---------- Design tokens (subset, mirrored from design system) ---------- */
/* Default mode = DARK. html.light flips to parchment. */
:root {
  --font-serif: "EB Garamond", Georgia, serif;
  --font-sans: "Manrope", system-ui, sans-serif;

  /* Dark surface (default) */
  --deepstone: 14 13 11;       /* #0e0d0b */
  --void:       8  7  6;
  --stone:     26 24 22;       /* #1a1816 */
  --stone-light: 42 38 34;
  --stone-hover: 52 47 43;

  /* Accents — same in both modes */
  --copper:         139  90 60;
  --copper-light:   196 149 106;
  --copper-hover:   160 106 72;

  --primordial: 61 92 78;
  --ember:     168 90 58;
  --blood:     139 50 50;

  /* Ink */
  --bone:           232 220 200;
  --bone-secondary: 200 188 170;
  --parchment:      212 197 185;
  --ash:            107 101 96;

  --border-subtle:  42 38 34;
  --border-default: 58 53 48;

  --ink-on-copper: 232 220 200;

  /* Planetary palette */
  --line-sun:     #c9a84c;
  --line-moon:    #e8dcc8;
  --line-mercury: #8a8078;
  --line-venus:   #a06a48;
  --line-mars:    #8b4a4a;
  --line-jupiter: #a87030;
  --line-saturn:  #6b6560;
  --line-uranus:  #5a7a6b;
  --line-neptune: #3d5c4e;
  --line-pluto:   #6b2c2c;

  --radius-button: 8px;
  --radius-card:   12px;
  --radius-modal:  16px;
  --radius-pill:   9999px;

  --ease-meditative: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-magnetic:   cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-glow:    0 0 20px rgb(139 90 60 / 0.18);
  --shadow-glow-lg: 0 0 60px rgb(139 90 60 / 0.30);

  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base: 1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.2rem;
  --text-2xl: 1.8rem;
  --text-3xl: 2.5rem;
  --text-4xl: 3.5rem;
  --text-5xl: 4.25rem;
  --text-6xl: 5.25rem;
  --text-7xl: 6.5rem;
  --text-display: clamp(2.6rem, 6vw, 5rem);
  --text-display-lg: clamp(3.5rem, 9vw, 8rem);
}

/* Light mode overrides — parchment palette */
html.light {
  --deepstone:    245 240 232;
  --void:         237 229 216;
  --stone:        237 229 216;
  --stone-light:  255 255 255;
  --stone-hover:  229 221 208;

  --copper-hover: 122  79  52;

  --bone:           26  24  22;
  --bone-secondary: 74  70  64;
  --parchment:      74  70  64;
  --ash:            107 101  96;

  --border-subtle:  229 221 208;
  --border-default: 212 197 185;

  --shadow-glow:    0 0 20px rgb(139 90 60 / 0.12), 0 2px 8px rgb(42 38 34 / 0.05);
  --shadow-glow-lg: 0 0 50px rgb(139 90 60 / 0.18), 0 4px 16px rgb(42 38 34 / 0.06);
}

/* .force-dark — sections that are always dark regardless of html mode */
.force-dark, html.light .force-dark {
  --deepstone: 14 13 11;
  --void:       8  7  6;
  --stone:     26 24 22;
  --stone-light: 42 38 34;
  --stone-hover: 52 47 43;
  --bone:           232 220 200;
  --bone-secondary: 200 188 170;
  --parchment:      212 197 185;
  --border-subtle:  42 38 34;
  --border-default: 58 53 48;
  --copper-hover:   160 106 72;
  background: rgb(var(--deepstone));
  color: rgb(var(--bone));
}

* , *::before, *::after { box-sizing: border-box; }

html {
  background: rgb(var(--void));
  scroll-behavior: auto;
  /* hide native cursor variants on desktop where we paint a custom one — see effects.jsx */
}

body {
  margin: 0;
  background: rgb(var(--deepstone));
  color: rgb(var(--bone));
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  position: relative;
}

::selection {
  background: rgb(var(--copper) / 0.85);
  color: rgb(var(--bone));
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  margin: 0;
  color: rgb(var(--bone));
  font-weight: 500;
  letter-spacing: -0.015em;
}

p { color: rgb(var(--bone) / 0.78); }

a { color: inherit; }

button { font-family: inherit; }

img { display: block; max-width: 100%; }

.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;
}

:focus-visible {
  outline: 2px solid rgb(var(--copper-light));
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Typography motifs ---------- */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.36em;
  color: rgb(var(--copper-light) / 0.78);
  display: inline-block;
}

.italic-copper {
  font-style: italic;
  color: rgb(var(--copper-light));
}

.serif { font-family: var(--font-serif); }
.sans  { font-family: var(--font-sans); }

.display {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: var(--text-display);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: rgb(var(--bone));
}

.display-lg {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: var(--text-display-lg);
  line-height: 0.96;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  padding: 0.95rem 1.85rem;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: var(--radius-button);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background 200ms var(--ease-meditative),
              color 200ms var(--ease-meditative),
              box-shadow 320ms var(--ease-meditative),
              transform 200ms var(--ease-magnetic);
  position: relative;
  isolation: isolate;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: rgb(var(--copper));
  color: rgb(var(--ink-on-copper));
  box-shadow: 0 0 40px rgb(var(--copper) / 0.40), inset 0 1px 0 rgb(255 255 255 / 0.08);
}
.btn-primary:hover {
  background: rgb(var(--copper-hover));
  box-shadow: 0 0 60px rgb(var(--copper) / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.12);
}

.btn-ghost {
  background: transparent;
  color: rgb(var(--bone) / 0.78);
  padding: 0.95rem 1.4rem;
  border: 1px solid rgb(var(--copper) / 0.32);
}
.btn-ghost:hover {
  color: rgb(var(--bone));
  border-color: rgb(var(--copper) / 0.6);
  background: rgb(var(--copper) / 0.06);
}

.btn .arr {
  display: inline-block;
  transition: transform 200ms var(--ease-magnetic);
}
.btn:hover .arr { transform: translateX(4px); }

/* magnetic wrapper sets translate via JS — keep transition smooth */
.magnetic { transition: transform 220ms var(--ease-magnetic); will-change: transform; }

/* ---------- Chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgb(var(--copper) / 0.28);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: rgb(var(--bone) / 0.78);
  background: rgb(var(--stone) / 0.72);
  font-weight: 500;
  /* backdrop-filter removed — re-blurred page content behind each chip while
     scrolling; the slightly more opaque background carries the same look. */
}
.chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgb(var(--primordial));
  box-shadow: 0 0 8px rgb(var(--primordial) / 0.7);
}

/* ---------- Card ---------- */
.card {
  background: rgb(var(--stone));
  border: 1px solid rgb(var(--copper) / 0.18);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-glow);
}
.card-lift {
  transition: transform 320ms var(--ease-meditative),
              box-shadow 320ms var(--ease-meditative),
              border-color 320ms var(--ease-meditative);
}
.card-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-lg);
  border-color: rgb(var(--copper) / 0.40);
}

/* ---------- Section rhythm ---------- */
.section {
  position: relative;
  padding: clamp(6rem, 14vh, 10rem) 1.5rem;
}
.section--tight { padding: clamp(4rem, 10vh, 7rem) 1.5rem; }
.section--full  { padding: clamp(8rem, 18vh, 12rem) 1.5rem; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}
.container--narrow { max-width: 980px; }
.container--wide   { max-width: 1320px; }

/* ---------- Chapter intro (eyebrow + headline) ---------- */
.chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 820px) 1fr;
  gap: 1.4rem;
  margin-bottom: clamp(2.5rem, 6vh, 5rem);
  position: relative;
  min-height: 1px; /* allow chapter-num overflow */
}
.chapter-head > .stack {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.chapter-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: var(--text-display);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.chapter-head .kicker {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  color: rgb(var(--bone) / 0.72);
  line-height: 1.7;
  max-width: 60ch;
}
.chapter-head--center {
  grid-template-columns: 1fr;
  text-align: center;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.chapter-head--center > .stack { align-items: center; }
.chapter-head--center .kicker { margin: 0 auto; }

/* Oversized chapter number — top-right of the chapter head, watermark */
.chapter-num {
  position: absolute;
  top: -0.18em;
  right: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(6rem, 13vw, 12rem);
  line-height: 0.85;
  letter-spacing: -0.04em;
  color: rgb(var(--copper-light) / 0.07);
  -webkit-text-stroke: 1px rgb(var(--copper-light) / 0.18);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  white-space: nowrap;
  will-change: transform;
  transform: translateY(var(--num-ty, 0));
}
.chapter-head--center .chapter-num {
  right: auto; left: 50%; top: -0.32em;
  transform: translateX(-50%) translateY(var(--num-ty, 0));
  font-size: clamp(7rem, 14vw, 12rem);
  opacity: 0.6;
}
.chapter-head .stack > * { position: relative; z-index: 1; }
@media (max-width: 760px) {
  .chapter-head { grid-template-columns: 1fr; }
  .chapter-num { font-size: 5.5rem; top: -0.25em; right: 0; }
}

html.no-chapter-num .chapter-num { display: none; }

/* ---------- Letter reveal ---------- */
.word-stagger > span {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 800ms var(--ease-meditative), transform 800ms var(--ease-meditative);
}
.word-stagger.in > span { opacity: 1; transform: translateY(0); }

/* ---------- Animations ---------- */
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.012); } }
.breathe { animation: breathe 5s var(--ease-meditative) infinite; }

/* Compositor-only pulse. The old version animated box-shadow, which cannot be
   GPU-composited — it repaints every frame, and because the dot isn't isolated
   it was forcing its whole section to repaint ~every frame (confirmed the #1
   repainter, section#companion, via the CDP layer tree, 2026-06-02). Now an
   expanding ring on a promoted ::after via transform + opacity only. */
.copper-pulse { position: relative; }
.copper-pulse::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 100%; height: 100%;
  border-radius: 9999px;
  border: 1.5px solid rgb(var(--copper) / 0.55);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: copperPulse 3s var(--ease-meditative) infinite;
  will-change: transform, opacity;
  pointer-events: none;
}
@keyframes copperPulse {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.55; }
  70%  { opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(3.4); opacity: 0; }
}

@keyframes orbit { from { transform: translate(-50%,-50%) rotate(0); } to { transform: translate(-50%,-50%) rotate(360deg); } }
/* These decorative rings are perfect CIRCLES (1px border, border-radius:50%),
   so rotating them is visually a no-op — but the animation forced them into
   huge promoted compositor layers (up to 180vmax ≈ 2592px ≈ ~100MB GPU texture
   each) that recomposited every frame forever. Confirmed the #1 + #2 biggest
   layers via the CDP layer tree (2026-06-02). Static = pixel-identical, zero
   per-frame cost. */
.orbit-slow, .orbit-rev, .orbit-vslow { animation: none; }

@keyframes drift-up {
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(-220px); opacity: 0; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ---------- Top nav ---------- */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  transition: background 420ms var(--ease-meditative),
              border-color 420ms var(--ease-meditative);
}
.topnav--floating { background: transparent; }
.topnav--pinned {
  /* Was backdrop-filter: blur(22px) saturate(140%) — a live frosted-glass that
     forced the GPU to re-blur the ENTIRE page behind this fixed nav on every
     scroll frame, the whole way down. That was the #1 page-wide scroll cost.
     On this dark page a near-opaque solid is visually ~identical at ~zero cost. */
  background: rgb(var(--void) / 0.90);
  border-bottom: 1px solid rgb(var(--copper) / 0.16);
}
.topnav-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.topnav-link {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: rgb(var(--bone) / 0.72);
  text-decoration: none;
  padding: 0.35rem 0;
  background: none;
  border: 0;
  font-family: var(--font-sans);
  cursor: pointer;
  font-weight: 500;
  transition: color 180ms var(--ease-meditative);
}
.topnav-link:hover { color: rgb(var(--bone)); }

/* Wordmark — diamond + name */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.wordmark svg { transition: transform 600ms var(--ease-meditative); }
.wordmark:hover svg { transform: rotate(45deg); }

/* Live sky ticker in nav */
.sky-ticker {
  display: none;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgb(var(--bone) / 0.45);
  align-items: center;
  gap: 0.5rem;
}
@media (min-width: 980px) {
  .sky-ticker { display: inline-flex; }
}
.sky-ticker .glyph {
  font-family: var(--font-serif);
  color: rgb(var(--copper-light));
  font-size: 13px;
}

/* Scroll-progress hairline below nav */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgb(var(--copper) / 0.0) 0%, rgb(var(--copper-light) / 0.9) 50%, rgb(var(--copper) / 0.0) 100%);
  z-index: 70;
  pointer-events: none;
  width: var(--p, 0%);
  transition: width 90ms linear;
}

/* ---------- Cursor companion (desktop only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .cursor-companion {
    position: fixed;
    top: 0; left: 0;
    width: 18px; height: 18px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 80;
    mix-blend-mode: screen;
    transform: translate3d(-50%, -50%, 0);
    background: radial-gradient(circle, rgb(var(--copper-light) / 0.85) 0%, rgb(var(--copper-light) / 0.0) 70%);
    transition: width 260ms var(--ease-magnetic), height 260ms var(--ease-magnetic), opacity 200ms;
    will-change: transform;
  }
  .cursor-companion.is-hover {
    width: 64px; height: 64px;
    background: radial-gradient(circle, rgb(var(--copper-light) / 0.35) 0%, rgb(var(--copper-light) / 0.0) 70%);
  }
  .cursor-trailer {
    position: fixed; top: 0; left: 0;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: rgb(var(--copper-light));
    pointer-events: none;
    z-index: 79;
    transform: translate3d(-50%, -50%, 0);
    box-shadow: 0 0 14px rgb(var(--copper-light) / 0.8);
    will-change: transform;
  }
}

/* ---------- Persistent ambient orbital layer (page-fixed) ---------- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.ambient .ring {
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 50%;
  border: 1px solid rgb(var(--copper) / 0.06);
}
.ambient .aurora {
  position: absolute;
  left: 50%; top: 50%;
  width: 1400px; height: 1400px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgb(var(--copper) / 0.22) 0%, rgb(var(--copper) / 0.0) 55%);
  filter: blur(40px);
  will-change: transform;
}

/* parchment grain just for light sections */
.grain::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgb(var(--copper) / 0.04), transparent 45%),
    radial-gradient(circle at 80% 70%, rgb(var(--primordial) / 0.025), transparent 50%);
  z-index: 0;
}

/* ---------- Marquee strip ---------- */
.marquee {
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgb(var(--copper) / 0.12);
  border-bottom: 1px solid rgb(var(--copper) / 0.12);
  padding: 1.5rem 0;
  background: rgb(var(--void) / 0.4);
}
.marquee-track {
  display: flex;
  gap: 4rem;
  width: max-content;
  animation: marquee 80s linear infinite;
  white-space: nowrap;
}
.marquee--fast .marquee-track { animation-duration: 50s; }
.marquee--rev .marquee-track  { animation-direction: reverse; }
.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-serif);
  font-size: 28px;
  color: rgb(var(--bone) / 0.55);
}
.marquee-item .glyph {
  font-size: 36px;
  color: rgb(var(--copper-light));
}
.marquee-item .text {
  font-style: italic;
  font-size: 22px;
  letter-spacing: 0.01em;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Hero (cosmic zoom) ---------- */
.hero {
  position: relative;
  background: #060403;
  color: rgb(var(--bone));
  /* svh = stable viewport height; doesn't recalc when iOS Safari's address
     bar slides during scroll (which used to cause the "zoomed out → snap"
     feel on iPhone). 540 small-viewports = same meditative scroll length. */
  height: 540svh;
}
.hero-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}
.hero-scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  will-change: opacity, transform;
}
.hero-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 76% 70% at 50% 50%, rgba(20, 14, 10, 0) 0%, rgba(6,4,3,0.75) 80%),
    linear-gradient(180deg, rgba(6,4,3,0.55) 0%, rgba(6,4,3,0) 18%, rgba(6,4,3,0) 75%, rgba(6,4,3,0.85) 100%);
  z-index: 7;
  mix-blend-mode: multiply;
}
/* film grain — fine static noise so the hero feels analog */
.hero-grain {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0.18;
  z-index: 6;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.9  0 0 0 0 0.75  0 0 0 0.55 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  background-repeat: repeat;
  /* Static grain — was animated (grainShift) which re-painted this full-screen
     turbulence texture ~10x/sec over the hero. Static noise reads identically
     to the eye and costs nothing per frame. */
}
@keyframes grainShift {
  0%   { transform: translate(0,0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -2%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0,0); }
}
/* subtle chromatic aberration along the edges */
.hero-aberration {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(ellipse 60% 80% at 50% 50%, transparent 60%, rgba(252,80,40,0.04) 90%, rgba(80,140,255,0.05) 100%);
  mix-blend-mode: screen;
}
.hero-starfield {
  position: absolute; inset: -10%;
  pointer-events: none;
  transition: opacity 600ms ease;
  background-image:
    radial-gradient(1px 1px at 8% 18%, rgba(232,220,200,0.78), transparent 60%),
    radial-gradient(1px 1px at 12% 42%, rgba(232,220,200,0.50), transparent 60%),
    radial-gradient(1.4px 1.4px at 24% 78%, rgba(196,149,106,0.66), transparent 60%),
    radial-gradient(1px 1px at 38% 22%, rgba(232,220,200,0.50), transparent 60%),
    radial-gradient(1px 1px at 52% 58%, rgba(232,220,200,0.36), transparent 60%),
    radial-gradient(1.2px 1.2px at 64% 34%, rgba(232,220,200,0.58), transparent 60%),
    radial-gradient(1px 1px at 76% 72%, rgba(232,220,200,0.42), transparent 60%),
    radial-gradient(1.5px 1.5px at 86% 18%, rgba(196,149,106,0.58), transparent 60%),
    radial-gradient(1px 1px at 92% 62%, rgba(232,220,200,0.48), transparent 60%),
    radial-gradient(1px 1px at 17% 88%, rgba(232,220,200,0.50), transparent 60%),
    radial-gradient(1.2px 1.2px at 44% 92%, rgba(232,220,200,0.40), transparent 60%),
    radial-gradient(1px 1px at 70% 8%, rgba(232,220,200,0.55), transparent 60%);
}

.hero-captions-wrap {
  position: absolute;
  left: 0; right: 0;
  bottom: 11%;
  height: 220px;
  pointer-events: none;
  z-index: 5;
}
.hero-captions {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  padding: 0 clamp(1.5rem, 5vw, 5rem);
}
.hero-rail {
  position: absolute;
  top: 50%; right: clamp(1rem, 3vw, 3rem);
  transform: translateY(-50%);
  display: flex; flex-direction: column;
  gap: 22px;
  pointer-events: none;
  z-index: 6;
}
@media (max-width: 760px) {
  .hero-rail { display: none; }
  .hero-captions-wrap { bottom: 7%; height: 260px; }
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 4;
}
.scroll-cue .label {
  font-size: 9.5px;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: rgb(var(--bone) / 0.55);
  margin-bottom: 10px;
}

/* ---------- Light body ---------- */
.light-body {
  background: rgb(var(--deepstone));
  color: rgb(var(--bone));
  position: relative;
  z-index: 2;
}

/* ---------- Tabbar (used in synastry chapter) ---------- */
.tabbar {
  display: inline-flex;
  padding: 4px;
  background: rgb(var(--stone) / 0.85);
  border: 1px solid rgb(var(--copper) / 0.16);
  border-radius: var(--radius-pill);
  gap: 2px;
}
.tabbar button {
  border: 0;
  padding: 0.65rem 1.1rem;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-family: var(--font-sans);
  font-weight: 500;
  color: rgb(var(--bone) / 0.6);
  background: transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 200ms var(--ease-meditative), background 200ms var(--ease-meditative);
}
.tabbar button[aria-selected="true"] {
  background: rgb(var(--copper));
  color: rgb(var(--ink-on-copper));
}

/* ---------- Aspect line ---------- */
.aspect-line {
  stroke-linecap: round;
  transition: opacity 240ms var(--ease-meditative);
}

/* ---------- Inter-chapter ornament ---------- */
.bridge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 3rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}
.bridge .line { flex: 1; height: 1px; background: rgb(var(--copper) / 0.25); }
.bridge .glyph {
  color: rgb(var(--copper-light));
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  opacity: 0.8;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .breathe, .copper-pulse, .orbit-slow, .orbit-rev, .orbit-vslow, .marquee-track {
    animation: none !important;
  }
  .hero { height: 100svh !important; }
}

/* ---------- Mobile collapsing nav ---------- */
@media (max-width: 880px) {
  .topnav-links .topnav-link { display: none; }
  .topnav-links .btn { padding: 0.55rem 1rem; font-size: 10px; }
  .sky-ticker { display: none !important; }
}

/* small device tweaks */
@media (max-width: 600px) {
  .section { padding: 5rem 1.25rem; }
  .chapter-head h2 { font-size: clamp(2rem, 8vw, 2.6rem); }
}

/* ---------- Responsive: collapse inline 2-col grids on mobile ---------- */
/* Most chapters render their layout with JSX inline-style grids of the form
   `grid-template-columns: minmax(0, ...fr) minmax(0, ...fr)`. We can't add
   media-query rules to inline styles, so target them via attribute selector
   and override with !important on narrow widths. */
@media (max-width: 760px) {
  .section [style*="grid-template-columns: minmax"],
  .container [style*="grid-template-columns: minmax"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  /* Tighter section gutter */
  .section { padding: 4.5rem 1.25rem; }
  /* Hero captions held safe of the chart */
  .hero-captions-wrap { width: calc(100% - 2rem); }
}

/* ---------- Responsive: wheels + globe SVGs ----------
   The natal wheel ships at fixed SVG width/height; constrain so it never
   overflows a narrow viewport. SVG viewBox preserves aspect ratio. */
.dc-wheel-host { max-width: 100%; }
.dc-wheel-host svg.dc-wheel {
  max-width: 100%;
  height: auto;
  display: block;
}
/* World-map globe card — sizes its inner globe container responsively */
@media (max-width: 760px) {
  .scanbook { max-width: 100% !important; }
}

/* utility */
.text-bone { color: rgb(var(--bone)); }
.text-copper { color: rgb(var(--copper-light)); }
.text-muted { color: rgb(var(--bone) / 0.66); }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Companion handwriting — words flow in like ink on paper. */
.ink-word {
  display: inline-block;
  opacity: 0;
  filter: blur(4px);
  transform: translateY(3px);
  animation: ink-flow 720ms cubic-bezier(0.3, 0.7, 0.2, 1) forwards;
  will-change: opacity, filter, transform;
}
@keyframes ink-flow {
  0%   { opacity: 0; filter: blur(4px); transform: translateY(3px); }
  60%  { opacity: 0.85; filter: blur(1.2px); transform: translateY(1px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ink-word { animation: none !important; opacity: 1; filter: none; transform: none; }
}

/* ---------- ScanningBook (chapter-cards · guidebook moment) ----------
   An open book whose right page is being scanned by a camera viewfinder,
   then turns to reveal the next page in a continuous loop. */
.scanbook { display: flex; justify-content: center; width: 100%; max-width: 360px; margin: 0 auto; }
.scanbook-stage {
  position: relative; width: 100%;
  aspect-ratio: 8 / 5;
  perspective: 1400px;
}
.scanbook-spread {
  position: absolute; inset: 8% 4%;
  background:
    linear-gradient(to right,
      #15110d 0%,
      #1f1812 47%,
      #0b0805 50%,
      #1f1812 53%,
      #15110d 100%);
  border-radius: 4px;
  box-shadow: 0 18px 44px rgb(0 0 0 / 0.55), 0 2px 6px rgb(0 0 0 / 0.45);
  transform-style: preserve-3d;
  border: 1px solid rgb(var(--copper) / 0.22);
}
.scanbook-spine {
  position: absolute;
  left: 50%; top: 4%; bottom: 4%; width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(to right, rgb(0 0 0 / 0), rgb(0 0 0 / 0.85) 50%, rgb(0 0 0 / 0));
  z-index: 3;
  pointer-events: none;
}
.scanbook-page {
  position: absolute;
  top: 6%; bottom: 6%;
  padding: 5% 6% 6%;
  background: linear-gradient(135deg, #251c14 0%, #1a1410 70%, #150f0b 100%);
  border-radius: 1px;
}
.scanbook-page-content {
  height: 100%;
  display: flex; flex-direction: column;
  justify-content: space-between;
}
.scanbook-page--left  { left: 4%;  right: 50%; }
.scanbook-page--right { left: 50%; right: 4%; }

.scanbook-page--under {
  /* sits behind the turning page */
  z-index: 1;
  background: linear-gradient(135deg, #2a1f15 0%, #1e1610 70%, #170f0a 100%);
}
.scanbook-page--turn {
  /* the page that flips */
  z-index: 2;
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  box-shadow: 8px 0 16px rgb(0 0 0 / 0.35);
  animation: scanbook-flip 8s cubic-bezier(0.45, 0.05, 0.4, 1) infinite;
}
@keyframes scanbook-flip {
  0%, 62%       { transform: rotateY(0deg);   opacity: 1; }
  82%           { transform: rotateY(-170deg); opacity: 1; }
  88%           { transform: rotateY(-170deg); opacity: 0; }
  88.5%         { transform: rotateY(0deg);   opacity: 0; }
  92%, 100%     { transform: rotateY(0deg);   opacity: 1; }
}

.scanbook-line {
  height: 2px;
  background: rgb(232 220 200);
  border-radius: 1px;
}
.scanbook-line--head { height: 3px; background: rgb(232 220 200); }
.scanbook-line--hi {
  height: 3.5px;
  background: linear-gradient(to right,
    rgb(var(--copper-light)) 0%,
    rgb(var(--copper-light)) 78%,
    rgb(var(--copper-light) / 0) 100%);
  box-shadow: 0 0 10px rgb(var(--copper) / 0.65);
  border-radius: 2px;
}

/* Camera reticle — corner brackets + scanning line over the right page. */
.scanbook-reticle {
  position: absolute;
  top: 14%; bottom: 14%;
  left: 52%; right: 7%;
  pointer-events: none;
  z-index: 4;
}
.scanbook-reticle-corners { position: absolute; inset: 0; }
.scanbook-reticle-corners span {
  position: absolute; width: 14px; height: 14px;
  border: 1.6px solid rgb(var(--copper));
  filter: drop-shadow(0 0 4px rgb(var(--copper) / 0.55));
}
.scanbook-reticle-corners span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scanbook-reticle-corners span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scanbook-reticle-corners span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scanbook-reticle-corners span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.scanbook-reticle-scan {
  position: absolute; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right,
    rgb(var(--copper) / 0) 0%,
    rgb(var(--copper)) 30%,
    rgb(var(--copper-light)) 50%,
    rgb(var(--copper)) 70%,
    rgb(var(--copper) / 0) 100%);
  box-shadow: 0 0 16px rgb(var(--copper) / 0.75);
  opacity: 0;
  animation: scanbook-scan 8s cubic-bezier(0.4, 0.05, 0.6, 1) infinite;
}
@keyframes scanbook-scan {
  0%       { top: 0%;   opacity: 0; }
  6%       { opacity: 1; }
  55%      { top: 100%; opacity: 1; }
  60%, 100% { top: 100%; opacity: 0; }
}

.scanbook-reticle-dot {
  position: absolute; top: 50%; left: 50%; width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: rgb(var(--copper));
  box-shadow: 0 0 0 4px rgb(var(--copper) / 0.18), 0 0 12px rgb(var(--copper) / 0.7);
  animation: scanbook-dot 8s ease-in-out infinite;
}
@keyframes scanbook-dot {
  0%, 60% { opacity: 1; transform: scale(1); }
  62%, 90% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .scanbook-page--turn,
  .scanbook-reticle-scan,
  .scanbook-reticle-dot { animation: none !important; }
  .scanbook-reticle-scan { top: 50%; opacity: 1; }
}
.no-scrollbar { scrollbar-width: none; }

/* ============================================================
   Mobile perf reductions (2026-05-20 — re-added after GSAP regression)
   Even with GSAP ScrollTrigger driving the hero, iOS Safari still
   chokes on feTurbulence + large blurs + many simultaneous SVG
   rotations. Community consensus is to ship a less-loaded mobile
   variant — full fidelity on desktop, deliberately simpler on touch.
   ============================================================ */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  /* Heat-haze + fire-haze SVG turbulence filters — the worst single
     iOS perf trap. Disable on mobile/touch. */
  .hero svg filter[id^="heatHaze"] feTurbulence,
  .hero svg filter[id^="fireHaze"] feTurbulence {
    display: none;
  }
  .hero svg filter[id^="heatHaze"] feDisplacementMap,
  .hero svg filter[id^="fireHaze"] feDisplacementMap {
    scale: 0;
  }

  /* Cap blur radii at compositor-friendly values. iOS slows sharply
     above ~16-20px on scrolled / scaled layers. */
  .hero-scene [style*="blur(40px)"] {
    filter: blur(16px) !important;
  }
  .hero-scene [style*="blur(30px)"] {
    filter: blur(14px) !important;
  }
  .hero-scene [style*="blur(20px)"] {
    filter: blur(12px) !important;
  }

  /* backdrop-filter is one of iOS Safari's worst scroll-perf taps.
     Drop entirely; the slightly more opaque card backgrounds carry
     the visual weight without the GPU pass. */
  .card,
  [class*="hero"] [style*="backdrop-filter"] {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Orbital ring SVGs in the ambient layer — purely decorative,
     and the aurora alone carries the warmth. Hide on mobile. */
  .ambient svg {
    display: none;
  }

  /* Drop decorative will-change hints on mobile — only active controls and
     hero-tweened child elements need layer promotion. */
  .chapter-num,
  .hero-scene,
  .ink-word,
  .ambient,
  .ambient .aurora {
    will-change: auto !important;
  }
}

