/* Utilitarian, high-clarity, mobile-first. The audience wants specs and
   photos fast, often on a phone with one bar of signal at a flea market.
   No web fonts, no framework, no layout shift. */

:root {
  color-scheme: light dark;

  --ink: #16130f;
  --ink-soft: #4a423a;
  --ink-faint: #6f6558;
  --paper: #faf8f4;
  --card: #ffffff;
  --rule: #ddd5c8;
  --rule-strong: #c3b8a5;
  --accent: #7a3b12;
  --accent-soft: #f2e6d8;
  --link: #8a4212;
  --ok: #2f5d3a;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --draft: #7a2323;
  --draft-bg: #fbeaea;
  --mark-ground: #16130f;

  --measure: 68ch;
  --gap: 1rem;
  --radius: 3px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Dark tokens are declared three times on purpose. The default "system"
   setting stamps nothing on the root, so prefers-color-scheme is the only
   signal; an explicit choice stamps data-theme and must beat the OS in both
   directions. Components only ever read the tokens, never a literal. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ece5da;
    --ink-soft: #bdb3a4;
    --ink-faint: #948b7e;
    --paper: #16140f;
    --card: #1f1c16;
    --rule: #353026;
    --rule-strong: #4a4335;
    --accent: #e0a06a;
    --accent-soft: #2d2419;
    --link: #e5a877;
    --ok: #8fc79f;
    --warn: #e0b968;
    --warn-bg: #2b2312;
    --draft: #e79a95;
    --draft-bg: #2f1a19;
    --mark-ground: #2c2419;
  }
}

:root[data-theme="dark"] {
    --ink: #ece5da;
    --ink-soft: #bdb3a4;
    --ink-faint: #948b7e;
    --paper: #16140f;
    --card: #1f1c16;
    --rule: #353026;
    --rule-strong: #4a4335;
    --accent: #e0a06a;
    --accent-soft: #2d2419;
    --link: #e5a877;
    --ok: #8fc79f;
    --warn: #e0b968;
    --warn-bg: #2b2312;
    --draft: #e79a95;
    --draft-bg: #2f1a19;
    --mark-ground: #2c2419;
}

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

/* The UA rule for [hidden] is display:none, but any author rule that sets
   display on the same element beats it - .card sets display:flex, so filtered
   cards kept their layout box and nothing appeared to happen. The filter
   scripts toggle the hidden property, so this override is load-bearing. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 { line-height: 1.2; margin: 1.6em 0 0.5em; font-weight: 650; }
h1 { font-size: 1.85rem; margin-top: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p, ul, ol { margin: 0 0 1em; }
li + li { margin-top: 0.3em; }
/* ...but that rhythm is for prose. Lists used as layout space themselves with
   gap, and the stray top margin is not harmless there: in the flex nav it made
   every item after the first taller by its own margin, so the one item without
   one - the first - stretched to match and its label sat above its siblings. */
.masthead nav li + li,
.crumbs li + li,
.badges li + li,
.grid > li + li,
.verdict-types li + li,
.opts li + li { margin-top: 0; }

code, kbd { font-family: var(--mono); font-size: 0.9em; }
pre { overflow-x: auto; background: var(--card); border: 1px solid var(--rule); padding: 0.8rem; border-radius: var(--radius); }
blockquote {
  margin: 1.2em 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--rule-strong);
  color: var(--ink-soft);
}
hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }

/* ---- Skip link and layout ---- */

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 0.5rem; top: 0.5rem; z-index: 100;
  background: var(--card); color: var(--ink);
  padding: 0.5rem 0.8rem; border: 2px solid var(--accent); border-radius: var(--radius);
}

.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.prose { max-width: var(--measure); }

/* ---- Masthead ---- */

.masthead {
  border-bottom: 2px solid var(--rule-strong);
  background: var(--card);
  position: sticky; top: 0; z-index: 20;
}
.masthead-inner {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 750; font-size: 1.02rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
/* The mark's ground follows the ink token so it reads on either theme. */
.brand-mark { width: 1.45rem; height: 1.45rem; flex: none; color: var(--mark-ground); }
.brand-word { color: var(--ink); }
.brand .amp {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0.16em;
}
.masthead nav { margin-left: auto; }
.masthead nav ul { display: flex; gap: 0.15rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.masthead nav a {
  display: block; padding: 0.3rem 0.55rem; border-radius: var(--radius);
  color: var(--ink-soft); text-decoration: none; font-size: 0.92rem; font-weight: 550;
}
.masthead nav a:hover, .masthead nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

/* ---- Breadcrumbs ---- */

.crumbs { font-size: 0.85rem; color: var(--ink-faint); padding: 0.7rem 0 0; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 0.35rem; color: var(--rule-strong); }

main { padding: 1.2rem 0 3rem; }

/* ---- Page header block ---- */

.page-head { border-bottom: 1px solid var(--rule); padding-bottom: 1rem; margin-bottom: 1.4rem; }
.page-head p.lede { font-size: 1.08rem; color: var(--ink-soft); max-width: var(--measure); margin-bottom: 0; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem;
  font-weight: 700; color: var(--accent); margin: 0 0 0.35rem;
}

/* ---- Badges ---- */

.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0 0; padding: 0; list-style: none; }
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem;
  border: 1px solid var(--rule-strong); border-radius: 999px; color: var(--ink-soft);
  background: var(--card); white-space: nowrap;
}
.badge-accent { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.badge-warn { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.badge-draft { border-color: var(--draft); color: var(--draft); background: var(--draft-bg); }
.badge-ok { border-color: var(--ok); color: var(--ok); }

/* ---- Notices ---- */

.notice {
  border: 1px solid var(--rule-strong); border-left-width: 4px;
  background: var(--card); padding: 0.85rem 1rem; border-radius: var(--radius);
  margin: 0 0 1.4rem; max-width: var(--measure);
}
.notice h2, .notice h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice-draft { border-color: var(--draft); background: var(--draft-bg); }
.notice-warn { border-color: var(--warn); background: var(--warn-bg); }

/* ---- Spec table ---- */

.table-scroll { overflow-x: auto; margin: 0 0 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
caption { text-align: left; font-weight: 650; padding-bottom: 0.4rem; }
th, td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { border-bottom: 2px solid var(--rule-strong); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); }
tbody tr:last-child td { border-bottom: 0; }

.specs { max-width: 34rem; }
.specs th { width: 45%; font-weight: 600; color: var(--ink-soft); }
.specs td { font-variant-numeric: tabular-nums; }

/* ---- Cards and grids ---- */

.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); padding: 0; list-style: none; margin: 0 0 1.6rem; }
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }

.card {
  border: 1px solid var(--rule); background: var(--card);
  border-radius: var(--radius); padding: 0.85rem 0.95rem;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.card h3, .card h2 { margin: 0; font-size: 1rem; }
.card h3 a, .card h2 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover, .card h2 a:hover { color: var(--link); text-decoration: underline; }
.card p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.card .meta { font-size: 0.78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.card-draft { border-style: dashed; }

/* ---- Image slots ---- */

.figure { margin: 0 0 1.2rem; }
.figure img { display: block; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.figure figcaption { font-size: 0.82rem; color: var(--ink-faint); padding-top: 0.4rem; }
.photo-slot {
  border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 1.4rem 1rem; font-size: 0.85rem; min-height: 8rem;
}

/* ---- Timeline ---- */

.timeline { list-style: none; margin: 0 0 1.6rem; padding: 0; border-left: 2px solid var(--rule-strong); }
.timeline li { position: relative; padding: 0 0 1rem 1.1rem; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 0.55em;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.timeline .year { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 0.4rem; }

/* ---- Value bands ---- */

.bands { list-style: none; margin: 0 0 1rem; padding: 0; }
.bands li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.bands li:last-child { border-bottom: 0; }
.bands .range { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }

/* ---- Search / filter UI ---- */

.filters {
  display: grid; gap: 0.7rem; margin: 0 0 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-size: 0.78rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); }
input[type="search"], input[type="text"], select {
  font: inherit; font-size: 0.95rem; padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink); width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button {
  font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  padding: 0.5rem 0.8rem; border-radius: var(--radius);
  border: 1px solid var(--rule-strong); background: var(--card); color: var(--ink);
}
button:hover { border-color: var(--accent); color: var(--accent); }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.result-count { font-size: 0.85rem; color: var(--ink-faint); margin: 0 0 0.8rem; }

/* ---- Identify wizard ---- */

/* One question fills the frame; the running tally sits beside it on a desk and
   above it on a phone, so the reader always sees the answer moving. */
.wizard { display: grid; gap: 1.25rem; align-items: start; margin: 0 0 2rem; }
@media (min-width: 56rem) { .wizard { grid-template-columns: minmax(0, 1fr) 15rem; } }

.wizard-progress { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; margin-bottom: 0.6rem; }
.wizard-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.18s ease-out; }
@media (prefers-reduced-motion: reduce) { .wizard-progress span { transition: none; } }

.wizard-count {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-faint); margin: 0 0 0.9rem; font-weight: 650;
}

.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step-q { font-size: 1.3rem; font-weight: 680; line-height: 1.25; padding: 0; margin: 0 0 0.4rem; }
.step-hint { color: var(--ink-soft); margin: 0 0 0.5rem; font-size: 0.95rem; }
.step-group {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-faint); margin: 0 0 0.9rem; font-weight: 650;
}

/* Big targets: this gets used one-handed, outdoors, in gloves. */
.opts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.4rem; }
.opt { flex: 1 1 9rem; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span {
  display: block; text-align: center; cursor: pointer;
  padding: 0.7rem 0.9rem; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); background: var(--card);
  font-weight: 600; font-size: 0.98rem;
}
.opt span:hover { border-color: var(--accent); color: var(--accent); }
.opt input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.measure-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.measure-row input {
  width: 7.5rem; font-size: 1.35rem; font-weight: 680;
  font-variant-numeric: tabular-nums; padding: 0.5rem 0.6rem;
}
.measure-row span { font-size: 0.95rem; color: var(--ink-faint); }

.wizard-nav { display: flex; gap: 0.5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.wizard-nav #next { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.wizard-nav #next:hover:not(:disabled) { filter: brightness(1.08); }
.wizard-nav button:disabled { opacity: 0.4; cursor: default; }
.wizard-nav .ghost { background: transparent; }
.wizard-nav #reset { margin-left: auto; }

.wizard-aside {
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--card); padding: 0.9rem 1rem;
}
.wizard-aside h2 {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-faint); margin: 0 0 0.3rem;
}
.wizard-aside ul { list-style: none; margin: 0.6rem 0 0; padding: 0; font-size: 0.85rem; color: var(--ink-soft); }
.wizard-aside li { padding: 0.22rem 0; border-top: 1px solid var(--rule); }
.wizard-aside li + li { margin-top: 0; }

.wizard-result {
  border: 2px solid var(--accent); border-radius: var(--radius);
  background: var(--accent-soft); padding: 1.1rem 1.2rem;
}
.wizard-result h2 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--accent); margin: 0 0 0.3rem;
}
.range-out { font-size: 2rem; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--accent); line-height: 1.05; }
.wizard-aside .range-out { font-size: 1.4rem; }
.wizard-result p { margin: 0.5rem 0 0; font-size: 0.92rem; color: var(--ink-soft); }

.verdict-types { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.7rem 0 0; padding: 0; }
.verdict-types li { display: flex; align-items: baseline; gap: 0.35rem; }
.verdict-types li + li { margin-top: 0; }
.verdict-types a {
  font-weight: 650; font-size: 0.85rem; text-decoration: none;
  border: 1px solid var(--accent); border-radius: 999px; padding: 0.1rem 0.55rem;
}
.verdict-types span { font-size: 0.78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.verdict-why { margin-top: 1rem; background: transparent; }
.verdict-why ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--ink-soft); }

/* ---- Identify: measurement and candidates ---- */

.identify-measure { border-color: var(--accent); }
.measure-row { display: flex; align-items: center; gap: 0.5rem; }
.measure-row input {
  width: 7rem; font-size: 1.15rem; font-weight: 650;
  font-variant-numeric: tabular-nums; padding: 0.4rem 0.55rem;
}
.measure-row span { font-size: 0.9rem; color: var(--ink-faint); }

/* The answer the page exists to give, so it outranks the reasoning below it. */
.candidates { border-top: 1px solid var(--rule-strong); margin-top: 0.9rem; padding-top: 0.8rem; }
.candidates h3 {
  margin: 0 0 0.5rem; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-faint);
}
.candidates ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.candidates li { display: flex; flex-direction: column; gap: 0.1rem; }
.candidates li + li { margin-top: 0; }
.candidates a { font-weight: 650; text-decoration: none; line-height: 1.25; }
.candidates a:hover { text-decoration: underline; }
.candidate-meta { font-size: 0.78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.candidates .why { margin: 0.6rem 0 0; }

/* ---- Source list ---- */

.sources { font-size: 0.88rem; }
.sources li { margin-bottom: 0.5rem; }
.sources .kind { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }

details { border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.6rem 0.8rem; margin-bottom: 1rem; background: var(--card); }
summary { cursor: pointer; font-weight: 620; }
details[open] summary { margin-bottom: 0.6rem; }

/* ---- Footer ---- */

.site-foot {
  border-top: 2px solid var(--rule-strong); background: var(--card);
  padding: 1.6rem 0 2.4rem; font-size: 0.88rem; color: var(--ink-soft);
}
.site-foot .cols { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.site-foot h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); margin: 0 0 0.4rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 0.25rem; }
.disclosure { border-top: 1px solid var(--rule); margin-top: 1.4rem; padding-top: 1rem; font-size: 0.82rem; color: var(--ink-faint); max-width: var(--measure); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 40rem) {
  body { font-size: 16px; }
  h1 { font-size: 1.5rem; }
  .masthead-inner { padding: 0.5rem 0; }
  .masthead nav { margin-left: 0; width: 100%; overflow-x: auto; }
  .masthead nav ul { flex-wrap: nowrap; }
  /* Thumb-sized answers: this tool is used standing over a plane, one-handed. */
  .opt span { padding: 0.45rem 0.75rem; font-size: 0.9rem; }
  .check { padding: 0.45rem 0; }
  .check input { width: 1.15rem; height: 1.15rem; }
}

@media print {
  .masthead, .site-foot, .filters, .verdict { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
}
