@font-face { font-family: "Inter V"; src: url("fonts/InterVariable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Data Mono"; src: url("fonts/AdwaitaMono-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --ground: #04060f;
  --ink: #eef6ff;
  --soft: #a9b6d2;
  --faint: #8a97b8;
  --rule: rgb(190 214 255 / .17);
  --ice: #8fe9ff;
  --edge: clamp(20px, 3.4vw, 56px);
  --glass: rgb(4 6 15 / .86);   /* text frames and footer */
  --frame-x: min(28px, calc(var(--edge) - 6px));
  --frame-y: 24px;
  --col: calc((100vw - 2 * var(--edge)) / 12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--ground); color-scheme: dark; scroll-behavior: smooth; overflow-x: clip; }
body { font: 400 16px/1.62 "Inter V", system-ui, sans-serif; color: var(--soft); -webkit-font-smoothing: antialiased; overflow-x: clip; }
canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100lvh; display: block; z-index: 0; }

a { color: var(--ink); text-underline-offset: .4em; text-decoration-thickness: 1px; }
a:focus-visible { outline: 1px solid var(--ice); outline-offset: 6px; }
.skip { position: fixed; top: -80px; left: var(--edge); z-index: 9; background: var(--ground); padding: 8px 12px; }
.skip:focus { top: 12px; }

/* ---- header: a word, a rule, five links ---- */
.top { position: fixed; z-index: 3; top: 0; left: var(--edge); right: var(--edge); display: grid; grid-template-columns: repeat(12, 1fr); align-items: center; height: 68px; border-bottom: 1px solid var(--rule); }
.top::before { content: ""; position: absolute; z-index: -1; top: 0; bottom: -44px; left: calc(-1 * var(--edge)); right: calc(-1 * var(--edge)); background: linear-gradient(rgb(4 6 15 / .93), rgb(4 6 15 / .84) 58%, rgb(4 6 15 / 0)); pointer-events: none; }
.mark { grid-column: 1 / 5; color: var(--ink); font-weight: 560; font-size: 14px; letter-spacing: .26em; text-transform: uppercase; white-space: nowrap; }
.top nav { grid-column: 7 / 13; display: flex; justify-content: space-between; }
.top nav a { font-size: 14px; color: var(--soft); text-decoration: none; padding: 12px 0; position: relative; transition: color .2s; }
.top nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -13px; height: 1px; background: var(--ice); opacity: 0; transition: opacity .25s; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="true"] { color: var(--ink); }
.top nav a[aria-current="true"]::after { opacity: 1; }

/* ---- sections: tall; the text scrolls with the page, the molecule a little slower behind it ---- */
main { position: relative; z-index: 2; }
.chapter { height: 175vh; }
.chapter--end { height: 100vh; height: 100svh; }
.pane { position: relative; height: 100vh; height: 100svh; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: 100%; padding: 96px var(--edge) 56px; }
.block { grid-row: 1; position: relative; align-self: center; width: 100%; }
/* a flat dark frame behind the words: square, with no hover or shadow, so it never reads as a control */
.block::before { content: ""; position: absolute; z-index: -1; inset: calc(-1 * var(--frame-y)) calc(-1 * var(--frame-x)); border-top: 1px solid var(--rule); background: var(--glass); pointer-events: none; }
/* the hero has no frame, only a soft shade under the words */
.chapter--hero .block::before { inset: -18% -24%; border: 0; background: radial-gradient(closest-side, rgb(4 6 15 / .74), rgb(4 6 15 / .46) 55%, rgb(4 6 15 / 0)); }

/* each chapter sits somewhere else on the grid */
.chapter--hero .block { grid-column: 1 / 7; align-self: end; }
.chapter--read .block { grid-column: 9 / 13; align-self: end; margin-bottom: 6vh; }
.chapter--edit .block { grid-column: 2 / 6; align-self: start; margin-top: 7vh; }
.chapter--mutate .block { grid-column: 7 / 11; align-self: center; margin-top: 10vh; }
.chapter--evolve .block { grid-column: 1 / 6; align-self: center; margin-top: -6vh; }
.chapter--ethics .block { grid-column: 2 / 8; }

h1, h2 { color: var(--ink); font-weight: 330; text-wrap: balance; font-feature-settings: "ss01", "cv11"; }
h1 { font-size: clamp(2.9rem, 6.3vw, 7.4rem); line-height: .98; letter-spacing: -.045em; margin: 20px 0 32px; max-width: 8.6em; }
h2 { font-size: clamp(2.1rem, 3.5vw, 4.1rem); line-height: 1.04; letter-spacing: -.035em; margin: 20px 0 24px; }
.finale { font-size: clamp(2.8rem, min(6vw, 11vh), 7rem); line-height: .99; letter-spacing: -.045em; max-width: 8em; }
.block > p { max-width: 31em; }
.lead { font-size: clamp(1rem, 1.15vw, 1.2rem); }
.meta { font: 400 13px/1 "Data Mono", ui-monospace, monospace; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; display: flex; gap: 16px; align-items: center; }
.meta span { color: var(--ice); }
.meta span::after { content: ""; display: inline-block; width: 40px; height: 1px; background: var(--rule); margin-left: 16px; vertical-align: .32em; }
.aside { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--faint); }
.go { margin-top: 48px; }
.go a { display: inline-block; padding: 10px 0; font-size: 15px; }

dl { max-width: 40em; }
dl > div { display: grid; grid-template-columns: 11.5em 1fr; gap: 24px; padding: 18px 0; border-top: 1px solid var(--rule); }
dt { color: var(--ink); line-height: 1.4; }
dd { font-size: 15px; }

/* the last box: closing line, replay and the fiction note together */
footer { grid-row: 1; grid-column: 1 / 13; align-self: end; position: relative; text-align: center; border-top: 1px solid var(--rule); padding-top: 22px; font-size: 14px; color: var(--soft); }
footer::before { content: ""; position: absolute; z-index: -1; inset: 0 -24px -56px; background: var(--glass); pointer-events: none; }
footer .finale { margin: 0 auto; max-width: none; font-size: clamp(2.5rem, min(5.2vw, 9.5vh), 6rem); }
footer .go { margin-top: 12px; }
.legal { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }

/* headline letters: the real glyph keeps its width while a base letter stands in */
.word { display: inline-block; white-space: nowrap; }
.ch { position: relative; display: inline-block; }
.ch[data-g] { color: transparent; }
.ch[data-g]::after { content: attr(data-g); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--ice); font: .62em "Data Mono", ui-monospace, monospace; letter-spacing: 0; }

/* ---- instrument layer: information only, never a control ---- */
.hud { position: fixed; inset: 0; z-index: 1; pointer-events: none; font: 400 12px/1.5 "Data Mono", ui-monospace, monospace; letter-spacing: .04em; user-select: none; }
.hud__lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud__lines path { fill: none; stroke: rgb(190 214 255 / .4); stroke-width: 1; }
.hud__lines circle { fill: var(--ice); }
.hud__lines [data-on], .pin { opacity: 0; transition: opacity .25s; }
.hud__lines [data-on="yes"], .pin[data-on="yes"] { opacity: 1; }
.pin { position: absolute; left: 0; top: 0; white-space: nowrap; color: var(--soft); text-shadow: 0 0 12px var(--ground), 0 0 5px var(--ground), 0 0 2px var(--ground); }
.pin span { display: block; width: fit-content; background: rgb(4 6 15 / .62); padding: 0 4px; }
.pin[data-side="left"] span { margin-left: auto; }
.pin span:first-child { color: var(--ink); text-transform: uppercase; }
.pin[data-side="left"] { text-align: right; }
.reticle { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .3s; }
.reticle[data-on="yes"] { opacity: 1; }
.reticle i { position: absolute; width: 34px; height: 34px; margin: -17px; border: 1px solid rgb(190 232 255 / .34); border-radius: 50%; }
.reticle i::before, .reticle i::after { content: ""; position: absolute; left: 50%; top: 50%; background: rgb(190 232 255 / .55); transform: translate(-50%, -50%); }
.reticle i::before { width: 48px; height: 1px; -webkit-mask: linear-gradient(90deg, #000 12px, transparent 12px calc(100% - 12px), #000 calc(100% - 12px)); mask: linear-gradient(90deg, #000 12px, transparent 12px calc(100% - 12px), #000 calc(100% - 12px)); }
.reticle i::after { width: 1px; height: 48px; -webkit-mask: linear-gradient(#000 12px, transparent 12px calc(100% - 12px), #000 calc(100% - 12px)); mask: linear-gradient(#000 12px, transparent 12px calc(100% - 12px), #000 calc(100% - 12px)); }
.reticle__read { position: absolute; left: 32px; top: -9px; white-space: nowrap; color: var(--soft); text-shadow: 0 0 6px var(--ground), 0 0 2px var(--ground); }
.counter { position: absolute; right: var(--edge); bottom: 20px; color: var(--faint); transition: opacity .25s; }
/* the last box covers the counter's corner */
[data-end] .counter { opacity: 0; }
.counter__now { color: var(--ink); }

@media (pointer: coarse) { .reticle { display: none; } }

@media (max-width: 760px), (orientation: portrait) {
  :root { --frame-y: 18px; }
  .top { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; padding-top: 14px; }
  .top::before { bottom: -30px; background: linear-gradient(rgb(4 6 15 / .94), rgb(4 6 15 / .9) 74%, rgb(4 6 15 / 0)); }
  .mark, .top nav { grid-column: 1; }
  .top nav a { padding: 12px 0; }
  .top nav a::after { bottom: -1px; }
  .pane { padding-bottom: 52px; }
  .chapter .block { grid-column: 1 / 13; align-self: end; margin: 0; }
  .meta, .aside { color: var(--soft); }
  .chapter--hero .block::before { inset: -84px -24px -60px; background: linear-gradient(rgb(4 6 15 / 0), rgb(4 6 15 / .78) 84px, rgb(4 6 15 / .86)); }
  h1 { font-size: clamp(2.6rem, 13vw, 5rem); margin: 14px 0 18px; }
  h2 { font-size: clamp(2rem, 9vw, 3.6rem); margin: 14px 0 16px; }
  footer .finale { font-size: clamp(2.1rem, 9.5vw, 4rem); }
  .go { margin-top: 24px; }
  dl > div { grid-template-columns: 1fr; gap: 4px; padding: 11px 0; }
  dd { font-size: 14px; line-height: 1.5; }
  .chapter--ethics h2 { font-size: clamp(1.7rem, 7.5vw, 3rem); }
  .pin { display: none; }
  .hud__lines { display: none; }
  .counter { bottom: 14px; }
}

[data-nogl] canvas, [data-nogl] .reticle, [data-nogl] .pin, [data-nogl] .hud__lines { display: none; }
/* a fixed layer of its own: a fixed background on the body is repainted on every scroll step */
[data-nogl] body::before { content: ""; position: fixed; z-index: -1; inset: 0; background: radial-gradient(120% 90% at 78% 32%, #0d1a3c, var(--ground) 62%); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
