/* Proving Ground: shared base, loaded by every page after tokens.css.
   Reset, the type roles, the top bar (src/nav.js) and the controls. One voice for the app and its sibling pages.
   The rules behind the numbers are in app/TYPE.md. Colours come from tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--void); color-scheme: dark; -webkit-text-size-adjust: 100%; font-size: 100%; }
/* Presenter mode: the interface grows with the projector's frame (about one step at 1920 x 1080), and never
   drops under the 16 px floor on a smaller frame. Nothing reflows between rooms. */
html.is-present { font-size: clamp(16px, min(1.125vw, 2vh), 30px); }
body {
  margin: 0; background: var(--void); color: var(--bone);
  font-family: var(--f-ui); font-size: var(--t-body); font-weight: var(--w-regular); line-height: var(--lh-body);
  font-kerning: normal; font-optical-sizing: auto;
  font-synthesis: none;                       /* never a faked bold, italic or small capital */
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: inherit; font-size: inherit; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
img, canvas, svg { display: block; }
strong, b { font-weight: var(--w-strong); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--on-ink); padding: 8px 12px; z-index: 50; font-size: var(--t-small); }
.skip:focus { left: 8px; }

/* ------------------------------------------------------------------ type roles */
/* the one statement or question of a view: Jost 500, sentence case */
.h1 { font-family: var(--f-display); font-weight: var(--w-display); font-size: var(--t-6); line-height: var(--lh-display); letter-spacing: var(--tr-display); text-wrap: balance; }
/* a name in a list or a panel: Jost 500, sentence case (capitals are kept for the one named thing) */
.place { font-family: var(--f-ui); font-style: normal; font-weight: var(--w-place); letter-spacing: var(--tr-place); text-wrap: balance; }
/* the one named thing (a 3D block, the selected site, a card title): tracked capitals */
.name-caps { font-family: var(--f-ui); font-weight: var(--w-medium); text-transform: uppercase; letter-spacing: var(--track-caps); line-height: var(--lh-tight); word-spacing: -0.06em; }
.kicker { font-family: var(--f-ui); font-weight: var(--w-medium); font-size: var(--t-small); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ash); line-height: 1.2; }
/* a section head inside a view */
.h3 { font-family: var(--f-ui); font-weight: var(--w-strong); font-size: var(--t-body); line-height: 1.25; letter-spacing: 0; color: var(--bone); margin: 0 0 var(--s-2); text-wrap: balance; }
.h2 { font-family: var(--f-ui); font-weight: var(--w-medium); font-size: var(--t-4); line-height: 1.12; letter-spacing: var(--tr-display); text-wrap: balance; }
.lead { font-size: var(--t-lead); line-height: var(--lh-lead); color: var(--ash); max-width: var(--measure); text-wrap: pretty; }
.fine { font-size: var(--t-small); color: var(--smoke); line-height: var(--lh-small); max-width: var(--measure-small); text-wrap: pretty; }
/* the label of a control, a readout or a column: decided once */
.label, .field-label, .ctl-label { font-size: var(--t-small); font-weight: var(--w-medium); color: var(--ash); letter-spacing: var(--tr-label); line-height: var(--lh-tight); }
/* numbers: Jost 650, tabular where they line up; the unit beside them is 400 and never in capitals */
.num { font-variant-numeric: tabular-nums lining-nums; }
.unit { font-weight: var(--w-regular); text-transform: none; letter-spacing: 0; color: var(--ash); }
/* an explanation in our own hand; one weight, never bold, never slanted */
.hand { font-family: var(--f-hand); font-style: normal; font-weight: 400; color: var(--ink); font-size: var(--t-hand); line-height: 1.2; letter-spacing: 0; }
.ink path { fill: none; }
.ink-text { font-family: var(--f-hand); font-weight: 400; fill: var(--ink); stroke: var(--casing); stroke-width: 4px; paint-order: stroke; stroke-linejoin: round; }

.loading { color: var(--ash); font-size: var(--t-small); }
.note-amber { color: var(--amber); font-size: var(--t-small); line-height: var(--lh-small); border-left: 2px solid var(--amber); padding: 2px 0 2px var(--s-3); max-width: var(--measure-small); text-wrap: pretty; }
/* a plain note (a list made for another test, a missing file): not a break, so not amber */
.note { color: var(--ash); font-size: var(--t-small); line-height: var(--lh-small); border-left: 2px solid var(--line-strong); padding: 2px 0 2px var(--s-3); max-width: var(--measure-small); text-wrap: pretty; }
.textlink { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; font-size: var(--t-small); }
.textlink:hover { text-decoration-thickness: 2px; }

/* readouts: a quiet label over a strong value. Used beside every terrain and in every panel. */
.readouts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.readouts > div { display: grid; gap: 1px; }
.readouts dt { font-size: var(--t-small); font-weight: var(--w-medium); color: var(--ash); letter-spacing: var(--tr-label); line-height: var(--lh-tight); }
.readouts dd { font-size: var(--t-lead); font-weight: var(--w-strong); line-height: var(--lh-tight); font-variant-numeric: tabular-nums lining-nums; }
.readouts dd.is-amber { color: var(--amber); }

/* which world a thing belongs to: a disc in the world's colour and its name */
.bodytag { display: inline-flex; align-items: center; gap: 0.45em; font-size: var(--t-small); font-weight: var(--w-medium); text-transform: uppercase; letter-spacing: var(--track-caps); line-height: var(--lh-tight); }
/* world tones for the disc only; the word stays ash (palette rule: world tones for discs and areas) */
.bodytag { color: var(--ash); }
.bodytag::before { content: ""; width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--tone, currentColor); flex: none; }
.bodytag.is-mars { --tone: var(--mars); }
.bodytag.is-earth { --tone: var(--earth); }
.bodytag.is-moon { --tone: var(--moon); }

/* marks for placeholder numbers */
.sample-mark { font-size: var(--t-micro); font-weight: var(--w-strong); letter-spacing: var(--tr-label); line-height: 1.3; color: var(--amber); border: 1px solid currentColor; border-radius: 2px; padding: 0 0.4em 0.05em; margin-left: 0.6em; vertical-align: 0.12em; white-space: nowrap; }
.sample-tag { font-size: var(--t-micro); font-weight: var(--w-strong); letter-spacing: var(--tr-stamp); line-height: 1; color: var(--amber); border: 1.5px solid var(--amber); padding: 0.42em 0.7em 0.36em; border-radius: 2px; white-space: nowrap; background: var(--amber-wash); }

/* a small status label: Known analog, Published analog pair, Reviewed ... */
.chip { display: inline-flex; align-items: center; gap: 0.4em; font-size: var(--t-small); font-weight: var(--w-medium); line-height: 1.2; color: var(--ash); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.18em 0.7em 0.22em; white-space: nowrap; }
.chip.is-ink { color: var(--bone); border-color: var(--ink); }
.badge { font-size: var(--t-small); font-weight: var(--w-medium); white-space: nowrap; color: var(--bone); }

/* verdict: a four-step meter, then the fixed words (Most recommended ... Not fully measured) */
.verdict { --pip: var(--v-rec); display: inline-flex; align-items: center; gap: 0.55em; font-weight: var(--w-medium); font-size: var(--t-small); line-height: var(--lh-tight); white-space: nowrap; color: var(--pip); }
.verdict::before {
  content: ""; width: 29px; height: 9px; flex: none; color: var(--pip);
  background:
    repeating-linear-gradient(90deg, currentColor 0 5px, transparent 5px 8px) 0 0 / var(--pips, 29px) 100% no-repeat,
    repeating-linear-gradient(90deg, var(--bone-4) 0 5px, transparent 5px 8px);
}
.verdict--most, .v-most { --pips: 29px; --pip: var(--v-most); }
.verdict--rec, .v-rec { --pips: 21px; --pip: var(--v-rec); }
.verdict--res, .v-res { --pips: 13px; --pip: var(--v-res); }
.verdict--not, .v-not { --pips: 5px; --pip: var(--v-not); }
.verdict--partial, .v-partial { --pips: 0px; --pip: var(--v-partial); }
.verdict-big { font-size: var(--t-body); }
/* a verdict inside a list row: quiet pip and word. Amber is kept for the detail pane, once per screen */
.verdict.is-quiet { --pip: var(--smoke); color: var(--smoke); font-weight: var(--w-regular); }

/* a measure's bar, 0 to 100 (src/ui.js fidelityBar): one scale, amber below 40, ticks at the break (40) and match (60) lines */
.mbar { position: relative; display: block; height: 0.6rem; min-width: 4rem; background: var(--bone-2); border-radius: 1px; }
.mbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bone); border-radius: 1px; }
.mbar.is-broken .mbar-fill { background: var(--amber); }
.mbar.is-mock .mbar-fill { opacity: 0.55; }
.mbar-tick { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.mbar-tick.is-40 { left: 40%; }
.mbar-tick.is-60 { left: 60%; }
.mbar.is-empty { background: none; border: 1px dashed var(--line-strong); }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; cursor: pointer;
  font-family: var(--f-ui); font-size: var(--t-small); font-weight: var(--w-medium); line-height: 1; letter-spacing: var(--tr-label);
  min-height: var(--tap); padding: 0.6em 1.15em; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: transparent; color: var(--bone); text-decoration: none; white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { border-color: var(--bone); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-size: var(--t-body); font-weight: var(--w-medium); padding: 0.6em 1.2em; letter-spacing: 0; }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-quiet { padding: 0.55em 0.85em; font-weight: var(--w-medium); }
.btn-quiet[aria-pressed="true"], .btn-quiet.is-picked, .btn-quiet.on { background: var(--ink-wash); border-color: var(--ink); color: var(--bone); box-shadow: inset 0 -2px 0 var(--ink); }
.btn-icon { padding: 0.3em 0.75em 0.45em; font-size: var(--t-lead); line-height: 1; min-width: var(--tap); }

/* a switch with two to five positions: the chosen one is lit, not filled */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--bone-1); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label, .seg button {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap);
  padding: 0.45em 1em; font-size: var(--t-small); font-weight: var(--w-medium); line-height: 1.1; letter-spacing: var(--tr-label);
  cursor: pointer; color: var(--ash); white-space: nowrap; background: none; border: 0; border-left: 1px solid var(--line-strong); border-radius: 0;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.seg label:first-of-type, .seg button:first-child { border-left: 0; }
.seg label:hover, .seg button:hover { color: var(--bone); }
.seg input:checked + label, .seg button.on, .seg button[aria-pressed="true"] { background: var(--ink-wash); color: var(--bone); box-shadow: inset 0 -2px 0 var(--ink); }
.seg input:focus-visible + label { outline: 2px solid var(--bone); outline-offset: -3px; }
.seg-small label, .seg-small button { padding: 0.4em 0.75em; }
/* a radio switch with more positions than fit one row: two columns */
.seg.seg-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-wrap label { border-left: 0; border-top: 1px solid var(--line-strong); text-align: center; }
.seg-wrap label:nth-of-type(-n+2) { border-top: 0; }
.seg-wrap label:nth-of-type(even) { border-left: 1px solid var(--line-strong); }
.seg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-grid button { border-left: 0; border-top: 1px solid var(--line-strong); text-align: center; }
.seg-grid button:nth-child(-n+2) { border-top: 0; }
.seg-grid button:nth-child(even) { border-left: 1px solid var(--line-strong); }
.seg-grid button.is-wide { grid-column: 1 / -1; }

.field { display: grid; gap: var(--s-2); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: var(--tap); background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
.range::-moz-range-track { height: 2px; background: var(--line-strong); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 0; margin-top: -10px; }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 0; }
.range:disabled { opacity: 0.4; cursor: default; }

.check { display: flex; gap: 0.6em; align-items: flex-start; font-size: var(--t-small); line-height: var(--lh-small); color: var(--bone); cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 1.05em; height: 1.05em; margin: 0.16em 0 0; border: 1px solid var(--line-strong); border-radius: 2px; background: transparent; cursor: pointer; display: grid; place-items: center; }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { content: ""; width: 0.5em; height: 0.28em; border: solid var(--on-ink); border-width: 0 0 2px 2px; transform: translateY(-0.06em) rotate(-45deg); }
.check small { display: block; font-size: var(--t-small); color: var(--smoke); }

.select { appearance: none; -webkit-appearance: none; font-size: var(--t-small); font-weight: var(--w-medium); line-height: 1.2; color: var(--bone); background-color: var(--bone-1);
  background-image: linear-gradient(45deg, transparent 50%, var(--ash) 50%), linear-gradient(135deg, var(--ash) 50%, transparent 50%);
  background-position: right 1.05em center, right 0.75em center; background-size: 0.32em 0.32em, 0.32em 0.32em; background-repeat: no-repeat;
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.5em 2em 0.5em 0.75em; min-height: var(--tap); cursor: pointer; max-width: 100%; }
.select:hover { border-color: var(--bone); }
.select option { background: var(--stage); color: var(--bone); }

/* ------------------------------------------------------------------ top bar (every page: src/nav.js) */
/* opaque, so nothing scrolls visibly under it */
.bar {
  position: sticky; top: 0; z-index: 20; height: var(--bar-h); display: flex; align-items: center; gap: var(--s-5);
  padding: 0 var(--gutter); background: var(--stage); border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--f-ui); font-weight: var(--w-medium); font-size: var(--t-small); text-transform: uppercase; letter-spacing: 0.14em; word-spacing: -0.1em;
  line-height: 1; text-decoration: none; white-space: nowrap; color: var(--bone); display: inline-flex; align-items: center; min-height: var(--tap); }
.nav { display: flex; align-items: center; gap: var(--s-5); flex: 1; min-width: 0; height: 100%; }
.nav-steps, .nav-side { display: flex; align-items: center; gap: clamp(0.5rem, 1.4vw, 1.5rem); height: 100%; }
.nav-side { margin-left: auto; }
.nav-sep { width: 1px; height: 1.4rem; background: var(--line-strong); flex: none; }
.nav a { display: inline-flex; align-items: center; gap: 0.45em; min-height: var(--tap); font-size: var(--t-small); font-weight: var(--w-medium); letter-spacing: var(--tr-label); line-height: 1;
  color: var(--ash); text-decoration: none; white-space: nowrap; padding: 0 0.15em; border-bottom: 2px solid transparent; transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.nav a:hover { color: var(--bone); }
.nav a[aria-current="page"] { color: var(--bone); border-bottom-color: var(--ink); }
.nav-n { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; border-radius: 50%; border: 1px solid var(--line-strong); font-weight: var(--w-strong); font-size: max(0.9em, 1rem);
  font-variant-numeric: tabular-nums lining-nums; color: var(--ash); }
.nav a[aria-current="page"] .nav-n { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.nav-short { display: none; }
.nav-more { position: relative; display: none; }
.nav-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4em; min-height: var(--tap); padding: 0 0.5em;
  font-size: var(--t-small); font-weight: var(--w-medium); color: var(--ash); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more[open] > summary { color: var(--bone); border-color: var(--bone); }
.nav-more-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 12rem; display: grid; padding: 0.35rem; background: var(--stage); border: 1px solid var(--line-strong); border-radius: var(--radius); z-index: 40; }
.nav-more-list a { padding: 0 0.75em; border-bottom: 0; }
.nav-more-list a[aria-current="page"] { color: var(--bone); box-shadow: inset 2px 0 0 var(--ink); }
.bar-right { display: flex; align-items: center; gap: var(--s-3); }
/* finds pass: five destinations in one row, the current one in bone with a bone rule under it */
.nav-steps { gap: clamp(1rem, 2.2vw, 2.25rem); }
.nav a { color: var(--ash); }
.nav a[aria-current="page"] { color: var(--bone); border-bottom-color: var(--bone); }
@media (max-width: 860px) {
  .nav-wide { display: none; }
  .nav-more { display: block; margin-left: auto; }
}
/* phone: two rows. The name and "More" on top; the three steps below, each a full-height target. */
@media (max-width: 720px) {
  :root { --bar-h: 5.75rem; }
  .bar { flex-wrap: wrap; align-content: stretch; gap: 0 var(--s-3); padding-top: 0; padding-bottom: 0; height: var(--bar-h); }
  .wordmark { flex: 1; min-height: 2.75rem; }
  .bar-right { order: 2; }
  .nav { display: contents; }
  .nav-more { order: 3; margin-left: 0; }
  .nav-steps { order: 4; flex-basis: 100%; height: 3rem; justify-content: space-between; gap: 0; border-top: 1px solid var(--line); }
  .nav-steps li.nav-wide { display: none; }
  .nav-steps li { flex: 1; display: flex; }
  .nav-steps a { flex: 1; justify-content: center; min-height: 3rem; }
  .nav-long { display: none; }
  .nav-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
