/*
 * Mockup foundation: the ONE place the shared mockup vocabulary is defined.
 *
 * Why: the reference mockups (work-order-map, client-record-x1000, quotation-ledger-focus-white,
 * schedule-dispatch-workhub) each carried a hand copy of the same variables (--page, --ink, --c-blue, --st-*, --sh-*,
 * --d-*, --t-*), and the copies drifted: four page colours, two inks, two status palettes, three --ink-3 greys.
 * Decided 2026-11-14 on mockups/style-pick-sheet.html (founder delegated the picks): one look, the production kit's.
 *
 * Load order in a mockup: ../frontend/src/design/paper/paper-tokens.css, ../frontend/src/design/paper/paper-kit.css,
 * then this file, then the page's own CSS. A page never redefines a name declared here: scripts/ui/mockup-kit-check.mjs
 * fails if it does (rules and allow-list: scripts/ui/mockup-kit.mjs, scripts/ui/mockup-kit.baseline.json). Moving a page
 * onto it: node scripts/ui/adopt-mockup-foundation.mjs mockups/<page>.html --write.
 * Values come from the paper tokens (frontend/src/design/tokens/paper.ts -> paper-tokens.css). The few literals below
 * have no equal token today and are marked "kit candidate": each is a value the mockups chose for contrast that the
 * kit token fails (measured 2026-11-14, WCAG 2.2 1.4.3; audits/BACKLOG.md entry of the same date).
 */
:root {
  /* type: the clarity scale (.claude/rules/ui-readability.md); 15 is the ledger header exception only */
  --f-ui: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --f-title: 'Poppins', 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --t-12: .75rem; --t-14: .875rem; --t-15: .9375rem; --t-16: 1rem; --t-18: 1.125rem; --t-24: 1.5rem; --t-26: 1.625rem;

  /* surfaces */
  --page: var(--ps-desk);            /* the canvas behind every sheet */
  --paper: var(--ps-paper);          /* sheets, cards, menus */
  --white: var(--ps-paper);
  --desk: #EFEEEA;                   /* troughs and pressed fills; kit candidate: the kit has it only as the warm stock's --ps-desk */
  --grid: var(--ps-grid);
  --hair: var(--ps-hair);
  --rule: var(--ps-rule);
  --hover: color-mix(in srgb, var(--desk) 45%, var(--paper));
  --hov: color-mix(in srgb, var(--desk) 85%, var(--paper));

  /* ink */
  --ink: var(--ps-ink);
  --ink-2: var(--ps-ink-2);
  --ink-3: #69675E;                  /* kit candidate: --ps-ink-3 #77756C is 4.27:1 on --ps-desk; this is 5.24:1 */
  --graphite: var(--ps-graphite);

  /* hues: the kit's five, colour only where something needs attention */
  --c-blue: var(--ps-hue-blue);
  --c-sent: var(--ps-hue-blue);
  --c-indigo: var(--ps-hue-indigo);
  --c-violet: var(--ps-hue-indigo);
  --c-green: var(--ps-hue-green);
  --c-amber: var(--ps-hue-amber);
  --c-red: var(--ps-hue-red);
  --sel: color-mix(in srgb, var(--c-blue) 17%, var(--paper));
  --tint: color-mix(in srgb, var(--c-blue) 7%, var(--paper));
  --pri: var(--ink);
  --pri-h: color-mix(in srgb, var(--ink) 84%, var(--paper));
  --on-pri: var(--paper);

  /* status tiles: the kit's stages; four pairs differ from the kit for contrast (kit candidates, BACKLOG P2 2026-11-14) */
  --st-draft: var(--ps-st-draft);       --on-draft: var(--ps-on-draft);
  --st-review: var(--ps-st-review);     --on-review: var(--ps-on-review);
  --st-approved: var(--ps-st-approved);
  --on-approved: color-mix(in srgb, var(--c-green) 60%, var(--ink)); /* kit candidate: kit --ps-on-approved (72 %) on its tile is 4.36:1; this 5.44:1 */
  --st-ready: var(--ps-st-ready);       --on-ready: #1F4FBF;    /* kit candidate: kit --ps-on-ready on its tile is 3.83:1; this 5.61:1 */
  --st-sent: var(--ps-st-sent);         --on-sent: var(--ps-on-sent);
  --st-won: var(--ps-st-won);           --on-won: var(--ink);   /* kit candidate: kit white on green is 3.39:1; ink 5.45:1 */
  --st-lost: #CF3329;                   --on-lost: #fff;        /* kit candidate: kit white on --ps-hue-red is 4.38:1; this 5.05:1 */
  --st-expired: var(--ps-st-expired);   --on-expired: var(--ps-on-expired);
  --st-cancelled: var(--ps-st-cancelled); --on-cancelled: var(--ps-on-cancelled);
  --good: color-mix(in srgb, var(--st-won) 62%, var(--ink));
  --bad: color-mix(in srgb, var(--st-lost) 78%, var(--ink));
  --warn: color-mix(in srgb, var(--c-amber) 62%, var(--ink));
  --good-tint: color-mix(in srgb, var(--c-green) 9%, var(--paper));
  --good-ring: color-mix(in srgb, var(--c-green) 35%, var(--paper));
  --warn-tint: color-mix(in srgb, var(--c-amber) 9%, var(--paper));
  --warn-ring: color-mix(in srgb, var(--c-amber) 48%, var(--paper));
  --bad-tint: color-mix(in srgb, var(--c-red) 8%, var(--paper));

  /* depth: rings and soft shadows */
  --sh-card: var(--ps-sh-sheet);
  --sh-pop: var(--ps-sh-pop);
  --sh-menu: var(--ps-sh-menu);
  --sh-modal: var(--ps-sh-modal);
  --sh-ink: var(--ps-sh-pb-ink);
  --sh-xs: var(--ps-sh-tile-sm-rest);
  /* kit candidates: the kit has no panel, hovered-card or lifted-sheet shadow; these are the four pages' own values */
  --sh-panel: 0 0 0 1px var(--hair), 0 1px 2px rgba(16, 18, 24, .04), 0 10px 30px -18px rgba(16, 18, 24, .16);
  --sh-card-h: 0 0 0 1px var(--rule), 0 10px 24px -12px rgba(16, 18, 24, .24);
  --sh-lift: 0 0 0 1px var(--rule), 0 14px 30px -10px rgba(16, 18, 24, .35), 0 40px 80px -30px rgba(16, 18, 24, .3);
  --press-light: var(--ps-press-light);
  --press-dark: var(--ps-press-dark);

  /* motion: the kit's curves. --k scales every duration below; it is the one foundation name a page may set (its
     speed switch writes it on <html>; PAGE_KNOBS in scripts/ui/mockup-kit.mjs). The durations are kit candidates: the
     kit's own --ps-dur-* have no speed knob. */
  --k: 1;
  --ease: var(--ps-ease-out);
  --spring: var(--ps-spring);
  --soak: var(--ps-soak);
  --unfold: var(--ps-menu-out);
  --out: var(--ps-menu-exit);
  --d-hover: calc(var(--k) * .15s); --d-fade: calc(var(--k) * .14s); --d-tip: calc(var(--k) * .18s);
  --d-glide: calc(var(--k) * .2s);  --d-toast-out: calc(var(--k) * .22s); --d-scrim: calc(var(--k) * .25s);
  --d-pop: calc(var(--k) * .26s);   --d-row: calc(var(--k) * .26s);  --d-rise: calc(var(--k) * .3s);
  --d-fold: calc(var(--k) * .3s);   --d-check: calc(var(--k) * .3s); --d-slide: calc(var(--k) * .34s);
  --d-toast: calc(var(--k) * .38s); --d-bar: calc(var(--k) * .5s);
  --stag: calc(var(--k) * 15ms);
}

/* Text size Large: the three body sizes one step up the clarity scale (12 -> 14, 14 -> 16, 16 -> 18); 15, 18, 24 and
   26 stay. The page's text-size switch
   sets it; the work order map opens on it (founder 2026-11-08: "use bigger fonts"). */
html[data-text="large"] { --t-12: .875rem; --t-14: 1rem; --t-16: 1.125rem; }

body {
  background: var(--page); color: var(--ink);
  font: 400 var(--t-14)/1.45 var(--f-ui); -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums lining-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--ink-3); opacity: 1; }

/* Reduced motion: the system setting, or the page's own Reduced motion switch (it toggles html.rm). Every move ends at
   once, a looping one included (it runs once, at once, instead of restarting every millisecond); the page's scripts
   read the same two signals before they animate anything themselves. */
html.rm *, html.rm *::before, html.rm *::after {
  animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
  transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important;
  }
}
