/* Desk sheet. Type, 44px targets, print, and motion that stops when asked. */
:root {
  color-scheme: light;
  --bg: #f3efe6;
  --header-bg: rgba(243, 239, 230, 0.97);
  --ink: #1a1c16;
  --muted: #3a4034;
  --line: #cbc3b4;
  --brass: #2c4030;
  --brass-ink: #f7f3ea;
  --surface: #fbf8f2;
  --focus: #6f5420;
  --selection-bg: #cfd8b9;
  --selection-ink: #283625;
  --caret: #405a33;
  --scrollbar: #8a9a72;
  --shell: 46rem;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --serif: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --sans: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--scrollbar) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  caret-color: var(--caret);
}
::selection { background: var(--selection-bg); color: var(--selection-ink); }
a { color: var(--brass); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-150%);
  z-index: 40;
  background: var(--brass);
  color: var(--brass-ink);
  padding: 0.7rem 0.9rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
}
.skip:focus { transform: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.wrap { width: min(var(--shell), calc(100% - 2rem)); margin: 0 auto; }

/* Canonical site header. Same structure, text and metrics on every surface. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  width: min(var(--shell), calc(100% - 2rem));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0 24px;
}
.site-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}
.site-monogram { font: italic 400 30px/1 var(--serif); letter-spacing: -0.04em; color: var(--brass); }
.site-name { display: flex; flex-direction: column; font: 400 15px/1.2 var(--sans); letter-spacing: 0.02em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav a:hover { color: var(--brass); }
.site-nav a[aria-current="page"] { text-decoration: underline 1px var(--brass); text-underline-offset: 6px; }

main { padding: var(--space-4) 0 3.5rem; }
h1, h2, h3 { text-wrap: balance; }
h1 {
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.05rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0.15rem 0 0.5rem;
}
h2 { font-weight: 500; font-size: 1.35rem; letter-spacing: -0.02em; margin: var(--space-4) 0 var(--space-1); }
.desk-meta { margin: 0 0 1.1rem; color: var(--muted); font: 400 12px/1.5 var(--mono); letter-spacing: 0.04em; }
.meta, caption, th, summary, label, button, figcaption, .help, .plate span { font-family: var(--sans); }
p { max-width: 68ch; text-wrap: pretty; }
.banner, .note, .plate {
  background: var(--surface);
  border: 1px solid var(--brass);
  padding: 0.9rem 1rem;
  max-width: none;
}
.banner, .note { font-family: var(--sans); font-size: 0.95rem; }
.note { margin: 1.1rem 0; }
.note a { display: inline-flex; align-items: center; min-height: 44px; }
/* The run's own limit line sits inside the output as a quiet note, not a second box. */
#out > .banner { background: none; border: 0; padding: 0; color: var(--muted); }
.plate { margin: 1.1rem 0; display: grid; gap: 0.35rem; }
.plate strong {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.03em;
}
.plate span, caption, figcaption { color: var(--muted); font-size: 0.875rem; }
figure { margin: 1.1rem 0; }
figure svg { display: block; max-width: 100%; height: auto; background: var(--surface); border: 1px solid var(--line); }
figcaption { max-width: 68ch; margin-top: 0.45rem; }
form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem 1rem;
  margin: 1.25rem 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
label { display: grid; gap: 0.35rem; font-size: 0.875rem; }
.wide { grid-column: 1 / -1; }
input, select, textarea {
  font: 1rem var(--mono);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  min-height: 44px;
  min-width: 44px;
  width: 100%;
}
button {
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 1rem;
  background: var(--brass);
  color: var(--brass-ink);
  border: 0;
  font-size: 0.95rem;
  cursor: pointer;
}
.help { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.875rem; max-width: 68ch; }
/* The per-word switch: a 44px box beside its words, one target for the whole label. */
.check { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; cursor: pointer; }
input[type="checkbox"] { width: 44px; height: 44px; min-width: 44px; margin: 0; padding: 0; accent-color: var(--brass); }
.formula { margin: 0.35rem 0; }
.formula code { font-size: 0.875rem; }
.scroll + .scroll { margin-top: 1rem; }
.scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); background: var(--surface); scrollbar-width: thin; }
table { border-collapse: collapse; width: max-content; min-width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums lining-nums; vertical-align: top; }
th { font-size: 0.875rem; font-weight: 600; }
caption { caption-side: bottom; text-align: left; padding: 0.5rem 0.75rem 0.65rem; }
svg text { fill: var(--ink); font-size: 12px; font-family: var(--sans); }
svg rect.bar, svg rect.block { fill: var(--brass); }
svg line { stroke: var(--line); }

/* Figures drawn from the default input. Fills sit on a 1px ink outline. */
.geo .g1 { fill: var(--surface); stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.geo .g2 { fill: #cfd8b9; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.geo .g3 { fill: var(--brass); stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.geo .g0 { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.geo .ln { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.geo .dot { fill: var(--ink); }
.geo .ring { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.method { display: grid; gap: 0.35rem; margin-top: 0.6rem; }
details { border-top: 1px solid var(--line); padding: 0.15rem 0 0.75rem; }
summary { min-height: 44px; display: flex; align-items: center; gap: 1rem; cursor: pointer; font-size: 1rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
/* The flex summary loses the native triangle, so the disclosure state is drawn. */
summary::after { content: "+"; margin-left: auto; font: 400 1.1rem/1 var(--mono); color: var(--brass); }
details[open] > summary::after { content: "\2212"; }
code { font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; }
pre { overflow-x: auto; scrollbar-width: thin; }

/* Canonical site footer. 12px mono, every link a 44px target. */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem max(1rem, calc((100% - var(--shell)) / 2)) 2.5rem;
  color: var(--muted);
  font: 400 12px/1.6 var(--mono);
}
.site-footer p { margin: 0; max-width: 68ch; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.site-footer-stamp { margin-bottom: 0.25rem; }
.site-footer-stamp a { margin-right: 12px; }
.site-footer-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 20px; }

/* The computed plate under the title: ink is the page ink, one pigment, no frame. Beside the opening text from 720px, in the right margin from 1420px. */
figure.lab-plate { --plate-ink: var(--ink); --plate-pigment: var(--pg-light); max-width: 420px; margin: 1.5rem 0 1.75rem; }
figure.lab-plate svg.plate { display: block; margin: 0; padding: 0; background: none; border: 0; }
figure.lab-plate figcaption { max-width: 44ch; margin-top: 0.9rem; color: var(--muted); font: italic 0.9375rem/1.55 var(--serif); }
@media (min-width: 720px) {
  figure.lab-plate { float: right; width: 250px; margin: 0.2rem 0 1rem 2rem; }
  figure.lab-plate + .banner { display: flow-root; }
}
@media (min-width: 1420px) {
  figure.lab-plate { width: 300px; margin: 0.4rem -332px 1rem 32px; }
  figure.lab-plate + .banner { display: block; }
}

@media (max-width: 680px) {
  .site-header-inner { flex-direction: column; align-items: stretch; padding: 8px 0 4px; }
  .site-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
  .site-nav a { justify-content: flex-start; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: transform 160ms ease; }
  button:hover { transform: translateY(-1px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  @page { margin: 16mm; }
  .site-header, nav, .skip, form, button, .site-footer { display: none !important; }
  body { background: #fff; color: #111; font-size: 11pt; }
  a { color: #000; text-decoration: none; }
  .banner, .note, .plate, .scroll, figure svg { border-color: #000; background: #fff; }
  .wrap { width: auto; }
}
