/*
 * StoryClick admin — brand tokens over Tabler (Bootstrap 5.3).
 *
 * The palette is the app's "Ink" theme (appv5/src/theme/tokens.ts) so the two
 * products read as one brand. What is deliberately NOT carried over from the
 * app: glassmorphism, film grain, generous leading, oversized display type.
 * This is ops tooling — a reviewer looks at it for eight hours and needs
 * density and scan speed, not atmosphere.
 *
 * Type roles:
 *   Instrument Serif  page titles and the wordmark only
 *   Geist             all UI text  (dense, high legibility at 13-14px)
 *   JetBrains Mono    ids, counts, timestamps, money, SKUs  (tabular)
 */

:root {
  /* Brand — Ink */
  --sc-bg:         #0e0e10;
  --sc-surface:    #16161a;
  --sc-surface-hi: #1f1f25;
  --sc-text:       #f5e9d4;
  --sc-text-dim:   rgba(245, 233, 212, 0.62);
  --sc-text-mute:  rgba(245, 233, 212, 0.55);
  --sc-accent:     #ff3d6e;
  --sc-accent-ink: #1a0510;
  --sc-line:       rgba(245, 233, 212, 0.10);
  --sc-chip:       rgba(245, 233, 212, 0.06);

  /* Status — used by story state, risk severity, delivery */
  --sc-draft:     rgba(245, 233, 212, 0.55);
  --sc-review:    #f6c445;
  --sc-published: #4ec9a0;
  --sc-rejected:  #ff8a4c;

  /* Tabler's own danger (#d63939) measures 3.86:1 on --sc-surface. A destructive
     action is the last label that should be hard to read. */
  --tblr-danger:      #ff6b6b;
  --tblr-danger-rgb:  255, 107, 107;
  --sc-blocked:   #ff4d4d;
  --sc-agent:     #a78bfa;

  --sc-radius:    10px;
  --sc-radius-sm: 7px;

  --sc-font-display: 'Instrument Serif', Georgia, serif;
  --sc-font-body: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sc-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Dark (default) ─────────────────────────────────────────────────────── */
[data-bs-theme='dark'] {
  --tblr-body-bg:           var(--sc-bg);
  --tblr-body-color:        var(--sc-text);
  --tblr-body-color-rgb:    245, 233, 212;
  --tblr-bg-surface:        var(--sc-surface);
  --tblr-bg-surface-dark:   var(--sc-bg);
  --tblr-bg-surface-secondary: var(--sc-surface-hi);
  --tblr-bg-surface-tertiary:  var(--sc-surface-hi);
  --tblr-border-color:      var(--sc-line);
  --tblr-border-color-translucent: var(--sc-line);
  --tblr-secondary:         var(--sc-text-dim);
  --tblr-secondary-color:   var(--sc-text-dim);
  --tblr-muted:             var(--sc-text-mute);
  --tblr-card-bg:           var(--sc-surface);
  --tblr-card-cap-bg:       var(--sc-surface);
  --tblr-tertiary-bg:       var(--sc-surface-hi);
  --tblr-emphasis-color:    var(--sc-text);
  --tblr-heading-color:     var(--sc-text);
}

/* ── Light — for reviewers working in daylight ──────────────────────────── */
[data-bs-theme='light'] {
  --sc-bg:         #faf7f2;
  --sc-surface:    #ffffff;
  --sc-surface-hi: #f2ece3;
  --sc-text:       #1a1613;
  --sc-text-dim:   rgba(26, 22, 19, 0.66);
  /* 0.58 measured 4.18:1 on the raised surface. The speaker labels above chat bubbles
     use this at 10px, which is not large text by any definition. */
  --sc-text-mute:  rgba(26, 22, 19, 0.62);
  --sc-line:       rgba(26, 22, 19, 0.12);
  --sc-chip:       rgba(26, 22, 19, 0.05);
  --sc-accent-ink: #ffffff;

  --tblr-body-bg:        var(--sc-bg);
  --tblr-body-color:     var(--sc-text);
  --tblr-body-color-rgb: 26, 22, 19;
  --tblr-bg-surface:     var(--sc-surface);
  --tblr-border-color:   var(--sc-line);
  --tblr-card-bg:        var(--sc-surface);
  --tblr-heading-color:  var(--sc-text);

  /* Status colours have to be restated for light, not inherited.
     The dark values are tuned to sit on #16161a, and --sc-draft is cream at 55%
     opacity — on a cream page that is 1.10:1, which is not "low contrast", it is
     a status label nobody can see at all. Every one of the six failed AA here
     before these existed: amber measured 1.63:1, green 2.06:1.
     These keep the hue and clear 4.5:1 against the card, the page and the raised
     surface, which is the bar for 11.5px text. */
  --sc-draft:     #6f6455;
  --sc-review:    #795c00;
  --sc-published: #0b7a5c;
  --sc-rejected:  #a8500c;
  --sc-blocked:   #c41f1f;
  --sc-agent:     #6d3fd4;
}

/* Accent applies to both themes. Tabler derives buttons/links from these. */
:root,
[data-bs-theme='dark'],
[data-bs-theme='light'] {
  --tblr-primary:      var(--sc-accent);
  --tblr-primary-rgb:  255, 61, 110;
  --tblr-primary-fg:   var(--sc-accent-ink);
  --tblr-link-color:   var(--sc-accent);
  --tblr-link-hover-color: var(--sc-accent);
  --tblr-font-sans-serif: var(--sc-font-body);
  --tblr-border-radius:    var(--sc-radius);
  --tblr-border-radius-sm: var(--sc-radius-sm);
}
