/* ============================================================================
   THE INPUT REGISTRY KIT: TOKENS
   Contract section 1.1. No component may contain a raw hex value. A raw hex
   outside this block is a bug (P1A A4, E38) and build assertion 19 fails on it.

   Every measurement that justified a value travels with it (P1A E40).

   ONE THEME PER SURFACE (P1A X4). No toggle is built. Both themes carry
   IDENTICAL token names, so a component rule cannot know which is active
   (P1A E38). The separation strategy flips with the theme; the component
   does not branch on theme, the tokens do.
   ========================================================================== */

:root {
  /* ---- SURFACE. The standalone kit page ships LIGHT with a DARK ledger band,
         which is the GCD shape (design 3.7). --------------------------------- */
  --ink: #0A0E0F;
  --surface: #FFFFFF;
  --surface-elevated: #F7F6F2;
  --card: #FFFFFF;
  --panel: #F2F1EC;

  --text: #16181A;
  --text-muted: #4A5054;
  --text-tertiary: #6B7276;

  /* ---- LINES: two tokens, never one. Contract 1.2 split 1.
         The shared 8 per cent hairline measures 1.26:1 and cards drawn with it
         stopped reading as objects under outdoor glare. The card outline was
         raised to roughly 33 per cent, measuring 3.03:1, meeting WCAG 1.4.11,
         while the hairline stayed for its other 47 consumers. Raising the
         shared token would have turned every divider into a bar. Two
         independent codebases reached this split independently. ------------- */
  --line: rgba(10,14,15,0.10);
  --line-strong: rgba(10,14,15,0.20);
  --card-outline: rgba(10,14,15,0.34);          /* measured 3.03:1 vs card fill */

  /* ---- ACCENT FAMILY: the only four a brand may fork (design 4.3).
         Split 2, contract 1.2: full teal measured 10.2:1 and was carrying
         actions and readings at the same time. A registry screen is almost
         entirely telemetry with a handful of actions; left unsplit, the
         actions disappear into the readings. ------------------------------- */
  --accent: #00E5CC;                            /* brand, interactive. Fill only on dark */
  --accent-data: #00A896;                       /* telemetry: rings, bars, gauges */
  --accent-text-light: #00756A;                 /* accent as TEXT or ICON on a light surface */
  --accent-dim: #00A896;                        /* hover, borders */

  /* On a light surface the interactive accent must be read as text, so the
     interactive token aliases the light-surface value. The component never
     knows: it always writes var(--accent-ui). */
  --accent-ui: var(--accent-text-light);

  /* ---- STATUS ---- */
  --warning: #FFB547;
  --danger: #FF5757;
  --success: #4ADE80;
  --ai: #9D8CFF;                                /* machine actor. Measured 5.96:1 */

  /* Status INK tokens. Contract 3.1: the chip LABEL is neutral high-contrast
     text; only the dot or icon and the background tint carry colour. This is
     why one chip definition works on both themes with no per-theme colour
     table, and it is the parent estate's single most transferable rule. */
  --warning-ink: #7A4A00;
  --danger-ink: #9B1C1C;
  --success-ink: #15803D;

  /* ---- LIGHT BAND ---- */
  --band-cream: #F5F2EA;
  --band-cream-ink: #2A2A32;

  /* ---- THE DARK LEDGER BAND. Fixed on both themes: a document does not
         follow the reader's theme where the band IS the theme (P1A X19). --- */
  --ledger-bg: #0A0E0F;
  --ledger-text: #F2F4F5;
  --ledger-muted: #A7B0B4;
  --ledger-line: rgba(255,255,255,0.10);
  --ledger-accent: var(--accent);

  /* ---- TYPE, exactly four sizes plus a mono trio. Contract 1.3.
         NOTHING BELOW 13px ANYWHERE (P1A C23).
         16px is a HARD MINIMUM on inputs, because it is what prevents iOS
         auto-zoom (P1A X6). ------------------------------------------------ */
  --t-headline: 32px;
  --t-section: 20px;
  --t-body: 16px;
  --t-caption: 13px;
  --m-large: 24px;
  --m-body: 16px;
  --m-small: 13px;
  --t-dense: 17px;
  --lh-dense: 1.62;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* ---- GEOMETRY. Contract 1.4. 4 and 8 rhythm. ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;
  --radius-card: 16px;
  --radius-chip: 999px;
  --radius-focus: 3px;

  /* Named token, per contract 1.4: any scrollable under the dock carries this
     bottom content inset so nothing hides behind it.

     AMENDED P6-m15. It was 88px and the dock MEASURES roughly 96px at 390px
     and roughly 104px between 621px and 1023px, where the band switcher's
     44px row sits under a full size dock-main. A token comment promising
     "nothing hides behind it" over a number eight to sixteen pixels short is
     the same class of defect as a label that states a number nobody checked.
     112px clears the tallest measured case with a margin, and the two narrower
     cases get their own values rather than one number covering none of them. */
  --dock-inset: 112px;

  /* Height budgets, stated so they can be disputed. Contract 3.3. */
  --row-compact-h: 72px;                        /* hard */
  --row-table-h: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #111517;
    --surface-elevated: #1A1A22;
    --card: #121218;
    --panel: #1E1F28;

    --text: #F2F4F5;
    --text-muted: #A7B0B4;
    --text-tertiary: #7C878C;

    --line: rgba(255,255,255,0.08);
    --line-strong: rgba(255,255,255,0.16);
    --card-outline: rgba(255,255,255,0.33);     /* measured 3.03:1 vs card fill */

    /* On dark the brand accent is legible as fill and as text, so the
       interactive token aliases the full-chroma accent. Same token name. */
    --accent-ui: var(--accent);

    --warning-ink: #FFD9A0;
    --danger-ink: #FFB4B4;
    --success-ink: #A7F3C6;

    --band-cream: #1A1A22;
    --band-cream-ink: #E8E6E0;

    --ledger-bg: #05080A;
    --ledger-line: rgba(255,255,255,0.12);
  }
}

/* An explicit choice, if a host ever stamps one, wins in both directions.
   The kit itself ships no toggle (P1A X4). */
:root[data-theme="dark"] {
  --surface: #111517; --surface-elevated: #1A1A22; --card: #121218; --panel: #1E1F28;
  --text: #F2F4F5; --text-muted: #A7B0B4; --text-tertiary: #7C878C;
  --line: rgba(255,255,255,0.08); --line-strong: rgba(255,255,255,0.16);
  --card-outline: rgba(255,255,255,0.33);
  --accent-ui: var(--accent);
  --warning-ink: #FFD9A0; --danger-ink: #FFB4B4; --success-ink: #A7F3C6;
  --band-cream: #1A1A22; --band-cream-ink: #E8E6E0;
  --ledger-bg: #05080A; --ledger-line: rgba(255,255,255,0.12);
}
