/* ============================================================
   THE ATLAS — Motion round: "Living Lobby, Still Library"
   All animation isolated here. Additive; degrades to the static build.
   Autonomous motion is gated to (prefers-reduced-motion: no-preference) and
   paused offscreen / on hidden tab by JS. Reading-flow motion is scroll-powered:
   nothing moves over body text unless the reader scrolls.
   ============================================================ */

/* ---------- 1 · Ambient mesh drift — home hero only ---------- */
.hero-mesh{
  position:absolute; inset:-20%; z-index:1; pointer-events:none; opacity:0;
  transition:opacity 1.6s var(--ease-rise);
  background:
    radial-gradient(38% 38% at 28% 32%, rgba(240,213,154,.05), transparent 70%),
    radial-gradient(42% 42% at 74% 38%, rgba(63,167,137,.04), transparent 72%),
    radial-gradient(46% 46% at 52% 78%, rgba(86,76,160,.035), transparent 72%);
}
@media (prefers-reduced-motion: no-preference){
  .hero-mesh{ opacity:1; will-change:transform;
    animation:meshDrift var(--dur-ambient) var(--ease-ambient) infinite; }
  .hero-mesh.is-paused{ animation-play-state:paused; }
}
@keyframes meshDrift{
  0%  { transform:translate3d(0,0,0) scale(1); }
  33% { transform:translate3d(2.5%,-2%,0) scale(1.06); }
  66% { transform:translate3d(-2%,2.5%,0) scale(1.04); }
  100%{ transform:translate3d(0,0,0) scale(1); }
}

/* ---------- 2 · Animated grain — faint filmic shimmer ---------- */
@media (prefers-reduced-motion: no-preference){
  .grain{ animation:grainShift 6s steps(8) infinite; }
}
@keyframes grainShift{
  0%   { background-position:0 0; }      12.5%{ background-position:-40px 20px; }
  25%  { background-position:30px -30px;} 37.5%{ background-position:-20px 40px; }
  50%  { background-position:40px 10px; } 62.5%{ background-position:-30px -20px; }
  75%  { background-position:20px 30px; } 87.5%{ background-position:-40px -10px; }
  100% { background-position:0 0; }
}

/* ---------- 3 · Reading-progress filament — scroll-powered ---------- */
.read-progress{
  position:fixed; left:0; top:var(--header-h); bottom:0; width:2px; z-index:45;
  display:none; pointer-events:none;
}
body.has-reading .read-progress{ display:block; }
.read-progress i{
  display:block; width:100%; height:100%; transform-origin:top; transform:scaleY(0);
  background:linear-gradient(180deg, var(--gold-100), var(--read-thread), var(--teal));
  box-shadow:0 0 10px var(--gold-glow);
}
@supports (animation-timeline: scroll()){
  body.has-reading .read-progress i{
    animation:filaFill linear both; animation-timeline:scroll(root block);
  }
}
@keyframes filaFill{ from{ transform:scaleY(0); } to{ transform:scaleY(1); } }
@media (prefers-reduced-motion: reduce){ .read-progress{ display:none !important; } }

/* ---------- 4 · Pullquote lighting — scroll-powered ---------- */
.body-rich blockquote, .pullquote{
  transition:box-shadow .8s var(--ease-rise), border-color .8s var(--ease-rise),
             text-shadow .8s var(--ease-rise);
}
.body-rich blockquote.lit{
  border-left-color:var(--gold); box-shadow:-2px 0 24px -10px var(--gold-glow);
}
.pullquote.lit{ text-shadow:0 0 48px var(--gold-glow); }

/* ---------- 5 · Card -> detail morph (View Transitions) ---------- */
@media (prefers-reduced-motion: no-preference){
  @supports (view-transition-name: x){
    .voice-detail .v-hero, .rev-detail .rev-hero{ view-transition-name:morph-hero; }
    ::view-transition-group(morph-hero){
      animation-duration:.42s; animation-timing-function:var(--ease-rise);
    }
  }
}

/* ============================================================
   Borrowed-technique round (adapted calm) — 2026-06-12
   6) hero headline word-reveal  7) cinematic opening  8) recurrence spine
   ============================================================ */

/* ---------- 6 · Hero headline word reveal (load-in) ---------- */
@media (prefers-reduced-motion: no-preference){
  .hero-title.hero-reveal .word{
    display:inline-block; opacity:0; transform:translateY(.42em);
    animation:heroWordIn 1s var(--ease-rise) both;
    animation-delay:calc(var(--i) * 110ms + 200ms);
  }
  .hero-title.hero-reveal .l2.word{ display:block; } /* keep the line break */
}
@keyframes heroWordIn{ to{ opacity:1; transform:none; } }

/* ---------- 7 · Cinematic opening — portal bloom on first scroll ---------- */
.home-hero{ --bloom:0; }
@media (prefers-reduced-motion: no-preference){
  /* a soft light ring expanding from the portal as the descent begins */
  .hero-bloom{
    position:absolute; left:50%; top:42%; width:40vmin; height:40vmin; z-index:1;
    margin:-20vmin 0 0 -20vmin; border-radius:50%; pointer-events:none;
    background:radial-gradient(circle, rgba(240,213,154,.10), transparent 62%);
    transform:scale(calc(1 + var(--bloom) * 2.4));
    opacity:calc(var(--bloom) * (1 - var(--bloom)) * 3.2);
  }
  /* eight family motes drift outward from the centre and dissolve */
  .hero-motes{ position:absolute; left:50%; top:42%; z-index:1; pointer-events:none; }
  .hero-motes i{
    position:absolute; left:0; top:0; width:7px; height:7px; margin:-3.5px; border-radius:50%;
    background:var(--c); box-shadow:0 0 12px var(--c);
    transform:rotate(var(--a)) translateX(calc(var(--bloom) * 32vmin));
    opacity:calc(var(--bloom) * (1 - var(--bloom)) * 2.6);
  }
}
@media (prefers-reduced-motion: reduce){ .hero-bloom, .hero-motes{ display:none; } }

/* ---------- 8 · Recurrence sticky spine (scroll storytelling) ---------- */
.rec-spine{
  position:sticky; top:calc(var(--header-h) + 6px); z-index:15;
  display:flex; align-items:baseline; gap:14px; margin:0 0 var(--space-6);
  padding:10px 16px; border-radius:var(--r-pill);
  background:rgba(8,8,10,.7); border:1px solid var(--ink-700);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  opacity:0; transition:opacity .5s var(--ease-rise); pointer-events:none;
}
.rec-spine.ready{ opacity:1; }
.rec-spine .rs-yr{ font-family:var(--font-mono); font-size:11px; letter-spacing:.16em;
  text-transform:uppercase; color:var(--gold); flex-shrink:0; }
.rec-spine .rs-meta{ font-family:var(--font-display); font-size:1rem; color:var(--parchment);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rec-spine .rs-prog{ margin-left:auto; font-family:var(--font-mono); font-size:10.5px;
  letter-spacing:.14em; color:var(--parchment-3); flex-shrink:0; }
.rec-spine .rs-yr, .rec-spine .rs-meta{ transition:opacity .3s var(--ease-rise); }
.rec-spine.swap .rs-yr, .rec-spine.swap .rs-meta{ opacity:0; }
@media (max-width:680px){ .rec-spine .rs-meta{ font-size:.9rem; } }

/* ============================================================
   CINEMATIC ATLAS — three-act scroll-scrubbed opening  (2026-06-13)
   DEFAULT = today's calm hero (acts II/III + ring hidden). The pinned
   sequence is added ONLY by .cinema-on (set in JS on desktop + fine
   pointer + motion allowed). Mobile/reduced-motion never pin.
   ============================================================ */
.cinema-stage{ --seq:0; --a1:1; --ring:0; --a2:0; --a3:0; }
.act-2, .act-3, .act-rings{ display:none; }   /* non-cinematic: hidden */

/* the .view entrance animation leaves a transform+filter that breaks the sticky
   stage — neutralise it on the cinema host so position:sticky engages. */
.home-view.cinema-host{ animation:none; }
/* body{overflow-x:hidden} makes body a scroll container (overflow-y→auto), which
   breaks the sticky stage. clip contains overflow without creating a scroller. */
body.has-cinema{ overflow-x:clip; }
/* 200vh = ~1 screen of scroll through the whole 3-act sequence (was 300vh, which
   needed too many scrolls). */
.cinema-on{ position:relative; height:200vh; }
.cinema-on .cinema-stage{
  position:sticky; top:0; height:100vh; min-height:0;
  display:block; padding:0; overflow:hidden;
}
.cinema-on .hero-bg{ will-change:transform; }   /* keep the portal scale on the compositor */
/* every act fills the pinned stage; content constrained to the content column */
.cinema-on .act{
  position:absolute; inset:0; left:0; right:0;
  display:flex; flex-direction:column; justify-content:center;
  max-width:var(--content-max); margin:0 auto; padding:0 clamp(20px,4vw,56px);
}
/* Act I — the hero (left-aligned, as today) */
.cinema-on .act-1{
  align-items:flex-start; z-index:3;
  opacity:var(--a1); transform:translateY(calc((1 - var(--a1)) * -52px));
}
/* Acts II + III — centred captions */
.cinema-on .act-2, .cinema-on .act-3{
  display:flex; align-items:center; text-align:center; z-index:4; gap:24px;
}
.cinema-on .act-2{ opacity:var(--a2); transform:translateY(calc((1 - var(--a2)) * 26px)); pointer-events:none; }
.cinema-on .act-3{ opacity:var(--a3); transform:translateY(calc((1 - var(--a3)) * 26px)); pointer-events:none; }
.cinema-on .act-3 .act-begin{ pointer-events:auto; }
.act-line{ font-family:var(--font-display); font-weight:360; letter-spacing:-.012em;
  font-size:clamp(2.2rem,6vw,5rem); line-height:1.04; color:var(--parchment);
  text-wrap:balance; text-shadow:0 0 60px rgba(8,8,10,.6); }

/* Act II — the eight Revelations assemble into a ring from the portal centre */
.cinema-on .act-rings{
  display:block; position:absolute; left:50%; top:46%; z-index:2; pointer-events:none;
  opacity:var(--ring);
}
.cinema-on .rev-node{
  position:absolute; left:0; top:0;
  transform:rotate(var(--a)) translateX(calc(var(--ring) * 33vmin)) rotate(calc(var(--a) * -1));
}
.cinema-on .rev-node .rn-dot{
  display:block; width:9px; height:9px; margin:-4.5px; border-radius:50%;
  background:var(--gold-100); box-shadow:0 0 14px var(--gold-glow);
}
.cinema-on .rev-node .rn-label{
  position:absolute; left:50%; top:15px; transform:translateX(-50%); white-space:nowrap;
  font-family:var(--font-mono); font-size:10px; letter-spacing:.12em; text-transform:uppercase;
  color:var(--parchment-2); opacity:calc((var(--ring) - .55) * 2.2); /* fade in late */
}
/* scroll cue fades the instant the descent begins */
.cinema-on .hero-scroll{ opacity:calc(1 - var(--seq) * 6); }

/* ---- Tradition detail: the provenance/timeline line (shown whole, no 80-char cut) ---- */
.trad-era{ margin-top:var(--space-4); max-width:62ch; font-size:.95rem; line-height:1.55; color:var(--parchment-3); }
.trad-era em{ font-style:italic; color:var(--parchment-2); }

/* ============================================================
   NAVIGATION — slim header + the Explore index overlay (2026-06-13)
   ============================================================ */
/* "Explore" trigger — always visible (it opens the full grouped index) */
.nav-explore{ display:inline-flex; align-items:center; gap:10px; cursor:pointer;
  background:none; border:1px solid var(--ink-700); border-radius:var(--r-pill);
  padding:9px 16px 9px 13px; color:var(--parchment-2);
  font-family:var(--font-mono); font-size:11px; letter-spacing:.16em; text-transform:uppercase;
  transition:color .35s var(--ease-rise), border-color .35s var(--ease-rise); }
.nav-explore:hover{ color:var(--gold); border-color:var(--gold-600); }
.nav-explore .ne-icon{ display:flex; flex-direction:column; justify-content:center; gap:4px; width:16px; }
.nav-explore .ne-icon span{ display:block; height:1.5px; width:16px; background:currentColor;
  transition:transform .4s var(--ease-rise), opacity .3s; }
.nav-explore[aria-expanded="true"] .ne-icon span:nth-child(1){ transform:translateY(5.5px) rotate(45deg); }
.nav-explore[aria-expanded="true"] .ne-icon span:nth-child(2){ opacity:0; }
.nav-explore[aria-expanded="true"] .ne-icon span:nth-child(3){ transform:translateY(-5.5px) rotate(-45deg); }
@media (max-width:560px){ .nav-explore .ne-label{ display:none; } .nav-explore{ padding:10px; } }

/* the 4 inline primary links collapse on mobile — the index overlay covers all */
@media (max-width:860px){ .primary-nav{ display:none; } }

/* ---- the Explore index overlay ---- */
body.menu-open{ overflow:hidden; }
.index-menu{ position:fixed; inset:0; z-index:80; display:grid; place-items:start center;
  opacity:0; pointer-events:none; transition:opacity .45s var(--ease-rise); }
.index-menu.open{ opacity:1; pointer-events:auto; }
.index-scrim{ position:absolute; inset:0; background:rgba(8,8,10,.97);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }
.index-inner{ position:relative; z-index:1; width:100%; max-width:var(--content-max);
  padding:clamp(22px,5vh,64px) clamp(20px,5vw,56px) clamp(40px,8vh,90px);
  max-height:100dvh; overflow-y:auto; }
.index-top{ display:flex; align-items:center; justify-content:space-between;
  margin-bottom:clamp(28px,6vh,60px); }
.index-eyebrow{ font-family:var(--font-mono); font-size:11px; letter-spacing:.26em;
  text-transform:uppercase; color:var(--gold); }
.index-close{ background:none; border:1px solid var(--ink-700); color:var(--parchment-2);
  width:44px; height:44px; border-radius:50%; font-size:24px; line-height:1; cursor:pointer;
  display:grid; place-items:center; transition:color .3s, border-color .3s; }
.index-close:hover{ color:var(--gold); border-color:var(--gold-600); }
.index-groups{ display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:clamp(26px,4vh,48px) clamp(28px,4vw,52px); }
.index-group .ig-label{ font-family:var(--font-mono); font-size:10.5px; letter-spacing:.22em;
  text-transform:uppercase; color:var(--parchment-3); margin-bottom:var(--space-4);
  padding-bottom:10px; border-bottom:1px solid var(--ink-700); }
.index-group a{ display:block; text-decoration:none; color:var(--parchment);
  font-family:var(--font-display); font-size:clamp(1.3rem,2.2vw,1.6rem); line-height:1.22;
  letter-spacing:-.01em; padding:6px 0;
  transition:color .3s var(--ease-rise), transform .3s var(--ease-rise); }
.index-group a:hover{ color:var(--gold); transform:translateX(6px); }
.index-group a.active{ color:var(--gold); }
/* groups rise in, gently staggered */
@media (prefers-reduced-motion: no-preference){
  .index-menu .index-group, .index-menu .index-top{ opacity:0; transform:translateY(16px);
    transition:opacity .5s var(--ease-rise), transform .5s var(--ease-rise); }
  .index-menu.open .index-top{ opacity:1; transform:none; }
  .index-menu.open .index-group{ opacity:1; transform:none; }
  .index-menu.open .index-group:nth-child(1){ transition-delay:.04s; }
  .index-menu.open .index-group:nth-child(2){ transition-delay:.10s; }
  .index-menu.open .index-group:nth-child(3){ transition-delay:.16s; }
  .index-menu.open .index-group:nth-child(4){ transition-delay:.22s; }
  .index-menu.open .index-group:nth-child(5){ transition-delay:.28s; }
}

/* ---- The Lineage — the flagship view, marked special wherever it links ---- */
.lineage-flag{ color:var(--gold); }
.lineage-flag::before{ content:"\2726"; margin-right:.5em; font-size:.82em; vertical-align:.04em;
  color:var(--gold-100); }
/* header: gilded, glowing, with a golden underline instead of the hairline */
.primary-nav a.lineage-flag{ color:var(--gold); text-shadow:0 0 14px var(--gold-glow); }
.primary-nav a.lineage-flag::after{ background:var(--gold); opacity:.7; }
.primary-nav a.lineage-flag:hover{ color:var(--gold-100); }
/* index overlay: the one gold entry among the cream — the centrepiece */
.index-group a.lineage-flag{ color:var(--gold); text-shadow:0 0 22px var(--gold-glow); }
.index-group a.lineage-flag:hover{ color:var(--gold-100); transform:translateX(6px); }
/* the star breathes, very slowly — a quiet signal this one is alive */
@media (prefers-reduced-motion: no-preference){
  .lineage-flag::before{ display:inline-block; animation:lineageStar 4.5s var(--ease-ambient) infinite; }
}
@keyframes lineageStar{ 0%,100%{ opacity:.55; transform:scale(.92) rotate(0deg); }
  50%{ opacity:1; transform:scale(1.08) rotate(45deg); } }
