/* donediff.dev v2 (D073). One stylesheet. Colour pairs are checked by tools/contrast.py (WCAG 2.1 AA by math).
   Two materials: the page is the "said" side (flat, quiet); screens (.term, .code, .install) are the "did" side,
   always dark, and hold every retro effect. Take the effects away and the page is the one that passed review. */

@font-face {
  font-family: "VT323";
  src: url("/assets/fonts/vt323-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

/* One meaning per colour: signal = brand, links, buttons, focus; ok = Verified; warn = Stale, Unverified, flags;
   bad = Contradicted, failing score; ink = text on a filled colour block. */
:root {
  --bg: #000000;
  --surface: #101010;
  --line: #333333;
  --text: #f2f2f2;
  --muted: #ababab;
  --signal: #2fd9ff;
  --ok: #46e08a;
  --warn: #ffb224;
  --bad: #ff7b6e;
  --ink: #000000;
  --display: "VT323", "JetBrains Mono", ui-monospace, monospace;
  --sans: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --glow: 0 0 0.5em color-mix(in srgb, currentColor 55%, transparent);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --surface: #f2f2f2;
    --line: #bdbdbd;
    --text: #111111;
    --muted: #4f4f4f;
    --signal: #00647d;
    --ok: #17663a;
    --warn: #8a4700;
    --bad: #b3261e;
    --ink: #ffffff;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f2f2f2;
  --line: #bdbdbd;
  --text: #111111;
  --muted: #4f4f4f;
  --signal: #00647d;
  --ok: #17663a;
  --warn: #8a4700;
  --bad: #b3261e;
  --ink: #ffffff;
  color-scheme: light;
}

/* A screen looks the same on the white page as on the black one: it re-declares the dark column. */
.term, .code, .install {
  --bg: #000000;
  --surface: #101010;
  --line: #333333;
  --text: #f2f2f2;
  --muted: #ababab;
  --signal: #2fd9ff;
  --ok: #46e08a;
  --warn: #ffb224;
  --bad: #ff7b6e;
  --ink: #000000;
  color-scheme: dark;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 2px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--sans);
}
h1, h2, h3, h4, p, ul, dl, dd, blockquote, pre, table { margin: 0; }
h1, h2, h3, h4 { text-wrap: balance; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: 0; font-synthesis: none; }
h3 { font: 700 1.1875rem/1.3 var(--sans); }
h4 { font: 600 1rem/1.3 var(--mono); color: var(--muted); }
a { color: var(--signal); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
code, pre { font-family: var(--mono); font-size: 0.875em; }
p code, li code, td code, th code, dd code { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 0.05em 0.3em; overflow-wrap: anywhere; }

.wrap { width: min(100% - 2rem, 70rem); margin-inline: auto; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--signal); color: var(--ink); padding: 0.7rem 1rem; z-index: 5; }
.skip:focus { top: 0.5rem; }
.small { font-size: 0.9375rem; line-height: 1.5; color: var(--muted); }
.lede { font-size: 1.25rem; line-height: 1.4; font-weight: 500; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 3.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; min-height: 2.75rem; color: var(--text); text-decoration: none; }
.brand-name { font: 400 1.75rem/1 var(--display); }
.mark-said { fill: var(--text); }
.mark-did { fill: var(--signal); }
.nav { display: flex; align-items: center; gap: 0.15rem; }
.nav a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.6rem; color: var(--text); text-decoration: none; font: 500 0.9375rem/1 var(--mono); border-radius: 2px; }
.nav a:hover { background: var(--surface); }
.nav a[aria-current="page"] { background: var(--signal); color: var(--ink); }
.theme { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; background: none; border: 0; border-radius: 2px; color: var(--text); cursor: pointer; }
.theme:hover { background: var(--surface); }
.nav-short { display: none; } /* "Start" on narrow phones, "Quick start" everywhere else */

/* Links that act as buttons, and links that stand alone on their line: 44 px targets */
.button { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1.2rem; border-radius: 2px; background: var(--signal); color: var(--ink); font: 600 0.9375rem var(--mono); text-decoration: none; }
.button:hover { background: var(--text); color: var(--ink); }
.go { display: inline-flex; align-items: center; min-height: 2.75rem; }
.links { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }

/* Hero */
.hero { padding: 2.25rem 0 2.5rem; }
.hero-grid { display: grid; gap: 1.75rem; }
.hero-text { display: grid; gap: 0.9rem; align-content: start; }
.hero h1 { font-size: clamp(3rem, 11vw, 4.5rem); line-height: 0.9; text-shadow: var(--glow); }
.install { display: flex; align-items: stretch; overflow: hidden; margin-top: 0.25rem; }
/* The whole command shows, wrapped: nobody should paste a line they cannot read. */
.install code { flex: 1; min-width: 0; padding: 0.8rem 0.9rem; white-space: normal; overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.6; align-self: center; }
/* .install clips overflow, so its focus ring sits inside the box */
.install code:focus-visible { outline-offset: -3px; }
.copy { min-width: 4.5rem; min-height: 2.75rem; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--text); font: 600 0.9375rem var(--mono); cursor: pointer; }
.copy:hover { background: var(--signal); color: var(--ink); }
.copy:focus-visible { outline-offset: -3px; }
/* Hero: the two lines a newcomer needs, install and run, each with its own Copy */
.cmds { display: grid; gap: 0.35rem; }
.cmds .install { margin-top: 0; }
.cmds > * + .cmd-label { margin-top: 0.45rem; }
.cmd-label { font: 500 0.875rem/1.4 var(--mono); color: var(--muted); }
.nobr { white-space: nowrap; } /* a flag and its value never split across lines (Design check F2) */

/* The hero screen */
.term { border-radius: 6px; min-width: 0; align-self: start; overflow: hidden; }
.term-bar { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.4rem 0.9rem; background: var(--signal); color: var(--ink); font: 600 0.8125rem/1.4 var(--mono); }
.term-note { color: var(--ink); }
.term-body {
  padding: 0.9rem; display: grid; gap: 0.7rem;
  /* scanlines, painted behind the text; static */
  background-image: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(255, 255, 255, 0.035) 2px 3px);
}
.said-label { font-size: 0.875rem; color: var(--muted); }
.said { position: relative; font-size: 1.125rem; line-height: 1.4; padding-left: 1.4em; }
.said::before { content: ">"; position: absolute; left: 0; top: 0; color: var(--muted); font-family: var(--mono); }
.prompt { font: 500 0.875rem/1.5 var(--mono); overflow-wrap: anywhere; }
.prompt span[aria-hidden] { color: var(--signal); }
.prompt .cursor { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 0.35em; vertical-align: text-bottom; background: var(--signal); }
.term-status { font: 400 0.875rem/1.5 var(--mono); color: var(--muted); }
.term-status.is-warn { color: var(--warn); }
.term-status.is-bad { color: var(--bad); }
.term-out { font-size: 0.8125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out:empty { display: none; }
.term-out .score { font: 400 2rem/1.1 var(--display); padding-block: 0.4rem; text-shadow: var(--glow); }
#term-live { display: grid; gap: 0.7rem; }
#term-live[hidden] { display: none; }
.term-out .b { font-weight: 700; }
.term-out .score .b { font-weight: 400; } /* VT323 has one weight: no fake bold */
.term-out .score span[class] { white-space: nowrap; } /* break only between label and value: "0/100 (F)" stays whole (Design S1) */
.term-out .dim { color: var(--muted); }
.term-out .red { color: var(--bad); }
.term-out .yellow { color: var(--warn); }
.term-out .green { color: var(--ok); }
.term-out .cyan { color: var(--signal); }
.term-actions { display: grid; gap: 0.6rem; }
.term-actions .small, .prompt + .small { font-size: 0.875rem; } /* the notes before the readout: kept short on phones */
.run { justify-self: start; min-height: 2.75rem; padding: 0 1.2rem; border: 0; border-radius: 2px; background: var(--signal); color: var(--ink); font: 600 0.9375rem var(--mono); cursor: pointer; }
.run:hover { background: var(--text); color: var(--ink); }
.run[disabled] { background: var(--line); color: var(--muted); cursor: progress; }
/* Loading: the status line turns signal and a thin bar runs under the status bar (no script: the button state drives it) */
.term:has(.run[disabled]) .term-status { color: var(--signal); }
.term:has(.run[disabled]) .term-bar::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: color-mix(in srgb, var(--ink) 35%, transparent); }

/* Sections */
.band { border-top: 1px solid var(--line); padding: 2rem 0; }
.split { display: grid; gap: 1rem; }
.split > div { display: grid; gap: 0.9rem; min-width: 0; }
.split > div > p, .split > div > ul, .split > div > dl { max-width: 42rem; }
.band h2 { font-size: 2rem; line-height: 1; }
.plain { padding-left: 1.1rem; display: grid; gap: 0.45rem; }
.code { padding: 0.9rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 0.875rem; }
.code code { font-size: inherit; } /* commands people copy: 14 px, like the hero install line (Design F1) */

.ledger { width: 100%; border-collapse: collapse; font-size: 1rem; }
.ledger th, .ledger td { text-align: left; vertical-align: top; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.ledger thead th { border-top: 0; font: 500 0.9375rem/1.5 var(--sans); color: var(--muted); padding-top: 0; }
.ledger tbody th { font: 600 0.9375rem/1.55 var(--mono); width: 38%; padding-right: 1rem; }

/* Verdict names: inverse-video chips. The name is the label, colour only adds. */
.verdicts { display: grid; gap: 0.7rem; }
.verdicts dt { display: inline-block; margin-bottom: 0.3rem; padding: 0.1rem 0.5rem; border-radius: 2px; background: var(--ok); color: var(--ink); font: 700 0.875rem/1.4 var(--mono); }
.verdicts .v-warn { background: var(--warn); }
.verdicts .v-bad { background: var(--bad); }

/* Docs and changelog */
.page { padding: 2rem 0 2.5rem; }
.doc { display: grid; gap: 1.25rem; max-width: 62rem; margin-inline: auto; } /* centred at 1440 (Design F5) */
.toc ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 0.25rem; }
.toc a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.5rem; color: var(--text); font: 500 0.9375rem/1 var(--mono); }
.prose { display: grid; gap: 0.9rem; min-width: 0; max-width: 46rem; }
.prose h1 { font-size: clamp(2.75rem, 9vw, 3.75rem); line-height: 0.95; }
.prose h2 { font-size: 2rem; line-height: 1; margin-top: 1.1rem; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.prose h3 { margin-top: 0.4rem; }
.prose h4 { margin-top: 0.3rem; }
.log { display: grid; gap: 0.7rem; }
.log ul { padding-left: 1.1rem; display: grid; gap: 0.45rem; }
.log h3 { font-family: var(--mono); font-size: 1.1875rem; }

/* Quick start: one column, steps as jump links, one row per cleared agent */
.start { max-width: 46rem; }
.steps ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.steps a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--text); font: 500 0.9375rem/1 var(--mono); }
.steps + h2 { margin-top: 0; } /* the step links already end the intro: no extra gap before step 1 */
.agents tbody th { width: 8.5rem; }
.agents td:nth-of-type(1) { width: 52%; }
.agents .install { margin-top: 0; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 1.4rem 0 2rem; font-size: 0.9375rem; color: var(--muted); }
.foot-row { display: grid; gap: 0.6rem; }
.foot-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 0.25rem; margin-left: -0.5rem; }
.foot-links a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.5rem; }

@media (max-width: 37.5rem) {
  .nav .nav-wide { display: none; } /* Changelog and Source: still in the footer */
}
@media (max-width: 26rem) {
  .nav-long { display: none; }
  .nav-short { display: inline; }
}
/* Phones and tablets: the demo and its score come right after the headline; the commands follow the demo */
@media (max-width: 59.9375rem) {
  .hero { padding-top: 1.25rem; }
  .hero-text { display: contents; }
  .hero-grid { gap: 0.9rem; }
  .term { order: 1; margin-block: 0.85rem; }
  .after-demo { order: 2; }
}
/* Phones under 480 px: the whole score line on the first screen (Design round 5 ruling). Spacing and order only,
   same words, same type sizes and line heights; 480 px and up are untouched. */
@media (max-width: 29.9375rem) {
  .hero { padding-top: 0.75rem; padding-bottom: 1.75rem; } /* 0.5.0: the four-agent line wraps to two lines */
  .term-body { row-gap: 0.5rem; }
  .hero .lede + p { margin-top: -0.9rem; } /* "Reads Claude Code sessions." joins the lede: one block, no paragraph gap */
  .term { margin-top: 0; } /* the grid gap alone between the hero text and the demo */
  .term-body { padding-top: 0.5rem; } /* term bar to "The agent's last message" */
  #term-live { display: contents; } /* the output and the status line join the screen's grid... */
  .prompt + .small { order: 1; } /* ...so the disk-check note sits under the output, right above the status line */
  #term-live > .term-status { order: 2; }
}
@media (min-width: 37.5rem) {
  .term-actions { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.6rem 1rem; }
}
@media (max-width: 22.5rem) {
  .nav a { padding: 0 0.25rem; }
  .brand { gap: 0.4rem; }
  .brand-name { font-size: 1.5rem; }
}
@media (max-width: 30rem) {
  .nav a { padding: 0 0.4rem; }
  .ledger, .ledger tbody, .ledger tr, .ledger th, .ledger td { display: block; width: auto; }
  .ledger thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .ledger tbody tr { border-top: 1px solid var(--line); padding: 0.6rem 0; }
  .ledger tbody th, .ledger tbody td { border: 0; padding: 0; }
  .ledger tbody th { width: auto; padding-bottom: 0.2rem; }
  .agents td:nth-of-type(1) { width: auto; }
  .agents tbody td:last-child { padding-top: 0.45rem; }
  .said { font-size: 1rem; } /* one line shorter on phones, so the score reaches the first screen */
  .term-out .score { font-size: 1.75rem; } /* label and value on one line from 375 px up, still the largest text */
}
@media (min-width: 30.0625rem) {
  .agents td:nth-of-type(1) { padding-right: 1rem; }
}
@media (min-width: 60rem) {
  .hero { padding: 3rem 0; }
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; align-items: start; }
  .hero h1 { font-size: clamp(4rem, 6.4vw, 5.75rem); }
  .band h2, .prose h2 { font-size: 2.25rem; }
  .term-out { font-size: 0.875rem; }
  .term-out .score { font-size: 2.75rem; }
  .split { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 2.5rem; }
  .verdicts { grid-template-columns: 1fr 1fr; gap: 0.9rem 2rem; }
  .doc { grid-template-columns: 13rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
  .toc { position: sticky; top: 1rem; }
  .toc ul { display: grid; }
  .toc a { display: flex; padding: 0; }
  .foot-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
}
/* Desktop: the headline and the two commands stay beside the demo while it scrolls (D096 fix 4). Only on screens
   tall enough to hold the whole column, so nothing in it is ever out of reach. */
@media (min-width: 60rem) and (min-height: 50rem) {
  .hero-text { position: sticky; top: 1rem; }
}

/* Glow: no glow on the white page, under more contrast, in forced colours or in print. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hero h1 { text-shadow: none; }
}
:root[data-theme="light"] .hero h1 { text-shadow: none; }
@media (prefers-contrast: more), (forced-colors: active), print {
  .hero h1, .term-out .score { text-shadow: none; }
  .term-body { background-image: none; }
}

/* Motion budget: one print-out, one cursor, one loading bar. All of it off under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .run, .copy, .button, .nav a, .theme { transition: background-color 0.12s, color 0.12s; }
  .run:active, .copy:active, .button:active { transform: translateY(1px); }
  .prompt .cursor { animation: blink 1.06s steps(1) 5; } /* five blinks (about 5 s), then it stays lit */
  .term-out > div { animation: print-in 1ms steps(1) both; animation-delay: calc(var(--i, 0) * 18ms); }
  .term:has(.run[disabled]) .term-bar::after { width: 30%; animation: slide 1.2s linear infinite; }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes print-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
