/* Tokens from the rubeen.dev design system "Lagebild". light-dark() keeps each token on one line. */
:root {
  color-scheme: light dark;
  --paper: light-dark(#f3f4f0, #0e1113);
  --paper-raised: light-dark(#ffffff, #161a1d);
  --paper-sunken: light-dark(#e7e9e3, #0a0c0d);
  --line: light-dark(#d5d9d1, #2a3135);
  --line-strong: light-dark(#7c837b, #5f686d);
  --ink: light-dark(#14171a, #e9ebe6);
  --ink-muted: light-dark(#545b61, #9ba3a8);
  --petrol: light-dark(#0b5b6b, #6cc9d6);
  --petrol-strong: light-dark(#073f4a, #9adde6);
  --petrol-soft: light-dark(#dcebec, #0f2c32);
  --on-petrol: light-dark(#ffffff, #0e1113);
  --signal: light-dark(#ee6a1f, #ff8442);
  --on-signal: light-dark(#14171a, #0e1113);
  --signal-soft: light-dark(#fde4d3, #3a1a08);
  --signal-text: light-dark(#a8400a, #ffa06b);
  --moss: light-dark(#3d6b2c, #9ccf83);
  --moss-soft: light-dark(#e2eddb, #16260f);
  --danger: light-dark(#a3261b, #ff8f84);
  --danger-soft: light-dark(#f8dfdb, #33110d);
  --code-bg: light-dark(#14171a, #0a0c0d);
  --code-ink: #e9ebe6;
  --code-accent: #6cc9d6;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --radius-xs: 2px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --measure: 68ch;
  --content-wide: 1120px;
  --gutter: var(--space-6);
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; font-family: var(--font-body); font-size: 15px; line-height: 22px; background: var(--paper); color: var(--ink); }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }
::selection { background: var(--signal-soft); }
h1, h2, p { margin: 0; }
a { color: var(--petrol); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--petrol-strong); text-decoration-thickness: 2px; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
summary { cursor: pointer; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--space-4); top: -60px; background: var(--paper-raised); padding: var(--space-2) var(--space-4); z-index: 3; }
.skip:focus { top: var(--space-2); }
.dim { color: var(--ink-muted); }

/* Frame: two columns from the top bar down, the tally sits exactly above the board. */
.top, .bench { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 0 var(--space-6); max-width: 1480px; margin-inline: auto; padding-inline: var(--gutter); }
.top { align-items: center; min-height: 60px; }
.id { display: flex; align-items: baseline; gap: var(--space-4); min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font: 750 20px/1 var(--font-display); font-variation-settings: "opsz" 24; letter-spacing: -.03em; white-space: nowrap; }
.brand-mark { width: 12px; height: 12px; background: var(--signal); border-radius: var(--radius-xs); }
.pitch { font-size: 14px; line-height: 20px; color: var(--ink-muted); }

/* Annunciator: one lamp per grader, a gap between code and model. */
.tally { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }
.lamps { display: flex; gap: 3px; list-style: none; margin: 0; padding: 0; }
.lamps li { width: 13px; height: 24px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs); }
.lamps li:nth-child(8) { margin-left: var(--space-2); }
.lamps li[data-state="fail"] { background: var(--signal); border-color: var(--signal); }
.lamps li[data-state="pass"] { background: var(--line); border-color: var(--line); }
.lamps li[data-state="unchecked"], .lamps li[data-state="stale"], .lamps li[data-state="running"] { background: repeating-linear-gradient(135deg, var(--line-strong) 0 1.5px, transparent 1.5px 5px); }
.count { font: 700 20px/26px var(--font-display); font-variation-settings: "opsz" 24; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.bench { align-items: start; padding-bottom: var(--space-3); }

/* Left: the artifact */
.artifact { display: flex; flex-direction: column; gap: var(--space-2); min-height: calc(100dvh - 72px); }
.pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: none; padding: 5px 13px; font: 600 14px/20px var(--font-mono); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:focus-visible { outline-offset: -3px; }
.field { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.field select, .field input { min-height: 32px; min-width: 0; padding: 4px 8px; color: var(--ink); background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: 400 14px/20px var(--font-body); }
.field input { font-family: var(--font-mono); }
#variant { width: 156px; }
#version { width: 11ch; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chips-label { font-weight: 700; font-size: 13px; line-height: 18px; margin-right: var(--space-1); }
.chip { min-height: 27px; padding: 2px 6px; font-size: 13px; line-height: 18px; background: none; border: 1px dashed var(--line-strong); border-radius: var(--radius-xs); }
.chip:hover { border-color: var(--signal); border-style: solid; }
.chip[aria-pressed="true"] { background: var(--signal); border: 1px solid var(--signal); color: var(--on-signal); font-weight: 600; }
#notes { flex: 1 1 0; min-height: 240px; width: 100%; resize: none; padding: var(--space-3); font: 400 13.5px/20px var(--font-mono); background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.diff { max-height: 68px; overflow-y: auto; padding: 5px 10px; font: 400 12.5px/18px var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper-sunken); border-radius: var(--radius-sm); }
.diff ins { background: var(--moss-soft); color: var(--moss); }
.diff del { background: var(--danger-soft); color: var(--danger); }
.switches { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--petrol); }
.quiet { min-height: 32px; padding: 4px 10px; font-size: 13px; line-height: 18px; background: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.quiet:disabled { color: var(--ink-muted); border-color: var(--line); cursor: default; }
.prs > summary { font-size: 14px; font-weight: 600; }
.pr { border-top: 1px solid var(--line); padding-block: var(--space-1); font-size: 14px; line-height: 20px; }
.pr summary { overflow-wrap: anywhere; }
.pr p { margin-top: var(--space-1); white-space: pre-wrap; overflow-wrap: anywhere; }
.pr pre { margin: var(--space-2) 0; padding: var(--space-2) var(--space-3); max-height: 260px; overflow: auto; font: 400 12.5px/18px var(--font-mono); background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius-sm); }
.pr .plus { color: #9ccf83; }
.pr .minus { color: #ff8f84; }

/* Right: the board */
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); padding-block: var(--space-2) var(--space-1); }
.group-head h2 { font: 700 15px/22px var(--font-display); font-variation-settings: "opsz" 18; }
.board > .group-head:first-child { padding-top: 5px; }
.source { font-size: 13px; line-height: 20px; color: var(--ink-muted); overflow-wrap: anywhere; }
#run { margin-left: auto; min-height: 32px; padding: 4px 12px; font-weight: 700; font-size: 14px; line-height: 20px; color: var(--on-petrol); background: var(--petrol); border: 0; border-radius: var(--radius-sm); }
#run:disabled { opacity: .7; cursor: default; }
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.rows > li { border-bottom: 1px solid var(--line); }
.row summary { display: grid; grid-template-columns: 108px 122px minmax(0, 1fr) 12px; gap: 0 var(--space-2); align-items: baseline; padding: 6px var(--space-2) 6px var(--space-3); list-style: none; }
.row summary::-webkit-details-marker { display: none; }
.row summary::after { grid-column: 4; content: "+"; font: 400 15px/20px var(--font-mono); color: var(--ink-muted); }
.row[open] summary::after { content: "−"; }
.row summary:focus-visible { outline-offset: -2px; }
.status { font-size: 13px; line-height: 20px; font-weight: 700; }
.status::before { display: inline-block; width: 1.2em; font-family: var(--font-mono); }
.name { font: 600 13.5px/20px var(--font-mono); white-space: nowrap; }
.first { font-size: 13.5px; line-height: 20px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.row[data-state="pass"] .status { color: var(--ink-muted); font-weight: 400; }
.row[data-state="pass"] .status::before { content: "✓"; }
.row[data-state="fail"] summary { background: var(--signal-soft); box-shadow: inset 5px 0 0 var(--signal); }
.row[data-state="fail"] .status { color: var(--signal-text); }
.row[data-state="fail"] .status::before { content: "!"; }
.row[data-state="unchecked"] summary, .row[data-state="stale"] summary, .row[data-state="running"] summary { background: repeating-linear-gradient(135deg, var(--paper-sunken) 0 6px, transparent 6px 12px); }
.row[data-state="unchecked"] .status::before, .row[data-state="running"] .status::before { content: "?"; }
.row[data-state="stale"] .status::before { content: "~"; }
.row[data-state="unchecked"] .status, .row[data-state="unchecked"] .first { color: var(--ink-muted); }
.row.changed summary { animation: ping .5s ease-out; }
@keyframes ping { from { outline: 2px solid var(--signal); outline-offset: -2px; } to { outline: 2px solid transparent; outline-offset: -2px; } }
@media (prefers-reduced-motion: reduce) { .row.changed summary { animation: none; } }
.more { padding: var(--space-1) var(--space-3) var(--space-3); font-size: 13.5px; line-height: 20px; }
.why { color: var(--ink-muted); }
.findings { margin: var(--space-1) 0; padding-left: 18px; overflow-wrap: anywhere; }
.findings:empty, .note:empty { display: none; }
.note { font-size: 13px; color: var(--ink-muted); }
.token { padding-top: var(--space-2); font-size: 14px; }
.token summary { font-weight: 600; }
.token-fields { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); padding-top: var(--space-2); }
.field.grow { flex: 1 1 120px; }
.field.grow input { flex: 1; width: 100%; }
#model { width: 21ch; }
.hint { padding-top: var(--space-1); font-size: 13px; line-height: 20px; color: var(--ink-muted); }

/* Matrix */
.matrix, .limits { max-width: 1480px; margin-inline: auto; padding-inline: var(--gutter); }
.matrix { padding-top: var(--space-6); }
.matrix-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font: 400 13px/18px var(--font-mono); font-variant-numeric: tabular-nums; }
thead th { padding: 4px 6px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
thead th:first-child { position: sticky; left: 0; text-align: left; background: var(--paper); font-family: var(--font-body); }
tbody th[scope="row"] { position: sticky; left: 0; padding: 0; text-align: left; background: var(--paper); white-space: nowrap; font-weight: 400; }
tbody th button { width: 100%; padding: 3px 12px 3px 0; text-align: left; background: none; border: 0; font: 600 13.5px/20px var(--font-body); }
tbody tr:hover th button { text-decoration: underline; }
tbody tr:not(.band) { cursor: pointer; }
.band th { padding: var(--space-3) 0 var(--space-1); text-align: left; font: 700 13.5px/20px var(--font-body); }
td { padding: 2px 6px; text-align: center; border: 2px solid var(--paper); white-space: nowrap; }
td.none { color: var(--ink-muted); }
td.some { background: var(--signal-soft); }
td.all { background: var(--signal); color: var(--on-signal); font-weight: 700; }

.limits { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) var(--space-6); padding-block: var(--space-6); font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.limits nav { display: flex; gap: var(--space-4); }

@media (max-width: 899px) {
  :root { --gutter: var(--space-4); }
  .top { display: contents; }
  .id { flex-wrap: wrap; gap: var(--space-1) var(--space-4); padding: var(--space-3) var(--gutter) var(--space-2); }
  .tally { position: sticky; top: 0; z-index: 2; padding: var(--space-2) var(--gutter); background: var(--paper); border-block: 1px solid var(--line); }
  .count { font-size: 16px; line-height: 22px; }
  .bench { display: block; padding-top: var(--space-2); }
  .artifact { min-height: 0; }
  #notes { flex: none; height: 44dvh; }
  .diff { max-height: 110px; }
  .seg button { padding: 8px 12px; }
  .chip { min-height: 36px; padding: 4px 10px; }
  .check { min-height: 36px; }
  .field select, .field input, .quiet, #run { min-height: 38px; }
  .board { padding-top: var(--space-3); }
  .row summary { grid-template-columns: auto minmax(0, 1fr) 12px; padding-block: 8px; }
  .status { grid-column: 2; grid-row: 1; justify-self: end; }
  .name { grid-column: 1; grid-row: 1; }
  .first { grid-column: 1 / -1; grid-row: 2; }
  .first:empty { display: none; }
  .pick .quiet { margin-left: auto; }
  #variant { width: auto; flex: 1; }
  .pick .field { flex: 1 1 100%; }
  tbody th button { white-space: normal; width: 104px; font-size: 13px; line-height: 17px; padding-right: 6px; }
  .row summary::after { grid-column: 3; grid-row: 1; }
}
