/* =============================================================================
   LEDGER — the first alternate skin (white-label S2, 2026-08-30)
   =============================================================================
   A COMPLETE value-set over the token contract, per LS constitution §2a:
   values only — tier anatomy, primitives, encodings and every hard rule are
   invariant; this file may declare tokens and nothing else. Parity is
   machine-checked by scripts/check_skin_contract.py (SK001): every contract
   token (scripts/skin_contract.json) plus the flagship's --ls-* set, in BOTH
   modes. A token missing here silently wears the flagship's value — that is
   a CI failure, not a fallback.

   Character (Will, 2026-08-30): SLATE MINIMAL — cool neutral grays, one
   restrained blue accent, flat surfaces, hairline borders; grotesk display
   (Inter, already loaded — no new font weight) instead of Fraunces. The
   "substance-forward" counterpart to the Living System flagship.

   Cascade notes (load ORDER matters — index.html loads this after
   living_system.css):
   • Dark block: body[data-skin="ledger"] (0,1,1) beats :root declarations on
     inheritance (body is closer than html for the body subtree).
   • Light block: body[data-skin="ledger"][data-mode="light"] (0,2,1) TIES the
     Paper remap (body.ls-active[data-mode="light"]) and wins on order. The
     --ls-* light twins here are REQUIRED for exactly that reason — without
     them, light mode paints LS surfaces in Paper cream under this skin.
   • The ls-active light remap also carries component-level literal repairs
     tuned for Paper; those still apply under Ledger light and are known,
     bounded debt (they shrink as living_system.css literals migrate to
     tokens under the U007 ratchet).
   ========================================================================== */

/* ── DARK (the skin's base) ────────────────────────────────────────────── */
body[data-skin="ledger"] {
  /* App contract — chrome & content */
  --color-bg:               #0D1117;
  --color-bg-2:             #10151C;
  --color-surface:          #161C24;
  --color-surface-2:        #1B222C;
  --color-text:             #DCE3EC;
  --color-text-muted:       #8C99A8;
  --color-border:           #232B36;
  --color-primary:          #5284D7;  /* AA-solved: >=4.6:1 on surface/bg-2/bg (2026-08-30) */
  --color-primary-dark:     #2F5AA8;
  --color-accent:           #7FA6E0;
  --color-accent-2:         #56C2C9;
  --color-success:          #3FB37F;
  --color-warning:          #D9A03C;
  --color-danger:           #E06C5F;
  --color-field-bg:         #121821;
  --color-field-border:     #2A3340;
  --color-field-text:       #DCE3EC;
  --color-field-placeholder:#6E7B8B;
  --color-field-focus:      rgba(93,138,214,.55);
  --color-sidebar-bg:       #0A0E13;
  --color-sidebar-text:     #C7D1DC;
  --color-topbar-bg:        rgba(13,17,23,.90);
  --color-ai:               #8178DA;  /* AA-solved: >=4.6:1 on --color-surface (2026-08-30) */
  --color-ai-light:         #978FE2;
  --color-ai-dark:          #6459C4;
  --color-ai-surface:       rgba(125,116,214,.08);
  --color-ai-border:        rgba(125,116,214,.25);
  --color-ai-glow:          0 0 16px rgba(125,116,214,.12);

  /* Data-viz — same semantics (red→amber→teal), cooler grades */
  --score-ramp-low:         #E36A62;
  --score-ramp-mid:         #D9A03C;
  --score-ramp-high:        #3AB8A2;
  --chart-series-1:         #60A5FA;
  --chart-series-2:         #2DD4BF;
  --chart-series-3:         #A78BFA;
  --chart-series-4:         #D9A03C;
  --chart-series-5:         #F472B6;
  --chart-series-6:         #FB923C;
  --chart-series-7:         #34D399;
  --chart-series-8:         #E36A62;
  --chart-grid:             rgba(148,163,184,.08);

  /* Font roles — grotesk display; the editorial serif voice is the
     flagship's, not Ledger's */
  --font-sans:              'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:              'Geist Mono', 'SF Mono', 'Fira Code', monospace;
  --font-display:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif:             Georgia, 'Times New Roman', serif;

  /* --ls-* — the LS vocabulary, re-graded slate. The amber family carries
     the LS ACCENT ROLE, so under Ledger it holds the restrained blue. */
  --ls-bg:        #0D1117;
  --ls-bg-2:      #10151C;
  --ls-bg-3:      #151B24;
  --ls-bg-4:      #1C242F;
  --ls-line:      rgba(148,163,184,.10);
  --ls-line-2:    rgba(148,163,184,.16);
  --ls-line-3:    rgba(148,163,184,.24);
  --ls-ink:       #E2E8F0;
  --ls-ink-2:     #9FACBD;
  --ls-ink-3:     #7E8CA0;
  --ls-ink-4:     #3C4656;
  --ls-amber:     #5D8AD8;
  --ls-amber-2:   #86ACE8;
  --ls-amber-3:   #B7CDF2;
  --ls-amber-deep:#2C4E8A;
  --ls-green:     #45B08C;
  --ls-green-2:   #7FD6B6;
  --ls-red:       #E06C5F;
  --ls-red-2:     #EE9C93;
  --ls-violet:    #8B84DD;
  --ls-violet-2:  #BBB5EC;
  --ls-sans:      var(--font-sans, 'Inter', ui-sans-serif, system-ui, sans-serif);
  --ls-mono:      var(--font-mono, 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  --ls-display:   var(--font-display, 'Inter', ui-sans-serif, system-ui, sans-serif);
  /* Flat chrome: no radial glows, hairline definition instead of depth */
  --ls-world-bg:      var(--ls-bg-2);
  --ls-world-shadow:  0 20px 40px rgba(0,0,0,.35);
  --ls-grid-color:    rgba(148,163,184,.04);
  --ls-chip-bg:       rgba(148,163,184,.05);
  --ls-caption-bg:    rgba(16,21,28,.90);
  --ls-node-shadow:   inset 0 0 0 1px rgba(148,163,184,.08);
  --ls-node-bg:       linear-gradient(180deg, rgba(148,163,184,.06), rgba(148,163,184,.02));
}

/* ── LIGHT ─────────────────────────────────────────────────────────────── */
body[data-skin="ledger"][data-mode="light"],
body[data-skin="ledger"][data-site-theme="classic"] {
  --color-bg:               #F5F7FA;
  --color-bg-2:             #EDF1F5;
  --color-surface:          #FFFFFF;
  --color-surface-2:        #FAFBFD;
  --color-text:             #1A222C;
  --color-text-muted:       #5A6878;
  --color-border:           #D7DEE7;
  --color-primary:          #2E62B8;
  --color-primary-dark:     #1E4585;
  --color-accent:           #3B70C4;
  --color-accent-2:         #12808A;
  --color-success:          #177A50;
  --color-warning:          #96650A;
  --color-danger:           #BC3F33;
  --color-field-bg:         #FFFFFF;
  --color-field-border:     #C9D2DD;
  --color-field-text:       #1A222C;
  --color-field-placeholder:#75828F;
  --color-field-focus:      rgba(46,98,184,.40);
  --color-sidebar-bg:       #14202E;
  --color-sidebar-text:     #E8EEF5;
  --color-topbar-bg:        rgba(255,255,255,.94);
  --color-ai:               #5B51BD;
  --color-ai-light:         #6E64CE;
  --color-ai-dark:          #48409B;
  --color-ai-surface:       rgba(91,81,189,.07);
  --color-ai-border:        rgba(91,81,189,.22);
  --color-ai-glow:          0 0 16px rgba(91,81,189,.10);

  --score-ramp-low:         #B8362C;
  --score-ramp-mid:         #8F6108;
  --score-ramp-high:        #0C6E56;
  --chart-series-1:         #1D4ED8;
  --chart-series-2:         #0F766E;
  --chart-series-3:         #6D28D9;
  --chart-series-4:         #8F6108;
  --chart-series-5:         #BE185D;
  --chart-series-6:         #C2410C;
  --chart-series-7:         #0C6E56;
  --chart-series-8:         #B8362C;
  --chart-grid:             rgba(26,34,44,.10);

  /* --ls-* light twins — REQUIRED: they out-order the Paper cream remap
     (see cascade notes above). Slate paper, not warm paper. */
  --ls-bg:        #F5F7FA;
  --ls-bg-2:      #EDF1F5;
  --ls-bg-3:      #E4EAF0;
  --ls-bg-4:      #D9E1E9;
  --ls-line:      rgba(26,34,44,.10);
  --ls-line-2:    rgba(26,34,44,.16);
  --ls-line-3:    rgba(26,34,44,.26);
  --ls-ink:       #1A222C;
  --ls-ink-2:     #46545F;
  --ls-ink-3:     #5F6E7C;
  --ls-ink-4:     #9AA7B3;
  --ls-amber:     #2E62B8;
  --ls-amber-2:   #1E4585;
  --ls-amber-3:   #16386D;
  --ls-amber-deep:#A9C4EA;
  --ls-green:     #177A50;
  --ls-green-2:   #0C5B3B;
  --ls-red:       #BC3F33;
  --ls-red-2:     #93312A;
  --ls-violet:    #5B51BD;
  --ls-violet-2:  #48409B;
  --ls-sans:      var(--font-sans, 'Inter', ui-sans-serif, system-ui, sans-serif);
  --ls-mono:      var(--font-mono, 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  --ls-display:   var(--font-display, 'Inter', ui-sans-serif, system-ui, sans-serif);
  --ls-world-bg:      var(--ls-bg-2);
  --ls-world-shadow:  0 16px 32px rgba(26,34,44,.10);
  --ls-grid-color:    rgba(26,34,44,.05);
  --ls-chip-bg:       rgba(26,34,44,.04);
  --ls-caption-bg:    rgba(255,255,255,.92);
  --ls-node-shadow:   inset 0 0 0 1px rgba(26,34,44,.10);
  --ls-node-bg:       linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.55));
}
