* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--color-parchment);
  color: var(--color-ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-ink);
  color: var(--color-canvas);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: fixed;
  z-index: 10;
  inset: 0 0 auto;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 5vw;
  background: rgba(245, 245, 247, .88);
  border-bottom: 1px solid rgba(29, 29, 31, .1);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
}

.brand { justify-self: start; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }

.study,
.eyebrow,
.progress-shell {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .15em;
}

.study { color: var(--color-muted); }

.autoplay,
.primary-action {
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-canvas);
  cursor: pointer;
}

.autoplay {
  justify-self: end;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 118px;
  justify-content: center;
  padding: 10px 16px;
  font-size: 13px;
}

.play-mark { font-size: 9px; }

.autoplay:hover,
.primary-action:hover { background: var(--color-primary-focus); }

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 5px;
}

#stage {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

#stage canvas { display: block; width: 100%; height: 100%; }

.chapter {
  position: relative;
  z-index: 2;
  min-height: 125svh;
  display: flex;
  align-items: flex-start;
  padding: 25svh 8vw 12svh;
  pointer-events: none;
}

.chapter-right { justify-content: flex-end; }

.copy { width: min(560px, 46vw); }

.eyebrow { margin: 0; color: var(--color-primary); }

h1,
h2 {
  margin: 24px 0 0;
  font-size: clamp(48px, 6.2vw, 98px);
  font-weight: 650;
  line-height: 1.045;
  letter-spacing: -.065em;
}

.lead {
  margin: 30px 0 0;
  color: var(--color-muted);
  font-family: var(--font-text);
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.65;
  letter-spacing: -.02em;
}

.scroll-cue,
.back-link,
.primary-action {
  pointer-events: auto;
  display: inline-block;
  margin-top: 34px;
  font-size: 14px;
}

.scroll-cue,
.back-link { color: var(--color-primary); }

.scroll-cue span { display: inline-block; margin-left: 5px; }

.ghost-word {
  position: absolute;
  z-index: -1;
  left: 5vw;
  bottom: 9svh;
  margin: 0;
  color: rgba(29, 29, 31, .055);
  font-size: clamp(100px, 22vw, 360px);
  font-weight: 700;
  line-height: .8;
  letter-spacing: -.08em;
}

.chapter-number {
  position: absolute;
  z-index: -1;
  right: 6vw;
  bottom: 9svh;
  margin: 0;
  color: rgba(29, 29, 31, .045);
  font-size: clamp(140px, 24vw, 390px);
  font-weight: 700;
  line-height: .72;
  letter-spacing: -.09em;
}

.chapter-right .chapter-number { right: auto; left: 5vw; }

.chapter-end {
  min-height: 100svh;
  justify-content: center;
  text-align: center;
  padding-top: 26svh;
}

.chapter-end .copy { width: min(820px, 88vw); }

.chapter-end h2 { font-size: clamp(52px, 8vw, 112px); }

.primary-action { padding: 13px 22px; }

.back-link { display: block; margin-inline: auto; width: max-content; }

.progress-shell {
  position: fixed;
  z-index: 10;
  inset: auto 0 0;
  height: 58px;
  display: grid;
  grid-template-columns: 100px 1fr 42px;
  gap: 22px;
  align-items: center;
  padding: 0 5vw;
  background: rgba(245, 245, 247, .88);
  color: var(--color-muted);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
}

.progress-track { height: 2px; overflow: hidden; background: var(--color-hairline); }

.progress-track i { display: block; width: 0; height: 100%; background: var(--color-primary); }

#percent { text-align: right; }

.fallback {
  position: fixed;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(390px, 84vw);
  text-align: center;
  transform: translate(-50%, -50%);
  color: var(--color-muted);
  font: 14px/1.5 var(--font-text);
}

.fallback-orbit { position: relative; width: 220px; height: 220px; margin: 0 auto 24px; }

.fallback-orbit i {
  position: absolute;
  inset: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

.fallback-orbit i:nth-child(1) { transform: translate(-90px, -20px); }
.fallback-orbit i:nth-child(2) { transform: translate(55px, -70px); }
.fallback-orbit i:nth-child(3) { transform: translate(18px, 64px); }

.noscript {
  position: fixed;
  z-index: 30;
  inset: 80px 20px auto;
  padding: 16px;
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  text-align: center;
}

@media (max-width: 760px) {
  .site-header { height: 64px; grid-template-columns: 1fr auto; padding: 0 6vw; }
  .study { display: none; }
  .autoplay { min-width: 105px; padding: 9px 13px; }
  .chapter,
  .chapter-right { min-height: 120svh; justify-content: flex-start; padding: 15svh 7vw 10svh; }
  .copy { width: min(94%, 440px); }
  h1,
  h2 { font-size: clamp(46px, 14vw, 66px); }
  .lead { max-width: 330px; }
  .chapter:nth-of-type(even) { padding-top: 72svh; }
  .chapter-end { min-height: 100svh; padding-top: 25svh; }
  .chapter-end .lead { margin-inline: auto; }
  .ghost-word { bottom: 12svh; font-size: 29vw; }
  .chapter-number { bottom: 13svh; font-size: 48vw; }
  .progress-shell { height: 50px; grid-template-columns: 70px 1fr 34px; gap: 12px; padding: 0 6vw; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue span { transform: none; }
}
