/* ============================================================================
   ds-tokens.css — THE SINGLE HOLDER FOR THE NEUTRAL, TYPE AND METRIC LAYER
   ============================================================================

   WHY THIS FILE EXISTS. Measured 2026-09-02: thirty tokens of the shipping
   design system were re-declared VERBATIM inside 172 drawings — roughly five
   thousand declarations where there should be thirty. Every value agreed, and
   that is the defect rather than the reassurance: they agreed BY COPY AND NOT
   BY REFERENCE. One hundred and seventy-two holders of one fact.

   That is the one-fact-two-holders defect at a scale of 172, and it is why
   every correction in this suite has cost a 101-file or 173-file sweep. A
   sweep is what you do when there is no holder.

   VALUES ARE TAKEN FROM `handover/design-system/system.css` AND
   `handover/design-system/components.css`, read at source. Nothing here is
   authored. Where this file and those disagree, THOSE WIN and this is stale.

   HOW A DRAWING USES IT. Link it in <helmet> beside ds-type.css and declare
   NOTHING it holds:

       <link rel="stylesheet" href="./ds-type.css" />
       <link rel="stylesheet" href="./ds-tokens.css" />
       <link rel="stylesheet" href="./ds-identity.css" />

   ============================================================================ */

:root {
  /* ---- GROUND AND SURFACE ------------------------------------------------ */
  --ground: #fefdfb;
  --surface: #f5f2ed;
  --lift: #fffcf6;
  --surface-press: #ece8e2;
  --edge: #c1bdb7;
  --edge-hi: #a39d96;

  /* ---- INK. A figure in ink is a figure nobody needs told about. --------- */
  --ink: #241e1a;
  --ink-2: #615953;
  --ink-3: #726a64;
  --ink-hi: #100a06;

  /* --ink-disabled HAS NO LEGITIMATE USE ON A REFUSAL and is held only for a
     genuinely inert control. Eighty-five refusals were greyed out by
     construction before this was corrected: a refusal is a FACT the substrate
     declines to publish, not a control nobody may touch. */
  --ink-disabled: #9b928c;

  /* ---- THE ONE CHROMA --------------------------------------------------- */
  /* EPISTEMIC, and the working surface's only colour. Every refusal, every
     bound, every absent-but-expected cell. A RESOLVED FIGURE TAKES NO CHROMA
     AND NO DECORATION: certainty is the one state that gets nothing, which is
     the same logic that leaves the primary action uncoloured. */
  --unknown: #7544cd;

  /* ---- WORKFLOW, AND CONFINED TO THE CHIP ------------------------------- */
  /* A state of WORK or the outcome of an ACT — never a state of a fact. The
     chip and nowhere else, and every chip site also passes a WORD. */
  --error: #b6073c;
  --settled: #005639;
  --settled-press: #00452e;
  --on-outstanding: #fdfaf3;

  /* ---- TYPE ------------------------------------------------------------- */
  --font: 'Montserrat', system-ui, -apple-system, sans-serif;
  --mono: 'Instrument Sans', 'Montserrat', system-ui, -apple-system, sans-serif; /* no typewriter face anywhere in the product (founder, 2026-10-06) */
  --font-mono: var(--mono);

  --t-micro: 11px;
  --t-fine: 13px;
  --t-body: 16px;
  --t-lead: 20px;
  --t-title: 24px;
  --t-head: 32px;
  --t-display: clamp(48px, 12vw, 76px);

  /* THE FIGURE CARD'S ONE NUMBER. 96px on a desk, which is what the page law states
     (docs/design-law, The Page, Section 3), and it shrinks with the viewport below ~600px
     because at hand width the slot is 263px wide and 96px "known" is 329px: the word ran
     off the card on /count at 375, inside the card's own overflow, where no ratio check
     and no gate could see it (D-1901). Measured on the served page at 375x812: a seven
     character money figure, "$12,480", is 245px at 60px and 261px at 64px, so 16vw, which
     is 60px at 375, is the widest that leaves the slot a margin. Sized to the figure the
     hand pages print, never to the widest a desk page could; a desk page at 375 is an
     incidental reading and still does not clip. This tree's token, not the office's. */
  --t-figure: clamp(56px, 16vw, 96px);

  /* THE FLOOR IS --t-micro AND IT IS 11px. A thirteen-pixel floor was applied
     once and erased the system's own eleven-pixel step; the step is the floor. */
  --t-min: var(--t-micro);

  --track-display: -0.022em;
  --track-title: -0.01em;
  --track-body: 0;
  --track-micro: 0.14em;

  /* the weight scale: see design/design-system/system.css (ADR 1222) */
  --w-hero: 650; --w-head: 600; --w-link: 550; --w-label: 500; --w-label-soft: 450; --w-plain: 400;
  --w-regular: var(--w-label);
  --w-medium: var(--w-head);
  --w-semibold: var(--w-head);
  --w-bold: var(--w-head);
  --w-black: var(--w-hero);
  --w-body: var(--w-regular);

  /* ---- SPACE ------------------------------------------------------------ */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* ---- RADIUS. A four-step family; zero radius is withdrawn. ------------ */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ---- TARGETS ---------------------------------------------------------- */
  --target: 44px;
  --target-min: 36px;
  --target-primary: 52px;

  /* ---- MEASURE AND PAGE ------------------------------------------------- */
  /* A desk surface resolves to ONE column, so its page and its measure are the
     same object. A reference document is navigable and multi-column, and there
     --page is set wider by the register. */
  --measure: 720px;
  --page: var(--measure);

  /* ---- MOTION ----------------------------------------------------------- */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --m-enter: 200ms;
  --m-press: 60ms;
  --m-state: 120ms;

  /* ---- MARK GEOMETRY ---------------------------------------------------- */
  /* THE SIX MARKS ARE A CLOSED SET AND A PARTITION, AND A CLOSED SET IS ONLY A
     SET IF THE MARK READS IDENTICALLY EVERYWHERE. These are the geometry the
     law states. Before this file they were TRANSCRIBED into drawings as
     literals, which means the set was closed by an author's typing rather than
     by reference — the same defect as a copied token, one layer down.

       Real              NO MARK. Certainty is the one state that gets nothing,
                         so there is deliberately no `--mark-real`.
       Real zero         a filled dot. A reading exists and came back nothing.
       Bounded below     a wedge up.   At least this much.
       Bounded above     a wedge down. At most this much.
       Bounded both ways a diamond.    Both wedges at once.
       Refusal           a hatched slot at the size the figure would have
                         occupied, NEVER COLLAPSED.

     FILL IS THE SET'S OWN CHANNEL: a filled dot and an open ring are different
     marks, so an open ring is a legal epistemic shape and is not the zero. */
  --mark: max(8px, 0.42em);
  --chipmark: max(12px, 0.92em);
  --flow: max(14px, 0.75em);
  --texture-step: max(2px, 0.11em);
  --knock: calc(var(--texture-step) * 2.2);
  --texture-unknown:
    repeating-linear-gradient(135deg,
      var(--unknown) 0 var(--texture-step, 3px),
      var(--ground) var(--texture-step, 3px) calc(var(--texture-step, 3px) * 2));

  /* The refusal's own words, so a slot says the same thing to a screen reader
     on every surface. */
  --stamp-text: "Nobody recorded this. Nothing here will guess it.";
}

/* A MARK QUALIFIES A FIGURE AND NEVER A CONTROL. A mark in an empty input tells
   an operator their own act is impossible, which is false: a blank field
   awaiting an act is a PENDING ACT, not a refusal. The distinction is by what
   the cell IS, never by how the cell looks. */

/* ==== THE BUTTON HIERARCHY [BUTTONS, 2026-10-09, ADR 1233] ===========================================
   ONE HIERARCHY, FOUR ROLES, AND THIS BLOCK IS BYTE-IDENTICAL IN `design/ds-tokens.css` (every drawing)
   AND `product/design-system/components.css` (every app page); `tests/buttons_hold_one_hierarchy.py` B1
   fails the day the two copies differ. Founder, 2026-10-09: *"Is it not best practice to use a contrasting
   color as a button when it is a prominent CTA?"* It is, and the category agrees: Apple, *"use a button
   that has a prominent visual style for the most likely action in a view"* and *"Keep the number of
   prominent buttons to one or two per view"*; Atlassian, *"Only include one primary button or call to
   action (CTA) in a page or area"*; Polaris, primary is *"High emphasis ... Should be used sparingly"*,
   secondary *"Medium emphasis"*, tertiary *"Low emphasis"*, critical for *"destructive actions"*.

     .btn-primary    the view's ONE most likely act. The app's own strong color filled, `--module-ink`,
                     with `--ground` on it (the palette law's one pairing, 7:1 and better). Never black.
     .btn-secondary  every other act a person presses. `--ground` with a 1.5px `--module-edge` frame.
     .btn-tertiary   an act that reads as a link: the app's ink, no fill, no frame, underlined on hover.
     .btn-danger     an act that destroys. Red words in a red frame and NEVER filled, because a filled
                     button is pressed without being read (Apple), so a destructive act is never primary.
     disabled        the existing withdrawal (`components.css`, D-200): no fill, no frame, 400 weight, and
                     the words beside it say why, per the disabled-control rule.
   `.btn-on-tile` takes an act onto an app's bright tile, where the tile's own text tone is the ink.
   The tokens are declared on the button itself so `--module-ink` resolves at the card it sits in. */
.btn-primary, .btn-secondary, .btn-tertiary, .btn-danger {
  --btn-ink: var(--module-ink, var(--ink-2));
  --btn-ground: var(--ground);
  --btn-edge: var(--module-edge, var(--edge-hi, var(--edge)));
  --btn-danger: var(--error);
  --btn-radius: 10px;
  box-sizing: border-box; display: inline-flex; align-items: center; gap: 7px;
  min-height: var(--target, 44px); padding: 0 16px;
  border: 1.5px solid transparent; border-radius: var(--btn-radius);
  font: inherit; font-size: var(--t-fine); font-weight: var(--w-link, 550); line-height: 1.25;
  text-decoration: none; text-align: left; cursor: pointer; user-select: none;
}
.btn-on-tile { --btn-ink: var(--module-text, var(--ink)); }
.btn-primary { background: var(--btn-ink); color: var(--btn-ground); border-color: var(--btn-ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--btn-ink) 82%, var(--ink));
                     border-color: color-mix(in oklab, var(--btn-ink) 82%, var(--ink)); }
.btn-secondary { background: var(--btn-ground); color: var(--btn-ink); border-color: var(--btn-edge); }
.btn-secondary:hover { border-color: var(--btn-ink); }
.btn-tertiary { background: transparent; color: var(--btn-ink); padding: 0 4px; }
.btn-tertiary:hover { text-decoration: underline; }
.btn-danger { background: var(--btn-ground); color: var(--btn-danger); border-color: var(--btn-danger); }
.btn-danger:hover { background: color-mix(in oklab, var(--btn-danger) 8%, var(--btn-ground)); }
/* A button keeps its own text color and no underline on hover, whatever a page's own `a:hover` says. Founder,
   2026-10-12: a primary went dark on hover and a page's `a:hover { color: var(--ink) }` turned its words dark too, so
   the label vanished. The selectors carry an element and a class so they outrank any bare `a:hover`. */
:is(a, button).btn-primary:hover { color: var(--btn-ground); text-decoration: none; }
:is(a, button).btn-secondary:hover, :is(a, button).btn-tertiary:hover { color: var(--btn-ink); }
:is(a, button).btn-secondary:hover { text-decoration: none; }
:is(a, button).btn-danger:hover { color: var(--btn-danger); text-decoration: none; }
.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-tertiary:focus-visible, .btn-danger:focus-visible {
  outline: 2px solid var(--btn-ink); outline-offset: 2px; }
.btn-primary:disabled, .btn-secondary:disabled, .btn-tertiary:disabled, .btn-danger:disabled,
.btn-primary[aria-disabled="true"], .btn-secondary[aria-disabled="true"],
.btn-tertiary[aria-disabled="true"], .btn-danger[aria-disabled="true"] {
  background: transparent; border-color: transparent; color: var(--ink-disabled, var(--ink-3));
  font-weight: var(--w-plain, 400); cursor: not-allowed; text-decoration: none; }
/* ==== TWO HIG FLOORS (design audit 1, 2026-10-27) ================================================================
   PLACEHOLDER TEXT is read by someone who has not typed yet: the browser default measured 4.11:1 on the field, under the
   4.5:1 AA floor, on every page. --ink-3 is the tree's own tertiary ink, held above 4.5:1 on both grounds. It stays lighter
   than typed text (--ink), so a placeholder still never reads as a value.
   A PRESSED BUTTON SHOWS IT WAS PRESSED: touch has no hover, so without :active a finger gets no answer until the page
   moves. The pressed face is the hover face, one step further. */
::placeholder { color: var(--ink-3, #726a64); opacity: 1; }
.btn-primary:active { background: color-mix(in oklab, var(--btn-ink) 70%, var(--ink)); border-color: color-mix(in oklab, var(--btn-ink) 70%, var(--ink)); }
.btn-secondary:active { background: color-mix(in oklab, var(--btn-ink) 14%, var(--btn-ground)); }
.btn-danger:active { background: color-mix(in oklab, var(--btn-danger) 14%, var(--btn-ground)); }
.btn-tertiary:active { background: color-mix(in oklab, var(--btn-ink) 12%, transparent); }
/* TYPE FLOOR ON A FINGER (design audit 1): a form field under 16px makes iOS zoom the page, and the 11 and 13px
   tokens are the sources of the small body text. On a coarse pointer the fine step is 14 and the micro step 12. */
@media (pointer: coarse) {
  :root { --t-fine: 14px; --t-micro: 12px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px; }
}
/* ==== END THE BUTTON HIERARCHY ======================================================================= */
