/* keepup: one page in three colours (paper, ink and one cobalt) and two faces (a serif for the words, a mono
   for the evidence). The design system is Astryx, written as plain CSS: its token names, its 4px spacing,
   its radius and motion, and its Side Gallery template as the frame (a column of words held against a picture). */

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-italic-latin.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Fragment Mono";
  src: url("fonts/fragment-mono-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

/* Registered, so a scene can fade from paper to cobalt and back. */
@property --ground { syntax: "<color>"; inherits: true; initial-value: #fbf7ef; }
@property --fg { syntax: "<color>"; inherits: true; initial-value: #17150f; }
@property --pencil { syntax: "<color>"; inherits: true; initial-value: #1f3dff; }
/* The band the board keeps on a phone. Not inherited, so setting them on the wall restyles the wall alone. */
@property --cut { syntax: "<length>"; inherits: false; initial-value: 480px; }
@property --cut-b { syntax: "<length>"; inherits: false; initial-value: 0px; }

:root {
  /* The three colours. Every other tone is one of them mixed into another. */
  --paper: #fbf7ef;
  --ink: #17150f;
  --cobalt: #1f3dff;

  /* Astryx spacing: a 4px base, in rem. The steps past 12 are for a page, on the same base. */
  --spacing-1: .25rem; --spacing-1-5: .375rem; --spacing-2: .5rem; --spacing-3: .75rem; --spacing-4: 1rem;
  --spacing-5: 1.25rem; --spacing-6: 1.5rem; --spacing-7: 1.75rem; --spacing-8: 2rem; --spacing-9: 2.25rem;
  --spacing-10: 2.5rem; --spacing-12: 3rem; --spacing-16: 4rem; --spacing-24: 6rem; --spacing-32: 8rem;

  /* Astryx radius, size, border and focus, with the corners dial at sharp. */
  --radius-inner: 1px; --radius-element: 2px;
  --border-width: 1px;
  --size-element-md: 2.125rem; --size-element-lg: 3rem;
  --focus-outline-width: 2px; --focus-outline-offset: 3px;

  /* Astryx elevation, drawn in ink. */
  --shadow-low: 0 1px 1px color-mix(in srgb, var(--ink) 8%, transparent), 0 2px 8px color-mix(in srgb, var(--ink) 6%, transparent);
  --shadow-med: 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent), 0 8px 24px color-mix(in srgb, var(--ink) 9%, transparent);

  /* Astryx motion. */
  --duration-fast: 175ms; --duration-medium: 410ms; --duration-medium-max: 550ms; --duration-slow: 975ms;
  --ease-standard: cubic-bezier(.24, 1, .4, 1);

  /* Type: one serif for every word, one mono for product output and numbers. */
  --font-family-body: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-family-heading: var(--font-family-body);
  --font-family-code: "Fragment Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-display-1-size: clamp(2.75rem, 5.8vw, 5.25rem);
  --text-display-2-size: clamp(2.125rem, 4vw, 3.625rem);
  --text-display-3-size: clamp(1.625rem, 2.6vw, 2.3125rem);
  --text-figure-size: clamp(1.875rem, 2.7vw, 2.4375rem);
  --text-large-size: clamp(1.1875rem, 1.56vw, 1.40625rem);
  --text-body-size: 1.125rem;
  --text-supporting-size: .8125rem;
  --text-code-size: .75rem;
  --text-board-size: .6875rem;

  /* The page is graph paper: 48 cells across, 12 columns of 4. A cell is a whole pixel, so every line is crisp. */
  --max: 81rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --cells: 48;
  --wrap: min(100% - 2 * var(--gutter), var(--max));
  --edge: calc((100% - var(--wrap)) / 2);
  --nav: 3.75rem;

  /* Pencil marks, used as masks so the pencil takes its colour from a token. */
  --stroke-line: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 20' preserveAspectRatio='none'><path d='M4 12C60 5 110 15 170 9S290 5 330 11 380 9 396 7' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' vector-effect='non-scaling-stroke'/></svg>");
  --stroke-ring: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 80' preserveAspectRatio='none'><path d='M24 46C8 22 66 6 116 8C166 10 196 28 187 48C178 68 112 77 62 71C28 67 6 50 25 30C38 17 70 10 98 12' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' vector-effect='non-scaling-stroke'/></svg>");
  --stroke-tick: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 13C6 15 8 18 10 20C13 13 17 7 21 4' fill='none' stroke='currentColor' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
@supports (width: round(down, 10%, 1px)) {
  :root {
    --wrap: calc(var(--cells) * round(down, min(100% - 2 * var(--gutter), var(--max)) / var(--cells), 1px));
    --edge: round(down, calc((100% - var(--wrap)) / 2), 1px);
  }
}

/* ---------- the ground ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* On paper the ground is a shade under the sheets that lie on it. */
body {
  --ground: color-mix(in srgb, var(--ink) 4%, var(--paper));
  --fg: var(--ink);
  --pencil: var(--cobalt);
  position: relative; margin: 0; overflow-x: clip;
  background: var(--ground); color: var(--fg);
  font: 400 var(--text-body-size)/1.35 var(--font-family-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}

/* A cobalt scene fades one fixed sheet of cobalt in over the paper. Only the navigation and the scenes' words
   change with it. So a scene change fades layers, restyles a few dozen elements and repaints almost nothing. */
.ground {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--cobalt); opacity: 0; will-change: opacity;
  transition: opacity var(--duration-medium-max) ease;
}
body[data-ground="cobalt"] .ground { opacity: 1; }
.nav, .hold {
  --ground: color-mix(in srgb, var(--ink) 4%, var(--paper)); --fg: var(--ink); --pencil: var(--cobalt);
  color: var(--fg);
  transition: --ground var(--duration-medium-max) ease, --fg var(--duration-medium-max) ease, --pencil var(--duration-medium-max) ease;
}
body[data-ground="cobalt"] .nav, body[data-ground="cobalt"] .hold { --ground: var(--cobalt); --fg: var(--paper); --pencil: var(--paper); }

/* A sheet is pure paper with ink on it, whatever ground it lies on. The flood's rows are paper type on cobalt. */
.sheet, .strips .col { --ground: var(--paper); --fg: var(--ink); --pencil: var(--cobalt); background: var(--ground); color: var(--fg); }
.flood { --ground: var(--cobalt); --fg: var(--paper); --pencil: var(--paper); color: var(--fg); }

/* Every tone is the type mixed into its ground, worked out again wherever the ground changes. */
body, .nav, .hold, .sheet, .strips .col, .flood {
  --t88: color-mix(in srgb, var(--fg) 88%, var(--ground));
  --t74: color-mix(in srgb, var(--fg) 74%, var(--ground));
  --t66: color-mix(in srgb, var(--fg) 66%, var(--ground));
  --t50: color-mix(in srgb, var(--fg) 50%, var(--ground));
  --t34: color-mix(in srgb, var(--fg) 34%, var(--ground));
  --t20: color-mix(in srgb, var(--fg) 20%, var(--ground));
  --t12: color-mix(in srgb, var(--fg) 12%, var(--ground));
  --t7: color-mix(in srgb, var(--fg) 7%, var(--ground));
}

h1, h2, p, ol, ul { margin: 0; }
::selection { background: var(--pencil); color: var(--ground); }
:focus-visible { outline: var(--focus-outline-width) solid var(--pencil); outline-offset: var(--focus-outline-offset); border-radius: var(--radius-element); }
main:focus { outline: none; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; top: var(--spacing-2); left: var(--spacing-2); z-index: 10;
  padding: var(--spacing-2) var(--spacing-3); background: var(--paper); color: var(--ink);
  border: var(--border-width) solid var(--ink); border-radius: var(--radius-element);
  font: 400 var(--text-supporting-size)/1 var(--font-family-code); text-decoration: none;
  transform: translateY(-300%);
}
.skip:focus { transform: none; }

/* The container: 48 cells wide, on the page's grid. */
.wrap { width: var(--wrap); margin-left: var(--edge); }

/* Graph paper. Fine lines every cell, a firmer one every column. Each line is drawn twice, once in cobalt and
   once in paper: on paper only the cobalt one shows, on cobalt only the paper one (a blueprint). So the sheet
   is painted once and never again. */
.graph { position: absolute; z-index: 0; inset: 0; overflow: clip; pointer-events: none; }
.graph div { position: absolute; top: 0; bottom: 0; left: var(--edge); width: var(--wrap); container-type: inline-size; }
.graph i {
  position: absolute; top: 0; bottom: 0; left: -50cqw; right: -50cqw;
  --c1: color-mix(in srgb, var(--cobalt) 5%, transparent);
  --c4: color-mix(in srgb, var(--cobalt) 9%, transparent);
  --p1: color-mix(in srgb, var(--paper) 6%, transparent);
  --p4: color-mix(in srgb, var(--paper) 11%, transparent);
  background:
    linear-gradient(90deg, var(--c4) 1px, transparent 1px) 0 0 / calc(100cqw / var(--cells) * 4) 100%,
    linear-gradient(90deg, var(--c1) 1px, transparent 1px) 0 0 / calc(100cqw / var(--cells)) 100%,
    linear-gradient(var(--c1) 1px, transparent 1px) 0 0 / 100% calc(100cqw / var(--cells)),
    linear-gradient(90deg, var(--p4) 1px, transparent 1px) 0 0 / calc(100cqw / var(--cells) * 4) 100%,
    linear-gradient(90deg, var(--p1) 1px, transparent 1px) 0 0 / calc(100cqw / var(--cells)) 100%,
    linear-gradient(var(--p1) 1px, transparent 1px) 0 0 / 100% calc(100cqw / var(--cells));
}

/* ---------- navigation (Astryx TopNav: a start slot and an end slot) ---------- */

.nav {
  position: sticky; top: 0; z-index: 4;
  height: var(--nav); margin-bottom: calc(-1 * var(--nav));
  background: var(--ground);
  border-bottom: var(--border-width) solid var(--t12);
}
.nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.wordmark { font: 400 1.625rem/1 var(--font-family-heading); letter-spacing: -.01em; color: var(--fg); text-decoration: none; }
.wordmark i { font-style: italic; }

/* ---------- button and field (Astryx Button, primary, and TextInput) ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--size-element-lg); padding: 0 var(--spacing-6);
  background: var(--fg); color: var(--ground);
  border: 0; border-radius: 0 var(--radius-element) var(--radius-element) 0;
  font: 400 var(--text-body-size)/1 var(--font-family-body); letter-spacing: .005em;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--duration-fast) ease, transform var(--duration-fast) ease;
}
.button:hover { background: var(--pencil); }
body[data-ground="cobalt"] .button:hover { background: var(--t88); }
.button:active { transform: translateY(1px); }
.button-sm { height: var(--size-element-md); padding: 0 var(--spacing-4); border-radius: var(--radius-element); font-size: 1.0625rem; }

.signup { display: grid; grid-template-columns: minmax(0, 1fr) auto; max-width: 27rem; margin-top: var(--spacing-8); }
.signup input[type="email"] {
  min-width: 0; height: var(--size-element-lg); padding: 0 var(--spacing-4);
  font: 400 var(--text-body-size)/1 var(--font-family-body); color: var(--ink); caret-color: var(--cobalt);
  background: var(--paper);
  border: var(--border-width) solid var(--fg); border-right: 0;
  border-radius: var(--radius-element) 0 0 var(--radius-element);
}
.signup input:focus-visible { position: relative; z-index: 1; }
.signup input::placeholder { color: color-mix(in srgb, var(--ink) 58%, var(--paper)); font-style: italic; opacity: 1; }
.signup input:-webkit-autofill { -webkit-text-fill-color: var(--ink); transition: background-color 600000s 0s, color 600000s 0s; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { grid-column: 1 / -1; font: 400 var(--text-supporting-size)/1.5 var(--font-family-code); color: var(--fg); }
.status:not(:empty) { margin-top: var(--spacing-3); }
.more { display: grid; gap: var(--spacing-4); max-width: 27rem; margin-top: var(--spacing-5); }
.more label { display: grid; gap: var(--spacing-1-5); font: 400 var(--text-supporting-size)/1.4 var(--font-family-code); color: var(--t66); }
.more input {
  height: var(--size-element-lg); padding: 0 var(--spacing-4);
  font: 400 var(--text-body-size)/1 var(--font-family-body); color: var(--ink);
  background: var(--paper); border: var(--border-width) solid var(--fg); border-radius: var(--radius-element);
}
.more .button { justify-self: start; border-radius: var(--radius-element); }

/* ---------- the board: everything new in AI, as rows on running strips of paper ---------- */

.wall { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: clip; }
.wall-in { position: relative; height: 100%; width: var(--wrap); margin-left: var(--edge); container-type: inline-size; }
/* The board is two layers on the same grid, hung from the container's right edge and growing to the left.
   A strip is 11 cells wide with a cell between strips, so each one ends on a column line.
   - .strips: two strips of paper with ink rows, for the scenes on paper.
   - .flood: the same rows as bare paper type, from edge to edge, for the scenes on cobalt. Two spare strips
     stand past the container's right edge.
   A scene change only fades strips in and out: no row is ever restyled or repainted. */
.board {
  --colgap: calc(100cqw / 48);
  --colw: max(17.75rem, calc(100cqw / 48 * 11));
  position: absolute; top: 0; bottom: 0; right: 0;
  display: flex; flex-direction: row-reverse; gap: var(--colgap);
  font: 400 var(--text-board-size)/1 var(--font-family-code);
}
.flood { right: calc(-2 * (var(--colw) + var(--colgap))); }
.col {
  flex: none; width: var(--colw); height: 100%; overflow: hidden;
  opacity: 0; will-change: opacity;
  transition: opacity var(--duration-medium-max) ease;
}
.strips .col { border-inline: var(--border-width) solid var(--t12); box-shadow: var(--shadow-low); }
/* Out of sight, a flood strip stays drawn at a hundredth of its strength, so it is ready the moment the page turns. */
.flood .col { opacity: .01; }
/* Scene 1: the two paper strips. Scene 2: every bare strip. Scene 5: the two bare strips beside the words. */
.wall[data-scene="1"] .strips .col,
.wall[data-scene="2"] .flood .col,
.wall[data-scene="5"] .flood .col.first, .wall[data-scene="5"] .flood .col.second { opacity: 1; }

.run { list-style: none; margin: 0; padding: 0; will-change: transform; }
.js .run { animation: run var(--t, 100s) linear var(--d, 0s) infinite; }
@keyframes run { to { transform: translateY(-50%); } }
/* Without the script, the dozen rows in the page sit in the middle of their strips. */
html:not(.js) .col { display: flex; flex-direction: column; justify-content: center; }

.r {
  display: grid; grid-template-columns: 11ch minmax(0, 1fr) max-content; column-gap: 1.5ch; align-items: center;
  height: 1.75rem; padding-inline: var(--spacing-3);
  border-bottom: var(--border-width) solid var(--t7);
  white-space: nowrap;
}
.k { color: var(--t50); }
/* A blacked-out name: one block per word. */
.bs { display: flex; gap: 1ch; align-items: center; min-width: 0; overflow: hidden; }
.b { display: block; flex: none; height: .4375rem; width: calc(var(--w, 4) * 1ch); background: var(--t20); border-radius: var(--radius-inner); }
.v { color: var(--t34); }
/* Only a row with a number is full strength, and its number takes the pencil's colour. */
.r.num .k { color: var(--fg); }
.r.num .b { background: var(--t66); }
.v.n { color: var(--pencil); }
.arrow { display: inline-block; width: .95em; height: .5em; margin: 0 .3em; vertical-align: .08em; overflow: visible; }

/* The ledger: the fourteen rows that have a number, on one sheet (Astryx Table: rows, not cards). */
.ledger-frame { position: fixed; inset: 0; z-index: 1; pointer-events: none; display: flex; align-items: center; padding-top: var(--nav); }
.ledger-frame .wrap { flex: none; display: flex; justify-content: flex-end; container-type: inline-size; }
.ledger {
  flex: none; width: max(26rem, calc(100cqw / 48 * 20)); max-width: 100%;
  margin: 0; padding: var(--spacing-2) var(--spacing-5); list-style: none;
  border: var(--border-width) solid var(--t12); border-radius: var(--radius-element);
  box-shadow: var(--shadow-med);
  font: 400 var(--text-code-size)/1 var(--font-family-code);
  transition: opacity var(--duration-medium) ease var(--duration-fast), visibility 0s;
}
.ledger-frame:not([data-scene="3"]) .ledger { visibility: hidden; opacity: 0; transition: opacity var(--duration-fast) ease, visibility 0s var(--duration-fast); }
.ledger .r {
  height: 2.125rem; padding-inline: 0; border-bottom-color: var(--t12);
  opacity: 0; transform: translateX(calc(var(--dx) * -1rem));
  transition: transform var(--duration-slow) var(--ease-standard), opacity var(--duration-medium-max) ease;
}
.ledger .r:last-child { border-bottom: 0; }
.ledger .k { color: var(--t66); }
.ledger .b { background: var(--t20); }
.ledger .v { position: relative; font-size: var(--text-supporting-size); }
.ledger-frame[data-scene="3"] .ledger .r { opacity: 1; transform: none; transition-delay: calc(var(--i) * 40ms); }
/* Late in scene 3 the pencil goes under the six that fit, and the rest step back. */
.ledger .pick .v::after {
  content: ""; position: absolute; left: -.5ch; right: -.5ch; bottom: -.62em; height: .5em;
  background: var(--pencil);
  -webkit-mask: var(--stroke-line) center / 100% 100% no-repeat; mask: var(--stroke-line) center / 100% 100% no-repeat;
  clip-path: inset(-20% 100% -20% 0);
  transition: clip-path var(--duration-medium) var(--ease-standard);
}
.ledger-frame[data-picks] .pick .v::after { clip-path: inset(-20% 0 -20% 0); transition-delay: calc(var(--k) * 70ms); }
.ledger-frame[data-scene="3"][data-picks] .r:not(.pick) { opacity: .34; transition-delay: 0s; }

/* ---------- scenes ---------- */

main { position: relative; z-index: 2; display: block; }
.scene { position: relative; }
.hold { padding-block: calc(var(--nav) + var(--spacing-10)) var(--spacing-10); }
.hold > .wrap { flex: none; }
.s-hero .hold { min-height: 100svh; display: flex; align-items: center; }
.pinned { height: 170vh; }
.pinned .hold { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; }
.cue { position: absolute; top: 58%; left: 0; width: 1px; height: 1px; }

.kicker { font: 400 var(--text-supporting-size)/1.5 var(--font-family-code); color: var(--t66); margin-bottom: var(--spacing-6); }

.headline {
  font: 400 var(--text-display-1-size)/.98 var(--font-family-heading);
  letter-spacing: -.018em;
}
.headline .line { display: block; white-space: nowrap; }
/* The turn of the headline is set in italic and underlined in pencil. */
.turn { position: relative; width: fit-content; font-style: italic; }
.turn::after {
  content: ""; position: absolute; left: .02em; right: -.02em; bottom: -.1em; height: .16em;
  background: var(--pencil);
  -webkit-mask: var(--stroke-line) center / 100% 100% no-repeat; mask: var(--stroke-line) center / 100% 100% no-repeat;
}

.big {
  font: 400 var(--text-display-2-size)/1.03 var(--font-family-heading);
  letter-spacing: -.018em;
  max-width: 12.5em;
  text-wrap: balance;
}
.mid { font: 400 var(--text-display-3-size)/1.08 var(--font-family-heading); letter-spacing: -.012em; text-wrap: balance; }

.small {
  font-size: var(--text-large-size); line-height: 1.34; color: var(--t74);
  max-width: 27rem; margin-top: var(--spacing-6);
  text-wrap: pretty;
}

/* Scene 1: six columns of words; the two strips keep the other six. */
.s-hero .words { max-width: 50%; }
.js .s-hero .kicker, .js .s-hero .line, .js .s-hero .small, .js .s-hero .signup {
  animation: rise var(--duration-slow) var(--ease-standard) backwards;
}
.js .s-hero .line:nth-child(1) { animation-delay: 80ms; }
.js .s-hero .line:nth-child(2) { animation-delay: 160ms; }
.js .s-hero .line:nth-child(3) { animation-delay: 240ms; }
.js .s-hero .small { animation-delay: 340ms; }
.js .s-hero .signup { animation-delay: 420ms; }
.js .s-hero .turn::after { animation: draw var(--duration-slow) var(--ease-standard) 1s backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(.5rem); } }
@keyframes draw { from { clip-path: inset(-50% 100% -50% 0); } to { clip-path: inset(-50% 0 -50% 0); } }

/* Scene 2: the flood. The words keep a clear pool of ground; the rows run everywhere else. */
.s-flood .words { position: relative; max-width: 75%; }
.s-flood .big { max-width: 16em; }
.s-flood .words::before {
  content: ""; position: absolute; z-index: -1; inset: -42% -22% -42% -60%;
  /* The pool is always the colour the ground has at that moment, so it never shows as a shape of its own. */
  background: radial-gradient(closest-side, var(--ground) 70%, transparent);
  opacity: 0; transition: opacity var(--duration-medium-max) ease;
}
body[data-scene="2"] .s-flood .words::before { opacity: 1; }
.s-flood .small { color: var(--t88); }

/* Scene 3: the words at the left, the ledger at the right. */
.s-base .words { max-width: 50%; }

/* Scene 4: the brief, printed like a receipt. It flows with the page, so it can be as tall as it needs. */
.s-brief .hold { padding-block: calc(var(--nav) + var(--spacing-24)) var(--spacing-24); }
.s-brief .big { max-width: 16em; }
.s-brief .small { margin-top: var(--spacing-8); max-width: 32rem; }
.receipt { position: relative; margin-top: var(--spacing-12); }
.receipt::before, .echo::before { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: var(--shadow-med); }
.js .receipt { opacity: 0; transform: translateY(var(--spacing-5)); transition: opacity var(--duration-medium) ease, transform var(--duration-slow) var(--ease-standard); }
.js .receipt[data-shown] { opacity: 1; transform: none; }
/* The sheet's lower edge is torn along the teeth of a till roll: a row of paper triangles under it. */
.brief { --tooth: .4375rem; position: relative; padding: var(--spacing-8) var(--spacing-10) var(--spacing-6); }
.brief::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: var(--tooth);
  background: conic-gradient(from -45deg at 50% 100%, var(--paper) 90deg, transparent 0) 50% 0 / calc(var(--tooth) * 2) var(--tooth) repeat-x;
}
.term { font: 400 var(--text-supporting-size)/1.7 var(--font-family-code); color: var(--t66); text-wrap: balance; }
.prompt, .ready { color: var(--fg); }
/* index, the number, the lever, whose number (Astryx Table: a header row, then rows on hairlines) */
.heads, .row {
  display: grid; grid-template-columns: 2.25rem minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, .8fr);
  column-gap: var(--spacing-8);
}
.heads {
  margin-top: var(--spacing-8); padding-bottom: var(--spacing-2);
  border-bottom: var(--border-width) solid var(--fg);
  font: 400 var(--text-code-size)/1.5 var(--font-family-code); color: var(--t66);
}
.rows { list-style: none; padding: 0; }
.row { align-items: last baseline; padding-block: var(--spacing-4) var(--spacing-5); border-bottom: var(--border-width) solid var(--t12); }
.idx { font: 400 var(--text-code-size)/1 var(--font-family-code); color: var(--t66); }
/* The return: its lead-in on a line above, then the number, large, with the rest beside it. */
.fig {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); grid-template-rows: 1.25rem auto;
  column-gap: .75ch; align-items: baseline; min-width: 0;
  font: 400 var(--text-supporting-size)/1.4 var(--font-family-code); color: var(--t74);
}
.pre { grid-column: 1 / -1; grid-row: 1; white-space: nowrap; }
mark {
  grid-column: 1; grid-row: 2; position: relative;
  background: none; color: var(--pencil);
  font: 400 var(--text-figure-size)/1 var(--font-family-heading); letter-spacing: -.012em;
  white-space: nowrap;
}
mark .arrow { width: .6em; height: .32em; margin: 0 .2em; vertical-align: .17em; }
.post { grid-column: 2; grid-row: 2; text-wrap: pretty; }
.lever { font: 400 var(--text-large-size)/1.15 var(--font-family-heading); }
.whose { font: 400 var(--text-code-size)/1.4 var(--font-family-code); color: var(--t66); }
.term-ready { padding-top: var(--spacing-5); }
/* The biggest return is ringed in pencil. */
.receipt .row:first-child mark { margin-right: .42em; }
.receipt .row:first-child mark::after {
  content: ""; position: absolute; inset: -.2em -.42em -.3em -.4em;
  background: var(--pencil);
  -webkit-mask: var(--stroke-ring) center / 100% 100% no-repeat; mask: var(--stroke-ring) center / 100% 100% no-repeat;
}
.js .receipt .row:first-child mark::after { clip-path: inset(0 100% 0 0); transition: clip-path var(--duration-slow) var(--ease-standard) var(--duration-medium-max); }
.js .receipt[data-shown] .row:first-child mark::after { clip-path: inset(0 0 0 0); }

/* Scene 5: on cobalt again. The brief once more, smaller, its rows taking turns; two strips keep running. */
.s-again .wrap { display: flex; flex-direction: column; align-items: flex-start; gap: var(--spacing-8); }
.s-again .words { max-width: 54%; }
.s-again .small { color: var(--t88); }
.echo { position: relative; width: max(34rem, 50%); max-width: 100%; }
.echo::before { box-shadow: 0 12px 32px color-mix(in srgb, var(--ink) 28%, transparent); }
.echo:empty { display: none; }
.echo .brief { padding: var(--spacing-5) var(--spacing-6) var(--spacing-3); }
.echo .heads, .echo .whose, .echo .pre, .echo .post { display: none; }
.echo .term { font-size: var(--text-code-size); }
.echo .rows { margin-top: var(--spacing-3); border-top: var(--border-width) solid var(--fg); }
.echo .row { grid-template-columns: 1.5rem minmax(0, 12rem) minmax(0, 1fr); column-gap: var(--spacing-5); padding-block: var(--spacing-2); }
.echo .fig { grid-template-rows: auto; }
.echo mark { grid-row: 1; font-size: 1.625rem; color: var(--t50); transition: color var(--duration-fast) ease; }
.echo .lever { font-size: var(--text-body-size); color: var(--t66); transition: color var(--duration-fast) ease; }
.echo .on mark { color: var(--pencil); }
.echo .on .lever { color: var(--fg); }
.echo .term-ready { padding-top: var(--spacing-3); }

/* Scene 6: calm. Three promises on hairlines, each ticked in pencil; then the closing line and the form. */
.last { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); padding-block: var(--spacing-32) var(--spacing-24); align-items: start; }
.mid { grid-column: 1 / span 5; }
.promises { grid-column: 7 / -1; list-style: none; padding: 0; border-top: var(--border-width) solid var(--fg); }
.promises li {
  position: relative; padding: var(--spacing-4) 0 var(--spacing-4) var(--spacing-9);
  border-bottom: var(--border-width) solid var(--t12);
  font-size: var(--text-large-size); line-height: 1.25;
}
.promises li::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 1.375rem; height: 1.375rem; margin-top: -.8125rem;
  background: var(--pencil);
  -webkit-mask: var(--stroke-tick) center / 100% 100% no-repeat; mask: var(--stroke-tick) center / 100% 100% no-repeat;
}
.js .promises li::before { clip-path: inset(0 100% 0 0); transition: clip-path var(--duration-medium) var(--ease-standard); transition-delay: calc(var(--k) * 140ms + 200ms); }
.js .promises[data-shown] li::before { clip-path: inset(0 0 0 0); }
.closing {
  grid-column: 1 / -1; margin-top: var(--spacing-24);
  font: 400 var(--text-display-1-size)/1 var(--font-family-heading); letter-spacing: -.015em;
  max-width: 11.5em; text-wrap: balance;
}
.last .signup, .last .more { grid-column: 1 / span 6; }
.last .signup { margin-top: var(--spacing-10); scroll-margin-top: calc(var(--nav) + 40vh); }

.foot { position: relative; z-index: 2; padding-block: var(--spacing-7) var(--spacing-8); border-top: var(--border-width) solid var(--t12); }
.foot .wordmark { font-size: 1.3125rem; color: var(--t66); }

/* A wrong address. */
.lost { min-height: 100svh; display: flex; align-items: center; padding-block: var(--spacing-12); }
.lost .wrap { flex: none; }
.lost .home { display: inline-block; margin-top: var(--spacing-10); }

/* ---------- narrower screens ---------- */

/* Under 1400px there is room for one strip beside the words. */
@media (max-width: 1399px) {
  .wall[data-scene="1"] .strips .col.second { opacity: 0; }
  .wall[data-scene="5"] .flood .col.second { opacity: .01; }
  .s-hero .words { max-width: 62%; }
}

/* A short window: the brief's second showing keeps four rows. */
@media (max-height: 780px) and (min-width: 900px) {
  .echo .row:nth-child(n+5) { display: none; }
}

@media (max-width: 899px) {
  :root { --cells: 24; --nav: 3.5rem; --text-display-1-size: clamp(2.5rem, 12vw, 3.875rem); --text-display-2-size: clamp(1.875rem, 8.3vw, 2.5rem); }
  .s-hero .words, .s-flood .words, .s-base .words, .s-again .words { max-width: none; }
  .small { max-width: none; }

  /* One strip, the width of the container. It fills the band between the words on screen (--cut and --cut-b
     come from board.js), so it never disappears while words move, and a word never runs through a row. */
  .board, .flood { left: 0; right: 0; }
  .col { display: none; }
  .col.first { display: block; width: 100%; }
  .wall, .wall[data-scene] { clip-path: inset(calc(var(--cut) + 1.25rem) 0 var(--cut-b) 0); }
  .r { grid-template-columns: 11.5ch minmax(0, 1fr) max-content; }
  .bs { max-width: min(100%, 12ch); }

  .s-hero .hold { align-items: flex-start; padding-top: calc(var(--nav) + var(--spacing-10)); }
  .pinned .hold { align-items: flex-start; padding-top: calc(var(--nav) + var(--spacing-8)); }
  .s-flood .words::before { display: none; }

  /* The ledger hangs right under scene 3's words, eight rows (--below is the words' bottom, from board.js). */
  .ledger-frame { display: block; padding: 0; }
  .ledger-frame .wrap { position: absolute; top: calc(var(--below, 15rem) + 1.5rem); display: block; }
  .ledger { width: 100%; padding: var(--spacing-1) var(--spacing-4); }
  .ledger .r { height: 2rem; }
  .ledger .r:nth-child(2), .ledger .r:nth-child(n+10) { display: none; }
  .ledger .r:nth-child(9) { border-bottom: 0; }
  /* Scene 3: the words and the ledger under them read as one block, centred under the nav. Room is kept
     below the words for the gap, eight 2rem rows, the padding and the borders. */
  .s-base .hold {
    align-items: safe center;
    padding-top: var(--nav);
    padding-bottom: calc(1.5rem + 8 * 2rem + .5rem + 2px);
  }

  .s-brief .hold { padding-block: calc(var(--nav) + var(--spacing-16)) var(--spacing-16); }
  .receipt { margin-top: var(--spacing-8); }
  .brief { padding: var(--spacing-5) var(--spacing-4) var(--spacing-4); }
  .heads { display: none; }
  .rows { margin-top: var(--spacing-4); border-top: var(--border-width) solid var(--fg); }
  .row { grid-template-columns: 1.375rem minmax(0, 1fr); column-gap: var(--spacing-2); row-gap: var(--spacing-1-5); align-items: start; padding-block: var(--spacing-4); }
  .row > .idx { grid-column: 1; grid-row: 1; padding-top: .3rem; }
  .row > .fig, .row > .lever, .row > .whose { grid-column: 2; }
  .fig { grid-template-rows: auto auto; }
  .term { line-height: 1.6; }

  /* Scene 5 on phones: the words, the first three rows of the brief taking turns, and the strip under them. */
  .s-again .wrap { gap: var(--spacing-6); }
  .echo { width: 100%; position: relative; z-index: 1; }
  .echo .term + .term { display: none; }
  .echo .row { row-gap: 0; padding-block: var(--spacing-2) var(--spacing-3); }
  .echo .row > .idx { padding-top: .55rem; }
  .echo .row:nth-child(n+4), .echo .term-ready { display: none; }
  .echo .row:nth-child(3) { border-bottom: 0; }

  .last { display: block; padding-block: var(--spacing-24) var(--spacing-16); }
  .promises { margin-top: var(--spacing-8); }
  .closing { margin-top: var(--spacing-24); }
  .last .signup { margin-top: var(--spacing-8); }
}

/* The same pictures, still. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .run { animation: run var(--t, 100s) linear var(--d, 0s) infinite !important; animation-play-state: paused !important; }
}
