:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-optical-sizing: auto;
  background: #111214;
  color: #f6f3ee;
  --background: #111214;
  --text: #f6f3ee;
  --subtle: #c0bfbc;
  --muted: #aaa9a5;
  --accent: #ff7465;
  --rule: #323234;
  --edge: max(3.2rem, calc((100vw - 88rem) / 2));
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
p, h1, h2, h3, ul, ol, dl, dd { margin: 0; }
::selection { background: var(--accent); color: #111214; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.skip-link {
  position: fixed; z-index: 10; top: 1rem; left: 1rem; padding: .7rem 1rem;
  background: var(--text); color: var(--background); transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }
.masthead {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-inline: var(--edge); padding-block: 1.35rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted); font-size: .82rem;
}
.wordmark {
  display: inline-flex; gap: .75rem; align-items: center;
  color: var(--text); font: 600 .73rem/1.5 var(--mono); letter-spacing: .085em;
}
.wordmark span { width: .62rem; height: .62rem; background: var(--accent); border-radius: 2px; }
.story {
  display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr);
  align-items: start; margin-inline: var(--edge);
}
.chapters { grid-column: 1; grid-row: 1; min-width: 0; }
.chapter {
  min-height: 89svh; display: flex; flex-direction: column; justify-content: center;
  align-items: flex-start; padding: 4rem clamp(1.25rem, 4.2vw, 4.5rem) 4rem 0;
  border-bottom: 1px solid var(--rule); gap: 1rem;
}
.chapter:last-child { border-bottom: 0; }
.intro { min-height: calc(100svh - 4rem); }
.eyebrow {
  color: var(--accent); font-size: .77rem; font-weight: 720;
  letter-spacing: .1em; line-height: 1.55; text-transform: uppercase;
}
h1, h2 { text-wrap: balance; overflow-wrap: normal; }
h1 {
  font-size: clamp(4.1rem, 8.8vw, 8.05rem);
  line-height: .84; font-weight: 750; letter-spacing: -.087em;
  margin: .35rem 0 .3rem;
}
.hero-period { color: var(--accent); }
h2 { font-size: clamp(2.25rem, 4.3vw, 4.7rem); line-height: .99; letter-spacing: -.052em; font-weight: 730; }
h3 { font-weight: 680; color: var(--text); font-size: 1rem; line-height: 1.36; }
.chapter p:not(.eyebrow) { max-width: 41ch; color: var(--subtle); line-height: 1.58; }
.chapter .intro-line:not(.eyebrow) {
  color: var(--text); max-width: 28ch; font-size: clamp(1.23rem, 2vw, 1.65rem);
  font-weight: 620; line-height: 1.26; letter-spacing: -.024em;
}
.lede { font-size: clamp(1rem, 1.5vw, 1.15rem); }
.chapter p.scroll-hint {
  display: flex; align-items: center; gap: .6rem;
  color: var(--muted); font-size: .8rem; margin-top: .85rem;
}
.scroll-hint span { color: var(--accent); font-size: 1.25rem; }
.metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%; gap: .75rem; border-block: 1px solid var(--rule); padding-block: 1rem;
}
.metrics dt { font-size: clamp(1.35rem, 3vw, 2.5rem); font-weight: 690; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.metrics dd { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.chapter p.stack:not(.eyebrow) { font-size: .83rem; color: var(--muted); max-width: 51ch; }
.history, .qualifications { padding: 0; list-style: none; width: 100%; max-width: 37rem; }
.history li, .qualifications li { padding: .75rem 0; border-top: 1px solid var(--rule); }
.history li { display: grid; grid-template-columns: 6.15rem 1fr; gap: .8rem; }
.history time { color: var(--muted); font: .72rem/1.8 var(--mono); white-space: nowrap; }
.chapter li p { margin-top: .3rem; font-size: .9rem; }
.contact { gap: .65rem; }
.mail-link { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: .2em; overflow-wrap: anywhere; }
.download {
  background: var(--accent); color: #151112; text-decoration: none;
  padding: .85rem 1.05rem; font-weight: 710; border-radius: .45rem;
  margin-top: 1rem; display: inline-flex; align-items: center; gap: .7rem;
}
.download:hover { background: #ff9a8e; }
.download:active { transform: scale(.98); }

.stage {
  grid-column: 2; grid-row: 1; position: sticky; top: 0; isolation: isolate;
  height: calc(100svh - 3.9rem); overflow: hidden; margin-block: 0;
  background: radial-gradient(ellipse at 54% 43%, #303033 0%, #202123 37%, #131416 73%);
  border-left: 1px solid var(--rule);
}
.stage-grid {
  position: absolute; inset: 5.1% 5%;
  border: 1px solid #353537;
  background-image: linear-gradient(#ffffff07 1px, transparent 1px), linear-gradient(90deg, #ffffff07 1px, transparent 1px);
  background-size: 42px 42px; mask-image: radial-gradient(ellipse at center, #000, #0009 65%, transparent);
}
.stage-grid::before, .stage-grid::after {
  position: absolute; content: ""; background: #ffffff19;
}
.stage-grid::before { left: 50%; height: 100%; width: 1px; }
.stage-grid::after { top: 50%; height: 1px; width: 100%; }
.rack-scene, .stage-poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.rack-scene { visibility: hidden; pointer-events: none; }
.rack-scene canvas { display: block; width: 100%; height: 100%; }
.stage-poster { object-fit: contain; }
.stage.is-rendered .rack-scene { visibility: visible; }
.stage.is-rendered .stage-poster { visibility: hidden; }
.stage-label {
  position: absolute; left: 5%; right: 5%; bottom: 5%;
  color: var(--subtle); display: flex; align-items: center; gap: .65rem;
  font: .72rem/1.3 var(--mono); letter-spacing: .035em;
}
.stage-count { color: var(--accent); font-variant-numeric: tabular-nums; }
.stage-progress { position: absolute; bottom: 3.6%; left: 5%; right: 5%; height: 1px; background: #555458; }
.stage-progress span { width: 100%; height: 100%; display: block; background: var(--accent); transform: scaleX(.018); transform-origin: left center; }

@media (min-width: 70rem) {
  .intro { position: relative; z-index: 1; }
}
@media (max-width: 58rem) {
  :root { --edge: 1.5rem; }
  .chapter { padding-right: 1.45rem; }
  .history li { grid-template-columns: 5rem 1fr; gap: .45rem; }
}
@media (max-width: 44rem) {
  :root { --edge: 1.2rem; }
  .masthead { padding-block: .75rem; }
  .story { display: flex; flex-direction: column; margin-inline: 0; }
  .stage {
    z-index: 2; width: 100%; height: clamp(12rem, 39svh, 23rem);
    border-inline: 0; border-bottom: 1px solid var(--rule); margin: 0;
  }
  .stage-grid { inset: 7% 5%; background-size: 28px 28px; }
  .stage-label { font-size: .64rem; }
  .chapters { width: 100%; padding-inline: var(--edge); }
  .chapter { padding: 2.5rem 0; min-height: 61svh; gap: .7rem; scroll-margin-top: 42svh; }
  .intro { padding-top: 1.65rem; min-height: calc(61svh - 2.8rem); }
  h1 { font-size: clamp(3.4rem, 13vw, 5.2rem); letter-spacing: -.077em; line-height: .9; }
  .hero-break { display: none; }
  .chapter p.scroll-hint { margin-top: .25rem; }
  .history li { padding-block: .65rem; }
  .contact { min-height: 59svh; }
}
@media (prefers-reduced-motion: reduce) {
  .stage { position: relative; top: auto; }
  .chapter { min-height: auto; padding-block: 3.25rem; }
  .intro { min-height: min(84svh, 46rem); }
  .stage-progress, .stage-count, .scroll-hint { display: none !important; }
  .download:active { transform: none; }
}
