/* Home page only: the scroll-driven 3D stage. Shared components live in site.css. */
body.is-home { background-attachment: fixed; }
#stage { position: fixed; inset: 0; width: 100%; height: 100lvh; z-index: 1; display: block; opacity: 0; transition: opacity 0.5s ease; }
.ready #stage { opacity: 1; }
.no-webgl #stage, .no-webgl .rail, .no-webgl .kwords { display: none; }

/* single-page share build: inner routes hide the 3D stage */
body.is-inner #stage, body.is-inner .kwords, body.is-inner .rail { display: none; }

/* huge words that sweep across as you scroll */
.kwords { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.kwords span {
  position: absolute; left: 0; top: 52%; white-space: nowrap; opacity: 0; will-change: transform, opacity;
  font: 800 23vw/1 var(--display); letter-spacing: -0.05em;
  background: linear-gradient(180deg, rgba(160, 175, 255, 0.13), rgba(160, 175, 255, 0.02));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* scroll progress: one dot per chapter */
.rail { position: fixed; right: clamp(14px, 2.2vw, 30px); top: 50%; transform: translateY(-50%); z-index: 3; display: grid; gap: 14px; }
.rail i { display: block; width: 7px; height: 7px; border-radius: 50%; background: rgba(160, 175, 255, 0.28); transition: transform 0.35s, background 0.35s, box-shadow 0.35s; }
.rail i.done { background: rgba(52, 229, 194, 0.55); }
.rail i.on { background: var(--mint); transform: scale(1.7); box-shadow: 0 0 12px rgba(52, 229, 194, 0.7); }

/* chapters */
body.is-home main { position: relative; z-index: 3; }
.chapter { min-height: 100svh; display: flex; align-items: center; padding: 110px var(--gutter) 80px; }
.copy { max-width: min(34rem, 50vw); }
.chapter h1, .chapter h2 { margin: 0 0 18px; }
.chapter h1 { font-size: clamp(2.6rem, 7vw, 6rem); line-height: 1; }
.chapter h2 { font-size: clamp(1.8rem, 3.6vw, 2.9rem); line-height: 1.08; }
.copy p { color: var(--mute); }
.chapter .lede { font-size: 1.15rem; color: var(--soft); }
.fact { font: 500 0.8rem/1.5 var(--mono); color: var(--mint) !important; letter-spacing: 0.02em; margin-top: 20px !important; }
.wd { display: inline-block; will-change: transform, opacity; }
.chapter.center { justify-content: center; text-align: center; }
.chapter.center .copy { max-width: 46rem; }
.chapter.center .actions { justify-content: center; }
.chapter.center h2 { font-size: clamp(2.4rem, 6.4vw, 5.6rem); line-height: 1; }
.chapter.right { justify-content: flex-end; }
.chapter.right .copy { max-width: min(30rem, 44vw); }

/* everything after the 3D story is ordinary, opaque content */
/* transparent so the ambient background shows through; a soft fade at the top joins it to the 3D scene above */
.after { position: relative; z-index: 4; background: linear-gradient(180deg, rgba(7, 10, 26, 0) 0, rgba(7, 10, 26, 0.35) 220px); border-top: 0; }

/* phone-sized layout: the 3D scene sits in the upper part, the copy sits in a card below it */
@media (max-width: 859px) {
  .rail { display: none; }
  .kwords { display: none; }
  .chapter { align-items: flex-end; padding: 96px var(--gutter) 28px; }
  .chapter.center, .chapter.right { justify-content: flex-start; text-align: left; }
  .chapter.center .actions { justify-content: flex-start; }
  .chapter.center .copy, .chapter.right .copy { max-width: none; }
  .chapter .copy {
    max-width: none; width: 100%;
    background: rgba(9, 13, 34, 0.8);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid var(--line); border-radius: 22px; padding: 22px 20px 18px;
  }
  .chapter h1 { font-size: clamp(1.75rem, 8vw, 2.3rem); }
  .chapter h2, .chapter.center h2 { font-size: clamp(1.5rem, 6.6vw, 1.9rem); }
  .chapter .lede { font-size: 1.02rem; }
  .chapter .actions { margin-top: 18px; }
  .chapter .btn { padding: 13px 18px; }
}
@media (max-height: 640px) and (max-width: 859px) { .chapter { padding-top: 84px; } }

/* no WebGL: still a good page */
.no-webgl .chapter { min-height: 0; padding-block: 80px; }
.no-webgl .copy { max-width: 40rem; }
