/*
 * signet-tokens.css — the Signet design system, whole and self-contained.
 *
 * Version: 2.0.0 (2026-08-08) — the LEDGER system.
 * Identity: teal·signal ground, warm paper cards, ink chrome, pill buttons,
 * Hanken Grotesk display over Space Mono machine values, hairline rules.
 *
 * WHY THIS REPLACED 1.0.0
 * -----------------------
 * 1.0.0 was the warm-dark / vermilion / zero-radius identity ratified by this
 * repo's own PROPOSAL-brand.md (2026-08-06). It is superseded by ruling **D128**
 * (2026-08-08): the ledger system won the identity experiment, and every Signet
 * UX/UI surface is to be made coherent with it — the marketing homepage, the
 * ceremonies, the receipt, and this console. The system doc is
 * `bestauth-surfaces/docs/design/DESIGN-SYSTEM.md`; the decision history is
 * D119–D128. Do not relitigate the hue here — it is a token.
 *
 * THE CONTRACT (unchanged from 1.0.0)
 * -----------------------------------
 * This file is the ONLY thing the two renders of the Signet console share:
 *   1. Signet Cloud (this repo) — aliases its --kp-* theme tokens to these.
 *   2. The engine's in-binary /admin (bestauth repo) — inlines this file
 *      verbatim in its base template.
 *
 * It is dependency-free BY DESIGN, and must stay that way:
 *   - no @import, no url(), no webfonts — nothing is ever fetched, so an
 *     air-gapped host renders the identical page at 2am. The system's real
 *     faces (Hanken Grotesk, Space Mono) are named FIRST in the stacks below
 *     and fall back to system faces wherever nobody has loaded them. Signet
 *     Cloud loads them from `/fonts.css`; the engine may choose not to.
 *   - custom properties only — no classes, no selectors that assume markup.
 *     The component vocabulary that consumes these tokens is a document
 *     (SIGNET-DESIGN-SYSTEM.md), not code, because the engine renders plain
 *     server-side HTML with zero JS.
 *
 * EDITING RULES
 * -------------
 *   - Values may change; names may not. Both renders read the names.
 *   - **Light is now the identity default (`:root`)** — the inverse of 1.0.0.
 *     The ledger system is a light system: the ground is the teal signal, the
 *     cards are warm paper, the ink is near-black. Dark lives under
 *     [data-theme="dark"] and is the system's ink-chrome palette promoted to a
 *     full surface; the host page owns the attribute.
 *   - Keep the two themes in the same order, with the same names, so a diff of
 *     the file is a diff of the palette and nothing else.
 *   - Bump the version when values change; the engine copies this file verbatim
 *     and needs to know when it drifted.
 *
 * ⚠ ONE NAME COLLIDES WITH THE SYSTEM DOC. The doc's `--paper` is the warm CARD
 *   (#FFFEF7); this file's `--sg-paper` has meant the PAGE GROUND since 1.0.0
 *   and both renders read it that way, so it keeps that meaning. The doc's five
 *   names are published verbatim below as `--sg-ground / --sg-card / --sg-warm /
 *   --sg-band / --sg-tint / --sg-hair` so a surface can quote the system
 *   directly instead of translating.
 *
 * CONTRAST LAW FOR THE TEAL GROUND. #141310 on #19A487 is 5.98:1 — the only
 * text that may sit DIRECTLY on the ground is full-strength ink. Dimmed and
 * muted inks are card-interior tokens (--sg-ink-dim on the ground is 2.46:1).
 * On the ground, hierarchy is type — size, weight, mono — never tint.
 */

:root {
  /* ── the system's own names, verbatim from DESIGN-SYSTEM.md ───────────────
     Published so a consumer can quote the system rather than translate it.
     Everything below is expressed in terms of these. */
  --sg-ground: #19a487; /* page ground — TEAL·SIGNAL, ruled 2026-08-07 */
  --sg-tint: #c6f0e8; /* panel tint, tracks the ground */
  --sg-card: #fffef7; /* the doc's `--paper`: the warm neutral card */
  --sg-warm: #e8e3d3; /* the heavier neutral card */
  --sg-band: #ede8da; /* inset bands, input grounds, hovers */
  --sg-hair: rgba(20, 19, 16, 0.16); /* hairline rules */

  /* ── palette · light (the default — the ledger identity is light-first) ─── */
  --sg-paper: var(--sg-ground); /* PAGE GROUND (see the collision note above) */
  --sg-surface: var(--sg-card); /* panel ground */
  --sg-surface-hi: var(--sg-band); /* raised ground, hover, input ground */
  --sg-border: var(--sg-hair); /* hairline rules */
  --sg-border-strong: rgba(20, 19, 16, 0.42); /* input + copy-field borders */
  --sg-border-subtle: rgba(20, 19, 16, 0.1); /* rules inside a panel */
  --sg-ink: #141310; /* primary text — never varies between themes' meaning */
  --sg-ink-dim: #55503f; /* secondary text (7.6:1 on card) */
  --sg-ink-muted: #6b6455; /* labels, captions (5.8:1 on card) */
  --sg-ink-disabled: #7a7362; /* placeholders (4.7:1 on card) */
  --sg-accent: #19a487; /* the hue at full strength — fills, on-dark text */
  --sg-accent-hi: #12836c; /* a darker fill for hover (card text on it: 4.7:1) */
  --sg-accent-deep: #0f6e5a; /* the accent as TEXT on card/tint (5.0:1 on tint) */
  --sg-accent-bg: var(--sg-tint);
  /* Ink laid ON the accent: card-white on #19A487 is only 3.09:1, the near-black
     is 5.98:1. Same choice the marketing site and the console concept make. */
  --sg-accent-ink: #141310;
  --sg-danger: #a33622; /* 6.8:1 on card */
  --sg-danger-bg: #f6e2dc; /* danger ink on it: 5.5:1 */
  --sg-success: #0f6e5a; /* 6.0:1 on card, 5.0:1 on tint */
  --sg-success-bg: var(--sg-tint);
  --sg-warn: #8a6111; /* 5.6:1 on card */
  --sg-warn-bg: #f2e7cb; /* warn ink on it: 4.6:1 */
  --sg-info: #2b5e7e; /* 7.0:1 on card */
  --sg-info-bg: #dce8ef; /* info ink on it: 5.7:1 */

  /* Text that sits DIRECTLY on the page ground rather than inside a card. On
     the teal there is no legible secondary tint, so the dim variant collapses
     onto the ink and the hierarchy is carried by size, weight and mono. In dark
     the ground is near-black and a genuine dim tone is available again. */
  --sg-ground-ink: #141310;
  --sg-ground-ink-dim: #141310;

  /* ── chrome · THEME-INVARIANT ─────────────────────────────────────────────
     The console's sidebar and topbar are ink in BOTH themes — that is the
     concept's signature, not a dark-mode accident. They therefore cannot read
     the palette above (which flips) and carry their own fixed set. In dark the
     page ground steps darker than the chrome so the rail still separates. */
  --sg-chrome: #141310; /* the ink rail */
  --sg-chrome-hi: #201e18; /* its raised ground: hover, the org switcher */
  --sg-chrome-line: #2e2b23; /* its rules */
  --sg-chrome-line-hi: #37332a; /* its borders */
  --sg-chrome-ink: #fffef6; /* text on the rail (18.5:1) */
  --sg-chrome-dim: #cfc9b8; /* its secondary text (11.5:1) */
  --sg-chrome-muted: #8f8a7a; /* its mono micro-labels (5.5:1) */

  /* ── the SOLID MARK — the system's strongest object ───────────────────────
     The primary button, the recommended tier, the top-tier badge. On light it
     is the concept's dark pill (ink ground, accent text); on dark that pill
     would vanish into the page, so it inverts to the accent fill with ink text
     — which is exactly what the concept does on its own dark surfaces. Every
     solid object reads these four names, so the inversion happens once. */
  --sg-solid: var(--sg-chrome); /* its ground */
  --sg-solid-hi: var(--sg-chrome-hi); /* its hover ground */
  --sg-solid-ink: var(--sg-accent); /* the SIGNAL text on it: labels, prices */
  --sg-solid-text: var(--sg-chrome-ink); /* body text on it */
  --sg-solid-dim: var(--sg-chrome-dim); /* secondary text on it */

  /* The ring pressed around a ceremony card. Ink at full strength on paper; on
     dark, full-strength ink-white is a glare, so it steps back to a hairline. */
  --sg-press-ring: #141310;

  /* ── type — the ledger faces first, system stacks behind them ───────────── */
  --sg-font:
    "Hanken Grotesk", ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sg-font-mono:
    "Space Mono", ui-monospace, "IBM Plex Mono", "JetBrains Mono",
    SFMono-Regular, Menlo, Consolas, monospace;

  /* ── scale & spacing — 4px base, the rhythm both consoles already use ──── */
  --sg-text-xs: 11.5px;
  --sg-text-sm: 13px;
  --sg-text-md: 15px;
  --sg-text-lg: 17px;
  --sg-text-xl: 2.1rem;
  --sg-space-1: 4px;
  --sg-space-2: 8px;
  --sg-space-3: 16px;
  --sg-space-4: 24px;
  --sg-space-5: 40px;

  /* ── shape — the pill is load-bearing in this identity, not a preference ──
     1.0.0 made the same claim about zero radius; D128 replaced the claim.
     --sg-radius is the DEFAULT (fields, small frames); the two named radii are
     the system's card and pill. */
  --sg-radius: 14px;
  --sg-radius-card: 22px;
  --sg-radius-lg: 28px;
  --sg-radius-pill: 999px;
  --sg-stroke: 1.5px; /* the system's border weight on pills and ceremonies */

  color-scheme: light;
}

[data-theme="dark"] {
  /* The ink chrome promoted to a whole surface. The ground steps BELOW the
     chrome tokens (#0E0D0A vs #141310) so the sidebar and topbar still read as
     separate objects rather than dissolving into the page. */
  --sg-paper: #0e0d0a;
  --sg-surface: #17150f;
  --sg-surface-hi: #201e18;
  --sg-border: rgba(255, 254, 247, 0.14);
  --sg-border-strong: rgba(255, 254, 247, 0.3);
  --sg-border-subtle: rgba(255, 254, 247, 0.08);
  --sg-ink: #fffef6;
  --sg-ink-dim: #cfc9b8;
  --sg-ink-muted: #8f8a7a; /* 5.5:1 on the ground */
  --sg-ink-disabled: #8a8372; /* placeholders stay readable: 4.7:1 on a panel */
  --sg-accent: #19a487;
  --sg-accent-hi: #22c4a2;
  --sg-accent-deep: #6fdcc2; /* the accent as TEXT on ink (11.4:1) */
  --sg-accent-bg: rgba(25, 164, 135, 0.16);
  --sg-accent-ink: #141310; /* unchanged: ink is what goes ON the teal */
  --sg-danger: #e8705c;
  --sg-danger-bg: rgba(232, 112, 92, 0.16);
  --sg-success: #6fdcc2;
  --sg-success-bg: rgba(111, 220, 194, 0.14);
  --sg-warn: #e0b25a;
  --sg-warn-bg: rgba(224, 178, 90, 0.14);
  --sg-info: #7fb4d9;
  --sg-info-bg: rgba(127, 180, 217, 0.14);

  --sg-ground-ink: #fffef6;
  --sg-ground-ink-dim: #cfc9b8;

  /* The solid mark inverts: an ink pill on an ink page is not a mark. It
     becomes the accent fill with ink text — 5.98:1, the same pairing the light
     theme lays ON the accent. */
  --sg-solid: #19a487;
  --sg-solid-hi: #22c4a2;
  --sg-solid-ink: #141310;
  --sg-solid-text: #141310;
  --sg-solid-dim: rgba(20, 19, 16, 0.86); /* 4.9:1 on the accent */

  --sg-press-ring: rgba(255, 254, 247, 0.34);

  /* The ground name still resolves for anything quoting the system directly;
     the tint goes translucent so a tinted panel reads as tinted, not as a
     light rectangle punched into a dark page. */
  --sg-ground: #0e0d0a;
  --sg-tint: rgba(25, 164, 135, 0.14);
  --sg-card: #17150f;
  --sg-warm: #201e18;
  --sg-band: #201e18;
  --sg-hair: rgba(255, 254, 247, 0.14);

  color-scheme: dark;
}
