/* Slipway base: reset, type, focus and the shared controls. Owner: foundation; nobody else edits this file.
   Every value comes from tokens.css. The gallery webdev/harness/foundation.html shows each class below.

   Contents
     1 reset            6 buttons            11 switch, stepper       16 table
     2 type             7 tag, count, chip   12 choice cards          17 facts, status, notice
     3 icons            8 segmented choice   13 menu                  18 progress bar
     4 focus            9 rows and fields    14 popover               19 empty and loading
     5 surfaces        10 slider + number    15 tooltip               20 forced colours, motion */

/* ------------------------------------------------------------------ 1 reset */
*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line-control) transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--space-edge);
  color: var(--ink);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
h1, h2, h3, h4, p, ul, ol, dl, dd, dt, figure, pre { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg, canvas { display: block; }
table { border-collapse: collapse; border-spacing: 0; }

/* text for screen readers only */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ 2 type */
/* numbers, file names, item names */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 0.94em; }
/* a quiet label over or beside a value: sentence case */
.label { display: flex; align-items: center; gap: var(--s-2); color: var(--ink-3); font: 500 var(--fs-small)/var(--lh-tight) var(--font-ui); }
/* capital letters: only for the brand, the title of a panel and the title of a group */
.caps { font: 600 var(--fs-label)/var(--lh-tight) var(--font-label); letter-spacing: var(--track-caps); text-transform: uppercase; }
/* secondary text */
.note { color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.note .icon { display: inline-block; vertical-align: calc(var(--s-1) * -1); margin-right: var(--s-2); }
.note--lead { color: var(--ink-2); }
/* a text link */
.textlink { display: inline-flex; align-items: center; gap: var(--s-2); padding: 0; border: 0; border-bottom: var(--hair) solid var(--line-bright); background: transparent; color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-snug); text-decoration: none; }
.textlink:hover { color: var(--ink); border-bottom-color: var(--ink); }
.textlink:active { color: var(--ink-2); }
code, kbd { white-space: nowrap; }
code { padding: 0 var(--s-2); border: var(--hair) solid var(--line-strong); border-radius: var(--r-1); background: var(--hull-sunk); font-family: var(--font-num); font-size: 0.9em; }
kbd { display: inline-block; min-width: var(--h-line); padding: 0 var(--s-2); border: var(--hair) solid var(--line-control); border-radius: var(--r-1); background: var(--hull-raise); font: 500 var(--fs-label)/1.6 var(--font-num); text-align: center; }

/* ------------------------------------------------------------------ 3 icons (the set is in js/ui/icons.js) */
.sprite { position: absolute; }
.icon { width: var(--icon); height: var(--icon); flex: none; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: square; stroke-linejoin: miter; }
.icon--s { width: var(--icon-s); height: var(--icon-s); stroke-width: 1.6; }
.icon--l { width: var(--icon-l); height: var(--icon-l); }
.icon--xl { width: var(--icon-xl); height: var(--icon-xl); }

/* ------------------------------------------------------------------ 4 focus */
/* One rule for every control: a real outline, so it stays visible in forced colours and is never a shadow.
   A control that touches the edge of a scrolling box sets --focus-off to a negative value (see .focus-in). */
:focus-visible { outline: var(--focus-w) solid var(--focus-ring); outline-offset: var(--focus-off); }
.focus-in:focus-visible, .focus-in :focus-visible { outline-offset: calc(var(--focus-w) * -1); }
/* controls that hide their native input draw the outline on the visible face */
.seg__opt input:focus-visible + .seg__face,
.switch input:focus-visible + .switch__track,
.choice input:focus-visible + .choice__face { outline: var(--focus-w) solid var(--focus-ring); outline-offset: var(--focus-off); }

/* ------------------------------------------------------------------ 5 surfaces */
/* everything that floats over the 3D view */
.surface, .bar, .panel, .log, .seq, .dropzone, .menu, .popover, .toast {
  background: var(--hull-glass);
  border: var(--hair) solid var(--line-strong); border-radius: var(--r-3);
  box-shadow: var(--shadow-panel);
}
.bar { display: flex; align-items: center; gap: var(--s-3); min-height: var(--h-top); padding: 0 var(--s-3); }
.bar__sep { flex: none; width: var(--hair); align-self: stretch; margin: var(--s-3) var(--s-1); background: var(--line-strong); }
/* a framed block inside a panel */
.well { padding: var(--s-3) var(--s-4); border: var(--hair) solid var(--line-strong); border-radius: var(--r-2); background: var(--hull-sunk); }

/* ------------------------------------------------------------------ 6 buttons */
/* .btn + one of --line (default action), --go (the one warm action of a panel), --quiet (in a bar).
   Sizes: --lg, --sm. Shape: --wide, --sq. Inside: .icon, <span>word</span>, .btn__file (may shorten), .btn__meta. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  min-width: 0; min-height: var(--h-control); padding: 0 var(--s-4);
  border: var(--hair) solid transparent; border-radius: var(--r-2); background: transparent; color: var(--ink);
  font: 500 var(--fs-control)/1.15 var(--font-ui); white-space: nowrap; text-decoration: none;
  transition: background var(--t-1) var(--ease), border-color var(--t-1) var(--ease), color var(--t-1) var(--ease), translate var(--t-1) var(--ease);
}
.btn > * { flex: none; }
.btn:active { translate: 0 var(--hair); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: var(--o-disabled); cursor: not-allowed; translate: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn--line { border-color: var(--line-control); background: var(--hull-raise); }
.btn--line:hover:not(:disabled) { border-color: var(--line-bright); background: var(--hull-raise-2); }
.btn--line:active:not(:disabled) { background: var(--hull-sunk); }
.btn--quiet { color: var(--ink-2); }
.btn--quiet:hover:not(:disabled), .btn--quiet[aria-expanded="true"] { background: var(--hull-raise-2); color: var(--ink); }
.btn--go { background: var(--warm); color: var(--ink-inverse); font-weight: 600; }
.btn--go:hover:not(:disabled) { background: var(--warm-strong); }
.btn--go:active:not(:disabled) { background: var(--warm); }
.btn--lg { min-height: var(--h-control-lg); padding: 0 var(--s-5); font-size: var(--fs-body); }
.btn--sm { min-height: var(--h-mini); padding: 0 var(--s-3); font-size: var(--fs-small); }
.btn--wide { width: 100%; }
.btn--sq { padding: 0 var(--s-3); gap: var(--s-2); font-family: var(--font-num); font-size: var(--fs-small); }
/* a file name inside a button gets shorter before anything else; a measure (.btn__meta) never does */
.btn__file { flex: 0 1 auto; min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; font: 400 var(--fs-small)/1.2 var(--font-num); opacity: var(--o-soft); }
.btn__meta { margin-left: auto; font: 400 var(--fs-small)/1.2 var(--font-num); opacity: var(--o-soft); }
.btn__file + .btn__meta { margin-left: 0; }
/* two buttons side by side */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.pair .btn { justify-content: flex-start; padding: 0 var(--s-3); }

/* a button that is only an icon: give it an aria-label and a data-tip */
.iconbtn {
  display: inline-grid; place-items: center; flex: none; width: var(--h-control); height: var(--h-control); padding: 0;
  border: var(--hair) solid transparent; border-radius: var(--r-2); background: transparent; color: var(--ink-2);
  transition: background var(--t-1) var(--ease), border-color var(--t-1) var(--ease), color var(--t-1) var(--ease);
}
.iconbtn:hover:not(:disabled) { background: var(--hull-raise-2); color: var(--ink); }
.iconbtn:active:not(:disabled) { background: var(--hull-sunk); }
.iconbtn:disabled { opacity: var(--o-disabled); cursor: not-allowed; }
/* a toggle: pressed has a frame and a fill, not pressed has none */
.iconbtn[aria-pressed="true"] { color: var(--cold-strong); background: var(--cold-wash); border-color: var(--cold-line); }
.iconbtn[aria-pressed="false"] { color: var(--ink-3); }
.iconbtn--s { width: var(--h-mini); height: var(--h-mini); }
.iconbtn--line { border-color: var(--line-control); background: var(--hull-raise); }

/* ------------------------------------------------------------------ 7 tag, count, chip */
/* a tag names a kind: a file extension, a format */
.tag {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--h-tag); padding: 0 var(--s-2);
  border: var(--hair) solid var(--line-strong); border-radius: var(--r-1);
  font: 400 var(--fs-label)/1 var(--font-num); color: var(--ink-2); white-space: nowrap;
}
.tag--cold { border-color: var(--cold-line); color: var(--cold); }
.tag--warm { border-color: var(--warm-line); color: var(--warm); }
.tag--hot { border-color: var(--hot-line); color: var(--hot); }
/* a count next to a word; --warm and --hot always carry an icon */
.count { display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--h-tag); padding: 0 var(--s-2); border: var(--hair) solid var(--line-strong); border-radius: var(--r-1); font-size: var(--fs-label); color: var(--ink-2); }
.count--warm { border-color: var(--warm-line); color: var(--warm); }
.count--hot { border-color: var(--hot-line); color: var(--hot); }
/* a chip is one object or one chosen value: an open file, a setting of a folded panel.
   Inside: .icon or .chip__dot, .chip__label (its kind), .chip__text (may shorten), .chip__state, .chip__close */
.chip { display: inline-flex; align-items: center; gap: var(--s-3); min-width: 0; min-height: var(--h-control); padding: 0 var(--s-3); border: var(--hair) solid var(--line-control); border-radius: var(--r-2); background: var(--hull-raise); font-size: var(--fs-control); white-space: nowrap; }
.chip > .icon { color: var(--ink-3); }
.chip__dot { flex: none; width: var(--chip); height: var(--chip); border-radius: var(--r-1); background: var(--c, var(--ink-3)); box-shadow: inset 0 0 0 var(--hair) var(--line-strong); }
.chip__label { flex: none; color: var(--ink-3); font-size: var(--fs-small); }
.chip__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip__state { flex: none; color: var(--ink-3); font-size: var(--fs-small); }
.chip__close { display: grid; place-items: center; flex: none; width: var(--target); height: var(--target); margin-right: calc(var(--s-2) * -1); padding: 0; border: 0; border-radius: var(--r-1); background: transparent; color: var(--ink-3); }
.chip__close:hover { background: var(--hull-raise-2); color: var(--ink); }
.chip__close:active { background: var(--hull-sunk); }
.chip--s { min-height: var(--h-mini); padding: 0 var(--s-3); gap: var(--s-2); font-size: var(--fs-small); }
.chip--pending { border-style: dashed; background: transparent; }
.chip--new { border-color: var(--cold-line); }
.chip--new > .icon { color: var(--cold); }
.chip--bad { border-color: var(--hot-line); }
.chip--bad > .icon { color: var(--hot); }

/* ------------------------------------------------------------------ 8 segmented choice */
/* Native radio inputs, so the arrow keys work:
   <div class="seg" role="radiogroup" aria-labelledby="…">
     <label class="seg__opt"><input type="radio" name="…" value="…"><span class="seg__face">Word</span></label> …
   Variants: --fill (takes the row), --cap (a word and a caption: <b>M</b><small>64 m</small>), --icons (no frame). */
.seg { display: inline-flex; gap: var(--s-1); padding: var(--s-1); border: var(--hair) solid var(--line-control); border-radius: var(--r-2); background: var(--hull-sunk); min-width: 0; }
.seg--fill { display: flex; flex: 1; }
.seg--fill .seg__opt { flex: 1 1 0; }
.seg__opt { position: relative; display: flex; min-width: 0; }
.seg__opt input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg__face {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--h-mini); padding: 0 var(--s-3); border: var(--hair) solid transparent; border-radius: var(--r-1);
  color: var(--ink-2); font: 500 var(--fs-control)/1.1 var(--font-ui); white-space: nowrap;
  transition: background var(--t-1) var(--ease), border-color var(--t-1) var(--ease), color var(--t-1) var(--ease);
}
.seg__face.num { font-family: var(--font-num); font-size: var(--fs-small); }
.seg__opt:hover input:not(:disabled):not(:checked) + .seg__face { background: var(--hull-raise); color: var(--ink); }
.seg__opt input:active:not(:disabled) + .seg__face { background: var(--hull-raise-2); }
.seg__opt input:checked + .seg__face { background: var(--cold-wash); border-color: var(--cold-line); color: var(--cold-strong); font-weight: 600; }
.seg__opt input:disabled { cursor: not-allowed; }
.seg__opt input:disabled + .seg__face { color: var(--ink-3); opacity: var(--o-muted); }
.seg__opt input:disabled:checked + .seg__face { background: transparent; border-color: var(--line-control); border-style: dashed; }
.seg--cap .seg__face { flex-direction: column; gap: var(--s-1); min-height: var(--h-cap); padding: var(--s-2) var(--s-2); }
.seg--cap b { font: 600 var(--fs-control)/1 var(--font-ui); }
.seg--cap small { font: 400 var(--fs-label)/1 var(--font-ui); color: var(--ink-3); }
.seg--cap input:checked + .seg__face small { color: var(--cold); }
.seg--icons { border-color: transparent; background: transparent; padding: 0; }

/* ------------------------------------------------------------------ 9 rows and fields */
/* a label on the left and a control on the right */
.row { display: flex; align-items: center; gap: var(--s-3); min-height: var(--h-control); min-width: 0; }
.row__label { flex: none; width: var(--w-label); color: var(--ink-2); font-size: var(--fs-control); line-height: var(--lh-tight); }
.row > .seg:not(.seg--fill) { flex: none; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
/* a label over a control, with a hint or an error under it */
.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field__label { color: var(--ink-2); font-size: var(--fs-control); line-height: var(--lh-tight); }
.field__hint { color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.field__error { display: flex; align-items: flex-start; gap: var(--s-2); color: var(--hot); font-size: var(--fs-small); line-height: var(--lh-snug); }
.field__error .icon { margin-top: var(--hair); }

.input {
  flex: 1; min-width: 0; height: var(--h-control); padding: 0 var(--s-3);
  border: var(--hair) solid var(--line-control); border-radius: var(--r-2); background: var(--hull-sunk); color: var(--ink);
  font-size: var(--fs-control);
  transition: border-color var(--t-1) var(--ease), background var(--t-1) var(--ease);
}
.input::placeholder { color: var(--ink-3); opacity: 1; }
.input:hover:not(:disabled) { border-color: var(--line-bright); }
.input:focus-visible { border-color: var(--cold); }
.input:disabled { opacity: var(--o-disabled); cursor: not-allowed; }
.input[aria-invalid="true"] { border-color: var(--hot); border-width: var(--stripe); }
.input.num { font-size: var(--fs-small); }
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; text-align: right; }
.input[type="number"]::-webkit-inner-spin-button, .input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
/* a field followed by its unit */
.unitfield { flex: 1; display: flex; align-items: center; gap: var(--s-3); min-width: 0; color: var(--ink-3); font-size: var(--fs-small); }
.unitfield .input { flex: none; width: var(--w-label); }
/* a field with a search icon */
.search { position: relative; display: flex; min-width: 0; }
.search > .icon { position: absolute; left: var(--s-3); top: calc((var(--h-control) - var(--icon)) / 2); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: var(--s-7); }

/* ------------------------------------------------------------------ 10 slider with a number field */
/* <div class="slide"><input class="slider" type="range" …><span class="slide__field"><input class="input num slide__num" type="number" …><span class="slide__unit">%</span></span></div>
   js/ui/controls.js keeps the two inputs and the filled part of the track (--p) together. */
.slide { flex: 1; display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.slide__field { flex: none; display: flex; align-items: center; gap: var(--s-2); color: var(--ink-3); font-size: var(--fs-small); }
.slide__num { flex: none; width: var(--w-value); }
.slide__unit { min-width: 1ch; }
.slide__value { flex: none; min-width: var(--w-value); text-align: right; color: var(--ink); }
.slider { flex: 1; min-width: 0; height: var(--h-control); margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: var(--h-bar-s); border-radius: var(--r-1); background: linear-gradient(to right, var(--cold) var(--p, 50%), var(--line-control) var(--p, 50%)); }
.slider::-moz-range-track { height: var(--h-bar-s); border-radius: var(--r-1); background: var(--line-control); }
.slider::-moz-range-progress { height: var(--h-bar-s); border-radius: var(--r-1); background: var(--cold); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: var(--s-4); height: var(--h-line); margin-top: calc((var(--h-bar-s) - var(--h-line)) / 2); border: var(--hair) solid var(--cold); border-radius: var(--r-1); background: var(--hull-raise); transition: background var(--t-1) var(--ease); }
.slider::-moz-range-thumb { width: var(--s-4); height: var(--h-line); border: var(--hair) solid var(--cold); border-radius: var(--r-1); background: var(--hull-raise); }
.slider:hover::-webkit-slider-thumb { background: var(--hull-raise-2); border-color: var(--cold-strong); }
.slider:hover::-moz-range-thumb { background: var(--hull-raise-2); border-color: var(--cold-strong); }
.slider:active::-webkit-slider-thumb { background: var(--cold); }
.slider:active::-moz-range-thumb { background: var(--cold); }
.slider:disabled { opacity: var(--o-disabled); cursor: not-allowed; }

/* ------------------------------------------------------------------ 11 switch, stepper */
/* <div class="toggle"><div class="toggle__text"><label for="x">Name</label><small>What it does.</small></div>
     <span class="switch"><input type="checkbox" role="switch" id="x"><span class="switch__track"></span></span></div>
   The track shows the word On or Off: the state never depends on colour alone. */
.toggle { display: flex; align-items: flex-start; gap: var(--s-4); }
.toggle__text { flex: 1; display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.toggle__text label { font-weight: 500; line-height: var(--lh-snug); cursor: pointer; }
.toggle__text small { color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.switch { position: relative; flex: none; width: var(--w-switch); height: var(--h-switch); margin-top: var(--s-1); }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; border: var(--hair) solid var(--line-control); border-radius: var(--r-2); background: var(--hull-sunk); transition: background var(--t-2) var(--ease), border-color var(--t-2) var(--ease); }
.switch__track::before { content: ""; position: absolute; top: var(--stripe); left: var(--stripe); width: var(--chip); height: var(--thumb); border-radius: var(--r-1); background: var(--ink-3); transition: translate var(--t-2) var(--ease), background var(--t-2) var(--ease); }
.switch__track::after { content: "Off"; position: absolute; top: 0; right: var(--s-3); font: 600 var(--fs-label)/calc(var(--h-switch) - var(--stripe)) var(--font-ui); color: var(--ink-2); }
.switch input:checked + .switch__track { border-color: var(--cold-line); background: var(--cold-wash); }
.switch input:checked + .switch__track::before { translate: calc(var(--w-switch) - var(--chip) - var(--stripe) * 3) 0; background: var(--cold); }
.switch input:checked + .switch__track::after { content: "On"; right: auto; left: var(--s-3); color: var(--cold-strong); }
.switch:hover input:not(:disabled) + .switch__track { border-color: var(--line-bright); }
.switch:hover input:checked:not(:disabled) + .switch__track { border-color: var(--cold); }
.switch input:active:not(:disabled) + .switch__track::before { width: calc(var(--chip) + var(--s-2)); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch__track { opacity: var(--o-disabled); }

/* a small whole number with a minus and a plus button */
.stepper { display: inline-flex; align-items: center; height: var(--h-mini); margin: 0 var(--s-1); vertical-align: middle; border: var(--hair) solid var(--line-control); border-radius: var(--r-1); background: var(--hull-sunk); }
.stepper__btn { display: grid; place-items: center; width: var(--target); height: var(--target); padding: 0; border: 0; background: transparent; color: var(--ink-2); }
.stepper__btn:hover { background: var(--hull-raise-2); color: var(--ink); }
.stepper__btn:active { background: var(--hull); }
.stepper__value { width: var(--w-stepper); height: var(--target); padding: 0; border: 0; border-inline: var(--hair) solid var(--line-strong); background: transparent; color: var(--ink); text-align: center; font-size: var(--fs-label); }
.stepper :focus-visible { outline-offset: calc(var(--focus-w) * -1); }

/* ------------------------------------------------------------------ 12 choice cards */
/* native radio inputs, one card per choice:
   <label class="choice"><input type="radio" name="…"><span class="choice__face"><span class="choice__dot"></span><span><b>Name</b><small>One line.</small></span><span class="tag">.zip</span></span></label> */
.choices { display: flex; flex-direction: column; gap: var(--s-3); }
.choice { position: relative; display: block; }
.choice input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice__face { display: grid; grid-template-columns: var(--chip) minmax(0, 1fr) auto; column-gap: var(--s-4); align-items: start; padding: var(--s-3) var(--s-4); border: var(--hair) solid var(--line-control); border-radius: var(--r-2); background: var(--hull-sunk); transition: background var(--t-1) var(--ease), border-color var(--t-1) var(--ease); }
.choice__face b { display: block; font-weight: 600; line-height: var(--lh-snug); }
.choice__face small { display: block; color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.choice__dot { width: var(--chip); height: var(--chip); margin-top: var(--s-2); border: var(--hair) solid var(--line-bright); border-radius: var(--r-round); }
.choice:hover input:not(:checked) + .choice__face { border-color: var(--line-bright); background: var(--hull-raise); }
.choice input:active + .choice__face { background: var(--hull-raise-2); }
.choice input:checked + .choice__face { border-color: var(--cold-line); background: var(--cold-wash); }
.choice input:checked + .choice__face .choice__dot { border-color: var(--cold); box-shadow: inset 0 0 0 calc(var(--stripe) + var(--hair)) var(--hull), inset 0 0 0 var(--chip) var(--cold); }
.choice input:disabled + .choice__face { opacity: var(--o-disabled); }

/* ------------------------------------------------------------------ 13 menu */
/* a short list of actions under a button: <div class="menuwrap"><button aria-expanded …><div class="menu" hidden>… */
.menuwrap { position: relative; flex: none; }
.menu { position: absolute; top: calc(100% + var(--s-3)); left: 0; z-index: 30; display: flex; flex-direction: column; gap: var(--s-1); width: var(--w-menu); padding: var(--s-2); background: var(--hull); box-shadow: var(--shadow-pop); }
.menu--right { left: auto; right: 0; }
.menu--text { width: var(--w-menu-s); padding: var(--s-4); gap: var(--s-3); }
.menu__item { display: flex; align-items: flex-start; gap: var(--s-4); padding: var(--s-3); border: 0; border-radius: var(--r-2); background: transparent; text-align: left; }
.menu__item > .icon { margin-top: var(--s-1); color: var(--ink-3); }
.menu__item b { display: block; font-weight: 500; }
.menu__item small { display: block; color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.menu__item:hover { background: var(--hull-raise-2); }
.menu__item:active { background: var(--hull-sunk); }
.menu__item:focus-visible { outline-offset: calc(var(--focus-w) * -1); }

/* ------------------------------------------------------------------ 14 popover */
/* A box over everything, next to the control that opens it. Use the popover attribute and
   openPopover(box, anchor) of js/ui/controls.js: the browser closes it on Escape and on a press outside.
   <div class="popover" popover id="…"><header class="popover__head">…</header><div class="popover__body">…</div><footer class="popover__foot">…</footer></div> */
.popover { position: fixed; inset: auto; z-index: 60; flex-direction: column; width: var(--w-pop); max-width: calc(100vw - var(--gutter) * 2); max-height: min(var(--h-pop), calc(100vh - var(--gutter) * 2)); margin: 0; padding: 0; overflow: hidden; background: var(--hull); color: var(--ink); box-shadow: var(--shadow-pop); }
.popover:popover-open, .popover.is-open { display: flex; }
.popover:not(:popover-open):not(.is-open) { display: none; }
.popover::backdrop { background: transparent; }
.popover__head { flex: none; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-bottom: var(--hair) solid var(--line); }
.popover__head h3 { flex: 1; font: 600 var(--fs-body)/var(--lh-tight) var(--font-ui); }
.popover__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--s-4); }
.popover__foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: var(--hair) solid var(--line); color: var(--ink-3); font-size: var(--fs-small); }

/* ------------------------------------------------------------------ 15 tooltip */
/* Put data-tip="Short text" on a control. js/ui/controls.js shows it on hover and on keyboard focus,
   keeps it while the pointer is on it and hides it with Escape. */
.tip { position: fixed; left: 0; top: 0; z-index: 70; max-width: var(--w-tip); padding: var(--s-2) var(--s-3); border: var(--hair) solid var(--line-control); border-radius: var(--r-2); background: var(--hull-raise-2); color: var(--ink); box-shadow: var(--shadow-pop); font-size: var(--fs-small); line-height: var(--lh-snug); overflow-wrap: anywhere; }
.tip kbd { margin-left: var(--s-2); }

/* ------------------------------------------------------------------ 16 table */
/* <div class="tablewrap"><table class="table"><thead>… <td class="is-num"> for numbers … <tfoot> for the total row.
   Variants: --hover (rows react to the pointer), --sticky (the head stays while the wrap scrolls). */
.tablewrap { min-width: 0; overflow: auto; }
.table { width: 100%; font-size: var(--fs-small); line-height: var(--lh-snug); }
.table th, .table td { padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table thead th { padding-bottom: var(--s-2); border-bottom: var(--hair) solid var(--line-strong); color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.table tbody td { border-bottom: var(--hair) solid var(--line); color: var(--ink); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .is-num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { padding-top: var(--s-3); border-top: var(--hair) solid var(--line-strong); color: var(--ink); font-weight: 600; }
.table--hover tbody tr:hover td { background: var(--hull-raise); }
.table--sticky thead th { position: sticky; top: 0; z-index: 1; background: var(--hull); }

/* ------------------------------------------------------------------ 17 facts, status, notice */
/* pairs of a label and a value, two per line */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3) var(--s-4); }
.kv > div { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.kv dt { color: var(--ink-3); font: 500 var(--fs-small)/var(--lh-tight) var(--font-ui); }
.kv dd { line-height: var(--lh-snug); color: var(--ink); overflow-wrap: anywhere; }
.kv dd small { color: var(--ink-3); font-size: var(--fs-small); }

/* one line of a check: an icon, a sentence, an optional value. The icon says the level, not only the colour. */
.status { display: flex; align-items: flex-start; gap: var(--s-3); color: var(--ink-2); font-size: var(--fs-control); line-height: var(--lh-snug); }
.status > .icon { margin-top: var(--s-1); }
.status > span:first-of-type { flex: 1; min-width: 0; }
.status > span:last-child:not(:first-of-type) { color: var(--ink); white-space: nowrap; }
.status--ok > .icon { color: var(--cold); }
.status--warn > .icon { color: var(--warm); }
.status--bad > .icon { color: var(--hot); }
.status--info > .icon { color: var(--ink-3); }
.status--block { padding: var(--s-3); border: var(--hair) solid var(--cold-line); border-radius: var(--r-2); background: var(--cold-wash); }
.status--block b { color: var(--ink); font-weight: 600; }
.status--block.status--warn { border-color: var(--warm-line); background: var(--warm-wash); }
.status--block.status--bad { border-color: var(--hot-line); background: var(--hot-wash); }

/* something to look at: a title, a sentence, an optional action */
.notice { display: flex; gap: var(--s-3); padding: var(--s-3); border: var(--hair) solid var(--warm-line); border-radius: var(--r-2); background: var(--warm-wash); }
.notice > .icon { margin-top: var(--s-1); color: var(--warm); }
.notice > div { flex: 1; min-width: 0; }
.notice b { display: block; font-weight: 600; line-height: var(--lh-snug); }
.notice p { margin-top: var(--s-1); color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-snug); }
.notice--bad { border-color: var(--hot-line); background: var(--hot-wash); }
.notice--bad > .icon { color: var(--hot); }
.notice--info { border-color: var(--line-strong); background: var(--hull-sunk); }
.notice--info > .icon { color: var(--ink-3); }

/* ------------------------------------------------------------------ 18 progress bar */
/* <div class="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="43" aria-label="…"><span class="progress__fill" style="--p:43%"></span></div> */
.progress { position: relative; height: var(--h-bar); border-radius: var(--r-1); background: var(--line-strong); }
.progress__fill { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); border-radius: var(--r-1); background: var(--cold); }
.progress__fill::after { content: ""; position: absolute; right: 0; top: calc(var(--s-2) * -1); bottom: calc(var(--s-2) * -1); width: var(--hair); background: var(--ink); }
.progress--stopped { background: var(--hot-line); }
.progress--stopped .progress__fill { background: var(--hot); }
.progress--busy { overflow: hidden; }
.progress--busy .progress__fill { width: 30%; animation: slide 1.4s var(--ease) infinite; }
.progress--busy .progress__fill::after { display: none; }

/* ------------------------------------------------------------------ 19 empty and loading */
/* nothing to show yet: <div class="empty"><svg class="icon icon--xl">…</svg><strong>Title</strong><p>One sentence.</p><button class="btn btn--line">…</button></div> */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-6) var(--s-5); color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); text-align: center; }
.empty > .icon { color: var(--ink-3); }
.empty strong { color: var(--ink); font: 600 var(--fs-body)/var(--lh-tight) var(--font-ui); }
.empty p { max-width: 36ch; }
.empty--bad > .icon { color: var(--hot); }
/* work in progress: <p class="loading"><span class="spinner"></span>Reading the file</p> */
.loading { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-2); font-size: var(--fs-control); }
.spinner { flex: none; width: var(--icon); height: var(--icon); border: var(--stripe) solid var(--cold-line); border-top-color: var(--cold-strong); border-radius: var(--r-round); animation: spin 0.9s linear infinite; }
.spinner--s { width: var(--icon-s); height: var(--icon-s); }
/* the shape of content that is not there yet; give the box a width and a height, or use --line */
.skeleton { border-radius: var(--r-1); background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 50%, var(--line) 75%) 0 0 / 200% 100%; animation: shimmer 1.6s linear infinite; }
.skeleton--line { height: var(--fs-small); margin: var(--s-2) 0; }
.skeleton--swatch { width: var(--swatch); height: var(--swatch); }

@keyframes spin { to { rotate: 360deg; } }
@keyframes blink { from { opacity: 1; } to { opacity: var(--o-muted); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes slide { from { left: -30%; } to { left: 100%; } }

/* ------------------------------------------------------------------ 20 forced colours, motion */
@media (forced-colors: active) {
  .seg__opt input:checked + .seg__face, .choice input:checked + .choice__face, .iconbtn[aria-pressed="true"], .switch input:checked + .switch__track { border-color: Highlight; outline: var(--hair) solid Highlight; outline-offset: calc(var(--hair) * -2); }
  .seg__opt input:focus-visible + .seg__face, .switch input:focus-visible + .switch__track, .choice input:focus-visible + .choice__face { outline: var(--focus-w) solid Highlight; outline-offset: var(--focus-off); }
  .switch__track::before, .progress__fill, .slider::-webkit-slider-thumb { forced-color-adjust: none; background: ButtonText; }
  .btn--go { border-color: ButtonText; }
  .icon { stroke: currentColor; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .skeleton { background-position: 50% 0; }
  .progress--busy .progress__fill { left: 35%; }
}
