/* Bantime board, "The Comparator": a measuring bench / engineering drawing.
   Paper, ink, hairlines, title blocks. Arms are told apart by position, marker shape and name;
   colour is a third channel (validated categorical slots 1-3, light and dark steps). */
:root {
  color-scheme: light;
  --paper: #f3f2ec; --sheet: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #67665f;
  --grid: #e1e0d9; --axis: #c3c2b7; --rule: rgba(11, 11, 11, 0.16); --paper-grid: rgba(11, 11, 11, 0.045);
  --a-control: #2a78d6; --a-24h: #eb6834; --a-tarpit: #1baf7a; --a-other: #6250d6;
  --good: #006300; --warn-bg: #fab219; --bad: #b42323; --bad-bg: #fbeaea; --warn-soft: #fdf3dc; --info-soft: #eaf1fb;
  --planted: #8a1f6a; --host: #5b4a9e; --fs: #1c5cab; --focus: #2a78d6;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0d0d0d; --sheet: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a199;
    --grid: #2c2c2a; --axis: #4a4a46; --rule: rgba(255, 255, 255, 0.16); --paper-grid: rgba(255, 255, 255, 0.035);
    --a-control: #3987e5; --a-24h: #d95926; --a-tarpit: #199e70; --a-other: #9085e9;
    --good: #0ca30c; --bad: #ff8a80; --bad-bg: #3a1716; --warn-soft: #33290f; --info-soft: #14233a;
    --planted: #e87ba4; --host: #b5a6ff; --fs: #86b6ef; --focus: #86b6ef;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0d0d0d; --sheet: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a199;
  --grid: #2c2c2a; --axis: #4a4a46; --rule: rgba(255, 255, 255, 0.16); --paper-grid: rgba(255, 255, 255, 0.035);
  --a-control: #3987e5; --a-24h: #d95926; --a-tarpit: #199e70; --a-other: #9085e9;
  --good: #0ca30c; --bad: #ff8a80; --bad-bg: #3a1716; --warn-soft: #33290f; --info-soft: #14233a;
  --planted: #e87ba4; --host: #b5a6ff; --fs: #86b6ef; --focus: #86b6ef;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--paper);
  background-image: linear-gradient(var(--paper-grid) 1px, transparent 1px), linear-gradient(90deg, var(--paper-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  font: 15px/1.5 var(--sans);
  overflow-wrap: anywhere;
}
.app { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }
a { color: var(--fs); }
code { font-family: var(--mono); font-size: 0.92em; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }

/* masthead */
.masthead { padding: 28px 0 12px; border-bottom: 2px solid var(--ink); margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; font: 600 12px/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: clamp(26px, 5.2vw, 46px); line-height: 1.08; margin: 0 0 14px; letter-spacing: -0.015em; max-width: 22ch; }
h2 { font-size: 20px; line-height: 1.2; margin: 0; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.dataline { font-size: clamp(16px, 2.2vw, 19px); margin: 12px 0 0; max-width: 70ch; min-height: 1.5em; }

/* stickers */
.stickers { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sticker {
  display: inline-block; font: 800 12px/1 var(--mono); letter-spacing: 0.1em; padding: 6px 9px;
  border: 2px solid currentColor; border-radius: 3px; white-space: nowrap; transform: rotate(-1.2deg);
}
.sticker.big { font-size: 15px; padding: 8px 12px; }
.sticker.small { font-size: 10px; padding: 3px 6px; border-width: 1.5px; vertical-align: middle; }
.s-live { color: var(--good); background: var(--sheet); }
.s-lab { color: #0b0b0b; background: var(--warn-bg); border-color: #0b0b0b; }
.s-planted { color: var(--planted); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--planted) 14%, transparent) 6px 8px), var(--sheet); }
.s-pending { color: var(--muted); background: var(--sheet); }
.s-snap { color: var(--fs); background: var(--sheet); }
.s-fixture { color: #fff; background: #c42525; border-color: #c42525; }
.s-fixture.big { font-size: 22px; padding: 10px 16px; transform: rotate(-2deg); box-shadow: 3px 3px 0 var(--ink); }
.chip { display: inline-block; font: 700 11px/1 var(--mono); letter-spacing: 0.06em; padding: 5px 7px; border: 1px solid var(--rule); border-radius: 2px; color: var(--ink-2); background: var(--sheet); white-space: nowrap; }
.c-run { color: var(--good); border-color: currentColor; }
.c-done { color: var(--ink); border-color: var(--ink); background: var(--grid); }
.c-warn { color: var(--ink); background: var(--warn-soft); border-color: #b07a00; }
.c-lab { margin-left: 6px; color: #0b0b0b; background: var(--warn-bg); border-color: transparent; }
.tag { display: inline-block; font: 700 10.5px/1 var(--mono); letter-spacing: 0.08em; padding: 3px 5px; border: 1px solid currentColor; border-radius: 2px; vertical-align: middle; white-space: nowrap; }
.tag-host { color: var(--host); }
.tag-fs { color: var(--fs); }

/* sheets (drawing frames) */
main { display: block; }
.sheet {
  position: relative; background: var(--sheet); border: 1px solid var(--ink); padding: 18px 18px 16px; margin: 0 0 18px;
  box-shadow: 4px 4px 0 var(--rule);
}
.sheet::before, .sheet::after { content: ""; position: absolute; width: 10px; height: 10px; border: 0 solid var(--ink); }
.sheet::before { top: 4px; left: 4px; border-top-width: 2px; border-left-width: 2px; }
.sheet::after { bottom: 4px; right: 4px; border-bottom-width: 2px; border-right-width: 2px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.prov-planted { border-style: dashed; border-width: 2px; border-color: var(--planted); }
.pair > :only-child { grid-column: 1 / -1; }
.planted-note { margin: 0 0 12px; padding: 8px 10px; border-left: 4px solid var(--planted); background: color-mix(in srgb, var(--planted) 8%, var(--sheet)); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 18px; }
@media (min-width: 980px) { .pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .pair > :not(:only-child) .lane { grid-template-columns: minmax(8rem, 10rem) minmax(0, 1fr); } .pair > :not(:only-child) .lane-read { grid-column: 1 / -1; } .pair > :not(:only-child) .lane-axis .lane-read { display: none; } }

/* title block */
.titleblock { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--rule); margin: 0 0 14px; }
.tb-cell { padding: 6px 8px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; min-width: 0; }
.tb-k { display: block; font: 600 10px/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tb-v { display: block; font: 500 13px/1.35 var(--mono); }

/* lanes */
.lane-title { margin-top: 4px; }
.lanes { --lane-cols: minmax(9rem, 12rem) minmax(0, 1fr) minmax(11rem, 15rem); }
.lane { display: grid; grid-template-columns: var(--lane-cols); gap: 6px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--grid); }
.lane:first-child { border-top: 0; }
.lane-axis { border-top: 1px solid var(--axis); padding-top: 2px; }
.lane-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.armname { display: inline-flex; align-items: center; gap: 7px; font: 700 15px/1.2 var(--mono); }
.lane-sub { font: 12px/1.2 var(--mono); color: var(--muted); padding-left: 21px; }
.lane-plot { min-width: 0; }
.lane-read { display: flex; flex-direction: column; gap: 1px; font: 13px/1.35 var(--mono); font-variant-numeric: tabular-nums; }
.lane-read .lift strong { font-size: 18px; }
.lane-read .k { color: var(--muted); }
.share { color: var(--ink-2); }
.share strong { color: var(--ink); }
.wait { color: var(--muted); font-style: italic; }
.lane-svg { display: block; overflow: visible; }
.axis-svg { display: block; overflow: visible; font: 11px var(--mono); fill: var(--muted); }
.axis-svg .zero { fill: var(--ink); font-weight: 700; }
.axis-dir { display: flex; justify-content: space-between; gap: 8px; font: 11px/1.3 var(--mono); color: var(--muted); }
.grid { stroke: var(--grid); stroke-width: 1; }
.zeroline { stroke: var(--ink-2); stroke-width: 1.5; }
.zerolabel { font: 11px var(--mono); fill: var(--muted); }
.ci-line { stroke-width: 2; stroke-linecap: round; }
.ci-cap { stroke-width: 2; stroke-linecap: round; }
.mk { stroke: var(--sheet); stroke-width: 2; paint-order: stroke; }
.mk.ring { fill: var(--sheet); stroke-width: 2.5; }
.lane:focus-visible { outline-offset: -2px; background: color-mix(in srgb, var(--focus) 7%, transparent); }
.no-axis .lane-ref .lane-plot:empty { display: none; }
.floor-note { font-size: 13px; margin: 8px 0 0; }

/* arm identity colours: marks only, never text */
.arm-control { --arm: var(--a-control); }
.arm-ban-10m-b { --arm: var(--a-control); }
.arm-ban-24h { --arm: var(--a-24h); }
.arm-tarpit { --arm: var(--a-tarpit); }
.arm-other { --arm: var(--a-other); }
.glyph { flex: none; overflow: visible; }
.glyph .mk { fill: var(--arm); stroke-width: 1; }
.glyph .mk.ring { fill: var(--sheet); stroke: var(--arm); stroke-width: 2.2; }
.lane .pt .mk { fill: var(--arm); }
.lane .pt .mk.ring { fill: var(--sheet); stroke: var(--arm); }
.lane .ci-line, .lane .ci-cap { stroke: var(--arm); }
.seg { fill: var(--arm); }

/* meters */
.meters { display: grid; gap: 6px; }
.meter { display: grid; grid-template-columns: 6.5rem minmax(40px, 1fr) 9.5rem; gap: 10px; align-items: center; font: 12px/1.2 var(--mono); }
.meter-label { color: var(--muted); }
.meter-svg { display: block; }
.meter-track { fill: var(--grid); }
.meter-fill { fill: var(--ink-2); }
.meter-fill.met { fill: var(--good); }
.meter-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.met-mark { color: var(--good); }

/* notices and banners */
.notice { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px dashed var(--axis); background: var(--paper); }
.banner { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; margin: 0 0 14px; border: 1px solid var(--ink); border-left-width: 6px; background: var(--sheet); }
.banner strong { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; }
.b-bad { border-color: var(--bad); background: var(--bad-bg); }
.b-bad strong { color: var(--bad); }
.b-warn { border-color: #b07a00; background: var(--warn-soft); }
.b-info { border-color: var(--fs); background: var(--info-soft); }
.warnline { color: var(--ink); background: var(--warn-soft); padding: 6px 8px; border-left: 3px solid #b07a00; }

/* arrivals */
.chart-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 6px 0 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 0; padding: 0; font: 13px var(--mono); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 2px; background: var(--arm); }
.toggle { font: 600 13px var(--mono); color: var(--ink); background: var(--sheet); border: 1px solid var(--ink); border-radius: 2px; padding: 6px 10px; cursor: pointer; min-height: 32px; }
.toggle:hover { background: var(--grid); }
.chart { position: relative; height: 230px; }
.film .chart { height: 300px; }
.arr-svg { display: block; font: 11px var(--mono); }
.arr-svg .tick { fill: var(--muted); }
.arr-svg .baseline { stroke: var(--axis); }
.arr-svg .dlabel { fill: var(--ink-2); font-size: 11px; }
.arr-svg .hit { fill: transparent; }
.arr-svg .col.dim { opacity: 0.35; }
.tip { position: absolute; z-index: 2; min-width: 150px; padding: 8px 10px; background: var(--sheet); border: 1px solid var(--ink); box-shadow: 3px 3px 0 var(--rule); font: 12px/1.4 var(--mono); pointer-events: none; display: grid; gap: 2px; }
.tip-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 6px; align-items: center; }
.tip-total { grid-template-columns: 1fr auto; border-top: 1px solid var(--grid); padding-top: 2px; }

/* tables */
.tablewrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font: 13px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; vertical-align: top; }
th:first-child, td:first-child, tbody th, .cert-table thead th:nth-child(2) { text-align: left; }
thead th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); font-weight: 600; }
tbody th { font-weight: 500; }
.cert-block { border-top: 1px solid var(--rule); padding-top: 4px; margin-top: 10px; }
.cert-block h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cert-meta { font: 12px/1.5 var(--mono); color: var(--ink-2); margin: 0 0 6px; }
.cert-table tr.m-first > * { border-top: 1px solid var(--axis); }
.cert-table tr.primary td, .cert-table tr.primary th { background: color-mix(in srgb, var(--fs) 5%, transparent); }
.role { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
td.bad, .bad { color: var(--bad); font-weight: 700; }
td.ok { color: var(--good); }
tr.flagged > * { background: var(--bad-bg); }
tr.unreach td { color: var(--muted); font-style: italic; }

/* hosts */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.tile { border: 1px solid var(--rule); padding: 10px 12px; display: flex; flex-direction: column-reverse; gap: 2px; background: var(--sheet); }
.tile-v { font: 700 22px/1.1 var(--sans); }
.tile.small .tile-v { font-size: 17px; }
.tile-k { font: 600 11px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tile.bad { border-color: var(--bad); }
.tile.bad .tile-v { color: var(--bad); }
.tile.warn { border-color: #b07a00; background: var(--warn-soft); }
.recon td:nth-child(2) { text-align: left; }
.recon h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* method */
.method ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; max-width: 80ch; }
.foot { font-size: 12.5px; margin-top: 8px; }

/* loading skeleton (same shapes as the first sheets, so nothing jumps) */
.skeleton .sk { height: 260px; }
.s-pending { min-width: 10ch; }
.noscript { max-width: 1120px; margin: 16px auto; padding: 0 16px; }

/* dev nav (fixture picker, dev/index.html only) */
.devnav { max-width: 1120px; margin: 0 auto; padding: 8px 16px; font: 12px/1.6 var(--mono); border-bottom: 1px dashed var(--axis); }
.devnav a { margin-right: 10px; }

/* narrow screens: stack the lane columns */
@media (max-width: 700px) {
  .lanes { --lane-cols: minmax(0, 1fr); }
  .lane-axis .lane-name, .lane-axis .lane-read { display: none; }
  .lane { gap: 6px; }
  .lane-read { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; }
  .meter { grid-template-columns: 5.5rem minmax(30px, 1fr) auto; }
  .sheet { padding: 14px 12px; }
  .sticker.big { font-size: 13px; }
  .s-fixture.big { font-size: 17px; }
}

/* film mode: hide chrome, larger type for recording */
.film body { font-size: 18px; }
.film .app { max-width: 1400px; padding: 0 40px 40px; }
.film h1 { font-size: clamp(34px, 5vw, 64px); }
.film .dataline { font-size: 24px; }
.film .armname { font-size: 19px; }
.film .lanes { --lane-cols: minmax(11rem, 14rem) minmax(0, 1fr) minmax(16rem, 19rem); }
.film .lane-plot .lane-svg { transform-origin: center; }
.film .lane-read { font-size: 16px; }
.film .lane-read .lift strong { font-size: 24px; }
.film .toggle, .film .foot, .film .devnav, .film .method { display: none; }
.film table { font-size: 15px; }

/* motion: only when the viewer allows it */
@media (prefers-reduced-motion: no-preference) {
  .lane .pt { animation: pop 420ms ease-out both; }
  .arr-svg .col { transition: opacity 120ms; }
  @keyframes pop { from { opacity: 0; } to { opacity: 1; } }
}
@media (forced-colors: active) {
  .seg, .glyph .mk, .lane .pt .mk { fill: CanvasText; }
  .sticker { forced-color-adjust: none; }
}
@media print { body { background: #fff; } .toggle, .devnav { display: none; } .sheet { box-shadow: none; break-inside: avoid; } }
