/* Palette, type and layout for a page about names a system cannot see.
   Neutrals are biased cool toward the accent rather than left pure grey.
   Semantic colours (found / missed) are deliberately not the accent. */

:root {
  --ground: #f3f5f8;
  --panel: #ffffff;
  --sunk: #eaeef3;
  --ink: #141a22;
  --muted: #5a6472;
  --line: #dde3ea;
  --line-strong: #c3ccd7;
  --accent: #1b4d8f;
  --accent-soft: #e8eefa;
  --missed: #a4342c;
  --missed-soft: #f7e9e7;
  --found: #0f6f5c;
  --found-soft: #e3f2ee;

  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --names: "IBM Plex Mono", "Noto Sans Arabic", "Noto Sans SC", "Noto Sans JP",
           "Noto Sans KR", "Noto Sans Hebrew", "Noto Sans Devanagari", ui-monospace, monospace;

  --col: 68ch;
  --r: 4px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f1319;
    --panel: #161c24;
    --sunk: #12171e;
    --ink: #e7ebf0;
    --muted: #98a3b2;
    --line: #242c36;
    --line-strong: #38424f;
    --accent: #86b4f5;
    --accent-soft: #182535;
    --missed: #e79486;
    --missed-soft: #2c1c1a;
    --found: #62c6a8;
    --found-soft: #122723;
  }
}
:root[data-theme="dark"] {
  --ground: #0f1319;
  --panel: #161c24;
  --sunk: #12171e;
  --ink: #e7ebf0;
  --muted: #98a3b2;
  --line: #242c36;
  --line-strong: #38424f;
  --accent: #86b4f5;
  --accent-soft: #182535;
  --missed: #e79486;
  --missed-soft: #2c1c1a;
  --found: #62c6a8;
  --found-soft: #122723;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(100% - 40px, 1000px); margin-inline: auto; }
.col { max-width: var(--col); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- eyebrow labels ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.eyebrow .mark { color: var(--accent); }

/* ---------- masthead ---------- */
.masthead { padding: 72px 0 40px; }
h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 5.4vw, 58px);
  line-height: 1.08;
  letter-spacing: -.018em;
  margin: 0 0 20px;
  text-wrap: balance;
  max-width: 20ch;
}
h1 em { font-style: italic; color: var(--accent); }
.standfirst { font-size: 19px; color: var(--muted); margin: 0; max-width: var(--col); }
.standfirst strong { color: var(--ink); font-weight: 600; }

/* ---------- the specimen: the hero object ---------- */
.specimen {
  margin: 40px 0 8px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.specimen-name {
  font-family: var(--names);
  font-size: clamp(24px, 4.6vw, 44px);
  line-height: 1.25;
  padding: 26px 26px 8px;
  margin: 0;
  word-break: break-word;
}
.specimen-sub {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  padding: 0 26px 22px;
  margin: 0;
}
.specimen-sub b { color: var(--ink); font-weight: 500; }
.outcomes { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.outcome { padding: 20px 26px; }
.outcome + .outcome { border-left: 1px solid var(--line); }
.outcome .what { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.outcome .verdict { font-family: var(--display); font-size: 25px; line-height: 1.1; margin: 0 0 8px; }
.outcome .detail { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin: 0; }
.outcome.miss .verdict { color: var(--missed); }
.outcome.hit .verdict { color: var(--found); }
@media (max-width: 620px) {
  .outcomes { grid-template-columns: 1fr; }
  .outcome + .outcome { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- figures strip ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin: 34px 0 12px; }
.figure { padding: 18px 20px; }
.figure + .figure { border-left: 1px solid var(--line); }
@media (max-width: 700px) {
  .figure + .figure { border-left: 0; border-top: 1px solid var(--line); }
}
.figure .n { font-family: var(--display); font-size: 34px; line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; display: block; }
.figure .k { font-size: 13.5px; color: var(--muted); display: block; margin-top: 9px; line-height: 1.45; }
.figure.miss .n { color: var(--missed); }
.figure.gain .n { color: var(--found); }

.provenance { font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.7;
  max-width: 78ch; margin: 0 0 8px; }

/* ---------- sections ---------- */
section { padding: 54px 0 4px; border-top: 1px solid var(--line); margin-top: 44px; }
h2 { font-family: var(--display); font-weight: 500; font-size: 27px; line-height: 1.2;
  letter-spacing: -.012em; margin: 0 0 14px; max-width: 26ch; text-wrap: balance; }
h3 { font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 34px 0 12px; }
p { margin: 0 0 16px; max-width: var(--col); }
.aside { font-size: 15px; color: var(--muted); border-left: 2px solid var(--line-strong);
  padding-left: 16px; max-width: var(--col); }

/* ---------- try-a-name ---------- */
.probe-field { margin: 22px 0 14px; }
#try-input {
  width: 100%; max-width: 640px; padding: 14px 16px;
  font-family: var(--names); font-size: 17px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  font-family: var(--names); font-size: 13px; padding: 7px 12px; cursor: pointer;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 999px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--panel); }

.stage { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  padding: 16px 18px; margin-bottom: 10px; }
.stage .h { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px; }
.stage .romanised { font-family: var(--names); font-size: 16px; margin: 0 0 12px; word-break: break-word; }
.stage .outcome-line { font-size: 14px; margin: 12px 0 0; color: var(--muted); }
.stage .outcome-line b { font-weight: 600; }
.stage .outcome-line.none b { color: var(--missed); }
.stage .outcome-line.some b { color: var(--found); }
.tok { display: inline-block; font-family: var(--mono); font-size: 13px; padding: 4px 9px;
  border-radius: 3px; margin: 0 5px 5px 0; border: 1px solid var(--line-strong); color: var(--muted); }
.tok.on { background: var(--found-soft); color: var(--found); border-color: transparent; font-weight: 500; }

/* ---------- tables ---------- */
.scroller { overflow-x: auto; margin: 16px 0 6px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 560px; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); background: var(--sunk); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.name { font-family: var(--names); font-size: 13.5px; }
.bar { position: relative; }
.bar > span { position: relative; z-index: 1; }
.bar::before { content: ""; position: absolute; inset: 4px auto 4px 0; width: var(--w, 0%);
  background: var(--accent-soft); border-radius: 2px; }
.tag { font-family: var(--mono); font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 3px;
  white-space: nowrap; }
.tag.miss { background: var(--missed-soft); color: var(--missed); }
.tag.hit { background: var(--found-soft); color: var(--found); }

/* ---------- calibrator ---------- */
.console { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  margin: 22px 0 14px; overflow: hidden; }
.dials { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.dial { padding: 20px 22px; }
.dial + .dial { border-left: 1px solid var(--line); }
@media (max-width: 640px) {
  .dials { grid-template-columns: 1fr; }
  .dial + .dial { border-left: 0; border-top: 1px solid var(--line); }
}
.dial label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.dial output { display: block; font-family: var(--mono); font-size: 22px; font-weight: 500;
  font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.dial input[type=range] { width: 100%; accent-color: var(--accent); }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border-top: 1px solid var(--line); background: var(--sunk); }
.readout .cell { padding: 16px 22px; }
.readout .cell + .cell { border-left: 1px solid var(--line); }
@media (max-width: 700px) { .readout .cell + .cell { border-left: 0; border-top: 1px solid var(--line); } }
.readout .n { font-family: var(--display); font-size: 26px; line-height: 1;
  font-variant-numeric: tabular-nums; display: block; }
.readout .k { font-size: 12.5px; color: var(--muted); display: block; margin-top: 8px; line-height: 1.45; }
.readout .cell.warn .n { color: var(--missed); }

/* ---------- caveats ---------- */
.caveats { list-style: none; padding: 0; margin: 18px 0 0; max-width: var(--col); }
.caveats li { padding: 14px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.caveats li:last-child { border-bottom: 1px solid var(--line); }
.caveats b { color: var(--ink); font-weight: 600; }

footer { margin-top: 56px; border-top: 2px solid var(--ink); padding: 22px 0 72px; font-size: 14px; }
footer p { color: var(--muted); }
footer .repo { font-family: var(--mono); font-size: 14px; color: var(--ink); }

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

/* ---------- alert queue ---------- */
.dial-note { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin: 10px 0 0; }
.queue-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline;
  justify-content: space-between; margin: 26px 0 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.queue-count { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 0; }
.tag.warn { background: color-mix(in srgb, var(--missed) 10%, transparent); color: var(--missed); }
#queue-table td.name { max-width: 320px; }
