/* base.css - tokens, reset and classless element styles. Colours come only from themes.css (--bg, --text, ...).
   Author: a2@clacks-bridge.org. Generated/edited with Claude. Copyright: clacks-bridge.org. License: MIT
   No class names: elements, ARIA and data-* attributes. Look: quiet, frames of three 1px lines (3px), one font weight.
   Switches on <html>: data-theme (see themes.css), data-density="touch|compact", data-frame="thin|medium|thick",
   data-font="system|humanist|serif|mono|cockpit|b612" (none = the theme's own default). */

/* ---------------------------------------------------------------- fonts: bundled, offline (OFL, see
../fonts/README.txt) */
@font-face { font-family: "B612"; src: url("../fonts/B612-Regular.woff2") format("woff2"); font-weight: 400;
    font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("../fonts/B612Mono-Regular.woff2") format("woff2"); font-weight: 400;
    font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-weight: 400; font-display: swap; }

/* ---------------------------------------------------------------- tokens (sizes only, no colour) */
:root {
  --font-system: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-humanist: Seravek, "Gill Sans Nova", Optima, Candara, "Noto Sans", "DejaVu Sans", sans-serif;
  --font-serif: Charter, "Bitstream Charter", "Sitka Text", Georgia, "DejaVu Serif", serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --font-cockpit: "B612 Mono", "IBM Plex Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
        /* the Airbus cockpit font, bundled */
  --font-b612: "B612", system-ui, sans-serif;
  --font: var(--font-system);
  --fs: 1rem;            /* body text */
  --fs-small: 0.85rem;   /* labels, meta */
  --fs-title: clamp(1.5rem, 5vw, 2.1rem);
  --lh: 1.5;
  --ctl: 2.75rem;        /* height of buttons and fields (44px: touch) */
  --ctl-pad: 0.3rem 0.85rem; --ctl-x: 0.85rem;   /* --ctl-x: the side padding of --ctl-pad */
  --gap: 0.8rem;
  --gap-s: 0.4rem;
  --gap-l: 1.4rem;
  --pad: 0.9rem 1rem;
  --radius: 0.4rem;
  --width: 46rem;
  --ease: 0.15s ease-out;
}
:root[data-density="compact"] {
  --fs: 0.95rem; --fs-small: 0.82rem; --fs-title: 1.4rem; --lh: 1.4;
  --ctl: 2.1rem; --ctl-pad: 0.2rem 0.6rem; --ctl-x: 0.6rem; --gap: 0.6rem; --gap-s: 0.3rem; --gap-l: 1rem;
  --pad: 0.55rem 0.8rem; --radius: 0.25rem; --width: 52rem;
}
/* rugged: dust, gloves, dirty hands, a slow touch screen. Everything is larger (a control is 60px high, text is 19px),
   with more room between controls; the focus ring is thicker. Nothing in the framework needs hover, a drag or a long
   press. */
:root[data-density="rugged"] {
  --fs: 1.2rem; --fs-small: 1rem; --fs-title: 2rem; --lh: 1.45;
  --ctl: 3.75rem; --ctl-pad: 0.4rem 1.1rem; --ctl-x: 1.1rem; --gap: 1.1rem; --gap-s: 0.7rem; --gap-l: 1.8rem;
  --pad: 1.1rem 1.3rem; --radius: 0.5rem;
}
:root[data-density="rugged"] :focus-visible { outline-width: 4px; }
:root[data-font="system"] { --font: var(--font-system); }
:root[data-font="humanist"] { --font: var(--font-humanist); }
:root[data-font="serif"] { --font: var(--font-serif); }
:root[data-font="mono"] { --font: var(--font-mono); }
:root[data-font="cockpit"] { --font: var(--font-cockpit); }
:root[data-font="b612"] { --font: var(--font-b612); }

/* ---------------------------------------------------------------- reset */
*, ::before, ::after { box-sizing: border-box; }
/* rem is always 16px: the density changes --fs (body text) and the spacing, never the root size (rem would compound) */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--fs)/var(--lh) var(--font); background: var(--bg); color: var(--text);
    overflow-wrap: anywhere; font-weight: 400; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* a control's focus ring sits right on its own border: no gap between the two lines */
:is(input:not([type=checkbox], [type=radio], [type=range], [type=color]), select, textarea, button):focus-visible {
  outline-offset: 0; }
::selection { background: var(--select); color: var(--text); }
/* one weight: hierarchy by size, colour and case */
strong, b, h1, h2, h3, h4, h5, h6, summary, dt, th, legend, caption { font-weight: 400; }

/* ---------------------------------------------------------------- text */
main { max-width: var(--width); margin: 0 auto; padding: var(--gap); }
/* data-width="wide" on html or main: the page follows the window (96vw, at most 90rem) instead of a fixed column */
:root[data-width="wide"] main, main[data-width="wide"] { max-width: min(96vw, 90rem); }
h1 { margin: 0.3rem 0; font-size: var(--fs-title); line-height: 1.2; color: var(--strong); }
h2 { margin: var(--gap-l) 0 var(--gap-s); font-size: var(--fs-small); letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--label); }
/* h2 and h3 are the two label levels: small, uppercase, spaced. h2 in the label colour opens a section, h3 in the
   strong text colour a part of it. h4 to h6 are plain headings (elements.css). */
h3 { margin: var(--gap) 0 var(--gap-s); font-size: var(--fs-small); letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--strong); }
p, ul, ol, dl, pre, table, blockquote { margin: 0 0 var(--gap-s); }
ul, ol { padding-left: 1.3rem; }
small, figcaption { font-size: var(--fs-small); color: var(--muted); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--gap-l) 0; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
code, kbd { padding: 0 0.3em; background: var(--panel); border-radius: 0.2rem; }
pre { padding: var(--pad); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    overflow-x: auto; }
pre code { padding: 0; background: none; }
del { color: var(--danger); } ins { color: var(--ok); text-decoration: none; }
dt { margin-top: var(--gap-s); font-size: var(--fs-small); color: var(--muted); }
dd { margin: 0; }
:not(details, aside, article, input, select, textarea)[data-state="ok"] { color: var(--ok); }
:not(details, aside, article, input, select, textarea)[data-state="warn"] { color: var(--warn); }
:not(details, aside, article, input, select, textarea)[data-state="bad"] { color: var(--danger); }
:not(details, aside, article, input, select, textarea)[data-state="info"] { color: var(--link); }

/* ---------------------------------------------------------------- header */
header { margin-bottom: var(--gap); }
main > header > div:not([role=group]) { display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: var(--gap-s) var(--gap); }
nav { display: flex; flex-wrap: wrap; gap: var(--gap-s) var(--gap); margin: 0 0 var(--gap); }
/* the list of links of a nav is a row; a drop-down list (combo box) inside a nav keeps its own box */
nav ul:not([role=listbox], combo-box > ul) { display: contents; list-style: none; padding: 0; }
/* header[data-sticky] stays in view; bars with data-sticky stack under it (--header-h is set by js/theme.js) */
header[data-sticky] { position: sticky; top: 0; z-index: 40; padding: var(--gap-s) 0;
    background: var(--ground, var(--bg)); border-bottom: 1px solid var(--line); }
:is([role=status], [role=alert])[data-sticky] { position: sticky; top: var(--header-h, 0px); z-index: 35; }
main > footer { margin-top: var(--gap-l); text-align: center; font-size: var(--fs-small); color: var(--muted); }

/* ---------------------------------------------------------------- frames: three lines of 1px
   A frame is always 3px wide: border = outside line, two inset shadows = middle and inside line. Thin, medium and thick
   only recolour the lines; the size never changes.
     thin   : outside = around, middle = border, inside = ground   -> one fine line, air on both sides
     medium : outside = around, middle = border, inside = border   -> two lines
     thick  : all three = hi                                         -> bold frame
   --around is the colour outside the frame, --ground the colour inside (set below; nest-aware). */
:where(details, section, fieldset, aside, article, dialog, [role=status], [role=alert], [data-frame]) {
  --around: var(--bg); --ground: var(--panel);
  --f1: var(--around); --f2: var(--border); --f3: var(--ground); --edge: initial;
  border: 1px solid var(--f1);
  box-shadow: inset 0 0 0 1px var(--f2), inset 0 0 0 2px var(--f3);
  border-radius: var(--radius); background: var(--ground);
}
:where(details, section, fieldset, aside, article, dialog, [role=status], [role=alert], body [data-frame])
    :where(details, section, fieldset, aside, article, dialog, [role=status], [role=alert], [data-frame]) {
  --around: var(--panel); --ground: var(--bg);
}
/* medium and thick: set on the whole page (html), a container or the frame itself. The three line colours are set on
   every element below it (a custom property no frame uses costs nothing); an element with its own data-frame wins. */
:root[data-frame="medium"] :not([data-frame]), [data-frame="medium"] :not([data-frame]), [data-frame="medium"] {
  --f3: var(--border);
}
:root[data-frame="thick"] :not([data-frame]), [data-frame="thick"] :not([data-frame]), [data-frame="thick"] {
  --f1: var(--edge, var(--hi)); --f2: var(--edge, var(--hi)); --f3: var(--edge, var(--hi));
}
/* data-frame="none": a frame that is not drawn. It keeps the padding and the (transparent) border. Use it to keep the
   margins of a form equal. */
[data-frame="none"] { --f1: transparent; --f2: transparent; --f3: transparent; background: transparent; }
/* <html> carries data-frame but is no frame */
:root { border: 0; box-shadow: none; border-radius: 0; background: var(--bg); }
section, fieldset { margin: 0 0 var(--gap); padding: var(--pad); }
article { margin: 0 0 var(--gap-s); padding: var(--pad); }
fieldset { min-width: 0; }
/* The legend is a heading inside the frame, not a break in the frame line: the browser would paint the fieldset ground
   up to the top of the legend, half a line above the frame, a strip of the wrong colour. A floated legend is a plain
   block. */
legend { float: left; width: 100%; margin: 0 0 var(--gap-s); padding: 0; color: var(--label);
    font-size: var(--fs-small); letter-spacing: 0.07em; text-transform: uppercase; }
legend + * { clear: both; }
details { margin: 0 0 var(--gap-s); --ground: var(--bg); }
details[open] { --ground: var(--panel); }
:is(details, article)[data-state="warn"] { --border: var(--warn); --edge: var(--warn); }
:is(details, article)[data-state="bad"] { --border: var(--danger); --edge: var(--danger); }
/* done is quiet: an ok card has a plain line frame and muted text, so only what needs attention stands out */
:is(details, article)[data-state="ok"] { --border: var(--line); --edge: var(--line); }
:is(details, article)[data-state="ok"] :where(summary, dt, dd, p, small, span, time) {
  color: var(--muted); }
:is(details, article)[data-state="ok"] summary::after { color: var(--muted); }
summary { display: block; position: relative; min-height: var(--ctl); padding: var(--pad); padding-right: 2.4rem;
    list-style: none; cursor: pointer; color: var(--strong); }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0.9rem; top: 0.55rem; font-size: 1.3rem; line-height: 1;
    color: var(--label); }
details[open] > summary::after { content: "\2212"; }
/* an open details: a thin line under the summary separates the header (the control) from the content */
details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: var(--gap-s); }
details > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details > :last-child { margin-bottom: var(--gap); }
/* a table is as wide as its parent: the two side margins of the content are taken off */
details > table { width: calc(100% - 2rem); }

/* ---------------------------------------------------------------- forms
   Every control takes its look from :where() (zero specificity), so a more specific rule below always wins. */
label { display: block; font-size: var(--fs-small); color: var(--muted); }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file]), select, textarea, button) {
  font: inherit; font-size: var(--fs); color: var(--text); min-height: var(--ctl); padding: var(--ctl-pad);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=color]), select, textarea) {
  width: 100%; margin-top: 0.15rem; }
/* numbers are right-aligned with equal-width digits: the places line up, so 100 and 10000 differ at a glance. Text and
   dates stay left (an ISO date has a fixed width, there is nothing to compare by place). A text field that holds
   digits (a pattern) is only right-aligned when the author says so: data-num. */
:is(input[type=number], input[data-decimal], input[data-num]) { text-align: right; font-variant-numeric: tabular-nums; }
/* no spin buttons: they differ between browsers, appear only on hover and touched the right-aligned digits. The arrow
   keys still step a native number field (step, min and max count); the framework's own data-decimal field has none. */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0; }
/* the caption of a number field follows its value, as the header of a number column does */
label:has(> :is(input[type=number], input[data-decimal], input[data-num])) { text-align: right; }
textarea { min-height: calc(var(--ctl) * 2); resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
:is(input, select, textarea):disabled, button:disabled { opacity: 0.55; cursor: not-allowed; }
/* validation: wrong is always shown (red). Valid is quiet; green only when asked for: data-state="ok" (a state the page
   sets, for example after the back-end confirmed the value), or data-show-valid on a field or a container of fields. */
:is(input, select, textarea):user-invalid, :is(input, select, textarea)[aria-invalid="true"],
:is(input, select, textarea)[data-state="bad"] { border-color: var(--danger); }
:is(input, select, textarea)[data-state="ok"],
:is(input, select, textarea)[data-show-valid]:user-valid,
[data-show-valid] :is(input, select, textarea):user-valid { border-color: var(--ok); }
:is(input, select, textarea)[data-state="pending"] { border-style: dashed; border-color: var(--link); }
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; margin: 0 0.4rem 0 0;
    vertical-align: -0.2rem; accent-color: var(--hi); }
/* :where() keeps this rule weaker than [data-state]: a label with a state shows the colour of the state */
label:where(:has(> input[type=checkbox]), :has(> input[type=radio])) { display: inline-flex; align-items: center;
    margin-right: var(--gap); color: var(--text); font-size: var(--fs); }
fieldset > ul { list-style: none; padding-left: 0; }
/* range: a browser chooses by itself which side of a slider is the filled one and in which colour (it differs between
   browsers and systems), so the slider is drawn here: hi up to the thumb, the line colour after it. --p (0 to 1) is set
   by js/fields.js; without it the track is plain and the thumb still shows the value. */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 1.6rem; margin: 0.2rem 0;
    padding: 0; background: transparent; border: 0; cursor: pointer; --p: 0;
    --stop: calc(0.55rem + (100% - 1.1rem) * var(--p)); }
input[type=range]::-webkit-slider-runnable-track { height: 0.4rem; border-radius: 0.2rem;
    background: linear-gradient(to right, var(--hi) var(--stop), var(--line) var(--stop)); }
input[type=range]::-moz-range-track { height: 0.4rem; border-radius: 0.2rem; background: var(--line); }
input[type=range]::-moz-range-progress { height: 0.4rem; border-radius: 0.2rem; background: var(--hi); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; box-sizing: border-box;
    width: 1.1rem; height: 1.1rem; margin-top: -0.35rem; border: 2px solid var(--bg); border-radius: 50%;
    background: var(--hi); }
input[type=range]::-moz-range-thumb { box-sizing: border-box; width: 1.1rem; height: 1.1rem;
    border: 2px solid var(--bg); border-radius: 50%; background: var(--hi); }
input[type=color] { width: 3.5rem; height: var(--ctl); margin-top: 0.15rem; padding: 0.15rem; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
input[type=file] { width: 100%; margin-top: 0.15rem; padding: 0.3rem; color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
input[type=file]::file-selector-button { margin-right: var(--gap-s); padding: 0.2rem 0.7rem; cursor: pointer;
    font: inherit; color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent);
    border-radius: var(--radius); }
output { display: block; font-size: var(--fs-small); color: var(--muted); }
/* buttons: <button> and <input type=submit|button|reset>; reset and data-variant=quiet are the quiet kind */
:where(button, input[type=submit], input[type=button], input[type=reset]) { width: auto; margin-top: 0; cursor: pointer;
    background: var(--accent); border-color: var(--accent); color: var(--on-accent); white-space: nowrap;
    transition: background var(--ease); }
:where(button, input[type=submit], input[type=button], input[type=reset]):hover {
    background: var(--accent-hover); border-color: var(--accent-hover); }
:is(button, input)[type=reset], button[data-variant="quiet"] { background: var(--bg); color: var(--text);
    border-color: var(--border); }
:is(button, input)[type=reset]:hover, button[data-variant="quiet"]:hover {
    background: var(--select); border-color: var(--border); }
button[data-variant="danger"] {
    background: var(--danger-btn); border-color: var(--danger-btn); color: var(--on-danger); }
button[data-variant="danger"]:hover { background: var(--danger-btn); filter: brightness(0.85); }
p > :is(button, input[type=submit], input[type=button], input[type=reset]) { margin: 0 var(--gap-s) var(--gap-s) 0; }
/* rows of fields: a <div> in a form, section or fieldset. The items sit on the bottom line, so the entry fields of a
   row are level whatever their captions are. An error message hangs under its own field and takes no room in the row,
   so no neighbour moves; the items of that line get the same room below (--reserve, set by js/validate.js), so the
   message covers nothing, also when the row wraps into several lines on a narrow screen. */
:is(form, section, fieldset, details) > div { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--gap);
    margin-bottom: var(--gap-s); }
:is(form, section, fieldset, details) > div > * { margin-bottom: var(--reserve, 0px); }
:is(form, section, fieldset, details) > div > label { position: relative; flex: 1 1 10rem; }
:is(form, section, fieldset, details) > div > :is(button, label:has(> input[type=checkbox]),
    label:has(> input[type=radio])) { flex: 0 0 auto; }
:is(form, section, fieldset, details) > div > :is(label:has(> input[type=checkbox]), label:has(> input[type=radio])) {
  min-height: var(--ctl); }
/* data-span="2": a field twice as wide as the others in its row */
:is(form, section, fieldset, details) > div > label[data-span="2"] { flex: 2 1 20rem; }
:is(form, section, fieldset, details) > div > label > output[data-error] { position: absolute; top: 100%; left: 0;
    right: 0; margin: 0.15rem 0 0; }

/* data-width="narrow" on a form, fieldset or section: at most 30rem, the fields are as wide as it is */
:is(form, fieldset, section)[data-width="narrow"] { max-width: 30rem; }
/* data-size="N" on an input: N characters wide (the digits of the font) plus the padding and the frame. Only these
   values exist; a label with such a field is as wide as the field, also in a row. */
input[data-size] { display: block; width: calc(var(--n) * 1ch + 2 * var(--ctl-x) + 2px); max-width: 100%; }
input[data-size="2"] { --n: 2; } input[data-size="3"] { --n: 3; } input[data-size="4"] { --n: 4; }
input[data-size="5"] { --n: 5; } input[data-size="6"] { --n: 6; } input[data-size="8"] { --n: 8; }
input[data-size="10"] { --n: 10; } input[data-size="12"] { --n: 12; } input[data-size="16"] { --n: 16; }
input[data-size="20"] { --n: 20; } input[data-size="24"] { --n: 24; } input[data-size="32"] { --n: 32; }
input[data-size="40"] { --n: 40; }
label:has(> input[data-size]) { width: fit-content; max-width: 100%; }
:is(form, section, fieldset, details) > div > label:has(> input[data-size]) { flex: 0 0 auto; }
/* data-labels="left" on a form, fieldset, section or details: the caption of a field is in a column on the left (12rem,
   --caption changes it), the field on the right, one field per line. Below 40em the caption stays above the field. */
@media (min-width: 40em) {
  :is(form, fieldset, section, details)[data-labels="left"] { --caption: 12rem; }
  :is(form, fieldset, section, details)[data-labels="left"] > label { position: relative; display: grid;
      grid-template-columns: var(--caption) minmax(0, 1fr); column-gap: var(--gap); align-items: baseline;
      width: auto; text-align: left; margin-bottom: var(--gap-s); }
  :is(form, fieldset, section, details)[data-labels="left"] > label > :where(input, select, textarea, combo-box) {
    margin-top: 0; }
  :is(form, fieldset, section, details)[data-labels="left"] > label:has(> :is(input[type=checkbox],
      input[type=radio])) { display: block; padding-left: calc(var(--caption) + var(--gap)); }
  :is(form, fieldset, section, details)[data-labels="left"] > label > output[data-error] {
    position: absolute; top: 100%; left: calc(var(--caption) + var(--gap)); right: 0; margin: 0.15rem 0 0; }
}

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border);
    font-size: var(--fs-small); }
/* a word in a cell breaks only when it must (break-word does not shrink the column below the word; the page default
   "anywhere" does, and a label or key then breaks in the middle). Such a table can be wider than its box, so on a
   narrow screen it is a block that scrolls sideways inside the box, instead of pushing out of it. On a wide screen it
   stays a real table that fills the width (as a block it would only be as wide as its content). */
@media (max-width: 40em) { table { display: block; max-width: 100%; overflow-x: auto; } }
th, td { padding: 0.35rem 0.6rem; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
th { background: var(--accent); color: var(--on-accent); font-size: var(--fs-small); letter-spacing: 0.04em; }
/* a number column: th[data-num] and td[data-num] are right-aligned with equal-width digits, like the number fields.
   The author marks it; nothing is guessed. Text, dates and identifiers stay left. Use the same number of decimals in a
   column. */
:is(td, th)[data-num] { text-align: right; font-variant-numeric: tabular-nums; }
tr[aria-selected=true] td { background: var(--select); }
tr[aria-selected=true] td:first-child { box-shadow: inset 4px 0 0 var(--hi); }
tbody tr:hover td { background: var(--panel); }
