/* Heliostack · charte v4.5 · socle commun des pages publiques : polices, jetons, thème, éléments de base.
 * Généré à partir de design/heliostack/tokens/tokens.css (jetons) et design/heliostack/fonts/fonts.css (polices).
 * Seulement des règles génériques : les sélecteurs propres au simulateur restent dans public/static/index.html.
 *
 * Thème : le clair par défaut ; le sombre selon le système, sauf choix forcé par le bouton
 * (attribut data-theme sur <html>, posé avant le premier rendu par public/templates/partials/theme_boot.js).
 * Les jetons sombres figurent deux fois (forcé, puis système) et les clairs deux fois (défaut, puis impression) :
 * pas de light-dark(), que css() (interne/static/common.js) renverrait tel quel aux SVG et à la 3D.
 * tests/test_public.py vérifie que les copies sont identiques.
 *
 * Polices : SIL Open Font License 1.1, voir fonts/OFL.txt. Jost italique est déclarée mais n’est téléchargée
 * que si de l’italique s’affiche. Space Mono 700 sert aux seuls chiffres clés.
 */

@font-face {
  font-family: "Jost";
  src: url("fonts/jost-roman-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+0178, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+2080-2089, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+2264-2265, U+FB01-FB02, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Jost";
  src: url("fonts/jost-italic-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+0178, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+2080-2089, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+2264-2265, U+FB01-FB02, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Space Mono";
  src: url("fonts/space-mono-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+0178, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+2080-2089, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+2248, U+2264-2265, U+FB01-FB02, U+FEFF, U+FFFD;
}

/* Repli métrique : Arial (ou Liberation Sans, de mêmes métriques) recalé sur Jost pour que l’arrivée de la police
   ne décale presque rien. */
@font-face {
  font-family: "Jost Fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 95.2%;
  ascent-override: 112.4%;
  descent-override: 39.4%;
  line-gap-override: 0%;
}

/* ── Thème clair (défaut) ── */
:root {
  color-scheme: light;
  --bg: #F7F2E7;
  --panel: #FFFFFF;
  --ink: #0E2240;
  --mute: #4B5568;
  --line: #DCD3C2;
  --line-input: #8F8878;
  --accent: #0E5A87;
  --accent-ink: #FFFFFF;
  --band: rgba(14, 90, 135, .10);
  --bar: #EBA01E;
  --err: #B3261E;
  --ok: #0B7A3B;
  --warn: #A04A00;
  --bad: #B3261E;
  --f-pv: #EBA01E;
  --f-bat: #2F8F5B;
  --f-grid: #3570C0;
  --f-load: #8059C4;
  --f-curt: #9A917E;
  --f-conv: #B08E68;
  --u-measured: #00727A;
  --u-filled: #3E9A9F;
  --u-base: #9B9402;
  --u-heating: #A20613;
  --u-cooling: #1A98D5;
  --u-dhw: #86227F;
  --u-ev: #268148;
  --u-pool: #00A2A3;
  --u-other: #40524E;
  --u-refrigeration: #00A1AD;
  --u-process: #836E02;
  --u-furnace: #7E3A27;
  --u-compressed_air: #109B8B;
  --u-irrigation: #007258;
  --u-it: #3590F7;
  --u-office: #1659C7;
  --u-display: #C170CA;
  --u-ventilation: #035B2D;
  --u-lighting: #9B904E;
  --u-kitchen: #8B5A29;
  --u-charging: #729D0E;
  --hs-bg: var(--bg);
  --hs-panel: var(--panel);
  --hs-raised: #FFFFFF;
  --hs-ink: var(--ink);
  --hs-mute: var(--mute);
  --hs-line: var(--line);
  --hs-line-input: var(--line-input);
  --hs-primary: #0E5A87;
  --hs-primary-hover: #0B4669;
  --hs-on-primary: #FFFFFF;
  --hs-link: #0E5A87;
  --hs-link-hover: #0B4669;
  --hs-title: #0E5A87;
  --hs-orange: #E8611E;
  --hs-gold: #F6B638;
  --hs-cream: #FBEFD2;
  --hs-logo-word: #0E2240;
  --hs-logo-1: #E8611E;
  --hs-logo-2: #B04E6E;
  --hs-logo-3: #4F4A8C;
  --hs-logo-4: #16285E;
  --hs-ok: var(--ok);
  --hs-warn: var(--warn);
  --hs-err: var(--err);
  --hs-selected-bg: var(--band);
  --hs-selected-edge: var(--hs-primary);
  --hs-focus: #E8611E;
  --hs-focus-width: 3px;
  --hs-focus-offset: 3px;
  --hs-focus-ring: var(--hs-focus-width) solid var(--hs-focus);
  --hs-shadow: none;
  --hs-radius-control: 4px;
  --hs-radius-panel: 6px;
  --hs-bar-radius: 3px;
  --hs-font-sans: "Jost", "Jost Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hs-font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hs-title-weight: 800;
  --hs-title-transform: uppercase;
  --hs-title-tracking: .04em;
  --hs-figure-weight: 700;
  --hs-data-sun: var(--f-pv);
  --hs-data-sun-strong: #806000;
  --hs-data-surplus: #F2B705;
  --hs-data-surplus-bg: #FCE7A0;
  --hs-data-curtailed-bg: #F1ECE1;
  --hs-data-battery: var(--f-bat);
  --hs-data-grid: var(--f-grid);
  --hs-data-grid-strong: #3570C0;
  --hs-data-load: var(--f-load);
  --hs-data-curtailed: var(--f-curt);
  --hs-data-losses: var(--f-conv);
  --hs-data-soc: var(--hs-ink);
  --hs-chart-label: var(--mute);
  --hs-chart-grid: var(--line);
  --hs-chart-axis: var(--line-input);
  --hs-chart-font-size: 11px;
  --hs-chart-gap: var(--panel);
  --hs-price-1: #1A9850;
  --hs-price-ink-1: #0E2240;
  --hs-price-2: #91CF60;
  --hs-price-ink-2: #0E2240;
  --hs-price-3: #FEE08B;
  --hs-price-ink-3: #0E2240;
  --hs-price-4: #FC8D59;
  --hs-price-ink-4: #0E2240;
  --hs-price-5: #D73027;
  --hs-price-ink-5: #FFFFFF;
  --hs-map-footprint: #FFFFFF;
  --hs-map-footprint-plan: #0E2240;
  --hs-map-excl: #FF5A4F;
  --hs-map-off: #9AA0A6;
  --hs-map-hover: #FFFFFF;
  --hs-3d-bg: var(--bg);
  --hs-3d-grid-major: #8F8878;
  --hs-3d-grid-minor: #DCD3C2;
  --hs-3d-unlabelled: #8F8878;
  --hs-3d-env-low: #B8AF9E;
  --hs-3d-env-high: #6E675A;
  --hs-3d-selected: var(--hs-orange);
  --hs-3d-shadow: rgba(14, 34, 64, .28);
  --hs-3d-panel-cell: #0E2240;
  --hs-3d-panel-frame: #C9CED6;
  --hs-3d-panel-line: #2E5C8A;
  --hs-plan-plane: rgba(143, 136, 120, .16);
  --hs-plan-plane-line: rgba(143, 136, 120, .75);
  --hs-plan-panel: #0E2240;
  --hs-plan-panel-line: #FFFFFF;
  --hs-plan-label: #FFFFFF;
  --hs-plan-halo: rgba(14, 34, 64, .72);
  --f-self: #2F8F5B;
  --hs-plane-1: #1F9E89;
  --hs-plane-2: #3A86FF;
  --hs-plane-3: #D63A8E;
  --hs-plane-4: #8AC926;
  --hs-plane-5: #00A6C8;
  --hs-plane-6: #F28AB0;
  --hs-plane-7: #4F772D;
  --hs-plane-8: #B07AA1;
}

/* ── Thème sombre forcé par le bouton ── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141310;
  --panel: #1C1A17;
  --ink: #F3ECDD;
  --mute: #B3AD9E;
  --line: #36332D;
  --line-input: #78725F;
  --accent: #3E9BD1;
  --accent-ink: #141310;
  --band: rgba(62, 155, 209, .18);
  --bar: #F2B54A;
  --err: #FF8A80;
  --ok: #3BB273;
  --warn: #E8A317;
  --bad: #FF8A80;
  --f-pv: #F2B54A;
  --f-bat: #4CB97A;
  --f-grid: #5E98E0;
  --f-load: #A585E8;
  --f-curt: #9A917E;
  --f-conv: #8A7258;
  --u-measured: #60B1B8;
  --u-filled: #88DBE0;
  --u-base: #D8CE6A;
  --u-heating: #EA5C4C;
  --u-cooling: #80D9FF;
  --u-dhw: #C767BD;
  --u-ev: #6FC186;
  --u-pool: #72E4E4;
  --u-other: #5F8E7A;
  --u-refrigeration: #74E3EE;
  --u-process: #C7AC4F;
  --u-furnace: #C07660;
  --u-compressed_air: #70DDCB;
  --u-irrigation: #5BB195;
  --u-it: #5BA8F0;
  --u-office: #4F7ADB;
  --u-display: #FFB3FF;
  --u-ventilation: #529867;
  --u-lighting: #DED18F;
  --u-kitchen: #CE9766;
  --u-charging: #B7DE5F;
  --hs-raised: #26241F;
  --hs-primary: #3E9BD1;
  --hs-primary-hover: #5BB0E0;
  --hs-on-primary: #141310;
  --hs-link: #5BB0E0;
  --hs-link-hover: #8CC6EA;
  --hs-title: #8CC6EA;
  --hs-orange: #F08A4B;
  --hs-gold: #F6B638;
  --hs-focus: #F08A4B;
  --hs-data-sun-strong: #F2B705;
  --hs-data-grid-strong: #5E98E0;
  --hs-data-surplus-bg: #8A7318;
  --hs-data-curtailed-bg: #2A2722;
  --hs-price-ink-1: #0E2240;
  --hs-price-ink-5: #FFFFFF;
  --hs-3d-grid-major: #78725F;
  --hs-3d-grid-minor: #36332D;
  --hs-3d-unlabelled: #78725F;
  --hs-3d-env-low: #3A372F;
  --hs-3d-env-high: #9A937F;
  --hs-3d-shadow: rgba(0, 0, 0, .40);
  --hs-3d-panel-cell: #0E2240;
  --hs-3d-panel-frame: #AEB6C4;
  --hs-3d-panel-line: #3E6FA8;
  --hs-plan-plane: rgba(120, 114, 95, .20);
  --hs-plan-plane-line: rgba(120, 114, 95, .85);
  --hs-plan-panel: #4F74C0;
  --hs-plan-panel-line: #F3ECDD;
  --hs-plan-label: #F3ECDD;
  --hs-plan-halo: rgba(20, 19, 16, .78);
  --f-self: #4CB97A;
  --hs-logo-word: #F3ECDD;
  --hs-logo-2: #C25A78;
  --hs-logo-3: #7B6FC4;
  --hs-logo-4: #5B7FD9;
}

/* ── Thème sombre du système, sauf clair forcé ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141310;
    --panel: #1C1A17;
    --ink: #F3ECDD;
    --mute: #B3AD9E;
    --line: #36332D;
    --line-input: #78725F;
    --accent: #3E9BD1;
    --accent-ink: #141310;
    --band: rgba(62, 155, 209, .18);
    --bar: #F2B54A;
    --err: #FF8A80;
    --ok: #3BB273;
    --warn: #E8A317;
    --bad: #FF8A80;
    --f-pv: #F2B54A;
    --f-bat: #4CB97A;
    --f-grid: #5E98E0;
    --f-load: #A585E8;
    --f-curt: #9A917E;
    --f-conv: #8A7258;
    --u-measured: #60B1B8;
    --u-filled: #88DBE0;
    --u-base: #D8CE6A;
    --u-heating: #EA5C4C;
    --u-cooling: #80D9FF;
    --u-dhw: #C767BD;
    --u-ev: #6FC186;
    --u-pool: #72E4E4;
    --u-other: #5F8E7A;
    --u-refrigeration: #74E3EE;
    --u-process: #C7AC4F;
    --u-furnace: #C07660;
    --u-compressed_air: #70DDCB;
    --u-irrigation: #5BB195;
    --u-it: #5BA8F0;
    --u-office: #4F7ADB;
    --u-display: #FFB3FF;
    --u-ventilation: #529867;
    --u-lighting: #DED18F;
    --u-kitchen: #CE9766;
    --u-charging: #B7DE5F;
    --hs-raised: #26241F;
    --hs-primary: #3E9BD1;
    --hs-primary-hover: #5BB0E0;
    --hs-on-primary: #141310;
    --hs-link: #5BB0E0;
    --hs-link-hover: #8CC6EA;
    --hs-title: #8CC6EA;
    --hs-orange: #F08A4B;
    --hs-gold: #F6B638;
    --hs-focus: #F08A4B;
    --hs-data-sun-strong: #F2B705;
    --hs-data-grid-strong: #5E98E0;
    --hs-data-surplus-bg: #8A7318;
    --hs-data-curtailed-bg: #2A2722;
    --hs-price-ink-1: #0E2240;
    --hs-price-ink-5: #FFFFFF;
    --hs-3d-grid-major: #78725F;
    --hs-3d-grid-minor: #36332D;
    --hs-3d-unlabelled: #78725F;
    --hs-3d-env-low: #3A372F;
    --hs-3d-env-high: #9A937F;
    --hs-3d-shadow: rgba(0, 0, 0, .40);
    --hs-3d-panel-cell: #0E2240;
    --hs-3d-panel-frame: #AEB6C4;
    --hs-3d-panel-line: #3E6FA8;
    --hs-plan-plane: rgba(120, 114, 95, .20);
    --hs-plan-plane-line: rgba(120, 114, 95, .85);
    --hs-plan-panel: #4F74C0;
    --hs-plan-panel-line: #F3ECDD;
    --hs-plan-label: #F3ECDD;
    --hs-plan-halo: rgba(20, 19, 16, .78);
    --f-self: #4CB97A;
    --hs-logo-word: #F3ECDD;
    --hs-logo-2: #C25A78;
    --hs-logo-3: #7B6FC4;
    --hs-logo-4: #5B7FD9;
  }
}

/* ── Impression : toujours les jetons clairs, quel que soit le thème de l’écran ── */
@media print {
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #F7F2E7;
    --panel: #FFFFFF;
    --ink: #0E2240;
    --mute: #4B5568;
    --line: #DCD3C2;
    --line-input: #8F8878;
    --accent: #0E5A87;
    --accent-ink: #FFFFFF;
    --band: rgba(14, 90, 135, .10);
    --bar: #EBA01E;
    --err: #B3261E;
    --ok: #0B7A3B;
    --warn: #A04A00;
    --bad: #B3261E;
    --f-pv: #EBA01E;
    --f-bat: #2F8F5B;
    --f-grid: #3570C0;
    --f-load: #8059C4;
    --f-curt: #9A917E;
    --f-conv: #B08E68;
    --u-measured: #00727A;
    --u-filled: #3E9A9F;
    --u-base: #9B9402;
    --u-heating: #A20613;
    --u-cooling: #1A98D5;
    --u-dhw: #86227F;
    --u-ev: #268148;
    --u-pool: #00A2A3;
    --u-other: #40524E;
    --u-refrigeration: #00A1AD;
    --u-process: #836E02;
    --u-furnace: #7E3A27;
    --u-compressed_air: #109B8B;
    --u-irrigation: #007258;
    --u-it: #3590F7;
    --u-office: #1659C7;
    --u-display: #C170CA;
    --u-ventilation: #035B2D;
    --u-lighting: #9B904E;
    --u-kitchen: #8B5A29;
    --u-charging: #729D0E;
    --hs-bg: var(--bg);
    --hs-panel: var(--panel);
    --hs-raised: #FFFFFF;
    --hs-ink: var(--ink);
    --hs-mute: var(--mute);
    --hs-line: var(--line);
    --hs-line-input: var(--line-input);
    --hs-primary: #0E5A87;
    --hs-primary-hover: #0B4669;
    --hs-on-primary: #FFFFFF;
    --hs-link: #0E5A87;
    --hs-link-hover: #0B4669;
    --hs-title: #0E5A87;
    --hs-orange: #E8611E;
    --hs-gold: #F6B638;
    --hs-cream: #FBEFD2;
    --hs-logo-word: #0E2240;
    --hs-logo-1: #E8611E;
    --hs-logo-2: #B04E6E;
    --hs-logo-3: #4F4A8C;
    --hs-logo-4: #16285E;
    --hs-ok: var(--ok);
    --hs-warn: var(--warn);
    --hs-err: var(--err);
    --hs-selected-bg: var(--band);
    --hs-selected-edge: var(--hs-primary);
    --hs-focus: #E8611E;
    --hs-focus-width: 3px;
    --hs-focus-offset: 3px;
    --hs-focus-ring: var(--hs-focus-width) solid var(--hs-focus);
    --hs-shadow: none;
    --hs-radius-control: 4px;
    --hs-radius-panel: 6px;
    --hs-bar-radius: 3px;
    --hs-font-sans: "Jost", "Jost Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --hs-font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --hs-title-weight: 800;
    --hs-title-transform: uppercase;
    --hs-title-tracking: .04em;
    --hs-figure-weight: 700;
    --hs-data-sun: var(--f-pv);
    --hs-data-sun-strong: #806000;
    --hs-data-surplus: #F2B705;
    --hs-data-surplus-bg: #FCE7A0;
    --hs-data-curtailed-bg: #F1ECE1;
    --hs-data-battery: var(--f-bat);
    --hs-data-grid: var(--f-grid);
    --hs-data-grid-strong: #3570C0;
    --hs-data-load: var(--f-load);
    --hs-data-curtailed: var(--f-curt);
    --hs-data-losses: var(--f-conv);
    --hs-data-soc: var(--hs-ink);
    --hs-chart-label: var(--mute);
    --hs-chart-grid: var(--line);
    --hs-chart-axis: var(--line-input);
    --hs-chart-font-size: 11px;
    --hs-chart-gap: var(--panel);
    --hs-price-1: #1A9850;
    --hs-price-ink-1: #0E2240;
    --hs-price-2: #91CF60;
    --hs-price-ink-2: #0E2240;
    --hs-price-3: #FEE08B;
    --hs-price-ink-3: #0E2240;
    --hs-price-4: #FC8D59;
    --hs-price-ink-4: #0E2240;
    --hs-price-5: #D73027;
    --hs-price-ink-5: #FFFFFF;
    --hs-map-footprint: #FFFFFF;
    --hs-map-footprint-plan: #0E2240;
    --hs-map-excl: #FF5A4F;
    --hs-map-off: #9AA0A6;
    --hs-map-hover: #FFFFFF;
    --hs-3d-bg: var(--bg);
    --hs-3d-grid-major: #8F8878;
    --hs-3d-grid-minor: #DCD3C2;
    --hs-3d-unlabelled: #8F8878;
    --hs-3d-env-low: #B8AF9E;
    --hs-3d-env-high: #6E675A;
    --hs-3d-selected: var(--hs-orange);
    --hs-3d-shadow: rgba(14, 34, 64, .28);
    --hs-3d-panel-cell: #0E2240;
    --hs-3d-panel-frame: #C9CED6;
    --hs-3d-panel-line: #2E5C8A;
    --hs-plan-plane: rgba(143, 136, 120, .16);
    --hs-plan-plane-line: rgba(143, 136, 120, .75);
    --hs-plan-panel: #0E2240;
    --hs-plan-panel-line: #FFFFFF;
    --hs-plan-label: #FFFFFF;
    --hs-plan-halo: rgba(14, 34, 64, .72);
    --f-self: #2F8F5B;
    --hs-plane-1: #1F9E89;
    --hs-plane-2: #3A86FF;
    --hs-plane-3: #D63A8E;
    --hs-plane-4: #8AC926;
    --hs-plane-5: #00A6C8;
    --hs-plane-6: #F28AB0;
    --hs-plane-7: #4F772D;
    --hs-plane-8: #B07AA1;
  }
}

/* ── Éléments de base ── */
body { font-family: var(--hs-font-sans); }
table, .kv, svg text { font-variant-numeric: tabular-nums; }

/* Définitions SVG du logo (<symbol id="hs-logo">, <symbol id="hs-logo-lockup">) : hors flux mais rendues,
   sinon les dégradés disparaissent (display:none les désactive). */
.hs-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Logo : posé directement sur le fond, sans plaque. En sombre, le mot passe en crème et les deux barres du bas
   s’éclaircissent (jetons --hs-logo-*, lus par logo_defs.svg) ; l’impression garde les couleurs d’origine. */
.hs-lockup { display: block; flex: none; width: auto; height: 26px; aspect-ratio: 797 / 134; }

/* Bouton de thème : 44 × 44 px, nom accessible fixe, état dans aria-pressed. Masqué tant que hs/theme.js
   ne l’a pas activé (sans JavaScript, le site suit le système). */
.hs-theme { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  padding: 0; border: 1px solid var(--hs-line-input); border-radius: var(--hs-radius-control);
  background: transparent; color: var(--hs-ink); cursor: pointer; }
.hs-theme:hover { border-color: var(--hs-ink); }
.hs-theme:focus-visible { outline: var(--hs-focus-ring); outline-offset: var(--hs-focus-offset); }
.hs-theme svg { width: 20px; height: 20px; }
.hs-theme .hs-moon, .hs-theme[aria-pressed="true"] .hs-sun { display: block; }
.hs-theme .hs-sun, .hs-theme[aria-pressed="true"] .hs-moon { display: none; }
@media print { .hs-theme { display: none !important; } }
