/* ===========================================================================
   TUNGSTEN SKYLARK — brand tokens, generated from themes/tokens.json
   (W3C Design Tokens / DTCG format).
   Drop into any web/electron app. Theme = pure variable swap; appearance =
   light/dark variable swap (mirrors the official ts-brand.css mechanics).
   Discipline: ~10% maximum accent per screen.
   Generated by tools/build-tokens-css.py — regenerate, don't hand-edit.
   ========================================================================== */

:root,
[data-theme='skylark'] {
    /* 1 · Skylark — the brand base (default) */
    --th-bg-l: #F5F2EC;        --th-bg-d: #232529;
    --th-surface-l: #FFF9F0;   --th-surface-d: #3C3F44;
    --th-text-l: #3C3F44;      --th-text-d: #F5F2EC;
    --th-accent-l: #FFA42B;    --th-accent-d: #FFB24D;
    --th-accent-soft-l: #FFC968;--th-accent-soft-d: #FFC968;
    --th-ink-l: #232529;       --th-ink-d: #232529;
}
[data-theme='ember'] {
    /* 2 · Ember — forge red, power */
    --th-bg-l: #F7F2ED;        --th-bg-d: #211C19;
    --th-surface-l: #FFFAF2;   --th-surface-d: #362E29;
    --th-text-l: #3A332F;      --th-text-d: #F6EFE8;
    --th-accent-l: #E4562D;    --th-accent-d: #FF7A4E;
    --th-accent-soft-l: #FF8B5E;--th-accent-soft-d: #FFA277;
    --th-ink-l: #FFFFFF;       --th-ink-d: #211C19;
}
[data-theme='dawn'] {
    /* 3 · Dawn — first light, distinctive */
    --th-bg-l: #EDF1F6;        --th-bg-d: #1C222C;
    --th-surface-l: #F8FAFD;   --th-surface-d: #2C3442;
    --th-text-l: #2D3340;      --th-text-d: #EDF1F7;
    --th-accent-l: #EE6C48;    --th-accent-d: #FF8F68;
    --th-accent-soft-l: #F9A887;--th-accent-soft-d: #FFB695;
    --th-ink-l: #FFFFFF;       --th-ink-d: #1C222C;
}
[data-theme='frost'] {
    /* 4 · Frost — winter on the fells, focus */
    --th-bg-l: #EFF3F6;        --th-bg-d: #1B2127;
    --th-surface-l: #F9FBFD;   --th-surface-d: #2A323A;
    --th-text-l: #2A3138;      --th-text-d: #E8EEF3;
    --th-accent-l: #3F8EC9;    --th-accent-d: #5AA5DE;
    --th-accent-soft-l: #7CB6DE;--th-accent-soft-d: #8FC6EC;
    --th-ink-l: #FFFFFF;       --th-ink-d: #FFFFFF;
}
[data-theme='harbour'] {
    /* 5 · Harbour — working water, steady */
    --th-bg-l: #ECF3F3;        --th-bg-d: #1A2323;
    --th-surface-l: #F7FCFC;   --th-surface-d: #293433;
    --th-text-l: #293534;      --th-text-d: #E9F1F0;
    --th-accent-l: #187D80;    --th-accent-d: #33A3A5;
    --th-accent-soft-l: #5DB2B3;--th-accent-soft-d: #66BFBF;
    --th-ink-l: #FFFFFF;       --th-ink-d: #FFFFFF;
}
[data-theme='meadow'] {
    /* 6 · Meadow — grassland, daylight */
    --th-bg-l: #F1F4EC;        --th-bg-d: #1F231C;
    --th-surface-l: #FBFDF7;   --th-surface-d: #2E3529;
    --th-text-l: #32372D;      --th-text-d: #EFF3E7;
    --th-accent-l: #5C9C38;    --th-accent-d: #76BE51;
    --th-accent-soft-l: #94C468;--th-accent-soft-d: #A3D67E;
    --th-ink-l: #FFFFFF;       --th-ink-d: #FFFFFF;
}
[data-theme='dusk'] {
    /* 7 · Dusk — the descent, nocturnal */
    --th-bg-l: #F1EFF5;        --th-bg-d: #201D27;
    --th-surface-l: #FBF9FD;   --th-surface-d: #312C3B;
    --th-text-l: #343040;      --th-text-d: #EFEBF5;
    --th-accent-l: #8A55C8;    --th-accent-d: #9C6BD8;
    --th-accent-soft-l: #B489DE;--th-accent-soft-d: #BE93E6;
    --th-ink-l: #FFFFFF;       --th-ink-d: #FFFFFF;
}
[data-theme='rose'] {
    /* 8 · Rose — the human side of the metal */
    --th-bg-l: #F6F0EF;        --th-bg-d: #231E1E;
    --th-surface-l: #FDF8F7;   --th-surface-d: #352E2E;
    --th-text-l: #3C3130;      --th-text-d: #F6F0EF;
    --th-accent-l: #CC4758;    --th-accent-d: #E86577;
    --th-accent-soft-l: #EF8B97;--th-accent-soft-d: #F2939F;
    --th-ink-l: #FFFFFF;       --th-ink-d: #FFFFFF;
}
[data-theme='ink'] {
    /* 9 · Ink — pure tungsten, calm */
    --th-bg-l: #F4F4F3;        --th-bg-d: #1D1E20;
    --th-surface-l: #FCFCFC;   --th-surface-d: #2D2F33;
    --th-text-l: #2F2F2E;      --th-text-d: #ECECEC;
    --th-accent-l: #6B6E75;    --th-accent-d: #B5B8BE;
    --th-accent-soft-l: #9A9DA3;--th-accent-soft-d: #D6D8DC;
    --th-ink-l: #FFFFFF;       --th-ink-d: #2F2F2E;
}
[data-theme='phosphor'] {
    /* 10 · Tungsten Phosphor — retro green-phosphor CRT terminal, permanent collection member. Dark-first; light variant is the paper printout. */
    --th-bg-l: #EEF4EE;        --th-bg-d: #060D08;
    --th-surface-l: #F8FCF8;   --th-surface-d: #0E1A10;
    --th-text-l: #1B2A1E;      --th-text-d: #CFF5D3;
    --th-accent-l: #0E6B2E;    --th-accent-d: #00FF41;
    --th-accent-soft-l: #35A85C;--th-accent-soft-d: #5CFF86;
    --th-ink-l: #FFFFFF;       --th-ink-d: #04120A;
}
[data-theme='brassworks'] {
    /* 11 · Tungsten Brassworks — steampunk riff: copper gaslight on aged iron. Eleventh collection member; the only copper/parchment voice in the set. */
    --th-bg-l: #F0E7D0;        --th-bg-d: #1A130D;
    --th-surface-l: #FAF3E3;   --th-surface-d: #2A1F15;
    --th-text-l: #33261A;      --th-text-d: #EFE2C8;
    --th-accent-l: #A0521C;    --th-accent-d: #E08A3C;
    --th-accent-soft-l: #C48A55;--th-accent-soft-d: #8A5A2B;
    --th-ink-l: #FAF3E3;       --th-ink-d: #1A130D;
}

/* ---------- working roles (light by default) + derived ---------- */
:root {
    color-scheme: light dark;
    --ts-bg: var(--th-bg-l);
    --ts-surface: var(--th-surface-l);
    --ts-text: var(--th-text-l);
    --ts-accent: var(--th-accent-l);
    --ts-accent-soft: var(--th-accent-soft-l);
    --ts-ink: var(--th-ink-l);

    --ts-text-soft: color-mix(in srgb, var(--ts-text) 62%, transparent);
    --ts-line: color-mix(in srgb, var(--ts-text) 16%, transparent);
    --ts-line-strong: color-mix(in srgb, var(--ts-text) 30%, transparent);
    --ts-glow: color-mix(in srgb, var(--ts-accent-soft) 24%, transparent);
    --ts-glow-strong: color-mix(in srgb, var(--ts-accent-soft) 42%, transparent);

    --font-display: 'Chakra Petch', 'Avenir Next', 'Segoe UI', sans-serif;
    --font-mono: Space Mono, ui-monospace, SF Mono, Menlo, monospace;

    --sp-1: 8px; --sp-2: 16px; --sp-3: 24px; --sp-4: 32px; --sp-5: 48px; --sp-6: 64px; --sp-7: 96px;
    --radius: 12px;
    --content-max: 1160px;
}

html[data-appearance='light'],
[data-theme][data-appearance='light'] {
    color-scheme: light;
    --ts-bg: var(--th-bg-l);
    --ts-surface: var(--th-surface-l);
    --ts-text: var(--th-text-l);
    --ts-accent: var(--th-accent-l);
    --ts-accent-soft: var(--th-accent-soft-l);
    --ts-ink: var(--th-ink-l);
}
html[data-appearance='dark'],
[data-theme][data-appearance='dark'] {
    color-scheme: dark;
    --ts-bg: var(--th-bg-d);
    --ts-surface: var(--th-surface-d);
    --ts-text: var(--th-text-d);
    --ts-accent: var(--th-accent-d);
    --ts-accent-soft: var(--th-accent-soft-d);
    --ts-ink: var(--th-ink-d);
}
@media (prefers-color-scheme: dark) {
    html[data-appearance='auto'],
    html:not([data-appearance]) {
        color-scheme: dark;
        --ts-bg: var(--th-bg-d);
        --ts-surface: var(--th-surface-d);
        --ts-text: var(--th-text-d);
        --ts-accent: var(--th-accent-d);
        --ts-accent-soft: var(--th-accent-soft-d);
        --ts-ink: var(--th-ink-d);
    }
}

/* ---------- --ts-accent-text: derived role for text-bearing accent -----
   Explicit sanctioned values (accentText in tokens.json) are used when
   declared; otherwise computed AA-safe blends. NEVER use --ts-accent
   for body-size text. Large text (>=24px / 18.7px bold) may use --ts-accent
   where it holds >=3:1. */
[data-theme='skylark'] {
    --ts-accent-text-l: #9A5300;   /* on #F5F2EC: 5.20:1 */
    --ts-accent-text-d: #FFB24D;   /* on #232529: 8.57:1 */
}
[data-theme='ember'] {
    --ts-accent-text-l: #B64524;   /* on #F7F2ED: 4.88:1 */
    --ts-accent-text-d: #FF7A4E;   /* on #211C19: 6.54:1 */
}
[data-theme='dawn'] {
    --ts-accent-text-l: #A74C32;   /* on #EDF1F6: 4.97:1 */
    --ts-accent-text-d: #FF8F68;   /* on #1C222C: 7.14:1 */
}
[data-theme='frost'] {
    --ts-accent-text-l: #3272A1;   /* on #EFF3F6: 4.64:1 */
    --ts-accent-text-d: #5AA5DE;   /* on #1B2127: 6.09:1 */
}
[data-theme='harbour'] {
    --ts-accent-text-l: #17777A;   /* on #ECF3F3: 4.72:1 */
    --ts-accent-text-d: #33A3A5;   /* on #1A2323: 5.29:1 */
}
[data-theme='meadow'] {
    --ts-accent-text-l: #45752A;   /* on #F1F4EC: 4.93:1 */
    --ts-accent-text-d: #76BE51;   /* on #1F231C: 7.04:1 */
}
[data-theme='dusk'] {
    --ts-accent-text-l: #8351BE;   /* on #F1EFF5: 4.74:1 */
    --ts-accent-text-d: #A172DA;   /* on #201D27: 4.69:1 */
}
[data-theme='rose'] {
    --ts-accent-text-l: #B8404F;   /* on #F6F0EF: 4.80:1 */
    --ts-accent-text-d: #E86577;   /* on #231E1E: 5.14:1 */
}
[data-theme='ink'] {
    --ts-accent-text-l: #6B6E75;   /* on #F4F4F3: 4.64:1 */
    --ts-accent-text-d: #B5B8BE;   /* on #1D1E20: 8.39:1 */
}
[data-theme='phosphor'] {
    --ts-accent-text-l: #0E6B2E;   /* on #EEF4EE: 5.95:1 */
    --ts-accent-text-d: #00FF41;   /* on #060D08: 14.39:1 */
}
[data-theme='brassworks'] {
    --ts-accent-text-l: #A0521C;   /* on #F0E7D0: 4.58:1 */
    --ts-accent-text-d: #E08A3C;   /* on #1A130D: 6.89:1 */
}

/* Semantic roles: derived, AA-audited (recipes in tokens.json $extensions).
   ok/error/warn are hue-anchored to meadow/rose/ember accents per mode,
   blended to >=4.5:1 on the theme bg; selection = accentSoft 40% over bg. */
[data-theme='skylark'] {
    --ts-ok-l: #45752A;   /* on #F5F2EC: 4.91:1 */
    --ts-ok-d: #76BE51;   /* on #232529: 6.76:1 */
    --ts-error-l: #B8404F;   /* on #F5F2EC: 4.84:1 */
    --ts-error-d: #E86577;   /* on #232529: 4.79:1 */
    --ts-warn-l: #B64524;   /* on #F5F2EC: 4.86:1 */
    --ts-warn-d: #FF7A4E;   /* on #232529: 5.95:1 */
    --ts-selection-l: #F9E2B7;
    --ts-selection-d: #7B6742;
}
[data-theme='ember'] {
    --ts-ok-l: #45752A;   /* on #F7F2ED: 4.93:1 */
    --ts-ok-d: #76BE51;   /* on #211C19: 7.43:1 */
    --ts-error-l: #B8404F;   /* on #F7F2ED: 4.86:1 */
    --ts-error-d: #E86577;   /* on #211C19: 5.27:1 */
    --ts-warn-l: #B64524;   /* on #F7F2ED: 4.88:1 */
    --ts-warn-d: #FF7A4E;   /* on #211C19: 6.54:1 */
    --ts-selection-l: #FAC9B4;
    --ts-selection-d: #7A523F;
}
[data-theme='dawn'] {
    --ts-ok-l: #45752A;   /* on #EDF1F6: 4.83:1 */
    --ts-ok-d: #76BE51;   /* on #1C222C: 7.04:1 */
    --ts-error-l: #B8404F;   /* on #EDF1F6: 4.77:1 */
    --ts-error-d: #E86577;   /* on #1C222C: 4.99:1 */
    --ts-warn-l: #B64524;   /* on #EDF1F6: 4.79:1 */
    --ts-warn-d: #FF7A4E;   /* on #1C222C: 6.20:1 */
    --ts-selection-l: #F2D4CA;
    --ts-selection-d: #775D56;
}
[data-theme='frost'] {
    --ts-ok-l: #45752A;   /* on #EFF3F6: 4.91:1 */
    --ts-ok-d: #76BE51;   /* on #1B2127: 7.15:1 */
    --ts-error-l: #B8404F;   /* on #EFF3F6: 4.85:1 */
    --ts-error-d: #E86577;   /* on #1B2127: 5.07:1 */
    --ts-warn-l: #B64524;   /* on #EFF3F6: 4.87:1 */
    --ts-warn-d: #FF7A4E;   /* on #1B2127: 6.30:1 */
    --ts-selection-l: #C1DBEC;
    --ts-selection-d: #496376;
}
[data-theme='harbour'] {
    --ts-ok-l: #45752A;   /* on #ECF3F3: 4.88:1 */
    --ts-ok-d: #76BE51;   /* on #1A2323: 7.07:1 */
    --ts-error-l: #B8404F;   /* on #ECF3F3: 4.81:1 */
    --ts-error-d: #E86577;   /* on #1A2323: 5.01:1 */
    --ts-warn-l: #B64524;   /* on #ECF3F3: 4.83:1 */
    --ts-warn-d: #FF7A4E;   /* on #1A2323: 6.22:1 */
    --ts-selection-l: #B3D9D9;
    --ts-selection-d: #386161;
}
[data-theme='meadow'] {
    --ts-ok-l: #45752A;   /* on #F1F4EC: 4.93:1 */
    --ts-ok-d: #76BE51;   /* on #1F231C: 7.04:1 */
    --ts-error-l: #B8404F;   /* on #F1F4EC: 4.86:1 */
    --ts-error-d: #E86577;   /* on #1F231C: 4.99:1 */
    --ts-warn-l: #B64524;   /* on #F1F4EC: 4.89:1 */
    --ts-warn-d: #FF7A4E;   /* on #1F231C: 6.19:1 */
    --ts-selection-l: #CCE1B7;
    --ts-selection-d: #546B43;
}
[data-theme='dusk'] {
    --ts-ok-l: #45752A;   /* on #F1EFF5: 4.80:1 */
    --ts-ok-d: #76BE51;   /* on #201D27: 7.31:1 */
    --ts-error-l: #B8404F;   /* on #F1EFF5: 4.74:1 */
    --ts-error-d: #E86577;   /* on #201D27: 5.18:1 */
    --ts-warn-l: #B64524;   /* on #F1EFF5: 4.76:1 */
    --ts-warn-d: #FF7A4E;   /* on #201D27: 6.43:1 */
    --ts-selection-l: #D9C6EC;
    --ts-selection-d: #5F4C73;
}
[data-theme='rose'] {
    --ts-ok-l: #45752A;   /* on #F6F0EF: 4.86:1 */
    --ts-ok-d: #76BE51;   /* on #231E1E: 7.25:1 */
    --ts-error-l: #B8404F;   /* on #F6F0EF: 4.80:1 */
    --ts-error-d: #E86577;   /* on #231E1E: 5.14:1 */
    --ts-warn-l: #B64524;   /* on #F6F0EF: 4.82:1 */
    --ts-warn-d: #FF7A4E;   /* on #231E1E: 6.38:1 */
    --ts-selection-l: #F3C8CC;
    --ts-selection-d: #764D52;
}
[data-theme='ink'] {
    --ts-ok-l: #45752A;   /* on #F4F4F3: 4.98:1 */
    --ts-ok-d: #76BE51;   /* on #1D1E20: 7.35:1 */
    --ts-error-l: #C24354;   /* on #F4F4F3: 4.52:1 */
    --ts-error-d: #E86577;   /* on #1D1E20: 5.21:1 */
    --ts-warn-l: #B64524;   /* on #F4F4F3: 4.94:1 */
    --ts-warn-d: #FF7A4E;   /* on #1D1E20: 6.47:1 */
    --ts-selection-l: #D0D1D3;
    --ts-selection-d: #67686B;
}
[data-theme='phosphor'] {
    --ts-ok-l: #45752A;   /* on #EEF4EE: 4.91:1 */
    --ts-ok-d: #76BE51;   /* on #060D08: 8.66:1 */
    --ts-error-l: #B8404F;   /* on #EEF4EE: 4.84:1 */
    --ts-error-d: #E86577;   /* on #060D08: 6.14:1 */
    --ts-warn-l: #B64524;   /* on #EEF4EE: 4.87:1 */
    --ts-warn-d: #FF7A4E;   /* on #060D08: 7.62:1 */
    --ts-selection-l: #A4D6B4;
    --ts-selection-d: #286E3A;
}
[data-theme='brassworks'] {
    --ts-ok-l: #406D27;   /* on #F0E7D0: 4.96:1 */
    --ts-ok-d: #76BE51;   /* on #1A130D: 8.10:1 */
    --ts-error-l: #AD3C4B;   /* on #F0E7D0: 4.84:1 */
    --ts-error-d: #E86577;   /* on #1A130D: 5.74:1 */
    --ts-warn-l: #AB4022;   /* on #F0E7D0: 4.89:1 */
    --ts-warn-d: #FF7A4E;   /* on #1A130D: 7.13:1 */
    --ts-selection-l: #DEC29F;
    --ts-selection-d: #472F19;
}
:root {
    --ts-accent-text: var(--ts-accent-text-l);
    --ts-ok: var(--ts-ok-l);
    --ts-error: var(--ts-error-l);
    --ts-warn: var(--ts-warn-l);
    --ts-selection: var(--ts-selection-l);
}
html[data-appearance='dark'] {
    --ts-accent-text: var(--ts-accent-text-d);
    --ts-ok: var(--ts-ok-d);
    --ts-error: var(--ts-error-d);
    --ts-warn: var(--ts-warn-d);
    --ts-selection: var(--ts-selection-d);
}

/* ===========================================================================
   SkylarkStream bridge — dark slots only for v1 (video UI stays dark).
   Colour utilities resolve these via tailwind.config (th.* family) and the
   brand.* aliases kept for the Nov 2026 amber ruling.
   =========================================================================== */
