/* countline: one ledger page. Tokens first; nothing below uses a literal colour or size. */
@font-face { font-family: "Shoulders"; src: url("/fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Spline Mono"; src: url("/fonts/spline-sans-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Spline Mono"; src: url("/fonts/spline-sans-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  /* OKLCH sources: ground 97.4% 0.012 235, panel 93.5% 0.02 235, ink 22% 0.035 255,
     ink-2 43% 0.03 255, accent 47% 0.19 264 (ballpoint blue), rule 84% 0.025 240, stroke 80% 0.03 240 */
  --ground: #eff8fe;
  --panel: #ddecf5;
  --ink: #0f1b2b;
  --ink-2: #455160;
  --accent: #204ec3;
  --rule: #bdcdda;
  --stroke: #adc1cf;
  --display: "Shoulders", "Arial Narrow", sans-serif;
  --mono: "Spline Mono", ui-monospace, "Cascadia Mono", monospace;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-3: clamp(2.6rem, 8vw, 5.4rem);
  --cell: 24px;
  --gutter: 16px;
  --measure: 64ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ground: #0b1420; --panel: #132132; --ink: #e6f0f8; --ink-2: #a9b8c7; --accent: #8fb0ff; --rule: #24364a; --stroke: #2e4560; }
}
:root[data-theme="dark"] { --ground: #0b1420; --panel: #132132; --ink: #e6f0f8; --ink-2: #a9b8c7; --accent: #8fb0ff; --rule: #24364a; --stroke: #2e4560; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 var(--step-0)/1.6 var(--mono);
  /* The material: squared ledger paper, one cell per count. */
  background-color: var(--ground);
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  background-attachment: local;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; display: inline-flex; align-items: center; min-height: 44px; }
.skip:focus { left: var(--gutter); top: var(--gutter); background: var(--ground); padding: 8px 12px; z-index: 2; }

.strip { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding: 12px var(--gutter); background: var(--ground); border-bottom: 2px solid var(--ink); }
.mark { font: 800 var(--step-1)/1 var(--display); letter-spacing: 0.04em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; }
.strip nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.strip nav a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 2px; font-size: var(--step--1); }

main { max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter) 64px; }
section { padding: 40px 0 8px; }
.sheet { background: var(--ground); border: 2px solid var(--ink); padding: 20px; max-width: var(--measure); }

/* The tally: 48 strokes in gates of five. Pale means not counted. */
.tally { display: flex; flex-wrap: wrap; gap: 14px 22px; padding: 40px 0 12px; }
.gate { position: relative; display: flex; gap: 7px; height: 64px; }
.gate i { display: block; width: 5px; height: 100%; background: var(--stroke); border-radius: 2px; }
.gate.full::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 5px; background: var(--stroke); transform: rotate(-28deg); border-radius: 2px; }
.tally-note { font-size: var(--step--1); color: var(--ink-2); margin: 0 0 24px; }
.tally-note strong { color: var(--ink); font-weight: 500; }

h1, h2 { font-family: var(--display); font-weight: 800; letter-spacing: 0.01em; line-height: 0.95; margin: 0 0 16px; }
h1 { font-size: var(--step-3); max-width: 14ch; }
h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.lede { max-width: var(--measure); font-size: var(--step-1); line-height: 1.5; }
.lede p { margin: 0 0 6px; }
p { max-width: var(--measure); }

pre { margin: 0; overflow-x: auto; white-space: pre-wrap; word-break: break-word; font: 500 var(--step--1)/1.7 var(--mono); }
code { font-family: var(--mono); font-size: 0.95em; }
.line { background: var(--panel); border-left: 6px solid var(--accent); padding: 18px 20px; max-width: var(--measure); }
.copy { margin-top: 14px; min-height: 44px; padding: 0 18px; font: 500 var(--step-0) var(--mono); color: var(--ground); background: var(--accent); border: 2px solid var(--accent); border-radius: 0; cursor: pointer; }
.copy:hover { background: var(--ink); border-color: var(--ink); }

.ledger { width: 100%; max-width: 60rem; border-collapse: collapse; background: var(--ground); font-size: var(--step--1); }
.ledger th, .ledger td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--ink); }
.ledger thead th { background: var(--panel); font-weight: 500; }
.wrap { overflow-x: auto; }
@media (max-width: 640px) {
  .ledger thead { position: absolute; left: -9999px; }
  .ledger tr { display: block; border: 1px solid var(--ink); margin-bottom: 12px; }
  .ledger td, .ledger th { display: block; border: 0; border-bottom: 1px solid var(--rule); }
  .ledger td::before { content: attr(data-label); display: block; font-weight: 500; color: var(--ink-2); }
}

.doc { max-width: var(--measure); background: var(--ground); border: 2px solid var(--ink); padding: 24px 20px; margin-top: 32px; }
.doc h1 { font-size: clamp(2.2rem, 7vw, 3.4rem); }
.doc h2 { font-size: var(--step-1); font-family: var(--mono); font-weight: 500; letter-spacing: 0; line-height: 1.3; margin-top: 28px; }

.foot { border-top: 2px solid var(--ink); border-bottom: 0; font-size: var(--step--1); }
.foot p { margin: 0; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
