/*
 * Thermal Architect: design tokens
 *
 * The one place a colour, a typeface or a radius is defined. The application
 * (builder.css) and the reference pages (help.css) read these by role.
 *
 * The identity, in four rules:
 *
 *   Graphite and paper. Surfaces are warm neutrals - a drafting sheet in the
 *   light theme, an instrument panel in the dark - so the engineering content
 *   sets the hierarchy, not decoration.
 *
 *   One accent: copper. It marks identity, what is selected, what has focus
 *   and where you are. Primary actions are graphite; links are underlined ink.
 *
 *   Every hue means one thing. Heat is red-orange, cold and reference blue,
 *   fluid cyan, boards violet. Green, amber and red are verdicts only.
 *
 *   Plex throughout: Sans for the interface, Mono with tabular figures for
 *   every number, Condensed for labels and the wordmark. Bundled (fonts/,
 *   SIL Open Font License), so it looks the same on every machine.
 */

@font-face {
    font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-latin-400-normal.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;
}
@font-face {
    font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-greek-400-normal.woff2) format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
    font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-latin-500-normal.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;
}
@font-face {
    font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-greek-500-normal.woff2) format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
    font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-latin-600-normal.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;
}
@font-face {
    font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-greek-600-normal.woff2) format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
    font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
    src: url(/static/fonts/ibm-plex-mono-latin-400-normal.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;
}
@font-face {
    font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap;
    src: url(/static/fonts/ibm-plex-mono-latin-500-normal.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;
}
@font-face {
    font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
    src: url(/static/fonts/ibm-plex-mono-latin-600-normal.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;
}
@font-face {
    font-family: 'IBM Plex Sans Condensed'; font-style: normal; font-weight: 500; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-condensed-latin-500-normal.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;
}
@font-face {
    font-family: 'IBM Plex Sans Condensed'; font-style: normal; font-weight: 600; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-condensed-latin-600-normal.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;
}
@font-face {
    font-family: 'IBM Plex Sans'; font-style: italic; font-weight: 400; font-display: swap;
    src: url(/static/fonts/ibm-plex-sans-latin-400-italic.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+2000-206F, U+2212;
}

:root {
    color-scheme: light;

    /* Graphite ramp: text and marks */
    --ink:           #1c1e21;   /* primary text, values */
    --ink-mid:       #383c42;   /* secondary text */
    --ink-soft:      #555a62;   /* labels */
    --ink-faint:     #666b73;   /* 5.2:1 on --panel, 4.8:1 on --field, both themes: AA for small text */
    --line-strong:   #85837d;   /* solved wires, axis lines */
    --line-mid:      #a8a59e;   /* wires, inactive marks */

    /* Surfaces: the paper, the chassis, the wells */
    --panel:         #fcfbf9;   /* panels, inspector, tables */
    --shell:         #e4e2dc;   /* the frame around the panels */
    --field:         #f3f2ee;   /* inputs, panel heads, wells */
    --field-2:       #ebe9e4;   /* a second well: hover, zebra */
    --canvas:        #f2f1ec;   /* the network sheet */
    --grid:          #ebe9e3;   /* minor drafting grid */
    --grid-major:    #dfdcd4;   /* major drafting grid, every fifth line */
    --rule:          #dddad3;   /* hairlines between things */
    --rule-firm:     #c3bfb6;   /* control borders, panel edges */

    /* Accent: copper. Identity, selection, focus, where you are. Nothing else. */
    --brand:         #a5521c;   /* 5.3:1 on --panel (light), 6.8:1 (dark) */
    --brand-deep:    #7f3d12;   /* accent text on its pale ground */
    --brand-pale:    #f6e9df;   /* a selected row, a drop target */

    /* Action: what runs things is graphite, not a colour */
    --action:        #25282c;   /* primary buttons */
    --action-deep:   #0f1113;   /* primary buttons, hover */
    --on-fill:       #fcfbf9;   /* text on a filled control */
    --on-fill-accent: #f0b48a;   /* an action inside a dark toast */

    /* Domains: each hue says one thing */
    --warm:          #b23a1e;   /* heat: sources, the hot side, temperature rise */
    --warm-deep:     #86290f;   /* heat text on its pale ground */
    --warm-pale:     #f8e6de;
    --cool:          #2f62a3;   /* cold: boundaries, sinks, the cold side */
    --cool-deep:     #234b7f;
    --cool-line:     #c3d3ea;
    --cool-pale:     #e7eef8;
    --fluid:         #0b6f80;   /* fluid systems: devices, ports, pipes */
    --fluid-soft:    #6aa3ac;   /* pipe and duct runs */
    --fluid-pale:    #e0eff1;
    --refrig:        #2f5fa8;   /* refrigeration and two-phase cards, ports, piping */
    --refrig-deep:   #1f437c;
    --refrig-pale:   #e3ebf7;
    --rf-liquid:     #2f5fa8;   /* subcooled or saturated liquid */
    --rf-mix:        #7a4fa0;   /* two-phase */
    --rf-vapour:     #b2452c;   /* superheated vapour */
    --rf-super:      #8f5f00;   /* supercritical */
    --board:         #5f528a;   /* circuit boards */
    --board-deep:    #473c6e;
    --board-pale:    #ebe8f3;
    --board-veil:    #5f528a33;

    /* Status: only for verdicts, warnings and failures */
    --ok:            #22693d;
    --ok-line:       #bcd6c4;
    --ok-pale:       #e7f1ea;
    --amber:         #8f5f00;   /* warnings, outdated results */
    --amber-deep:    #5e3e00;
    --amber-line:    #e5cf9f;
    --amber-pale:    #fbf2df;
    --danger:        #a52a1d;   /* failures, limits exceeded, destructive actions */
    --danger-deep:   #781a10;
    --bad-line:      #e8c3bd;
    --bad-pale:      #fbebe8;

    /* Data: chart series */
    --series-1:      #1c1e21;   /* the primary trace is ink */
    --series-2:      #a5521c;
    --series-3:      #2f62a3;
    --series-4:      #0b6f80;
    /* Traces: a categorical palette in fixed order, never cycled past eight.
       Checked with a colour-vision-deficiency validator against each theme's
       panel (adjacent pairs: CVD separation >= 10, normal >= 17); slot 4 sits
       under 3:1 on the light panel, which the legend and table views relieve. */
    --trace-1:       #2f6fbf;
    --trace-2:       #d0602e;
    --trace-3:       #1a9a78;
    --trace-4:       #c79100;
    --trace-5:       #cf5f92;
    --trace-6:       #3f8a22;
    --trace-7:       #6a5bd0;
    --trace-8:       #d94c4a;

    --glass: 252 251 249;
    /* Depth, kept for what floats: a menu, a dialog, a dragged part. */
    --shadow-lift:  0 1px 0 rgba(28, 30, 33, .06);
    --float-shadow: 0 1px 0 rgba(28, 30, 33, .08), 0 8px 24px rgba(28, 30, 33, .16);
    --shadow-modal: 0 1px 0 rgba(28, 30, 33, .1), 0 18px 48px rgba(28, 30, 33, .26);

    /* Type. Plex: a family drawn for engineering documentation, with tabular
       figures and a condensed cut for labels (fonts.css, bundled). */
    --sans:    'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    --mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
    --display: 'IBM Plex Sans Condensed', 'IBM Plex Sans', 'Arial Narrow', sans-serif;

    /* The temperature scale, as a gradient for legends: the same stops as
       THERMAL_STOPS in builder.js, which colours the readouts and maps. */
    --thermal-scale: linear-gradient(90deg, rgb(52, 86, 186), rgb(104, 136, 205) 25%,
                                     rgb(150, 143, 150) 50%, rgb(214, 117, 78) 75%, rgb(181, 36, 28));

    /* Geometry. Two radii: a control, and something that floats. */
    --radius:    2px;
    --radius-lg: 3px;

    --topbar-h: 50px;
}

/* ---------------------------------------------------------------- dark theme

   Follows the system unless the reader chose (View → Theme, saved in this
   browser): data-theme="light" or "dark" on <html> wins either way. The two
   blocks are the same list; CSS has no way to share it between a media query
   and an attribute selector. Graphite, not blue-black: a dark instrument
   panel rather than a dark web page. */
:root[data-theme="dark"] {
    color-scheme: dark;

    /* Graphite ramp: text and marks */
    --ink:           #e8e6e1;   /* primary text, values */
    --ink-mid:       #cbc8c1;   /* secondary text */
    --ink-soft:      #aaa69f;   /* labels */
    --ink-faint:     #918e88;   /* 5.2:1 on --panel, 4.8:1 on --field, both themes: AA for small text */
    --line-strong:   #7c7d80;   /* solved wires, axis lines */
    --line-mid:      #56585c;   /* wires, inactive marks */

    /* Surfaces: the paper, the chassis, the wells */
    --panel:         #1a1b1d;   /* panels, inspector, tables */
    --shell:         #0f1011;   /* the frame around the panels */
    --field:         #222326;   /* inputs, panel heads, wells */
    --field-2:       #2a2b2e;   /* a second well: hover, zebra */
    --canvas:        #151617;   /* the network sheet */
    --grid:          #1e1f21;   /* minor drafting grid */
    --grid-major:    #25272a;   /* major drafting grid, every fifth line */
    --rule:          #2b2c2f;   /* hairlines between things */
    --rule-firm:     #3d3f43;   /* control borders, panel edges */

    /* Accent: copper. Identity, selection, focus, where you are. Nothing else. */
    --brand:         #df915a;   /* 5.3:1 on --panel (light), 6.8:1 (dark) */
    --brand-deep:    #f0ae80;   /* accent text on its pale ground */
    --brand-pale:    #36251a;   /* a selected row, a drop target */

    /* Action: what runs things is graphite, not a colour */
    --action:        #dedbd4;   /* primary buttons */
    --action-deep:   #f4f2ed;   /* primary buttons, hover */
    --on-fill:       #121314;   /* text on a filled control */
    --on-fill-accent: #7f3d12;   /* an action inside a dark toast */

    /* Domains: each hue says one thing */
    --warm:          #ee7a5c;   /* heat: sources, the hot side, temperature rise */
    --warm-deep:     #f5a68f;   /* heat text on its pale ground */
    --warm-pale:     #3b2019;
    --cool:          #7eaaea;   /* cold: boundaries, sinks, the cold side */
    --cool-deep:     #a9c6f2;
    --cool-line:     #2c3e5a;
    --cool-pale:     #1a2433;
    --fluid:         #4cbfce;   /* fluid systems: devices, ports, pipes */
    --fluid-soft:    #357f8a;   /* pipe and duct runs */
    --fluid-pale:    #132c31;
    --refrig:        #7fa6e6;
    --refrig-deep:   #a9c4f0;
    --refrig-pale:   #17233a;
    --rf-liquid:     #7fa6e6;
    --rf-mix:        #b993dc;
    --rf-vapour:     #ef8a6e;
    --rf-super:      #e2a84b;
    --board:         #a99cd2;   /* circuit boards */
    --board-deep:    #c7bce8;
    --board-pale:    #27233a;
    --board-veil:    #a99cd233;

    /* Status: only for verdicts, warnings and failures */
    --ok:            #62c28d;
    --ok-line:       #2f4a39;
    --ok-pale:       #15291d;
    --amber:         #e2a84b;   /* warnings, outdated results */
    --amber-deep:    #f2d39c;
    --amber-line:    #5a4520;
    --amber-pale:    #2f2513;
    --danger:        #f07d70;   /* failures, limits exceeded, destructive actions */
    --danger-deep:   #f4aaa1;
    --bad-line:      #552c27;
    --bad-pale:      #331a17;

    /* Data: chart series */
    --series-1:      #e8e6e1;   /* the primary trace is ink */
    --series-2:      #df915a;
    --series-3:      #7eaaea;
    --series-4:      #4cbfce;
    --trace-1:       #4f8ae0;
    --trace-2:       #e06f3a;
    --trace-3:       #22a882;
    --trace-4:       #b58508;
    --trace-5:       #d96a9c;
    --trace-6:       #4f9a30;
    --trace-7:       #8a7de6;
    --trace-8:       #e5605c;

    --glass: 26 27 29;
    --shadow-lift: 0 1px 0 rgba(0, 0, 0, .35);
    --float-shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 10px 28px rgba(0, 0, 0, .45);
    --shadow-modal: 0 1px 0 rgba(0, 0, 0, .5), 0 22px 56px rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        /* Graphite ramp: text and marks */
        --ink:           #e8e6e1;   /* primary text, values */
        --ink-mid:       #cbc8c1;   /* secondary text */
        --ink-soft:      #aaa69f;   /* labels */
        --ink-faint:     #918e88;   /* 5.2:1 on --panel, 4.8:1 on --field, both themes: AA for small text */
        --line-strong:   #7c7d80;   /* solved wires, axis lines */
        --line-mid:      #56585c;   /* wires, inactive marks */

        /* Surfaces: the paper, the chassis, the wells */
        --panel:         #1a1b1d;   /* panels, inspector, tables */
        --shell:         #0f1011;   /* the frame around the panels */
        --field:         #222326;   /* inputs, panel heads, wells */
        --field-2:       #2a2b2e;   /* a second well: hover, zebra */
        --canvas:        #151617;   /* the network sheet */
        --grid:          #1e1f21;   /* minor drafting grid */
        --grid-major:    #25272a;   /* major drafting grid, every fifth line */
        --rule:          #2b2c2f;   /* hairlines between things */
        --rule-firm:     #3d3f43;   /* control borders, panel edges */

        /* Accent: copper. Identity, selection, focus, where you are. Nothing else. */
        --brand:         #df915a;   /* 5.3:1 on --panel (light), 6.8:1 (dark) */
        --brand-deep:    #f0ae80;   /* accent text on its pale ground */
        --brand-pale:    #36251a;   /* a selected row, a drop target */

        /* Action: what runs things is graphite, not a colour */
        --action:        #dedbd4;   /* primary buttons */
        --action-deep:   #f4f2ed;   /* primary buttons, hover */
        --on-fill:       #121314;   /* text on a filled control */
        --on-fill-accent: #7f3d12;   /* an action inside a dark toast */

        /* Domains: each hue says one thing */
        --warm:          #ee7a5c;   /* heat: sources, the hot side, temperature rise */
        --warm-deep:     #f5a68f;   /* heat text on its pale ground */
        --warm-pale:     #3b2019;
        --cool:          #7eaaea;   /* cold: boundaries, sinks, the cold side */
        --cool-deep:     #a9c6f2;
        --cool-line:     #2c3e5a;
        --cool-pale:     #1a2433;
        --fluid:         #4cbfce;   /* fluid systems: devices, ports, pipes */
        --fluid-soft:    #357f8a;   /* pipe and duct runs */
        --fluid-pale:    #132c31;
        --refrig:        #7fa6e6;
        --refrig-deep:   #a9c4f0;
        --refrig-pale:   #17233a;
        --rf-liquid:     #7fa6e6;
        --rf-mix:        #b993dc;
        --rf-vapour:     #ef8a6e;
        --rf-super:      #e2a84b;
        --board:         #a99cd2;   /* circuit boards */
        --board-deep:    #c7bce8;
        --board-pale:    #27233a;
        --board-veil:    #a99cd233;

        /* Status: only for verdicts, warnings and failures */
        --ok:            #62c28d;
        --ok-line:       #2f4a39;
        --ok-pale:       #15291d;
        --amber:         #e2a84b;   /* warnings, outdated results */
        --amber-deep:    #f2d39c;
        --amber-line:    #5a4520;
        --amber-pale:    #2f2513;
        --danger:        #f07d70;   /* failures, limits exceeded, destructive actions */
        --danger-deep:   #f4aaa1;
        --bad-line:      #552c27;
        --bad-pale:      #331a17;

        /* Data: chart series */
        --series-1:      #e8e6e1;   /* the primary trace is ink */
        --series-2:      #df915a;
        --series-3:      #7eaaea;
        --series-4:      #4cbfce;
        --trace-1:       #4f8ae0;
        --trace-2:       #e06f3a;
        --trace-3:       #22a882;
        --trace-4:       #b58508;
        --trace-5:       #d96a9c;
        --trace-6:       #4f9a30;
        --trace-7:       #8a7de6;
        --trace-8:       #e5605c;

        --glass: 26 27 29;
        --shadow-lift: 0 1px 0 rgba(0, 0, 0, .35);
        --float-shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 10px 28px rgba(0, 0, 0, .45);
        --shadow-modal: 0 1px 0 rgba(0, 0, 0, .5), 0 22px 56px rgba(0, 0, 0, .6);
    }
}
