/* THE LETTERS THEMSELVES. plex.css holds the @font-face blocks and the woff2
 * files beside it, carried inside Scoren and never fetched from Google or any
 * other site (his answer Q5 "A", 2026-10-15; job K317 2026-10-27). It is
 * imported HERE rather than linked by each page, so a screen cannot have the
 * tokens and not have the letters — the fault this file's foot flagged. A till
 * that loses its internet mid-shift keeps its tabular figures.
 *
 * An @import must stand before the first rule, so it stands here. The copy
 * beside apps/lane/ui/tokens.css resolves to apps/lane/ui/plex.css: the till
 * is bundled from that one folder and its CSP is default-src 'self'.
 *
 * WHAT IT COSTS, named rather than hidden: an @import is serial, so the office
 * over a phone's network spends one more round trip — this sheet, then that
 * one — before the first paint. A <link> on every page would fetch both at
 * once, and that is exactly the arrangement that let 290 pages be written
 * without the letters in the first place. The sheet is 1.6 KB, the faces
 * themselves are fetched only when a page uses them, and font-display: swap
 * means nobody waits on letters either way. One round trip is the price of a
 * page that cannot forget. The till pays nothing at all: its files are local. */
@import url("plex.css");

/* ===========================================================================
 * Scoren — the sixteen tokens
 *
 * Phase 0 · docs/design/visual-identity.md (locked 2026-08-25)
 *
 * THE RULE THIS FILE EXISTS TO ENFORCE:
 *   No screen writes a raw hex. Ever. If a colour is needed that is not on
 *   this list, that is a conversation, not a local decision.
 *
 * THEME HANDLING — three states, and all three are covered on purpose:
 *   1. bare :root                       → light. The FULL palette lives here.
 *   2. prefers-color-scheme: dark       → dark, unless the user chose light
 *   3. [data-theme="dark"|"light"]      → an explicit choice always wins
 *
 * visual-identity.md: "No colour is defined only inside a media query or
 * [data-theme] block — a colour that exists only in one branch renders one
 * theme's text on the other theme's ground." Every token below is defined in
 * full on bare :root and only OVERRIDDEN afterwards.
 * =========================================================================== */

:root {
  /* ── Colour · light ─────────────────────────────────────────────────────── */
  --ground:       #F5F8F6;   /* the page behind everything                     */
  --surface:      #FFFFFF;   /* cards, tables, panels                          */
  --surface-2:    #EFF3F1;   /* toolbars, footers, a highlighted row           */
  --ink:          #131C18;   /* body text, headings, numbers                   */
  --ink-soft:     #586A61;   /* secondary text, descriptions                   */
  --ink-faint:    #5F6F66;   /* column headers, sub-lines, the absent em dash  */
  --line:         #DBE3DE;   /* hairline dividers between regions              */
  --line-control: #878887;   /* a field, a choice, a card — 3:1 on its ground  */
  --line-soft:    #EAEFEC;   /* row separators inside a table                  */
  --accent:       #0F6A52;   /* primary buttons, links, the ONE brand colour   */
  --accent-soft:  #E4F0EB;   /* quiet ground behind an accent pill             */
  --warn:         #8C5C0C;   /* Pending · Partial · incomplete · needs a look  */
  --warn-soft:    #FAEEDA;
  --danger:       #963528;   /* Blocked · error · below cost · negative margin */
  --danger-soft:  #FAE7E3;
  --quiet:        #5D6E75;   /* Done · Committed · Complete — finished, not good */
  --quiet-soft:   #E8EEF0;

  --shadow: 0 1px 2px rgba(19,28,24,.06), 0 8px 24px -12px rgba(19,28,24,.18);

  /* ── The focus ring: where the keys go (Preyash, 2026-10-24, answer B) ──────
   * One ring: 3px of the till green. An outline, so the box does not move or
   * grow. --accent is at least 3:1 on --surface, --surface-2, --ground, --line
   * and --accent-soft, in light and in dark (the panel behind the box, not the
   * page). Here, with the colours it is made of, so primitives.css and
   * controls.css never depend on each other being loaded. */
  --focus-ring: 3px solid var(--accent);

  /* ── The Scoren mark (Preyash, 2026-09-26) ─────────────────────────────────
   * The ring's own colours, drawn ONLY by apps/lane/ui/mark.css. The orange
   * follows the theme (Preyash, 2026-09-26, answer B): #EB6100 on light
   * screens, where #FF6A00 measured 2.87:1 on white, and #FF6A00 on dark
   * ones and on the start-up screen. The rest are the same in both. Never a
   * status colour for anything else — --mark-orange is not --warn and
   * --mark-ok is not "good" anywhere but the ring's Approved state.
   * Measured as graphics (3:1) by scripts/check-contrast.mjs. */
  --mark-orange:  #EB6100;   /* the one orange arc — light screens             */
  --mark-blue:    #2563EB;   /* the centre dot                                 */
  --mark-ok:      #16A34A;   /* Approved: the closed ring and its dot          */
  --boot-mark-orange: #FF6A00; /* the orange arc on the start-up screen        */
  --boot-ground:  #0E1311;   /* the till's start-up screen, dark in both themes */
  --boot-ink:     #E6EDE9;   /* the ring's arcs and SCOREN on that ground       */
  --boot-ink-soft: #93A59B;  /* the store and register line under SCOREN      */

  /* ── Price check (Preyash, 2026-09-27, P6) ─────────────────────────────────
   * "A thick border in a colour used for nothing else, plus a big PRICE CHECK
   * band", so a camera can tell a price check from a sale. Not red (red means
   * something is wrong), not --mark-blue (the ring's dot), not a status
   * colour. Drawn ONLY by apps/lane/ui/pricecheck.css. The band's word is
   * 30px bold — large text, held to 3:1 by scripts/check-contrast.mjs, as
   * the border is (a graphic). */
  --check:        #0079E6;   /* the price check border and band — nothing else */
  --check-ink:    #FFFFFF;   /* PRICE CHECK on the band                         */

  /* ── The printed tag (K615f) ── Paper, not a screen: the same in both themes
   * and never redefined for dark. Drawn ONLY by apps/office/print-tags/tags.mjs,
   * which is handed these values as the Print tags page reads them from here
   * (getComputedStyle), so a tag's colours live in this list like every other.
   * The chip is his own Tap House label's red (price-label.html, 2026-11-10);
   * white on it is held to 4.5:1 by scripts/check-contrast.mjs. */
  --tag-paper:    #FFFFFF;   /* the tag's paper                                 */
  --tag-ink:      #000000;   /* every printed word, and the price's black box   */
  --tag-chip:     #C8102E;   /* the CASH PRICE chip, on a printed tag only      */

  /* ── Type ───────────────────────────────────────────────────────────────── */
  /* One superfamily, three voices. IBM Plex, carried by Scoren and loaded by
   * the @import at the head of this file. The stacks below are what a screen
   * falls back to only if a font file is missing from a build. */
  --font-display: "IBM Plex Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-ui:      "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system,
                  "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-data:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo,
                  Consolas, "Liberation Mono", monospace;

  /* ONE MULTIPLIER OVER THE NINE TYPE TOKENS (`--type-scale`). Medium is 1,
   * which is every size written below and what every screen had before there
   * was a choice. ONLY THE TILL ever moves it, through `data-text-size` (the
   * three rules are at the foot of this block, under the palette): the back
   * office and the customer screen compute exactly what they computed before.
   *
   * THE 13px FLOOR (`DECISIONS.md` 2026-10-14, "nothing on the till is drawn
   * under 13px"): a word that is 13px or more at Medium never drops under 13px
   * at Small. The three tokens written here UNDER 13px are the office's sizes
   * and keep their own size as their floor (a Small with bigger small-words
   * than Medium would be absurd). On the till they are 13px — the block "THE
   * TILL'S SMALL WORDS ARE 13px" under the Text size rules below. So each
   * floor is `min(13px, its own Medium size)`, written out. Nothing is floored
   * from above, so Large is a plain multiply. */
  --type-scale: 1;

  --text-page:     clamp(calc(30px * var(--type-scale)), calc(4.4vw * var(--type-scale)), calc(46px * var(--type-scale)));
  --text-section:  max(13px,   calc(27px   * var(--type-scale)));
  --text-title:    max(13px,   calc(19px   * var(--type-scale)));
  --text-body:     max(13px,   calc(15px   * var(--type-scale)));
  --text-table:    max(13px,   calc(13.5px * var(--type-scale)));
  --text-button:   max(13px,   calc(13px   * var(--type-scale)));
  --text-chip:     max(12.5px, calc(12.5px * var(--type-scale)));
  --text-subline:  max(12px,   calc(12px   * var(--type-scale)));
  --text-label:    max(11px,   calc(11px   * var(--type-scale)));

  /* REGULAR OR BOLD — the till's own Weight setting (2026-10-24). ONE STEP UP
   * ON THE SANS FACE ONLY: 400 becomes 500 and 500 becomes 600. 600 stays 600,
   * because that is the heaviest IBM Plex Sans this repo carries, and the money
   * column keeps the one mono weight it has (500) — a heavier price would be a
   * faked bold. Only the till steps these, through `data-weight="bold"` (the
   * rule is with the Text size ones below), so the office and the customer
   * screen stay at 400 and 500. A SANS rule that
   * writes 400 or 500 today uses the token; 600, 700 and every mono weight stay
   * the number they are. */
  --weight-plain: 400;
  --weight-mid:   500;

  --leading-body:  1.55;
  --leading-row:   1.4;

  /* ── Shape and space ────────────────────────────────────────────────────── */
  --radius-control: 6px;    /* buttons, inputs, chips that are not pills */
  --radius-panel:   10px;   /* panels, dialogs                          */
  --radius-pill:    999px;  /* status pills and switch tracks           */

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;

  --cell-y: 10px; --cell-x: 12px;      /* table cell padding    */
  --gutter-table: 16px;                 /* back-office tables    */
  --gutter-dense: 14px;                 /* dense keying grids    */

  /* ── Motion ─────────────────────────────────────────────────────────────── */
  /* 150ms, on COLOUR AND SHADOW ONLY — never size. A control that changes
   * size on hover moves the thing underneath a finger already on its way. */
  --motion: 150ms ease;
}

/* ── THIS REGISTER'S TEXT SIZE AND WEIGHT (Preyash, 2026-10-23/24) ──────────
 * The three numbers are his (he answered A to the drawn sizes,
 * docs/mockups/till-text-size-2026-10-24/): Small .90 · Medium 1 · Large 1.17.
 * Large stops at 1.17 because 1.18 is the first size that wraps "Same as
 * Windows" inside its button at 1200 wide.
 *
 * THEY LIVE HERE, with the tokens they move, and not in the till's own sheet:
 * a page sheet that re-points a token the shared controls are drawn with flows
 * downhill into every control below it, which is the one thing
 * `scripts/check-rules.mjs` refuses. Here it is the design system's own rule,
 * read once, beside the sizes it changes.
 *
 * ONLY THE TILL EVER WRITES THESE ATTRIBUTES — `apps/lane/ui/text.js`, from the
 * register's own saved setting, before the first paint. No office page and no
 * customer screen loads that file, so for them these rules never match and
 * every size is what it was. MEDIUM AND REGULAR HAVE NO RULE: they are the
 * tokens as written above, so a register that never picked a size renders byte
 * for byte what it rendered before there was a choice. */
:root[data-text-size="small"] { --type-scale: .90; }
:root[data-text-size="large"] { --type-scale: 1.17; }
:root[data-weight="bold"] { --weight-plain: 500; --weight-mid: 600; }

/* THE TILL'S SMALL WORDS ARE 13px (Preyash, 2026-10-14, "A": nothing on the
 * till is drawn under 13px — `DECISIONS.md`). The three small tokens (a field
 * label, a sub-line, a chip) are 11 / 12 / 12.5 in the back office and 13 on
 * the till, at Medium; 13 is also their floor at Small, and Large multiplies.
 * THE TILL'S PAGE SAYS SO ON ITS <html>: `data-surface="till"` is written in
 * `apps/lane/ui/index.html` and on no other page — not an office page, not the
 * customer screen (text-size.test.mjs holds both) — so this rule never matches
 * in the office, which keeps its sizes byte for byte. It lives HERE, beside the
 * scale, for the same reason the scale does: a page sheet that declares a
 * token the shared controls are drawn with is a redraw
 * (`scripts/check-rules.mjs`). An attribute, not :has(): the contrast gate
 * reads every selector in this sheet and cannot read :has(). */
[data-surface="till"] {
  --text-chip:    max(13px, calc(13px * var(--type-scale)));
  --text-subline: max(13px, calc(13px * var(--type-scale)));
  --text-label:   max(13px, calc(13px * var(--type-scale)));
}

/* System preference — but an explicit light choice still wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #0E1311;
    --surface:     #161D1A;
    --surface-2:   #1D2622;
    --ink:         #E6EDE9;
    --ink-soft:    #93A59B;
    --ink-faint:   #8A9A91;
    --line:        #28322D;
    --line-control:#6A7468;
    --line-soft:   #212A26;
    --accent:      #4FB894;
    --accent-soft: #122C25;
    --warn:        #D6A052;
    --warn-soft:   #2E2417;
    --danger:      #E08573;
    --danger-soft: #31201C;
    --quiet:       #9BAEB6;
    --quiet-soft:  #1C2529;
    --mark-orange: #FF6A00;
    --check:       #3FA2FF;
    --check-ink:   #06121F;

    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}

/* An explicit dark choice wins in both directions. */
:root[data-theme="dark"] {
  --ground:      #0E1311;
  --surface:     #161D1A;
  --surface-2:   #1D2622;
  --ink:         #E6EDE9;
  --ink-soft:    #93A59B;
    --ink-faint:   #8A9A91;
    --line:        #28322D;
    --line-control:#6A7468;
    --line-soft:   #212A26;
    --accent:      #4FB894;
  --accent-soft: #122C25;
  --warn:        #D6A052;
  --warn-soft:   #2E2417;
  --danger:      #E08573;
  --danger-soft: #31201C;
  --quiet:       #9BAEB6;
  --quiet-soft:  #1C2529;
  --mark-orange: #FF6A00;
  --check:       #3FA2FF;
  --check-ink:   #06121F;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

/* visual-identity.md: "body always paints an explicit --ground" — a
 * transparent body borrows whatever is behind it, which on a till is the
 * shell's own default and on the web is the browser's. */
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

/* ===========================================================================
 * SETTLED 2026-10-27 (job K317) — IBM Plex IS self-hosted. The flag that
 * stood here is cleared: the woff2 files are in the repo and the @import at
 * the head of this file loads them, so no screen asks the internet for its
 * letters and a lane that sells four hours with no connection (STACK.md)
 * keeps its tabular figures instead of silently falling back to Helvetica.
 *
 * The fallback stacks on --font-display / --font-ui / --font-data stay. They
 * are no longer what a screen shows; they are what it shows if a font file is
 * ever missing from a build, which is a build fault worth surviving.
 *
 * A standing rule (scripts/check-rules.mjs, rule 24) keeps it that way: no
 * tracked page, sheet or script may name Google's two font hosts again, in a
 * link or inside a string it builds one from. The rule names them; nothing
 * else in the project may, which is why this note does not either.
 * =========================================================================== */
