/* =============================================================
   TUTORFORGE — The Consecrated Forge
   Design system + layout. Pure static, no build step.
   ============================================================= */

/* ---------- 1. DESIGN TOKENS ---------- */
:root {
  /* Palette — 21 colours from brief.designSystem */
  --ink-void:      #0A0705;
  --ink-nave:      #120D09;
  --ink-night:     #14100C;
  --oxblood-deep:  #2A0E0E;
  --oxblood:       #4A1414;
  --oxblood-lit:   #5C1418;
  --stone-umber:   #1C1611;
  --stone-ash:     #322A20;
  --gold-leaf:     #C9A24B;
  --gold-lume:     #E8C977;
  --gold-molten:   #F2D98D;
  --gold-tarnish:  #8A6E33;
  --parchment:     #E7DCC4;
  --vellum:        #F4ECD8;
  --teal-sigil:    #27E0C8;
  --teal-bloom:    #5FF6E4;
  --teal-deep:     #0E6B62;
  --cyan-scan:     #1B8FA0;
  --ash-text:      #B8AD98;
  --ash-mute:      #6E665A;
  --error-glitch:  #FF3B6B;

  /* Fonts */
  --f-display: "Cinzel", "PT Serif Caps", "Times New Roman", serif;
  --f-crest:   "Cinzel Decorative", "Cinzel", serif;
  --f-editorial: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --f-body:    "EB Garamond", "Cormorant Garamond", Georgia, serif;
  --f-mono:    "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  /* Motion curves */
  --ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-settle: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-door:   cubic-bezier(0.76, 0, 0.24, 1);

  /* Frame */
  --frame-inset: 24px;

  /* Type scale (fluid) */
  --step--1: clamp(0.78rem, 0.72rem + 0.3vw, 0.92rem);
  --step-0:  clamp(1rem, 0.92rem + 0.4vw, 1.18rem);
  --step-1:  clamp(1.3rem, 1.1rem + 1vw, 1.7rem);
  --step-2:  clamp(1.8rem, 1.4rem + 2vw, 2.8rem);
  --step-3:  clamp(2.4rem, 1.6rem + 4vw, 4.4rem);
  --step-4:  clamp(3rem, 1.8rem + 6.5vw, 7rem);
  --step-5:  clamp(3.6rem, 2rem + 9vw, 9.5rem);

  --maxw: 1380px;
  --gutter: clamp(1.25rem, 5vw, 5rem);

  color-scheme: dark;
}

/* ---------- 2. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* Lenis controls scroll */
}
body {
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ash-text);
  background: var(--ink-void);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
body.is-locked { overflow: hidden; height: 100vh; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }
::selection { background: rgba(39, 224, 200, 0.28); color: var(--vellum); }

/* ---------- 3. LENIS ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- 4. CUSTOM CURSOR ---------- */
.has-custom-cursor,
.has-custom-cursor a,
.has-custom-cursor button,
.has-custom-cursor input,
.has-custom-cursor textarea,
.has-custom-cursor select,
.has-custom-cursor [data-magnetic],
.has-custom-cursor [data-cursor] { cursor: none; }

#cursor-trail {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none; z-index: 9000;
}
.cursor-quill {
  position: fixed; top: 0; left: 0;
  width: 30px; height: 30px;
  pointer-events: none; z-index: 9002;
  transform: translate(-50%, -50%);
  will-change: transform;
  opacity: 0;
  transition: opacity .4s ease;
}
.cursor-quill.is-ready { opacity: 1; }
.cursor-quill svg { width: 100%; height: 100%; overflow: visible; }
.cursor-seal {
  position: fixed; top: 0; left: 0;
  width: 78px; height: 78px;
  pointer-events: none; z-index: 9001;
  transform: translate(-50%, -50%) scale(0);
  will-change: transform;
  opacity: 0;
}
.cursor-seal.is-active { opacity: 1; }
.cursor-seal svg { width: 100%; height: 100%; }
.cursor-seal .seal-text { fill: var(--gold-lume); font-family: var(--f-crest); }
.cursor-seal .seal-disc { fill: rgba(42,14,14,.55); stroke: var(--gold-leaf); stroke-width: 1; }
.cursor-seal .seal-rim  { fill: none; stroke: var(--teal-sigil); stroke-width: .6; opacity:.6;}

/* ---------- 5. PERSISTENT OVERLAYS (grain / scanlines / vignette / frame) ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8000; }

#fx-grain {
  z-index: 8001;
  opacity: .07;
  mix-blend-mode: overlay;
  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='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: grainShift .5s steps(4) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-2%, -2%); }
  100% { transform: translate(3%, 1%); }
}
#fx-scanlines {
  z-index: 8002;
  opacity: .55;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(31,224,200,0.14) 0px,
    rgba(31,224,200,0.14) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}
#fx-vignette {
  z-index: 8000;
  background:
    radial-gradient(130% 100% at 50% 38%, transparent 42%, rgba(10,7,5,0.55) 78%, rgba(10,7,5,0.92) 100%);
}
/* Gilt manuscript-margin frame */
#fx-frame {
  z-index: 8005;
  border: 1px solid rgba(201,162,75,0.34);
  margin: var(--frame-inset);
  box-shadow:
    inset 0 0 0 1px rgba(10,7,5,0.6),
    inset 0 0 40px rgba(0,0,0,0.5);
}
#fx-frame::before, #fx-frame::after,
#fx-frame > span {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border: 1px solid rgba(201,162,75,0.5);
}
#fx-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
#fx-frame::after  { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
#fx-frame .fc-bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
#fx-frame .fc-br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

body.crt-storm #fx-grain { opacity: .19; animation-duration: .12s; }
body.crt-storm #fx-scanlines {
  opacity: 1;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(31,224,200,0.30) 0px,
    rgba(31,224,200,0.30) 1px,
    transparent 1px,
    transparent 2px);
  animation: scanRoll 6s linear infinite;
}
@keyframes scanRoll { from { background-position: 0 0; } to { background-position: 0 400px; } }

/* ---------- 6. PRELOADER ---------- */
#preloader {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--ink-void);
  display: grid; place-items: center;
  overflow: hidden;
}
#preloader .pre-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.6rem; width: min(560px, 82vw);
  text-align: center;
}
#preloader .pre-crest { width: clamp(110px, 22vw, 190px); height: auto; }
#preloader .pre-crest path {
  fill: none;
  stroke: url(#goldGrad);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(242,217,141,0.0));
}
#preloader .pre-foil { opacity: 0; }
#preloader .pre-brand {
  font-family: var(--f-crest);
  letter-spacing: .42em;
  font-size: var(--step--1);
  color: var(--gold-leaf);
  text-indent: .42em;
  opacity: 0;
}
.pre-channel {
  position: relative;
  width: min(340px, 70vw); height: 3px;
  background: var(--stone-ash);
  border-radius: 2px; overflow: hidden;
}
.pre-fill {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, var(--gold-tarnish), var(--gold-leaf) 60%, var(--gold-molten));
  border-radius: 2px;
}
.pre-meniscus {
  position: absolute; top: -2px; left: 0; width: 14px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--vellum), var(--gold-molten) 55%, transparent 75%);
  filter: blur(.4px);
  transform: translateX(-50%);
  box-shadow: 0 0 12px var(--gold-molten);
}
.pre-readout {
  display: flex; gap: 1.4rem; align-items: baseline;
  font-family: var(--f-mono); font-size: var(--step--1);
  letter-spacing: .08em;
}
.pre-pct  { color: var(--teal-sigil); min-width: 4ch; text-align: right; }
.pre-hex  { color: var(--gold-leaf); }
.pre-motto {
  font-family: var(--f-editorial); font-style: italic;
  color: var(--ash-mute); font-size: var(--step-0);
  opacity: 0;
}
.pre-skip {
  position: absolute; bottom: calc(var(--frame-inset) + 18px); right: calc(var(--frame-inset) + 18px);
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .18em;
  color: var(--ash-mute); text-transform: uppercase;
  border-bottom: 1px solid transparent; transition: color .3s, border-color .3s;
}
.pre-skip:hover { color: var(--gold-leaf); border-color: var(--gold-tarnish); }
.pre-folio {
  position: absolute; bottom: calc(var(--frame-inset) + 18px); left: calc(var(--frame-inset) + 18px);
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .22em; color: var(--ash-mute);
}
/* door split */
#preloader .door {
  position: absolute; top: 0; height: 100%; width: 51%;
  background: var(--ink-void); z-index: 2;
  transition: transform 1.1s var(--ease-door);
}
#preloader .door-l { left: 0; transform-origin: left; }
#preloader .door-r { right: 0; transform-origin: right; }
#preloader.doors-open .door-l { transform: translateX(-101%); }
#preloader.doors-open .door-r { transform: translateX(101%); }
#preloader.doors-open .pre-inner { opacity: 0; transition: opacity .4s ease; }
#preloader.done { display: none; }
.door-seam {
  position: absolute; top: 0; left: 50%; width: 2px; height: 100%;
  transform: translateX(-50%); z-index: 3;
  background: linear-gradient(to bottom, transparent, var(--gold-molten), var(--teal-sigil), var(--gold-molten), transparent);
  opacity: 0;
}
#preloader.flare .door-seam { opacity: 1; transition: opacity .3s ease; }

/* ---------- 7. WEBGL CANVAS / HERO ---------- */
#webgl-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 1; pointer-events: none; opacity: 0;
  transition: opacity 1.2s ease;
}
#webgl-canvas.is-live { opacity: 1; }

/* ---------- 8. SITE CHROME (nav) ---------- */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6000;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(1.1rem, 2.4vw, 1.9rem) calc(var(--frame-inset) + clamp(.6rem, 2vw, 1.6rem));
  transition: background .5s ease, backdrop-filter .5s ease;
}
.site-nav.scrolled {
  background: linear-gradient(to bottom, rgba(10,7,5,0.82), rgba(10,7,5,0));
  backdrop-filter: blur(3px);
}
.brand-crest {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--f-crest); letter-spacing: .26em;
  font-size: .82rem; color: var(--gold-lume);
}
.brand-crest svg { width: 38px; height: 38px; }
.brand-crest .crest-vein { stroke: var(--teal-sigil); opacity: 0; transition: opacity .4s; }
.brand-crest:hover .crest-vein { opacity: .9; }
.brand-crest .crest-name { display: none; }
@media (min-width: 760px) { .brand-crest .crest-name { display: inline; } }

.nav-cluster { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.4rem); }
.nav-links { display: none; gap: clamp(1rem, 2vw, 1.9rem); }
@media (min-width: 1024px) { .nav-links { display: flex; } }
.nav-link {
  position: relative; font-family: var(--f-mono);
  font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ash-text); padding: .3rem 0;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 0;
  background: var(--teal-sigil); transition: width .3s var(--ease-reveal);
}
.nav-link:hover { color: var(--gold-lume); }
.nav-link:hover::after { width: 100%; }

/* Language switcher */
.lang-switch { position: relative; }
.lang-toggle {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .14em;
  color: var(--gold-leaf); text-transform: uppercase;
  border: 1px solid rgba(201,162,75,0.32); padding: .42rem .7rem; border-radius: 2px;
  transition: border-color .3s, color .3s;
}
.lang-toggle:hover { border-color: var(--gold-leaf); color: var(--gold-lume); }
.lang-toggle .chev { transition: transform .3s; }
.lang-switch.open .lang-toggle .chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + .5rem); right: 0;
  background: rgba(18,13,9,0.96); backdrop-filter: blur(8px);
  border: 1px solid rgba(201,162,75,0.28);
  padding: .5rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: .15rem;
  min-width: 184px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .26s, transform .26s, visibility .26s; z-index: 10;
}
.lang-switch.open .lang-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-opt {
  display: flex; justify-content: space-between; gap: .6rem; align-items: baseline;
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .1em;
  padding: .5rem .65rem; color: var(--ash-text); text-transform: uppercase;
  border-left: 2px solid transparent; transition: background .2s, color .2s, border-color .2s;
}
.lang-opt:hover { background: rgba(201,162,75,0.08); color: var(--gold-lume); }
.lang-opt[aria-current="true"] { color: var(--oxblood-lit); border-color: var(--error-glitch); }
.lang-opt[aria-current="true"] .lo-code { color: var(--teal-sigil); }
.lang-opt .lo-code { color: var(--gold-tarnish); }

.btn-passage {
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-void); background: linear-gradient(120deg, var(--gold-leaf), var(--gold-lume));
  padding: .68rem 1.2rem; border-radius: 2px; position: relative; overflow: hidden;
  display: none;
}
@media (min-width: 760px) { .btn-passage { display: inline-block; } }
.btn-passage::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent, var(--teal-bloom), transparent);
  transform: translateX(-110%); transition: transform .6s var(--ease-reveal);
}
.btn-passage:hover::before { transform: translateX(110%); }

/* mobile menu */
.nav-burger { display: inline-flex; flex-direction: column; gap: 4px; padding: .4rem; }
@media (min-width: 1024px) { .nav-burger { display: none; } }
.nav-burger span { width: 22px; height: 1.5px; background: var(--gold-leaf); transition: transform .3s, opacity .3s; }
.nav-burger.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 5999;
  background: rgba(10,7,5,0.97); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 1.4rem; opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s;
}
.mobile-menu.open { opacity: 1; visibility: visible; }
.mobile-menu a {
  font-family: var(--f-editorial); font-size: 1.7rem; color: var(--parchment);
  letter-spacing: .04em;
}
.mobile-menu a:hover { color: var(--gold-lume); }

/* ---------- 9. SHARED SECTION PRIMITIVES ---------- */
main { position: relative; z-index: 2; }
.section { position: relative; padding-block: clamp(5rem, 14vh, 11rem); }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.sec-tag {
  font-family: var(--f-mono); font-size: var(--step--1);
  letter-spacing: .26em; color: var(--teal-sigil); text-transform: uppercase;
  display: inline-flex; align-items: center; gap: .6rem;
}
.sec-tag::before { content: ""; width: 28px; height: 1px; background: var(--teal-deep); }
.sec-gloss { font-family: var(--f-mono); color: var(--ash-mute); font-size: var(--step--1); margin-left: .8rem; }
.h-display {
  font-family: var(--f-editorial); font-weight: 600;
  line-height: 1.04; letter-spacing: -0.01em; color: var(--parchment);
}
.h-cinzel { font-family: var(--f-display); font-weight: 600; letter-spacing: .01em; }

/* reveal helpers */
[data-reveal] { opacity: 0; transform: translateY(28px); }
.no-motion [data-reveal] { opacity: 1; transform: none; }

/* fleuron divider */
.fleuron { display: grid; place-items: center; padding-block: clamp(2rem, 5vh, 4rem); }
.fleuron svg { width: min(420px, 70vw); height: auto; overflow: visible; }
.fleuron .fl-line path { stroke: var(--gold-tarnish); stroke-width: 1; fill: none; }
.fleuron .fl-orn path { fill: var(--gold-leaf); }
.fleuron .fl-vein {
  stroke: var(--teal-sigil); stroke-width: 1.4; fill: none;
  filter: drop-shadow(0 0 4px var(--teal-sigil));
}

/* ---------- 10. HERO / NARTHEX ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: flex-start;
  padding-top: clamp(7rem, 18vh, 12rem);
  overflow: hidden;
}
.hero-fallback {
  position: absolute; inset: 0; z-index: 0;
  background-image: url("../assets/hero.webp");
  background-image: -webkit-image-set(url("../assets/hero.webp") 1x);
  background-image: image-set(url("../assets/hero.webp") type("image/webp"));
  background-size: cover; background-position: center 18%;
}
.hero-fallback::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, rgba(10,7,5,0.86) 0%, rgba(10,7,5,0.42) 38%, rgba(10,7,5,0.18) 60%, rgba(10,7,5,0.55) 100%);
}
.hero .wrap { position: relative; z-index: 3; }
.hero-copy { max-width: 720px; }
.hero-eyebrow {
  font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .24em;
  color: var(--gold-leaf); text-transform: uppercase; margin-bottom: 1.4rem;
  display: inline-flex; align-items: center; gap: .7rem;
}
.hero-eyebrow::before { content: ""; width: 36px; height: 1px; background: var(--gold-tarnish); }
.hero-headline {
  font-family: var(--f-display); font-weight: 700;
  font-size: var(--step-5); line-height: 0.98; letter-spacing: -0.005em;
  color: var(--vellum); margin-bottom: 1.6rem;
  text-shadow: 0 2px 40px rgba(0,0,0,0.7);
}
.hero-headline .glyph { display: inline-block; }
.hero-headline .word { display: inline-block; white-space: nowrap; }
.hero-sub {
  font-family: var(--f-editorial); font-size: var(--step-1); font-weight: 400;
  line-height: 1.42; color: var(--parchment); max-width: 56ch; margin-bottom: 2.4rem;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem; }
.cta-primary {
  position: relative; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-void); overflow: hidden;
  background: linear-gradient(120deg, var(--gold-leaf), var(--gold-lume) 70%, var(--gold-molten));
  padding: 1.05rem 2.1rem; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(242,217,141,0.4), 0 10px 30px rgba(0,0,0,0.5);
}
.cta-primary .vein-edge {
  position: absolute; inset: 0; border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--teal-sigil); opacity: 0; transition: opacity .35s;
}
.cta-primary:hover .vein-edge { opacity: 1; }
.cta-secondary {
  font-family: var(--f-editorial); font-style: italic; font-size: var(--step-0);
  color: var(--ash-text); border-bottom: 1px solid var(--gold-tarnish);
  padding-bottom: 2px; transition: color .3s, border-color .3s;
}
.cta-secondary:hover { color: var(--gold-lume); border-color: var(--gold-lume); }

.hero-meta {
  position: absolute; bottom: calc(var(--frame-inset) + 1.4rem); left: var(--gutter); right: var(--gutter);
  z-index: 3; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem;
  font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .14em; color: var(--ash-mute);
}
.hero-meta .meta-stats { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.hero-meta .meta-stats span { color: var(--gold-tarnish); }
.hero-ticker { color: var(--teal-sigil); }
.scroll-cue {
  display: flex; align-items: center; gap: .6rem; color: var(--ash-text);
  font-family: var(--f-mono); font-size: .64rem; letter-spacing: .2em; text-transform: uppercase;
}
.scroll-cue .cue-line {
  width: 1px; height: 30px; background: linear-gradient(var(--gold-leaf), transparent);
  animation: cueDrop 2.2s var(--ease-settle) infinite;
}
@keyframes cueDrop { 0%,100% { transform: scaleY(.6); opacity:.4; transform-origin: top; } 50% { transform: scaleY(1); opacity: 1; } }

/* ---------- 11. MANIFESTO / NAVE ---------- */
.nave { position: relative; background: var(--ink-nave); overflow: hidden; }
.nave-bg {
  position: absolute; inset: -8% 0; z-index: 0;
  background: url("../assets/manifesto-bg.webp") center/cover no-repeat;
  opacity: .35; will-change: transform;
}
.nave-bg::after { content:""; position:absolute; inset:0; background: linear-gradient(var(--ink-void), transparent 30%, transparent 70%, var(--ink-void)); }
.nave .wrap { position: relative; z-index: 2; }
.nave-rail {
  position: absolute; top: 0; bottom: 0; left: calc(var(--frame-inset) + .8rem); z-index: 3;
  writing-mode: vertical-rl; font-family: var(--f-mono); font-size: .62rem;
  letter-spacing: .3em; color: var(--teal-deep); opacity: .7;
  display: none;
}
@media (min-width: 900px) { .nave-rail { display: block; } }
.nave-lines { display: flex; flex-direction: column; gap: clamp(.4rem,2vh,1.2rem); align-items: flex-start; margin: clamp(3rem,9vh,7rem) 0; }
.nave-line {
  font-family: var(--f-editorial); font-weight: 500;
  font-size: var(--step-4); line-height: 1.05; letter-spacing: -.01em;
}
.nave-line:nth-child(odd) { color: var(--gold-lume); }
.nave-line:nth-child(even) { color: var(--parchment); }
.nave-body {
  font-family: var(--f-body); font-size: var(--step-0); line-height: 1.65;
  color: var(--ash-text); max-width: 52ch; margin: 0 auto;
  text-align: center;
}
.nave-body strong { color: var(--gold-lume); font-weight: 600; }

/* ---------- 12. RELIQUARY ---------- */
.reliquary { background: var(--ink-night); position: relative; }
.reliquary-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1.2rem; margin-bottom: clamp(2.4rem,6vh,4rem); }
.reliquary-head h2 { font-size: var(--step-3); color: var(--vellum); }
.reliquary-grid {
  display: grid; gap: clamp(1.2rem, 3vw, 2.2rem);
  grid-template-columns: 1fr;
}
@media (min-width: 820px) { .reliquary-grid { grid-template-columns: repeat(3, 1fr); } }
.relic-card {
  position: relative; border: 1px solid rgba(201,162,75,0.22);
  background:
    linear-gradient(180deg, rgba(28,22,17,0.4), rgba(10,7,5,0.78)),
    url("../assets/reliquary.webp");
  background-size: 300% 100%, 300% 100%;
  padding: clamp(1.6rem, 3vw, 2.6rem); overflow: hidden;
  transform-style: preserve-3d; will-change: transform;
  transition: transform .5s var(--ease-settle), border-color .5s, box-shadow .5s;
  min-height: 420px; display: flex; flex-direction: column; justify-content: flex-end;
}
.relic-card:nth-child(1) { background-position: 0% 30%, 0% 30%; }
.relic-card:nth-child(2) { background-position: 50% 30%, 50% 30%; }
.relic-card:nth-child(3) { background-position: 100% 30%, 100% 30%; }
.relic-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 60% at 50% 0%, rgba(39,224,200,0.0), transparent 60%);
  transition: background .5s; pointer-events: none;
}
.relic-card:hover {
  border-color: rgba(39,224,200,0.5);
  box-shadow: 0 18px 50px rgba(0,0,0,0.6), 0 0 30px rgba(39,224,200,0.12);
}
.relic-card:hover::before { background: radial-gradient(120% 60% at 50% 0%, rgba(39,224,200,0.18), transparent 60%); }
.relic-arch {
  position: absolute; top: clamp(1.2rem,2.6vw,2rem); left: clamp(1.2rem,2.6vw,2rem); right: clamp(1.2rem,2.6vw,2rem);
  height: 90px; pointer-events: none;
}
.relic-arch svg { width: 100%; height: 100%; overflow: visible; }
.relic-arch .arch-gold { stroke: var(--gold-leaf); fill: none; stroke-width: 1.3; opacity:.7; }
.relic-arch .arch-vein { stroke: var(--teal-sigil); fill: none; stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1;
  filter: drop-shadow(0 0 4px var(--teal-sigil)); transition: stroke-dashoffset .8s var(--ease-reveal); }
.relic-card:hover .relic-arch .arch-vein { stroke-dashoffset: 0; }
.relic-index { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .2em; color: var(--gold-tarnish); margin-bottom: 1rem; }
.relic-title { font-family: var(--f-editorial); font-size: var(--step-2); font-weight: 600; color: var(--gold-lume); line-height: 1.08; margin-bottom: .9rem; }
.relic-body { font-size: var(--step-0); line-height: 1.55; color: var(--ash-text); margin-bottom: 1.4rem; }
.relic-stat {
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .12em; color: var(--teal-sigil);
  border-top: 1px solid rgba(201,162,75,0.18); padding-top: .9rem;
}

/* ---------- 13. SCRIPTORIUM ---------- */
.scriptorium { position: relative; background: var(--stone-umber); overflow: hidden; }
.scriptorium-bg {
  position: absolute; inset: 0; z-index: 0; opacity: .16;
  background: url("../assets/scriptorium.webp") center/cover no-repeat;
  mix-blend-mode: screen;
}
.scriptorium .wrap { position: relative; z-index: 2; }
.scriptorium-head { margin-bottom: clamp(2.6rem,7vh,4.5rem); max-width: 30ch; }
.scriptorium-head h2 { font-size: var(--step-3); color: var(--vellum); margin-top: 1rem; }
.scriptorium-grid { display: grid; gap: clamp(2rem,6vw,5rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 940px) { .scriptorium-grid { grid-template-columns: minmax(0,1fr) minmax(0,1.05fr); } }
.dropcap-col { position: relative; }
.dropcap {
  font-family: var(--f-crest); font-weight: 700;
  font-size: clamp(8rem, 22vw, 18rem); line-height: .8; color: var(--gold-leaf);
  position: relative; display: inline-block; cursor: default;
  text-shadow: 0 6px 30px rgba(0,0,0,0.5);
  transition: color .4s;
}
.dropcap .dc-ghost {
  position: absolute; inset: 0; color: var(--teal-sigil); opacity: 0;
  transform: translate(3px,-2px); mix-blend-mode: screen; pointer-events: none;
}
.dropcap:hover { color: var(--gold-molten); }
.dropcap:hover .dc-ghost { opacity: .55; animation: dcGlitch .4s steps(3); }
@keyframes dcGlitch { 0%{transform:translate(4px,-3px);} 50%{transform:translate(-4px,2px);} 100%{transform:translate(2px,-1px);} }
.scriptorium-intro { font-family: var(--f-editorial); font-size: var(--step-1); font-style: italic; color: var(--parchment); margin-top: 1.4rem; max-width: 36ch; }

.liturgy { position: relative; }
.liturgy-vine {
  position: absolute; left: 14px; top: 0; bottom: 0; width: 30px; pointer-events: none;
}
.liturgy-vine svg { width: 100%; height: 100%; overflow: visible; }
.liturgy-vine .vine-gold { stroke: var(--gold-tarnish); fill: none; stroke-width: 1.4; opacity: .5; }
.liturgy-vine .vine-teal {
  stroke: var(--teal-sigil); fill: none; stroke-width: 1.6;
  filter: drop-shadow(0 0 3px var(--teal-sigil));
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.liturgy-step { position: relative; padding-left: 64px; padding-block: clamp(1.2rem,3vh,2rem); }
.liturgy-step .step-numeral {
  position: absolute; left: 0; top: clamp(1.2rem,3vh,2rem);
  font-family: var(--f-display); font-size: 1.5rem; color: var(--gold-leaf);
  width: 36px; text-align: center;
}
.liturgy-step .step-sigil {
  position: absolute; left: 6px; top: calc(clamp(1.2rem,3vh,2rem) + 2.4rem);
  width: 24px; height: 24px; opacity: .3; transition: opacity .5s;
}
.liturgy-step .step-sigil svg { width:100%; height:100%; }
.liturgy-step .step-sigil path, .liturgy-step .step-sigil circle { stroke: var(--teal-sigil); fill: none; stroke-width: 1.4; }
.liturgy-step.lit .step-sigil { opacity: 1; filter: drop-shadow(0 0 6px var(--teal-sigil)); }
.liturgy-step h3 { font-family: var(--f-display); font-size: var(--step-1); color: var(--gold-lume); margin-bottom: .4rem; }
.liturgy-step p { font-size: var(--step-0); color: var(--ash-text); max-width: 44ch; }
.scriptorium-pq {
  margin-top: clamp(2.6rem,6vh,4rem);
  font-family: var(--f-editorial); font-style: italic; font-weight: 500;
  font-size: var(--step-2); line-height: 1.3; color: var(--parchment); max-width: 30ch;
}
.scriptorium-pq .pq-first { color: var(--teal-sigil); font-style: normal; font-family: var(--f-crest); }

/* ---------- 14. CHAPTER HOUSE ---------- */
.chapter { background: var(--ink-nave); position: relative; overflow: hidden; }
.chapter-head { margin-bottom: clamp(2.4rem,6vh,4rem); }
.chapter-head h2 { font-size: var(--step-3); color: var(--vellum); margin: 1rem 0 .8rem; }
.chapter-head .ch-sub { font-family: var(--f-editorial); font-style: italic; color: var(--ash-text); font-size: var(--step-1); }
.chapter-layout { display: grid; gap: clamp(2rem,5vw,4rem); grid-template-columns: 1fr; }
@media (min-width: 960px) { .chapter-layout { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); } }
.portrait-row { display: grid; gap: clamp(1rem,2.5vw,1.8rem); grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .portrait-row { grid-template-columns: 1fr; } }
.portrait {
  position: relative; border: 1px solid rgba(201,162,75,0.3);
  padding: 0; overflow: hidden; background: var(--ink-void);
}
.portrait .pf-img {
  aspect-ratio: 3/4; background-image: url("../assets/chapter-house.webp");
  background-size: 320% 100%; filter: sepia(.4) brightness(.85) contrast(1.05);
  transition: filter .6s, transform .8s var(--ease-settle);
}
.portrait:nth-child(1) .pf-img { background-position: 8% center; }
.portrait:nth-child(2) .pf-img { background-position: 50% center; }
.portrait:nth-child(3) .pf-img { background-position: 92% center; }
.portrait:hover .pf-img { filter: sepia(.1) brightness(1) contrast(1.05); transform: scale(1.04); }
.portrait .pf-frame {
  position: absolute; inset: 0; border: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(201,162,75,0.35);
  transition: box-shadow .5s;
}
.portrait:hover .pf-frame { box-shadow: inset 0 0 0 2px var(--teal-sigil), inset 0 0 24px rgba(39,224,200,0.18); }
.portrait .pf-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1rem; background: linear-gradient(transparent, rgba(10,7,5,0.92));
}
.portrait .pf-title { font-family: var(--f-editorial); font-size: var(--step-0); color: var(--parchment); line-height: 1.2; margin-bottom: .35rem; }
.portrait .pf-cred { font-family: var(--f-mono); font-size: .58rem; letter-spacing: .12em; color: var(--teal-sigil); }
.chapter-aside { align-self: center; }
.chapter-quote { font-family: var(--f-editorial); font-style: italic; font-size: var(--step-2); line-height: 1.3; color: var(--gold-lume); }
.chapter-quote-attr { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .14em; color: var(--ash-mute); margin-top: 1.2rem; }
.credential-ticker {
  margin-top: clamp(2.6rem,6vh,4rem); border-block: 1px solid rgba(201,162,75,0.16);
  padding-block: .9rem; overflow: hidden; white-space: nowrap;
}
.credential-ticker .ticker-track {
  display: inline-block; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .28em;
  color: var(--gold-tarnish); animation: tickerScroll 32s linear infinite; padding-left: 100%;
}
.no-motion .credential-ticker .ticker-track { animation: none; padding-left: 0; }
@keyframes tickerScroll { to { transform: translateX(-100%); } }

/* ---------- 15. GATE ---------- */
.gate { position: relative; min-height: 100svh; display: flex; align-items: center; overflow: hidden; }
.gate-bg {
  position: absolute; inset: 0; z-index: 0;
  background: url("../assets/gate.webp") center 30%/cover no-repeat;
}
.gate-bg::after { content:""; position:absolute; inset:0; background: linear-gradient(90deg, rgba(10,7,5,0.92) 0%, rgba(10,7,5,0.55) 50%, rgba(10,7,5,0.85) 100%); }
.gate .wrap { position: relative; z-index: 2; }
.gate-head h2 { font-size: var(--step-3); color: var(--vellum); margin: 1rem 0 2.4rem; max-width: 18ch; }
.gate-criteria { display: grid; gap: 1.6rem; margin-bottom: clamp(2.4rem,6vh,4rem); max-width: 62ch; }
.gate-crit { display: flex; gap: 1.4rem; align-items: flex-start; }
.gate-crit .gc-num { font-family: var(--f-mono); font-size: 1.1rem; color: var(--gold-leaf); min-width: 2.4ch; }
.gate-crit p { font-family: var(--f-editorial); font-size: var(--step-1); color: var(--parchment); line-height: 1.4; }
.gate-stats { display: flex; flex-wrap: wrap; gap: clamp(2rem,6vw,4rem); margin-bottom: 2.4rem; }
.gate-stat .gs-num { font-family: var(--f-mono); font-size: clamp(2.2rem,6vw,3.6rem); color: var(--teal-sigil); line-height: 1; }
.gate-stat .gs-label { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .18em; color: var(--ash-mute); margin-top: .5rem; }

/* ---------- 16. ALTAR ---------- */
.altar { position: relative; background: var(--oxblood-deep); overflow: hidden; }
.altar-bg {
  position: absolute; inset: 0; z-index: 0;
  background: url("../assets/altar.webp") center/cover no-repeat; opacity: .5;
}
.altar-bg::after { content:""; position:absolute; inset:0; background: radial-gradient(80% 70% at 50% 30%, transparent, rgba(10,7,5,0.85)); }
.altar .wrap { position: relative; z-index: 2; max-width: 760px; }
.altar-head { text-align: center; margin-bottom: clamp(2.4rem,6vh,3.6rem); }
.altar-head h2 { font-size: var(--step-3); color: var(--vellum); margin: 1rem 0 1.2rem; }
.altar-head p { font-family: var(--f-editorial); font-size: var(--step-1); color: var(--parchment); max-width: 52ch; margin-inline: auto; }
.petition { display: grid; gap: 1.6rem; }
.petition .field { display: flex; flex-direction: column; gap: .5rem; }
.petition .field-row { display: grid; gap: 1.6rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .petition .field-row { grid-template-columns: 1fr 1fr; } }
.petition label { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ash-text); }
.petition input, .petition textarea, .petition select {
  background: rgba(10,7,5,0.55); border: 1px solid rgba(201,162,75,0.28);
  padding: .85rem 1rem; color: var(--vellum); border-radius: 2px;
  font-family: var(--f-editorial); font-size: var(--step-0);
  transition: border-color .35s, box-shadow .35s;
}
.petition input::placeholder, .petition textarea::placeholder { color: var(--ash-mute); }
.petition input:focus, .petition textarea:focus, .petition select:focus {
  outline: none; border-color: var(--teal-sigil); box-shadow: 0 0 0 1px var(--teal-deep), 0 0 18px rgba(39,224,200,0.12);
}
.petition textarea { resize: vertical; min-height: 110px; }
.petition .seal-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; margin-top: 1rem; }
.seal-btn {
  position: relative; width: 150px; height: 150px; display: grid; place-items: center;
  transition: transform .18s var(--ease-settle);
}
.seal-btn svg { width: 100%; height: 100%; overflow: visible; }
.seal-img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%;
  filter: drop-shadow(0 10px 26px rgba(0,0,0,.6)); transition: filter .4s ease, transform .3s ease; }
.seal-btn:hover .seal-img { filter: drop-shadow(0 6px 22px rgba(39,224,200,.45)) brightness(1.06) saturate(1.08); }
.seal-btn.fired .seal-img { filter: drop-shadow(0 0 30px var(--teal-bloom)) brightness(1.16); }
.altar-success .succ-seal .seal-img { filter: drop-shadow(0 0 26px rgba(39,224,200,.5)); }
.seal-btn .seal-wax { fill: url(#waxGrad); stroke: var(--oxblood); stroke-width: 2; }
.seal-btn .seal-mono { fill: var(--gold-lume); font-family: var(--f-crest); font-weight: 700; }
.seal-btn .seal-ring { fill: none; stroke: var(--teal-sigil); stroke-width: 1; opacity: 0; transition: opacity .4s; }
.seal-btn:hover .seal-ring { opacity: .85; }
.seal-btn .seal-motto { fill: var(--gold-tarnish); font-family: var(--f-mono); font-size: 9px; letter-spacing: 2px; }
.seal-btn.pressed { transform: scale(.9); }
.seal-btn.fired .seal-mono { fill: var(--teal-bloom); }
.seal-label { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-leaf); }
.altar-reassure { text-align: center; font-family: var(--f-mono); font-size: .64rem; letter-spacing: .14em; color: var(--ash-mute); margin-top: 1.6rem; }
.altar-success { text-align: center; display: none; padding: clamp(2rem,5vh,4rem) 0; }
.altar-success.show { display: block; animation: fadeUp .9s var(--ease-reveal); }
.altar-success h3 { font-family: var(--f-display); font-size: var(--step-2); color: var(--gold-lume); margin-bottom: 1rem; }
.altar-success p { font-family: var(--f-editorial); font-size: var(--step-1); color: var(--parchment); max-width: 44ch; margin-inline: auto; }
.altar-success .succ-seal { width: 90px; margin: 0 auto 1.6rem; }
@keyframes fadeUp { from { opacity:0; transform: translateY(24px);} to {opacity:1; transform:none;} }
.petition.hide { display: none; }

/* ---------- 17. FOOTER / CRYPT ---------- */
.crypt { background: var(--ink-void); position: relative; padding-block: clamp(4rem,9vh,7rem); border-top: 1px solid rgba(201,162,75,0.12); }
.crypt .wrap { display: grid; gap: clamp(2.2rem,5vh,3.6rem); }
.crypt-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 2rem; }
.crypt-motto { font-family: var(--f-crest); font-size: var(--step-3); color: var(--gold-leaf); line-height: 1; }
.crypt-gloss { font-family: var(--f-editorial); font-style: italic; color: var(--ash-text); font-size: var(--step-1); margin-top: .6rem; }
.crypt-crest { width: 86px; height: 86px; position: relative; }
.crypt-crest svg { width: 100%; height: 100%; }
.crypt-crest .crest-vein { stroke: var(--teal-sigil); opacity: 0; transition: opacity .4s; }
.crypt-crest:hover .crest-vein { opacity: 1; }
.crypt-links { display: flex; flex-wrap: wrap; gap: 1.6rem; }
.crypt-links a { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ash-text); transition: color .3s; }
.crypt-links a:hover { color: var(--gold-lume); }
.crypt-langs { display: flex; flex-wrap: wrap; gap: .3rem; }
.crypt-lang { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ash-mute); padding: .3rem .55rem; border-bottom: 2px solid transparent; transition: color .3s, border-color .3s; }
.crypt-lang:hover { color: var(--gold-lume); }
.crypt-lang[aria-current="true"] { color: var(--teal-sigil); border-color: var(--error-glitch); }
.crypt-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; border-top: 1px solid rgba(201,162,75,0.1); padding-top: 1.6rem; }
.crypt-hint { font-family: var(--f-mono); font-size: .62rem; letter-spacing: .1em; color: var(--ash-mute); opacity: .6; }
.crypt-colophon { font-family: var(--f-mono); font-size: .62rem; letter-spacing: .12em; color: var(--ash-mute); }

/* ---------- 18. EASTER-EGG OVERLAY ---------- */
#easter-overlay {
  position: fixed; inset: 0; z-index: 9500; display: none;
  background: var(--ink-void);
  overflow: hidden;
}
#easter-overlay.active { display: block; }
#easter-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
#easter-overlay .palimpsest-bg {
  position: absolute; inset: 0; z-index: 1;
  background: url("../assets/palimpsest.webp") center/cover no-repeat;
  opacity: .45; mix-blend-mode: screen;
}
.easter-content { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem,8vw,6rem); pointer-events: none; }
.easter-reveal-line { font-family: var(--f-crest); font-size: var(--step-3); color: var(--teal-bloom); text-shadow: 0 0 24px rgba(39,224,200,0.5); margin-bottom: 1.6rem; max-width: 18ch; }
.forge-log { font-family: var(--f-mono); font-size: .82rem; line-height: 1.7; color: var(--teal-sigil); max-width: 60ch; height: 230px; overflow: hidden; position: relative; mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.forge-log .log-head { color: var(--gold-leaf); letter-spacing: .3em; margin-bottom: .8rem; }
.forge-log .log-track { display: flex; flex-direction: column; gap: .15rem; }
.easter-promo { font-family: var(--f-mono); font-size: .82rem; color: var(--gold-lume); margin-top: 2rem; }
.easter-restore { font-family: var(--f-mono); font-size: .76rem; color: var(--ash-text); margin-top: 1rem; }
.easter-restore .blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 19. GOLD-LEAF CURTAIN TRANSITION ---------- */
#curtain {
  position: fixed; inset: 0; z-index: 9700; pointer-events: none;
  background: linear-gradient(180deg, var(--oxblood-deep), var(--ink-void) 70%, var(--oxblood));
  transform: scaleY(0); transform-origin: top; display: none;
}
#curtain.active { display: block; }
#curtain::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, transparent, var(--teal-sigil), var(--gold-molten), var(--teal-sigil), transparent);
  filter: blur(1px);
}

/* ---------- 20. AUDIO TOGGLE ---------- */
.audio-toggle {
  position: fixed; bottom: calc(var(--frame-inset) + 14px); right: calc(var(--frame-inset) + 14px);
  z-index: 6500; display: flex; align-items: center; gap: .5rem;
  font-family: var(--f-mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ash-mute); border: 1px solid rgba(201,162,75,0.2); padding: .42rem .7rem;
  border-radius: 2px; background: rgba(10,7,5,0.5); backdrop-filter: blur(4px);
  transition: color .3s, border-color .3s;
}
.audio-toggle:hover { color: var(--gold-lume); border-color: var(--gold-tarnish); }
.audio-toggle .ico { width: 8px; height: 8px; border-radius: 50%; background: var(--ash-mute); transition: background .3s; }
.audio-toggle.on .ico { background: var(--teal-sigil); box-shadow: 0 0 8px var(--teal-sigil); }

/* reduced-motion notice */
.rm-notice {
  position: fixed; bottom: calc(var(--frame-inset) + 14px); left: 50%; transform: translateX(-50%);
  z-index: 6500; font-family: var(--f-mono); font-size: .6rem; letter-spacing: .12em;
  color: var(--ash-mute); background: rgba(10,7,5,0.7); padding: .4rem .8rem; border: 1px solid rgba(201,162,75,0.16);
  opacity: 0; transition: opacity .5s; pointer-events: none;
}
.rm-notice.show { opacity: 1; }

/* ---------- 21. 404 ---------- */
.err-page { min-height: 100svh; display: grid; place-items: center; position: relative; overflow: hidden; background: var(--ink-void); text-align: center; }
.err-bg { position: absolute; inset: 0; z-index: 0; background: url("../assets/404.webp") center/cover no-repeat; opacity: .55; }
.err-bg::after { content:""; position:absolute; inset:0; background: radial-gradient(70% 70% at 50% 45%, transparent, rgba(10,7,5,0.9)); }
.err-inner { position: relative; z-index: 3; padding: var(--gutter); max-width: 640px; }
.err-404 { font-family: var(--f-mono); font-size: clamp(4rem,18vw,9rem); color: var(--error-glitch); line-height: 1; position: relative; margin-bottom: 1rem; opacity: .85; }
.err-404 .e-ghost { position: absolute; inset: 0; color: var(--teal-sigil); mix-blend-mode: screen; }
.err-heading { font-family: var(--f-crest); font-size: var(--step-3); color: var(--gold-lume); margin-bottom: 1.2rem; }
.err-code { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .1em; color: var(--teal-sigil); margin-bottom: 1.6rem; }
.err-body { font-family: var(--f-editorial); font-size: var(--step-1); color: var(--parchment); margin-bottom: 2.2rem; }

/* ---------- 22. UTILITY / A11Y ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 11000; background: var(--gold-leaf); color: var(--ink-void); padding: .6rem 1rem; font-family: var(--f-mono); font-size: .8rem; }
.skip-link:focus { left: 12px; top: 12px; }
:focus-visible { outline: 2px solid var(--teal-sigil); outline-offset: 3px; }

/* ---------- 23. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  #fx-grain, #fx-scanlines { display: none; }
  .scroll-cue .cue-line { animation: none; }
}
.no-motion #fx-grain, .no-motion #fx-scanlines { display: none; }
.no-motion .nave-bg { transform: none !important; }

/* ---------- 24. RESPONSIVE TUNING ---------- */
@media (max-width: 640px) {
  :root { --frame-inset: 14px; }
  .hero { padding-top: 6rem; flex-direction: column; min-height: auto; }
  .hero-meta {
    position: static; width: 100%; margin-top: 2.4rem;
    flex-direction: column; align-items: flex-start; gap: 1.1rem;
    padding-inline: var(--gutter);
  }
  .hero-meta .meta-stats { gap: .8rem 1.2rem; }
  .hero-ticker { display: none; }
  .nave-line { font-size: var(--step-3); }
  .audio-toggle { bottom: calc(var(--frame-inset) + 6px); }
}
@media (min-width: 641px) and (max-width: 1023px) {
  .hero-meta .hero-ticker { display: none; }
}

/* ---------- AMBIENT GLITCH (nous-style random) ---------- */
.is-glitch {
  position: relative;
  text-shadow: 1.5px 0 var(--error-glitch), -1.5px 0 var(--teal-sigil), 0 0 8px rgba(39,224,200,.25);
  transform: translateX(var(--glx, 0));
  will-change: transform;
}
.glitch-sweep {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0;
  mix-blend-mode: screen;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(39,224,200,0.06) 2px 3px),
    linear-gradient(90deg, transparent, rgba(255,59,107,0.04), transparent);
}
.glitch-sweep.run { animation: gsweep .46s steps(3) forwards; }
@keyframes gsweep {
  0%   { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateX(0); }
  18%  { opacity: .8; clip-path: inset(0 0 64% 0); transform: translateX(3px); }
  48%  { opacity: .5; clip-path: inset(36% 0 30% 0); transform: translateX(-4px); }
  74%  { opacity: .7; clip-path: inset(66% 0 6% 0); transform: translateX(2px); }
  100% { opacity: 0; clip-path: inset(100% 0 0 0); transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) { .glitch-sweep { display: none; } .is-glitch { text-shadow: none; transform: none; } }
