/* ============================================================
   FilmDocs.App theme overrides — Studio (dark) + Studio Light.
   Loaded by every tokenized tool alongside js/theme.js.

   How it works: each tool's own <style> carries a :root block with
   the ORIGINAL token values (so Original mode = today's look, and a
   failed load of this file degrades to Original). The blocks below
   override those tokens on <html> when js/theme.js stamps
   .fd-studio / .fd-light — same element as :root, higher
   specificity, so tool vars that reference tokens re-resolve
   correctly in every mode.

   Two-tier Studio palette (PJ 2026-07-25):
   - Dept/brand colors  -> full Studio muted treatment
   - FUNCTIONAL colors (G/NG greens+reds, warning yellows, info
     blues, day/night) -> 50% blend toward muted: "a bit muted,
     but still saturated". Tune live with ?tune=1.
   Screen-only: PDFs never change. Fonts: Source Serif 4 for the
   Studio display voice; Inter stays for body/UI.
   ============================================================ */
/* Fonts vendored locally — no runtime request to Google. Regenerate with tools/vendor-fonts.py. */
/* cyrillic-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/sourceserif4-v14-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- STUDIO DARK ---------- */
html.fd-studio{
  /* dept/brand tokens — full muted */
  --spurp:#b6a3cf;--spurp-rgb:182,163,207;--spurp2:#a08cba;--spurp2-rgb:160,140,186;
  --steal:#84b3ab;--steal-rgb:132,179,171;--steal2:#6da39b;--steal2-rgb:109,163,155;
  --sora:#c9a074;--sora-rgb:201,160,116;--sora2:#b98d5e;--sora2-rgb:185,141,94;
  --sora3:#a87e50;--sora3-rgb:168,126,80;
  --scyan:#7fadb8;--scyan-rgb:127,173,184;
  --spink:#c9a961;--spink-rgb:201,169,97;--samber:#c9a961;--samber-rgb:201,169,97;
  --sgold:#b89d55;--sgold-rgb:184,157,85;--smag:#b592bd;--smag-rgb:181,146,189;
  /* functional tokens — 50% blend, still saturated */
  --sred:#e07e7e;--sred-rgb:224,126,126;--sred2:#d15a58;--sred2-rgb:209,90,88;
  --sblue:#76a4df;--sblue-rgb:118,164,223;--sblue2:#5c8ad4;--sblue2-rgb:92,138,212;
  --sgrn:#6ec986;--sgrn-rgb:110,201,134;--sgrn2:#52b570;--sgrn2-rgb:82,181,112;
  --sgrn3:#49af82;--sgrn3-rgb:73,175,130;--sgrn4:#67aa6a;--sgrn4-rgb:103,170,106;
  --sgrn5:#60af6a;--sgrn5-rgb:96,175,106;--sgrn6:#7cb87c;--sgrn6-rgb:124,184,124;
  --syel:#e2b442;--syel-rgb:226,180,66;--syel2:#df9f40;--syel2-rgb:223,159,64;
  --syel3:#e4b534;--syel3-rgb:228,181,52;
  /* destructive red — muted brick on warm charcoal */
  --sdanger:#e3b3ae;--sdanger-rgb:227,179,174;--sdanger-bg-rgb:160,85,72;
  /* warm charcoal base + muted-gold brand voice */
  --bg:#181613;--surface:#201d19;--surface2:#282420;--toolbar-bg:#141210;
  --text:#ece7dd;--text-dim:#a29a8b;
  --border:rgba(255,255,255,0.09);--input-bg:rgba(0,0,0,0.28);
  --accent:#c9a961;--accent2:#3a332a;
  --accent-green:#93b48d;--accent-yellow:#c9a961;
  --info:#8ba3c4;--danger:#a05548;--line:#332e28;
  --row-bg:rgba(255,255,255,0.02);--row-alt:rgba(0,0,0,0.12);--row-hover:rgba(255,255,255,0.045);
  --ink-rgb:255,255,255;--shade-rgb:0,0,0;--on-accent:#181613;
  /* the desk the white script page sits on (Sides, Script Writer, Script
     Liner, Script Supervisor). It was a baked #2a2a3e — cool blue-grey, which
     the rollout missed, so it clashed with this warm charcoal and, in Day,
     left a dark slab that Day-coloured text disappeared into. */
  --paper-desk:#242019;
}

/* Serif display voice on headings — Inter stays for body/UI text */
html.fd-studio h1,html.fd-studio h2,html.fd-studio h3,html.fd-studio h4,
html.fd-studio .header h1{
  font-family:'Source Serif 4',Georgia,serif;
  letter-spacing:.3px;
}
html.fd-studio .header h1{font-weight:600;font-size:20px;}

/* Keep serif OUT of inputs and script-paper pages */
html.fd-studio input,html.fd-studio textarea,html.fd-studio select,html.fd-studio button{font-family:'Inter',sans-serif;}
html.fd-studio .sc-page h1,html.fd-studio .sc-page h2,html.fd-studio .sc-page h3,html.fd-studio .sc-page h4,
html.fd-studio .page h1,html.fd-studio .page h2,html.fd-studio .page h3,html.fd-studio .page h4{font-family:inherit;letter-spacing:0;}

/* ---------- STUDIO LIGHT (warm paper) ---------- */
html.fd-studio.fd-light{
  /* dept/brand tokens — ink weights */
  --spurp:#7d6a9b;--spurp-rgb:125,106,155;--spurp2:#6f5b8f;--spurp2-rgb:111,91,143;
  --steal:#47776f;--steal-rgb:71,119,111;--steal2:#3d6b63;--steal2-rgb:61,107,99;
  --sora:#8f6a3e;--sora-rgb:143,106,62;--sora2:#835f33;--sora2-rgb:131,95,51;
  --sora3:#7a5930;--sora3-rgb:122,89,48;
  --scyan:#4f7b85;--scyan-rgb:79,123,133;
  --spink:#8a6d2f;--spink-rgb:138,109,47;--samber:#8a6d2f;--samber-rgb:138,109,47;
  --sgold:#806a2e;--sgold-rgb:128,106,46;--smag:#8a5f93;--smag-rgb:138,95,147;
  /* functional tokens — 72% toward ink but still legible color */
  --sred:#b65e5b;--sred-rgb:182,94,91;--sred2:#b04843;--sred2-rgb:176,72,67;
  --sblue:#5980ad;--sblue-rgb:89,128,173;--sblue2:#476da4;--sblue2-rgb:71,109,164;
  --sgrn:#589a63;--sgrn-rgb:88,154,99;--sgrn2:#428f52;--sgrn2-rgb:66,143,82;
  --sgrn3:#3d8c5c;--sgrn3-rgb:61,140,92;--sgrn4:#4e894e;--sgrn4-rgb:78,137,78;
  --sgrn5:#4b8c4e;--sgrn5-rgb:75,140,78;--sgrn6:#60905d;--sgrn6-rgb:96,144,93;
  --syel:#aa842c;--syel-rgb:170,132,44;--syel2:#ac7930;--syel2-rgb:172,121,48;
  --syel3:#ab8524;--syel3-rgb:171,133,36;
  /* destructive red — must be INK on warm paper: the old baked #f3bbbb
     was pale pink on #faf8f2, about 1.4:1 contrast, effectively invisible */
  --sdanger:#984a42;--sdanger-rgb:152,74,66;--sdanger-bg-rgb:152,74,66;
  /* warn yellow, same reasoning. 34 tools declared --warn:#facc15 in their own
     :root and theme.css never overrode --warn, so Night's bright yellow landed
     on warm paper: "Draft" on eight agreements at 1.26:1, Timesheets' overtime
     hours at 1.44:1, DIT's partial-roll pill at 1.18:1. Pointing --warn at
     --syel helped (2.74:1) but --syel is a FILL, not ink. This is the ink
     weight — ~7:1 on #faf8f2 — and it is the value TaskManager had already
     arrived at by hand for exactly this reason. */
  --warn:#7d5f22;
  /* warm paper base */
  --bg:#f1ede4;--surface:#faf8f2;--surface2:#efeadf;--toolbar-bg:#e9e4d8;
  /* --text-dim was #6f6759. It is THE secondary-text token — 3009 references
     across 87 pages, every uppercase field label, every stat-tile caption,
     every helper line — and in Day it did not clear 4.5:1 on the surfaces it
     actually sits on.
     Three separate contrast sweeps quoted "4.40:1 on --surface" and left it.
     The number was right and the surface was wrong: on --surface (#faf8f2)
     #6f6759 measures 5.26:1 and passes. 4.40 is --toolbar-bg (#e9e4d8) — the
     top bar, the status bar, sidebar headers and tooltips — which is where 554
     of the 3827 measured dim runs live, alongside another ~75 on the palette's
     own shade tints. Aiming a fix at --surface would have moved nothing.
     Day's darkest surfaces are its worst, because Day's ladder runs DOWN from
     white while Night's and Studio's run UP from black: in both dark themes
     --toolbar-bg is the BEST surface for dim text (9.57 and 6.70, against 8.74
     and 6.02 on --surface). Day inherited "toolbar is darker than surface"
     without inheriting what that was for, so the same move that buys contrast
     there spends it here. White is the ceiling, so the surface ladder cannot
     be reversed; the ink has to come down instead.
     #5e574b is the value at which every backdrop this palette can PRODUCE
     clears 4.5 — all five surface tokens (6.72 / 6.11 / 5.95 / 5.63 / 5.18 on
     input-bg…toolbar-bg), --accent2, --paper-desk, --border as a fill, and
     both canonical rgba(var(--shade-rgb),a) tints over --surface: 0.2 (the
     "Collapse All" button in 37 tools' help sidebars, was 4.06) and 0.3 (the
     lead stat tile, was 3.53). Worst case is now 4.51, everything else >=4.84.
     Hierarchy survives, and it is measured rather than asserted: dim-to-primary
     separation goes 30.5 -> 23.8 dL*, which lands between Studio's shipped 27.9
     and Night's shipped 16.4. Day stays more separated than the theme the whole
     rollout was pixel-gated against. Hue and saturation are unchanged (H 38.2,
     S 0.11) — this is the same warm grey, one step down the L axis.
     Night and Studio are untouched. */
  --text:#26221c;--text-dim:#5e574b;--border:#dcd5c5;--input-bg:#ffffff;
  --accent:#8a6d2f;--accent2:#e4dcc9;--accent-green:#4f7a4d;--accent-yellow:#8a6d2f;
  --info:#4c6584;--danger:#984a42;--line:#ddd5c3;
  --row-bg:rgba(120,105,75,0.03);--row-alt:rgba(120,105,75,0.06);--row-hover:rgba(138,109,47,0.08);
  /* white/black overlay flip: "white" overlays become warm ink */
  --ink-rgb:38,30,16;--shade-rgb:120,105,75;--on-accent:#faf8f2;
  /* desk: darker than --surface so a white script page still reads as paper
     lying ON something, rather than dissolving into the background */
  --paper-desk:#e2dbcb;
}

/* Day-mode fix for the site-wide hardcoded-white help-sidebar header
   (.help-sidebar-header h3{color:#fff} in ~20 tools). Scoped to fd-light
   so Night/Studio pixels are untouched. */
html.fd-studio.fd-light .help-sidebar-header h3{color:var(--text);}
