/* © 2026 MEK.txt. All rights reserved. Part of the MEK design system; not licensed for reuse. */
/* MEK design system · tokens
   The single source of truth. Every other file reads these; projects should too.
   Colour: a 100→1000 ink scale. 100 is the ground (page background), 1000 the strongest ink, plus accent
   and 500-accent (the quiet accent). Theme values mirror the mektxt-system Figma file's web-colour variables. */

/* ---------- Version ----------
   The release this file belongs to (CHANGELOG.md). Projects can show it: .x::after { content: var(--mek-version); } */
:root { --mek-version: "2.58.0"; }

/* ---------- Fonts ---------- */
@font-face { font-family: "Dosage Humanist"; src: url("../fonts/Dosage-Humanist.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Dosage Mono";     src: url("../fonts/Dosage-Mono.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Dosage Tall";     src: url("../fonts/Dosage-Tall.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Dosage Mono Tall"; src: url("../fonts/Dosage-MonoTall.woff2") format("woff2"); font-display: block; }
/* MEKZANTINE: the blackletter display face. Drawn on an 18px em: sharp only at 18, 36, 54, 72… */
@font-face { font-family: "MEKZANTINE";      src: url("../fonts/MEKZANTINE-Regular.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "MEKZANTINE Mono"; src: url("../fonts/MEKZANTINE-Mono.woff2") format("woff2"); font-display: block; }
/* The other faces. A browser only downloads a face a page uses, so these cost nothing until a font set
   (data-font, css/type.css) or a project picks them. MEKMODE: a 10px em, sharp at 10, 20, 30, 40. MEK Sans: a 15px em,
   sharp at 15, 30, 45, 60. MonoMEK: a 12px em like Dosage, sharp at 12, 24, 36. Dings: pictures on the keyboard's keys. */
@font-face { font-family: "MEKMODE";       src: url("../fonts/MEKMODE-Text.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "MEKMODE Dings"; src: url("../fonts/MEKMODE-Dings.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "MEK Sans"; font-style: normal; src: url("../fonts/MEKSans-Regular.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "MEK Sans"; font-style: italic; src: url("../fonts/MEKSans-Italic.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "MonoMEK";       src: url("../fonts/MonoMEK-Text.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "MonoMEK Dings"; src: url("../fonts/MonoMEK-Dings.woff2") format("woff2"); font-display: block; }

/* ---------- Themes ----------
   From the web-colour variables in the mektxt-system Figma file: every step is set, exactly as Figma has it.
   Dark, PICO-8 and Byzantine aren't in Figma; Dark and Byzantine set 100, 400, 700, 800, 900, 1000 and accent, and
   derive the rest; PICO-8 sets every step from its 16 (board t88), B/W from its two (board t90). */
:root, [data-theme="light"] {
  --100: #ffffff; --200: #f7f7f7; --400: #d5d8de; --500: #c7c7c7; --600: #b6b6b6;
  --700: #999999; --800: #565656; --900: #222222; --1000: #111111; --accent: #3737ff; --500-accent: #7676d1;
  color-scheme: light;
}
[data-theme="dark"]        { --100: #111111; --400: #333333; --700: #8d8d8d; --800: #b6b6b6; --900: #e6e6e6; --1000: #f7f7f7; --accent: #3ccf55; }
[data-theme="bw"]          { --100: #000000; --200: #000000; --400: #ffffff; --500: #ffffff; --600: #ffffff; --700: #ffffff; --800: #ffffff; --900: #ffffff; --1000: #ffffff; --accent: #ffffff; --500-accent: #ffffff; }
[data-theme="miner"]       { --100: #000000; --200: #1b1b1b; --400: #383432; --500: #594b47; --600: #4b453d; --700: #7e7568; --800: #a99f91; --900: #d3c8b9; --1000: #ece5dd; --accent: #ffc982; --500-accent: #a7804c; }
[data-theme="amber"]       { --100: #110500; --200: #1f0a02; --400: #56331d; --500: #ffa46c; --600: #ff7825; --700: #ff7825; --800: #ffa46c; --900: #ffc6a3; --1000: #ffc6a3; --accent: #ffe1cf; --500-accent: #ffa46c; }
[data-theme="gameboy"]     { --100: #181818; --200: #181818; --400: #4a5138; --500: #4a5138; --600: #4a5138; --700: #8c926b; --800: #c5caa4; --900: #c5caa4; --1000: #c5caa4; --accent: #dcff7d; --500-accent: #8c926b; }
[data-theme="dos-age"]     { --100: #071324; --200: #0c1e37; --400: #253a56; --500: #306082; --600: #304a6c; --700: #847e87; --800: #9badb7; --900: #cbdbfc; --1000: #cbdbfc; --accent: #99e57e; --500-accent: #37946e; }
[data-theme="lilac"]       { --100: #150c21; --200: #1e142b; --400: #33334d; --500: #474759; --600: #3d3d4b; --700: #68687e; --800: #d3c8b9; --900: #d3c8b9; --1000: #ece5dd; --accent: #9782ff; --500-accent: #715fc8; }
[data-theme="zx-spectrum"] { --100: #000000; --200: #000000; --400: #0000d7; --500: #0000ff; --600: #0000ff; --700: #ff00ff; --800: #d7d7d7; --900: #ffffff; --1000: #ffffff; --accent: #ffff00; --500-accent: #00ff00; }
[data-theme="pico8"]       { --100: #000000; --200: #000000; --400: #1d2b53; --500: #5f574f; --600: #5f574f; --700: #83769c; --800: #c2c3c7; --900: #c2c3c7; --1000: #fff1e8; --accent: #ff77a8; --500-accent: #7e2553; }
[data-theme="byzantine"]   { --100: #170612; --400: #4c2144; --700: #957d8c; --800: #c9b48f; --900: #e6d8b8; --1000: #f8efd9; --accent: #f2c75c; }
/* Carto: OpenStreetMap's standard map (OSM Carto), for maps first. Its land the ground, its building fill the line and
   the building's outline 500; the inks warm greys down to its labels' near black; the accent its boundaries' purple, a
   step darker (a blue one would read as water). Every step set. A light theme. */
[data-theme="carto"]       { --100: #f2efe9; --200: #e9e5dd; --400: #d9d0c9; --500: #c4b6ab; --600: #a89c91; --700: #6b6560; --800: #4f4a45; --900: #262320; --1000: #111111; --accent: #8a3d8a; --500-accent: #be96b9; color-scheme: light; }
/* App themes: for everyday (consumer) apps, two light and dark pairs, Slate and Mono, every step set. Neutral grounds and ink; the
   accent is the action (the primary button, links, the selected row), and success, warning, danger and info (below)
   are the only other colours. A consumer app starts with one pair and keeps only that pair (DESIGN.md "App themes"). */
[data-theme="slate-light"] { --100: #f8fafc; --200: #f1f5f9; --400: #d7dee8; --500: #c3ccd8; --600: #a3afbf; --700: #64748b; --800: #475569; --900: #1e293b; --1000: #0f172a; --accent: #4f46e5; --500-accent: #a5a1f0; }
[data-theme="slate-dark"]  { --100: #0f141c; --200: #161d28; --400: #2b3545; --500: #3a4558; --600: #4e5b70; --700: #94a3b8; --800: #cbd5e1; --900: #e2e8f0; --1000: #f8fafc; --accent: #8b8dff; --500-accent: #45479a; }
[data-theme="mono-light"]  { --100: #ffffff; --200: #f5f5f5; --400: #dddddd; --500: #c8c8c8; --600: #a8a8a8; --700: #6e6e6e; --800: #474747; --900: #1f1f1f; --1000: #0d0d0d; --accent: #111111; --500-accent: #8a8a8a; }
[data-theme="mono-dark"]   { --100: #0d0d0d; --200: #161616; --400: #2e2e2e; --500: #3c3c3c; --600: #525252; --700: #9a9a9a; --800: #c8c8c8; --900: #ececec; --1000: #ffffff; --accent: #ffffff; --500-accent: #6a6a6a; }
/* All but Light, Carto and the app themes' lights are dark. */
[data-theme]:not([data-theme="light"], [data-theme="carto"], [data-theme$="-light"]) { color-scheme: dark; }
[data-theme$="-light"] { color-scheme: light; }
/* Steps the two non-Figma themes don't set. (PICO-8 sets its own, from its 16: a faithful theme never mixes, board t88.) */
:is([data-theme="dark"], [data-theme="byzantine"]) {
  --200: color-mix(in srgb, var(--400) 30%, var(--100));
  --500: color-mix(in srgb, var(--400) 50%, var(--800));
  --600: color-mix(in srgb, var(--400) 50%, var(--700));
  --500-accent: color-mix(in srgb, var(--accent) 50%, var(--100));
}

:root, [data-theme] {
  --ground-80: color-mix(in srgb, var(--100) 80%, transparent); /* Figma 100-80%: primary button fill */
  --overlay: var(--ground-80);   /* dialog backdrop: the page washed to ground */
  --accent-10: color-mix(in srgb, var(--accent) 10%, transparent); /* Figma accent-10%: selected primary button fill */
  /* Each role's soft tint: a badge's or a banner's ground, a selected row's. Solid (a mix with the ground, never
     see-through); a faithful theme uses its surface instead. */
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--100));
  --good-soft: color-mix(in srgb, var(--good) 14%, var(--100));
  --warn-soft: color-mix(in srgb, var(--warn) 14%, var(--100));
  --bad-soft: color-mix(in srgb, var(--bad) 14%, var(--100));
  --info-soft: color-mix(in srgb, var(--info) 14%, var(--100));
  --gilt-ground: color-mix(in srgb, var(--gilt) 20%, var(--100));   /* a drop initial's field (Illumination) */
  /* Shared looks a faithful theme draws its own way (see "Faithful palettes" below): here, every other theme's. */
  --faithful: 0;                 /* 1 in a faithful theme: a switch for the few places that need one (the heat cells) */
  --overlay-dither: none;        /* a faithful theme dithers the backdrop instead of washing it */
  --line-style: solid;           /* B/W: dotted, a field's line at rest beside the boxes' dotted lines */
  --dim-mask: none;              /* B/W: a disabled control, a placeholder: every other pixel masked off (a grey it can't draw) */
  --lift-fill: color-mix(in srgb, var(--line) 25%, var(--bg));            /* a hovered cell's fill: a quarter of the way to the line */
  --lift-edge: color-mix(in srgb, var(--line) 50%, var(--text-muted));    /* its edge: halfway from 400 to 700 */
  --fade: 0.5;                   /* half-there: the torch's edge on a map, the middle frame of a pop */
  --memory-ink: color-mix(in srgb, var(--text-strong) 35%, var(--bg));    /* what's remembered but not seen: a faint ink */
  --scanlines: repeating-linear-gradient(to bottom, transparent 0 2px, color-mix(in srgb, var(--100) 35%, transparent) 2px 4px);

  /* ---------- Semantic aliases (use these in components) ---------- */
  --bg: var(--100);          /* page */
  --surface: var(--200);     /* rows, wells, code blocks */
  --line: var(--400);        /* default box edge, rules, field borders */
  --line-hover: var(--600);  /* edge on hover; placeholder text */
  --text-muted: var(--700);  /* labels, captions, metadata */
  --text-soft: var(--800);   /* secondary controls, menu items; active edge */
  --text: var(--900);        /* body copy */
  /* A motif's four tones (css/parts/motif.css, js/motifs.js), strongest to weakest: a step quieter than text. */
  --motif-1: var(--700); --motif-2: var(--600); --motif-3: var(--500); --motif-4: var(--400);
  --text-strong: var(--1000);/* headings, hovered/selected controls */
  --scrollbar-ink: var(--text-muted);  /* the scrollbar's checkerboard and, on hover, its solid bar */
  --key: var(--500-accent);            /* a shortcut key hint, [Q], on an idle control: the quiet accent */
  --key-on: var(--text-soft);          /* the key on a chosen or selected control: 800 */

  /* ---------- Switch (Figma: switch) ----------
     A tray of buttons that picks one. Idle buttons are plain .btn (edge 400, label 900). */
  --switch-track: var(--surface);      /* the tray: fill and edge, so it reads as one flat well */
  --switch-gap: 6px;                   /* between buttons, and from the tray's edge (plus its 1px line) */
  --switch-edge-on: var(--text-muted); /* the chosen button's edge: 700 */
  --switch-key: var(--key);            /* the [1] key on an idle button */
  --switch-key-on: var(--key-on);      /* the key on the chosen one: 800 */

  /* ---------- Check (checkbox and radio) ---------- */
  --check-size: 14px;                  /* the box or ring, line included */
  --check-gap: 6px;                    /* from the box to the label */
  --check-edge: var(--line);           /* idle line: 400 */
  --check-edge-hover: var(--line-hover); /* hovered line: 600 */
  --check-edge-on: var(--text-soft);   /* checked line: 800 */
  --check-ink-on: var(--accent);       /* the tick, bar or dot */

  /* ---------- Range (slider) ---------- */
  --range-handle-w: 8px;               /* the handle: a block with stepped corners */
  --range-handle-h: 16px;
  --range-track-h: 4px;
  --range-handle: var(--text-soft);    /* the handle at rest: 800 */
  --range-handle-hover: var(--text-strong); /* hovered: 1000 */
  --range-fill: var(--accent);         /* the track up to the handle, and the held handle */
  --range-empty: var(--line);          /* the dither of the track after it */

  /* ---------- Alert and toast ---------- */
  --alert-edge: var(--text-muted);     /* a note's edge: 700 (.good / .warn / .bad use their status colour) */
  --alert-icon: var(--text-soft);      /* a note's icon and title: 800 */
  --toast-width: 360px;                /* the toast stack, on a wide screen */
  --toast-time: 4000ms;                /* how long a toast stays (.bad stays until closed) */

  /* ---------- Progress and meter ---------- */
  --meter-cell: 4px;                   /* one cell */
  --meter-gap: 1px;                    /* between cells */
  --meter-h: 8px;
  --meter-fill: var(--accent);         /* lit cells (a meter with low/high uses --good / --warn / --bad) */
  --meter-empty: var(--line);          /* the dither of the unlit ones: 400 */

  /* ---------- Tabs ---------- */
  --tab-rule: var(--line);             /* the rule under the row: 400 */
  --tab-on: var(--accent);             /* the chosen tab's stretch of it */

  /* ---------- Icons in buttons ----------
     A button's icon is 1.5× (22.5px): each of its pixels is 3 screen pixels on a 2× (Retina) screen, so it stays
     crisp there; on a 1× screen some come out a pixel wider. Everything around it is in half pixels for the same
     reason: the icon always starts on a whole screen pixel of a 2× screen. An icon-only button (it has an
     aria-label) is a 36px square with the icon set 7px in and 6.5px down (on its face, over the 2px bottom edge).
     Beside a label the icon takes no more height than the words (pulled 1.5px up and 1px down into the padding),
     and sits as close to the edge and the words as the 2× one did (its drawing has 4.5px clear each side). */
  /* A button's foot: its heavier bottom edge, the face raised above it; pushed, the face sinks --btn-press into it
     (button.css and switch.css work their insets and padding out from these). */
  --btn-foot: 2px;
  --btn-press: 1px;
  --btn-icon: 22.5px;
  --btn-icon-box: 36px;               /* an icon-only button, square */
  --btn-icon-pad: 6.5px 0 0 7px;      /* where its icon sits */
  --btn-icon-pad-pushed: calc(6.5px + var(--btn-press)) 0 0 7px; /* pushed, the icon drops with the face */
  --btn-icon-pull: -1.5px -1px;       /* beside a label: into the padding, top and bottom */
  --btn-icon-edge: -2.5px;            /* ...towards the button's edge */
  --btn-icon-in: -1.5px;              /* ...towards the words */

  /* ---------- Icons beside text ----------
     The smallest an icon is drawn beside words: 1.5× (22.5px), as in a button, for the same reason (crisp on a 2×
     screen, each pixel 3 screen pixels). An icon in running text (a paragraph, a list item, a link, a label, a table
     cell, a heading, a .t- text span) takes it; a component that sizes its own icons keeps them. Its box is pulled
     into the line (--icon-text-pull, top and bottom), so a line with an icon is no taller than one without, and its
     drawing sits on the capitals' middle: --icon-text-drop is its vertical-align, which counts from the pulled box,
     so the icon runs from 17px over the baseline to 5.5px under it (its 9×9 drawing centred 5.75px up), on whole
     pixels of a 2× screen. */
  --icon-text: 22.5px;
  --icon-text-drop: -1.75px;
  --icon-text-pull: -3.75px;
  /* Two cases either side of it. An icon-only control with no box (a .link or .pick-btn with an aria-label and only
     icons in it: an alert's close, a code block's Copy) is 1.5× too, as an icon-only button is; it keeps the 18px row
     of a line of words, its icon pulled 2.5px up and 2px down (--icon-only-pull) so the drawing sits on the row's
     middle. A marker that trails words (the external arrow after a tool link, .icon.x1) stays 1× (15px): at 1.5× it
     outweighs the words it marks. */
  --icon-only-pull: -2.5px -2px;

  /* ---------- Tooltip ---------- */
  --tip-delay: 500ms;                  /* hover this long before a tip shows (keyboard focus: at once) */
  --tip-warm: 300ms;                   /* after a tip goes, the next shows at once for this long */
  --tip-width: 240px;                  /* the widest a tip gets before it wraps */
  --tip-edge: var(--line);             /* its edge: 400 */

  /* ---------- Tag ---------- */
  --tag-corner: 1px;                   /* the pixel stepped off each corner: a 2px radius, drawn in pixels */
  --tag-glint: 4s;                     /* how often the dither glint passes: 1px a 250th of it (a frame at 4s) */

  /* ---------- Breadcrumb and pagination ---------- */
  --crumbs-sep: var(--line);           /* the / between crumbs: 400 */
  --crumbs-row-gap: 4px;               /* between the lines of a trail that wraps: 18px lines, 22px apart */

  /* ---------- Diagram (css/parts/diagram.css) ---------- */
  --diagram-wire: var(--text-muted);   /* a wire and its label: 700 */
  --diagram-live: var(--accent);       /* .live: the way to where it ends up */
  --diagram-fail: var(--bad);          /* .fail: what a failing check leads to, dashed */
  --diagram-ghost: var(--line-hover);  /* .ghost: a way round, rarely taken, dashed: 600 */
  --diagram-gap-x: 44px;               /* between columns: room for a wire's label */
  --diagram-gap-y: 32px;               /* between rows */
  --pages-on: var(--accent);           /* the rule under the current page */

  /* ---------- Command palette ---------- */
  --palette-width: 480px;
  --palette-rows: 8;                   /* the list is always this many rows tall */
  --palette-edge: var(--line);         /* its edge: 400 */

  /* ---------- Empty and loading ---------- */
  --spinner-ink: var(--accent);        /* the spinner's pixel */
  --skeleton-ink: var(--line);         /* a skeleton bar's dither: 400 */

  /* ---------- Menubar ---------- */
  --menu-edge: var(--line);            /* a menu's edge: 400 */

  /* ---------- Avatar ---------- */
  --avatar-ground: var(--surface);     /* behind initials, a picture or an identicon: 200 */
  --avatar-ink: var(--text-soft);      /* an identicon's pixels: 800 (.accent: the accent) */

  /* ---------- Code block ---------- */
  --code-ground: var(--surface);       /* behind code: 200, as a well */

  /* ---------- Disclosure ---------- */
  --disclose-rule: var(--line);        /* the rules of an accordion: 400 */

  /* ---------- Tree ---------- */
  --tree-line: var(--line);            /* the line its rows hang off, and their ticks: 400 */
  --tree-sign: var(--500-accent);      /* a group's [-] and [+]: the quiet accent, as a key */
  --tree-head: var(--text-muted);      /* a group's name: 700, hover dissolves to 1000 */

  /* ---------- Charts (status colours are per theme, below) ---------- */
  --chart-1: var(--accent);      /* the main series */
  --chart-2: var(--text-soft);   /* the second, compared with it */
  --chart-3: var(--500-accent);  /* time, or a third */

  /* ---------- Type ---------- */
  /* Dosage's four styles by name; the roles below point at them. */
  --font-dosage: "Dosage Humanist", monospace;
  --font-dosage-tall: "Dosage Tall", monospace;
  --font-dosage-mono: "Dosage Mono", monospace;
  --font-dosage-mono-tall: "Dosage Mono Tall", monospace;
  --font-ui: var(--font-dosage);             /* default for everything */
  --font-mono: var(--font-dosage-mono);      /* numbers, code, key/value, tables */
  --font-display: var(--font-dosage-tall);   /* titles */
  --font-heading: var(--font-ui);            /* section headings (.t-heading): the body face unless a project picks one */
  --font-display-mono: var(--font-dosage-mono-tall);
  --font-blackletter: "MEKZANTINE", "Dosage Tall", monospace;  /* titles, wordmarks, display only: never UI or body */
  --font-blackletter-mono: "MEKZANTINE Mono", "Dosage Mono Tall", monospace;
  /* The other faces, by name. Roles above stay Dosage unless a font set (data-font, css/type.css) swaps them. */
  --font-mekmode: "MEKMODE", "Dosage Mono", monospace;
  --font-meksans: "MEK Sans", "Dosage Humanist", monospace;
  --font-monomek: "MonoMEK", "Dosage Mono", monospace;
  --font-mekmode-dings: "MEKMODE Dings", monospace;
  --font-monomek-dings: "MonoMEK Dings", monospace;

  /* Sizes. Pixel fonts are only crisp on their grid: Dosage on multiples of 12, MEKZANTINE on 18.
     Off-grid sizes (11, 14, 16) are allowed for small UI text, and are smoothed. */
  --text-2xs: 14px;  /* field labels, tags: the smallest text there is */
  --text-xs: 14px;   /* footnotes, captions, notes */
  --text-sm: 16px;   /* UI: buttons, menus, nav, labels */
  --text-crisp: 14px;/* the small Mono labels: keys, counts, the game kit's (HUD, XP, streak…). 14, so off Dosage's grid
                        and smoothed; 12 in the compact scale */
  --text-md: 16px;   /* body */
  --text-lg: 24px;   /* crisp: section headings, h1 */
  --text-xl: 36px;   /* crisp: samples, hero numbers */
  --text-2xl: 48px;  /* crisp */
  --text-3xl: 72px;  /* crisp: big type, .t-huge */
  --text-4xl: 96px;  /* crisp: big type, .t-mega */
  --leading: normal;
  --leading-tall: 1.6;  /* for Tall styles */
  --leading-display: 1.25;  /* big Tall titles over one line: room for ascenders and descenders, 120px at 96 */
  --leading-blackletter: 1.34;  /* MEKZANTINE: about 24px at 18, on its 18px em */

  /* ---------- Space (4px base) ---------- */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --space-8: 32px; --space-12: 48px; --space-16: 64px; --space-18: 72px;
  --page-max: 1200px;
  --page-gutter: 32px;  /* 16px at --bp-phone and under */
  --press-min: 44px;    /* a finger's press area, at the least, on a touch screen (pointer: coarse): the close's */

  /* ---------- Focus ----------
     Where the keyboard is. A ring only for keyboard focus (:focus-visible), never on a click. See docs/focus.html. */
  --focus-ring: var(--text-soft);   /* the ring: 1px dashed in 800 */
  --focus-offset: 2px;              /* outside the element, so it never covers the edge */
  --scroll-pad: 0px;                /* a page with a sticky bar sets this to the bar's height and a little more, so
                                       what takes focus (or a #link) never lands under it */

  /* ---------- Breakpoints ----------
     Each is the widest a range goes, "at or under": @media (max-width: 640px) is the phone. CSS can't read a custom
     property inside @media, so a query writes the number and names its token in a comment; js/mek.js reads these
     (mek.bp(), <html data-bp>). Phones are designed at 390 wide. */
  --bp-phone: 640px;      /* phone: 640 and under. The page gutter halves, big type steps down */
  --bp-tablet: 900px;     /* tablet: 641–900. Sidebars become panels, two columns become one */
  --bp-desktop: 1200px;   /* desktop: 901–1200 (the page's widest, --page-max). Over it: wide */

  /* ---------- Shape ---------- */
  --radius: 4px;   /* fields and surface rows only; boxes use the stepped px-box corner, never border-radius */
  --stroke: 1px;   /* every line is one pixel */

  /* ---------- Motion ----------
     Pixel things move in whole frames, not tweens. One frame = 1/12 s.
     Use steps() for anything drawn in pixels; linear only for fades of overlays. No springs, no ease-out curves, but
     one: the glide, for layout that moves (a sidebar's column closing, a grid's cards finding their new places). */
  --frame: 83ms;
  --dur-instant: 0ms;     /* focus, selected, pushed: immediate */
  --dur-tick: 83ms;       /* 1 frame: nudges, press */
  --dur-beat: 167ms;      /* 2 frames: menus, toggles */
  --dur-bar: 333ms;       /* 4 frames: dialogs, reveals */
  --dur-glide: 240ms;     /* layout that moves: the sidebar part's column, the grid glide (mektxt.com/works' sidebar) */
  --ease-glide: cubic-bezier(0.2, 0.7, 0.2, 1);   /* its curve, the one smooth one: quick, then settling */
  --dur-leave: 220ms;     /* a phone's bottom sheet going away: quicker than it came */
  --ease-leave: cubic-bezier(0.4, 0, 1, 1);       /* its curve: speeding up as it goes, the glide's other half */
  --dur-loop: 800ms;      /* idle loops: bop, blink */
  --dur-type: 40ms;       /* per character, typewriter */
  --dur-dissolve: 333ms;  /* hover dissolve: 25 → 50 → 75 → 100% of pixels, one frame each */
  --dur-theme: 667ms;     /* theme change: dither wipe out of the control you used, at display frame rate (js/mek.js) */
  --ease-step: steps(1, end);
  --ease-frames-2: steps(2, end);
  --ease-frames-4: steps(4, end);
  --ease-fade: linear;
  --ease-dissolve: steps(4, jump-start);  /* first dither frame shows at once, so hover still feels instant */
  --px-frame: 16ms;       /* slides: one whole pixel per display frame (60 fps) */

  /* ---------- Sound ----------
     Off until the person turns it on (js/sound.js). Square-wave notes, set in semitones from the root, each a whole
     number of steps long: one step is a 24fps frame, so a sound keeps time with the film-rate shimmer. */
  --sound-volume: .05;    /* every cue's loudness, 0 to 1: quiet, under the person's own audio */
  --sound-root: 523.25;   /* the root note, in Hz: C5. Cues are semitones from it */
  --sound-step: 42ms;     /* a note's unit length: one 24fps frame */
  --sound-wave: square;   /* the oscillator: square (8-bit), or triangle, sawtooth, sine */
  --sound-ambience: .03;  /* a place's background (js/ambience.js): under the cues */
  --sound-sfx: .3;        /* a game's effects (js/sfx.js), against each one's own level */

  /* ---------- Fog of war (js/fog.js) ----------
     A tile map fading in steps with distance: dimmed, then dithered into a near tone, then a far one, thinning out. */
  --fog-ground: var(--bg);   /* a tile's ground: kept as it is, and what the first step dims toward */
  --fog-dim: .3;             /* the first step: how far toward the ground (a faithful theme drops a pixel in four) */
  --fog-tone-1: color-mix(in srgb, var(--bad) 45%, var(--bg));      /* the near tones: each tile takes the one nearest */
  --fog-tone-2: color-mix(in srgb, var(--good) 45%, var(--bg));     /* its own hue, on half its pixels */
  --fog-tone-3: color-mix(in srgb, var(--accent) 45%, var(--bg));
  --fog-far: var(--line);    /* the far silhouette: a half, a quarter, an eighth of the pixels */
  /* Tile map (js/tilemap.js): a grid of two-colour tiles on a canvas. Its tiles' inks are the map tones and kin inks
     (below, per theme) or a project's own. */
  --tilemap-ground: var(--bg);          /* a cell's ground, under its tile */
  --tilemap-mark: var(--line);          /* a marked cell's checkerboard (a cell that can be picked, a path) */
  --tilemap-cursor: var(--500-accent);  /* the cell under the cursor, inverse: the quiet accent, never the accent */
  /* Ambient life (js/ambient.js): a scene's quiet marks, every one an alias. Never --accent: that stays the view's own. */
  --ambient-glint: var(--text-strong);       /* a px of water catching the light */
  --ambient-glint-fade: var(--text-muted);   /* its glow as it fades */
  --ambient-leaf-1: var(--warn);             /* falling leaves, one of five */
  --ambient-leaf-2: var(--bad);
  --ambient-leaf-3: var(--good);
  --ambient-leaf-4: var(--warn);
  --ambient-leaf-5: var(--text-soft);
  --ambient-firefly: var(--warn);            /* a firefly's px */
  --ambient-firefly-glow: var(--good);       /* its glow round it */
  --ambient-wing-1: var(--text-strong);      /* a butterfly's wings, one of five */
  --ambient-wing-2: var(--warn);
  --ambient-wing-3: var(--good);
  --ambient-wing-4: var(--bad);
  --ambient-wing-5: var(--line-hover);
  --ambient-butterfly-body: var(--text-soft);
  --ambient-mote: var(--text-muted);         /* a mote of dust in the air */
  --ambient-snow: var(--text-strong);        /* a snowflake, one px */
  --ambient-rain: var(--text-muted);         /* a raindrop's streak, head and tail */

  /* ---------- Layers ---------- */
  --z-menu: 5; --z-sticky: 10; --z-dialog: 100;
  --z-tip: 150;     /* a tooltip, where there's no popover */
  --z-toast: 200;   /* the toast stack, where the browser has no popover (top layer) for it */
  --z-fx: 250;      /* a screen effect over the whole page (css/parts/fx.css): over the toasts */
}

/* ---------- Status ----------
   Green for good (up, healthy, done), orange for a warning (slower, close to a limit), red for bad (down, failed,
   wrong). Each theme picks its own from its palette, all at least 4.5:1 on its ground. Where the accent is green
   (Dark, Gameboy), good is the accent. DOS Age is the game kit's home, where good and the accent sit side by side (a
   health bar beside a mana one): its good is the palette's own grass green, apart from the pale mint accent. Amber's text is orange, so its warning is yellow; the Spectrum has no
   orange, so its warning is its normal yellow (D7), apart from the bright yellow accent. Use them only for status (the one exception: rolling glyphs, motion.css, flash them as noise before a glyph lands), never
   as decoration. */
:root, [data-theme="light"] { --good: #12883a; --warn: #b85400; --bad: #d42638; }
[data-theme="dark"]        { --good: var(--accent); --warn: #ff9a3c; --bad: #ff5a64; }
[data-theme="bw"]          { --good: #ffffff; --warn: #ffffff; --bad: #ffffff; }
[data-theme="miner"]       { --good: #a3c77e; --warn: #e8873f; --bad: #e0614f; }
[data-theme="amber"]       { --good: #d6e07a; --warn: #ffd23f; --bad: #ff4b3e; }
[data-theme="gameboy"]     { --good: var(--accent); --warn: #e2b55c; --bad: #e0705c; }
[data-theme="dos-age"]     { --good: #6abe30; --warn: #df7126; --bad: #d95763; }
/* DOS Age draws motifs in its blues: blue 3, blue 2 and blue 1 (the palette has three, so the two weakest tones share blue 1). */
[data-theme="dos-age"]     { --motif-1: var(--500); --motif-2: #3f3f74; --motif-3: var(--400); --motif-4: var(--400); }
[data-theme="lilac"]       { --good: #7fdba6; --warn: #ffa65e; --bad: #ff6b8b; }
[data-theme="zx-spectrum"] { --good: #00ff00; --warn: #d7d700; --bad: #ff0000; }
[data-theme="pico8"]       { --good: #00e436; --warn: #ffa300; --bad: #ff004d; }
[data-theme="byzantine"]   { --good: #93c47d; --warn: #ea8a3a; --bad: #e8505b; }
[data-theme="carto"]       { --good: #0f7a33; --warn: #a64b00; --bad: #c41f30; }
/* Info: a fact, a tip, something new, never a problem: a blue each theme has (the faithful ones, their own). */
:root, [data-theme="light"] { --info: #1b6fae; }
[data-theme="dark"]        { --info: #5aaeff; }
[data-theme="bw"]          { --info: #ffffff; }
[data-theme="miner"]       { --info: #8fb8d6; }
[data-theme="amber"]       { --info: #ffe1cf; }
[data-theme="gameboy"]     { --info: #c5caa4; }
[data-theme="dos-age"]     { --info: #5b6ee1; }
[data-theme="lilac"]       { --info: #8ab4ff; }
[data-theme="zx-spectrum"] { --info: #00d7d7; }
[data-theme="pico8"]       { --info: #29adff; }
[data-theme="byzantine"]   { --info: #7fa8d6; }
[data-theme="carto"]       { --info: #1f68b3; }   /* the one blue among its roles: the accent is purple, so a map's water is never mistaken for it */
/* The app themes: every role at least 4.5:1 on its ground (sketched in meknegement/sketches/app-themes). */
[data-theme="slate-light"] { --good: #047857; --warn: #b45309; --bad: #dc2626; --info: #0369a1; }
[data-theme="slate-dark"]  { --good: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #38bdf8; }
[data-theme="mono-light"]  { --good: #1a7f37; --warn: #9a6700; --bad: #cf222e; --info: #0969da; }
[data-theme="mono-dark"]   { --good: #3fb950; --warn: #d29922; --bad: #f85149; --info: #58a6ff; }

/* ---------- Illumination ----------
   A book's two inks (css/parts/illumination.css): --gilt for ornament, --rubric for a book's red (a part's name, an
   initial's letter). Named for what they do, as --good and --bad are: B/W's gilt is white, Gameboy's green. Ornament
   only: never on a control, a status or a link, never the accent. Not mixed from the status colours (--warn and --bad
   mixed toward each other came out one orange in Village): a fixed pair a theme, from roles only where a theme sets
   none. The dark boutique themes share DOS-AGE's lamplight gold and a cinnabar (Village's, the art library's pick,
   2026-11-13), 8.1:1 and 4.8:1 and more on each ground; Light and the light app themes a darker pair (5.2, 5.9 on
   white); the faithful themes their own colours. --gilt-ground, a drop initial's field, is in the block above. */
:root, [data-theme] { --gilt: var(--warn); --rubric: var(--bad); }
:root, [data-theme="light"], [data-theme$="-light"] { --gilt: #94601f; --rubric: #b8323f; }
:is([data-theme="dark"], [data-theme="miner"], [data-theme="dos-age"], [data-theme="lilac"], [data-theme="byzantine"],
  [data-theme$="-dark"]) { --gilt: #d9a066; --rubric: #d95763; }
[data-theme="bw"]          { --gilt: #ffffff; --rubric: #ffffff; }
[data-theme="amber"]       { --gilt: #ffc6a3; --rubric: #ff7825; }
[data-theme="gameboy"]     { --gilt: #c5caa4; --rubric: #8c926b; }
[data-theme="zx-spectrum"] { --gilt: #d7d700; --rubric: #ff0000; }   /* its normal red is 3.9:1 on black: the bright one */
[data-theme="pico8"]       { --gilt: #ffa300; --rubric: #ff004d; }
[data-theme="carto"]       { --gilt: #8c5e00; --rubric: #b8323f; }   /* gilt: OSM's primary-road casing, a step darker */

/* ---------- Map tones and kin inks ----------
   A map's own hues, apart from status: --good, --warn and --bad stay for status, so a map's grass, fruit and wood
   don't borrow them. Map tones (--map-*): what a world is made of, a figure's ink on the map's ground, at least 3:1 on
   it (--map-earth is a block's, a dark fill under a figure, and needs only to show). Kin inks (--kin-1 to -4): four
   inks for kinds of one thing (households, teams, factions, a legend's groups), told apart from each other and kept
   off the accent, the status reds and oranges and the text greys, at least 4.5:1 on the ground (a name is set in
   one). Set by hand a theme. DOS Age and Miner take theirs from DOS-AGE's own palette (the art library's
   tiles/dos-age), and the faithful themes from their machine's, where some must meet: Gameboy, Amber and B/W have
   one ink for all four kin, the Spectrum's fourth is its warning yellow and PICO-8's fruit its red. The light themes
   share a set, as the dark app themes share Dark's. */
:root, [data-theme="light"], [data-theme$="-light"] {
  --map-grass: #5b8a1e; --map-water: #0f8a9a; --map-sand: #a68a52; --map-wood: #7f4f3a; --map-earth: #573026;
  --map-fruit: #a01c5a; --map-ore: #6b5a8e;
  --kin-1: #1a6f78; --kin-2: #b0308f; --kin-3: #626a10; --kin-4: #7d2fa8;
}
:is([data-theme="dark"], [data-theme$="-dark"]) {
  --map-grass: #8a9a3a; --map-water: #3fb8c8; --map-sand: #c8b088; --map-wood: #a8714f; --map-earth: #5e3a2c;
  --map-fruit: #d0306e; --map-ore: #d8b0a0;
  --kin-1: #4fd1c5; --kin-2: #ff7fd0; --kin-3: #dff07a; --kin-4: #d08cff;
}
/* DOS-AGE's own: its canopy green, its river cyan, sand, light and dark timber, its red (houses, monsters, people;
   the atlas has no fruit), gold (its gold items). Fruit sits at the game's 2.9:1, as it draws it. Kin-4 is its ochre:
   its gold is ore's. */
[data-theme="dos-age"] {
  --map-grass: #7eae30; --map-water: #5fcde4; --map-sand: #d9a066; --map-wood: #8f563b; --map-earth: #663931;
  --map-fruit: #ac3232; --map-ore: #ffd23f;
  --kin-1: #639bff; --kin-2: #d77bba; --kin-3: #eec39a; --kin-4: #ba8030;
}
/* Miner is DOS-AGE's mine: the same palette, its sand the theme's own (800: the gold sands are its accent), ore a pale
   silver glint. */
[data-theme="miner"] {
  --map-grass: #4b692f; --map-water: #5fcde4; --map-sand: var(--800); --map-wood: #8f563b; --map-earth: #663931;
  --map-fruit: #ac3232; --map-ore: #cbdbfc;
  --kin-1: #639bff; --kin-2: #d77bba; --kin-3: #7eae30; --kin-4: #ba8030;
}
[data-theme="lilac"] {
  --map-grass: #7aa65a; --map-water: #48a8c8; --map-sand: #e0c890; --map-wood: #b07850; --map-earth: #5a3640;
  --map-fruit: #d83a4a; --map-ore: #b8e0f0;
  --kin-1: #ffd75e; --kin-2: #5ee8e8; --kin-3: #f08fe0; --kin-4: #b8e06a;
}
/* Byzantine's sand is its own vellum (800); its gold is the accent, so ore is malachite. */
[data-theme="byzantine"] {
  --map-grass: #7a9a4a; --map-water: #4aa8b8; --map-sand: var(--800); --map-wood: #a8603a; --map-earth: #5a2a24;
  --map-fruit: #c02a50; --map-ore: #5fd0b0;
  --kin-1: #80d8e8; --kin-2: #e080d0; --kin-3: #c8e070; --kin-4: #b090ff;
}
/* Carto: OSM Carto's own, each a figure's step darker where its fill is too pale (park #c8facc, water #aad3df, beach
   #fff1ba). Water is its water labels' blue, wood its amenity brown, ore a cool slate (the accent is the purple). */
[data-theme="carto"] {
  --map-grass: #3d7f37; --map-water: #4d80b3; --map-sand: #94783c; --map-wood: #734a08; --map-earth: #5c4a3d;
  --map-fruit: #b81f5b; --map-ore: #5d6878;
  --kin-1: #0b7268; --kin-2: #5f6b04; --kin-3: #734a08; --kin-4: #3f55a6;
}
/* The faithful themes: their machine's colours only (--palette below), a step where it is one. */
[data-theme="zx-spectrum"] {
  --map-grass: #00d700; --map-water: #00d7d7; --map-sand: var(--800); --map-wood: #d70000; --map-earth: var(--400);
  --map-fruit: var(--700); --map-ore: #00ffff;
  --kin-1: #00ffff; --kin-2: var(--700); --kin-3: #00d700; --kin-4: #d7d700;
}
[data-theme="pico8"] {
  --map-grass: #008751; --map-water: #29adff; --map-sand: #ffccaa; --map-wood: #ab5236; --map-earth: var(--500);
  --map-fruit: #ff004d; --map-ore: #ffec27;
  --kin-1: #ffec27; --kin-2: #ffccaa; --kin-3: #00e436; --kin-4: #008751;
}
[data-theme="gameboy"] {
  --map-grass: var(--700); --map-water: var(--700); --map-sand: var(--800); --map-wood: var(--700); --map-earth: var(--400);
  --map-fruit: var(--1000); --map-ore: var(--1000);
  --kin-1: var(--1000); --kin-2: var(--1000); --kin-3: var(--1000); --kin-4: var(--1000);
}
[data-theme="amber"] {
  --map-grass: var(--700); --map-water: var(--800); --map-sand: var(--900); --map-wood: var(--700); --map-earth: var(--400);
  --map-fruit: var(--800); --map-ore: var(--1000);
  --kin-1: var(--1000); --kin-2: var(--1000); --kin-3: var(--1000); --kin-4: var(--1000);
}
[data-theme="bw"] {
  --map-grass: var(--1000); --map-water: var(--1000); --map-sand: var(--1000); --map-wood: var(--1000); --map-earth: var(--1000);
  --map-fruit: var(--1000); --map-ore: var(--1000);
  --kin-1: var(--1000); --kin-2: var(--1000); --kin-3: var(--1000); --kin-4: var(--1000);
}

/* ---------- Faithful palettes ----------
   The themes that stand for a real machine or screen keep to its colours, and only its colours: every token, every
   state, every colour drawn. --palette lists them (a string, read by docs/palette-check.html, which checks the
   tokens against it and every page's drawn colours against it). Hardware only: status, hover and effects too.
   ZX Spectrum: its 15 colours, normal at D7 and bright at FF. Gameboy: the 4 shades of its screen. Amber: one
   phosphor at its intensities. B/W: black and white; anything between is dither. PICO-8: its 16 colours. */
[data-theme="zx-spectrum"] { --palette: "#000000 #0000d7 #d70000 #d700d7 #00d700 #00d7d7 #d7d700 #d7d7d7 #0000ff #ff0000 #ff00ff #00ff00 #00ffff #ffff00 #ffffff"; }
[data-theme="gameboy"]     { --palette: "#181818 #4a5138 #8c926b #c5caa4"; }
[data-theme="amber"]       { --palette: "#110500 #1f0a02 #56331d #ff7825 #ffa46c #ffc6a3 #ffe1cf"; }
[data-theme="bw"]          { --palette: "#000000 #ffffff"; }
[data-theme="pico8"]       { --palette: "#000000 #1d2b53 #7e2553 #008751 #ab5236 #5f574f #c2c3c7 #fff1e8 #ff004d #ffa300 #ffec27 #00e436 #29adff #83769c #ff77a8 #ffccaa"; }
/* What they draw their own way: nothing see-through, nothing mixed. Where another theme blends, a faithful one steps
   to another token or dithers between two (2×2, the hover dissolve's pattern). The list of faithful themes lives
   here and only here; components read these tokens. */
:is([data-theme="zx-spectrum"], [data-theme="gameboy"], [data-theme="amber"], [data-theme="bw"], [data-theme="pico8"]) {
  --faithful: 1;
  --accent-soft: var(--200); --good-soft: var(--200); --warn-soft: var(--200); --bad-soft: var(--200); --info-soft: var(--200);   /* the roles' tints: the surface, unmixed */
  --gilt-ground: var(--200);               /* a drop initial's field: the surface */
  --ground-80: var(--100);                 /* the primary button's fill: the solid ground */
  --overlay: transparent;                  /* the dialog backdrop: the ground over the page, 3 pixels in 4 */
  --overlay-dither: conic-gradient(var(--100) 0 75%, transparent 0);
  --accent-10: var(--100);                 /* the chosen primary button: the ground, with the line in a checkerboard */
  --accent-10-dots: var(--400);
  --lift-fill: var(--100);                 /* a hovered cell: the ground, the line one pixel in four; the edge a step up */
  --lift-dots: var(--400);
  --lift-edge: var(--600);
  --fade: 1;                               /* nothing half-there: a quieter step instead */
  --fade-ink: var(--800);
  --memory-ink: var(--700);
  --scanlines: repeating-linear-gradient(to bottom, transparent 0 3px, var(--100) 3px 4px);   /* a ground row every 4px */
  --white: var(--1000);                    /* the shine on extruded type: the theme's brightest */
  --fog-tone-1: var(--400);                /* the fog's near tones: its own steps, unmixed */
  --fog-tone-2: var(--500);
  --fog-tone-3: var(--500-accent);
}
/* B/W, after the faithful block so it wins. A quiet line can't be grey there, so a box's line at rest is dotted: every
   other pixel the ground (--line-gap, read by px-box as --edge-gap). Chosen, hovered and featured boxes draw solid,
   so their states show (board t92). A chosen primary button is the ground with no checkerboard: white dots would sit
   under its white label, and its solid edge already says it's chosen. A disabled control and a placeholder are drawn
   through --dim-mask: a checkerboard keeping the dotted line's pixels, so their ink is greyed the 1-bit way. */
[data-theme="bw"]          { --line-gap: var(--100); --accent-10-dots: var(--100);
  --dim-mask: conic-gradient(#000 0 25%, transparent 0 50%, #000 0 75%, transparent 0) 0 0 / 2px 2px; --line-style: dotted; }

/* ---------- Fixed ink ----------
   The same in every theme but the faithful ones (they use their 1000). Only for highlights drawn over a theme's own
   colours (the extruded type's shine). --black is the shade mixed into a drawn colour to darken it (the HUD vial's
   liquid); a faithful theme never mixes, so it never reads it. :where, so the faithful block above outranks it. */
:where(:root) { --white: #ffffff; --black: #000000; }

/* ---------- Page dials ----------
   --display-size for page titles, --rhythm between sections, --grid-gap between the items of a grid (cards, panels,
   tiles). A project changes them in its own CSS: dense (16, 8), balanced (these) or airy (64, 48). */
:root {
  --display-size: var(--text-2xl);   /* 48 */
  --rhythm: var(--space-12);         /* 48px */
  --grid-gap: var(--space-4);        /* 16px */
  --label-gap: 6px;                  /* a label over what it names (Theme over its dropdown): close, so it's the thing's own */
  --group-gap: var(--space-6);       /* between groups of a form or a panel (a label, its control, its note): 24px */
  --scroll-room: var(--space-2);     /* kept inside a box that scrolls (.scroller), so nothing its contents draw past
                                        their own edges is cut: a field's notched label (6px over its top), the focus
                                        ring (3px round): 8px */
  --dialog-inset: var(--space-4);    /* a dialog from the window's edges, at the least: 16px */
  --dialog-large-w: 1200px;          /* a .dialog.large at most: 1200 × 800, a place to work in that still looks like a dialog */
  --dialog-large-h: 800px;
  --dialog-head-line: 30px;          /* a dialog head's title line (24 at 1.25): the note and the close sit on its first */
  --dialog-stepped-h: 640px;
  /* A .dialog.large on a phone is a bottom sheet (dialog.css, js/mek.js): */
  --sheet-top: var(--space-12);      /* the page left showing over it, at the least: 48px */
  --sheet-root: var(--space-3);      /* its foot sits this far under the screen's edge, so it grows out of the bottom */
  --sheet-grab-w: 48px; --sheet-grab-h: 4px;   /* the handle over its head */
  --sheet-grab: var(--line-hover);   /* the handle's ink: 600 */         /* a .dialog.stepped, on every step: its tallest step's height, so it never jumps */
}

/* ---------- Scale ----------
   The default type and button icons are a step up (text 14, 14, 16, nothing under 14; icons in buttons and beside text 1.5×). <html data-scale="compact">,
   or data-scale="compact" on any area, puts back the smaller set: text 11, 12, 14, the small Mono labels at a crisp 12, and 15px (1×) icons in buttons and beside text, a button's taking its padding like words. */
[data-scale="compact"] {
  --text-2xs: 11px; --text-xs: 12px; --text-sm: 14px; --text-crisp: 12px;
  --btn-icon: 15px; --btn-icon-box: auto; --btn-icon-pad: var(--space-2) 9px 9px; --btn-icon-pad-pushed: calc(var(--space-2) + var(--btn-press)) 9px calc(9px - var(--btn-press));   /* (padded like words) */
  --btn-icon-pull: 0; --btn-icon-edge: -3px; --btn-icon-in: -3px;
  --icon-text: 15px; --icon-text-drop: -3px; --icon-text-pull: 0;   /* icons beside text at 1×, as before */
  --icon-only-pull: 1.5px;   /* an icon-only text control's 15px icon, centred in its 18px row */
}
