/*
 * HAsset-Book — variabili dell'admin (docs-admin/stile-admin.md §2–§4).
 * Solo variabili e caratteri: colori dei due temi, carattere, misure, e i valori dati a Bootstrap.
 * Tema: <html data-tema="chiaro|scuro|auto">. Carattere: <html data-carattere="inter|manrope|sistema">.
 * Le variabili hanno il prefisso hb- per non scontrarsi con quelle di Prenota e dei moduli.
 */

/* Il browser scarica un carattere solo se una pagina lo usa davvero: viene caricato solo quello scelto. */
/*
 * Inter 4.1 self-hosted (assets/fonts/inter/, licenza OFL): il file dell'autore (rsms.me/inter) diviso per alfabeto, disegno «testo»
 * (opsz 14), pesi 100-900. Il browser scarica solo i pezzi che servono alla pagina; il latino per ultimo, così vince dove si sovrappone.
 */
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter/Inter-cirillico.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116, U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter/Inter-greco.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF, U+1F00-1FFF;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter/Inter-vietnamita.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    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;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter/Inter-latino-esteso.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    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;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter/Inter-latino.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    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: "Manrope";
    src: url("../fonts/manrope/Manrope-VariableFont_wght.woff2") format("woff2-variations"),
         url("../fonts/manrope/Manrope-VariableFont_wght.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

/* ---------- Colori: tema chiaro ---------- */
:root {
    --hb-bg: #f3f4f6;
    --hb-surface: #ffffff;
    --hb-side: #1d2327;
    --hb-side-ink: #f0f0f1;
    --hb-side-muted: #c3c4c7;
    --hb-side-hover: #2c3338;
    --hb-side-active-bg: #2271b1;
    --hb-side-active-ink: #ffffff;
    --hb-side-line: rgba(255, 255, 255, .10);
    --hb-line: #dcdde0;
    --hb-ink: #1d2327;
    --hb-muted: #50575e;
    --hb-accent: #2271b1;
    --hb-accent-hover: #135e96;
    --hb-accent-ink: #ffffff;
    --hb-tint: #e8f1f9;
    --hb-field: #ffffff;
    --hb-field-line: #8c8f94;
    --hb-field-off: #f3f4f6;
    --hb-ok-bg: #e3f3ea;
    --hb-ok-ink: #17643c;
    --hb-warn-bg: #fcefdc;
    --hb-warn-ink: #8a4b00;
    --hb-err-bg: #fbe9ea;
    --hb-err-ink: #8a2424;
    --hb-neutro-bg: #eceef1;
    --hb-neutro-ink: #3a414a;
    --hb-info-bg: #e8f1f9;
    --hb-info-ink: #135e96;
    --hb-viola-bg: #ece8fa;
    --hb-viola-ink: #4d36a0;
    --hb-ombra: 0 8px 24px rgba(0, 0, 0, .12);

    /* Misure (§4) */
    --hb-radius: 8px;
    --hb-radius-sm: 6px;
    --hb-sidebar-w: 248px;
    --hb-tocco: 44px;

    /* Caratteri (§3) */
    --hb-font-inter: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --hb-font-manrope: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --hb-font-sistema: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --hb-font: var(--hb-font-inter);

    color-scheme: light;
}

/* ---------- Colori: tema scuro (scelto, o automatico se il dispositivo è scuro) ---------- */
:root[data-tema="scuro"] {
    --hb-bg: #0f1317;
    --hb-surface: #181d22;
    --hb-side: #0a0d10;
    --hb-side-ink: #e6e8ea;
    --hb-side-muted: #a9b1b9;
    --hb-side-hover: #1c2228;
    --hb-side-active-bg: #2f7fc4;
    --hb-side-active-ink: #ffffff;
    --hb-line: #2b3238;
    --hb-ink: #eceef0;
    --hb-muted: #a9b1b9;
    --hb-accent: #5aa2e6;
    --hb-accent-hover: #7cb6ec;
    --hb-accent-ink: #0b1a28;
    --hb-tint: #16283a;
    --hb-field: #12171c;
    --hb-field-line: #4a535c;
    --hb-field-off: #1c2228;
    --hb-ok-bg: #12301f;
    --hb-ok-ink: #7fd6a4;
    --hb-warn-bg: #352409;
    --hb-warn-ink: #f2bd6b;
    --hb-err-bg: #3a1517;
    --hb-err-ink: #f4a3a6;
    --hb-neutro-bg: #252a30;
    --hb-neutro-ink: #c3cad2;
    --hb-info-bg: #16283a;
    --hb-info-ink: #7cb6ec;
    --hb-viola-bg: #271f45;
    --hb-viola-ink: #b9a8f5;
    --hb-ombra: 0 8px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-tema="auto"] {
        --hb-bg: #0f1317;
        --hb-surface: #181d22;
        --hb-side: #0a0d10;
        --hb-side-ink: #e6e8ea;
        --hb-side-muted: #a9b1b9;
        --hb-side-hover: #1c2228;
        --hb-side-active-bg: #2f7fc4;
        --hb-side-active-ink: #ffffff;
        --hb-line: #2b3238;
        --hb-ink: #eceef0;
        --hb-muted: #a9b1b9;
        --hb-accent: #5aa2e6;
        --hb-accent-hover: #7cb6ec;
        --hb-accent-ink: #0b1a28;
        --hb-tint: #16283a;
        --hb-field: #12171c;
        --hb-field-line: #4a535c;
        --hb-field-off: #1c2228;
        --hb-ok-bg: #12301f;
        --hb-ok-ink: #7fd6a4;
        --hb-warn-bg: #352409;
        --hb-warn-ink: #f2bd6b;
        --hb-err-bg: #3a1517;
        --hb-err-ink: #f4a3a6;
        --hb-neutro-bg: #252a30;
        --hb-neutro-ink: #c3cad2;
        --hb-info-bg: #16283a;
        --hb-info-ink: #7cb6ec;
        --hb-viola-bg: #271f45;
        --hb-viola-ink: #b9a8f5;
        --hb-ombra: 0 8px 24px rgba(0, 0, 0, .45);
        color-scheme: dark;
    }
}

/* ---------- Carattere scelto dall'utente ---------- */
:root[data-carattere="manrope"] { --hb-font: var(--hb-font-manrope); }
:root[data-carattere="sistema"] { --hb-font: var(--hb-font-sistema); }

/* ---------- Nomi di prima (app.css e CSS dei moduli li usano): puntano ai valori nuovi ---------- */
:root {
    --hb-border: var(--hb-line);
    --hb-border-strong: var(--hb-field-line);
    --hb-border-subtle: var(--hb-line);
    --hb-text: var(--hb-ink);
    --hb-text-muted: var(--hb-muted);
    --hb-primary: var(--hb-accent);
    --hb-primary-dark: var(--hb-accent-hover);
    --hb-primary-soft: var(--hb-tint);
    --hb-danger: var(--hb-err-ink);
    --hb-warning: var(--hb-warn-ink);
    --hb-shadow: none;
    --hb-sidebar-bg: var(--hb-side);
    --hb-sidebar-text: var(--hb-side-ink);
    --hb-sidebar-text-active: var(--hb-side-active-ink);
}

/* ---------- Bootstrap prende i valori della guida ---------- */
:root {
    --bs-body-font-family: var(--hb-font);
    --bs-body-font-size: .9375rem;
    --bs-body-line-height: 1.5;
    --bs-body-bg: var(--hb-bg);
    --bs-body-color: var(--hb-ink);
    --bs-emphasis-color: var(--hb-ink);
    --bs-heading-color: var(--hb-ink);
    --bs-secondary-color: var(--hb-muted);
    --bs-secondary-rgb: 80, 87, 94;
    --bs-tertiary-color: var(--hb-muted);
    --bs-secondary-bg: var(--hb-bg);
    --bs-tertiary-bg: var(--hb-bg);
    --bs-border-color: var(--hb-line);
    --bs-border-color-translucent: var(--hb-line);
    --bs-link-color: var(--hb-accent);
    --bs-link-hover-color: var(--hb-accent-hover);
    --bs-primary: #2271b1;
    --bs-primary-rgb: 34, 113, 177;
    --bs-border-radius: var(--hb-radius);
    --bs-border-radius-sm: var(--hb-radius-sm);
    --bs-border-radius-lg: var(--hb-radius);
    --bs-box-shadow: none;
    --bs-box-shadow-sm: none;
    --bs-box-shadow-lg: none;
    --bs-success-bg-subtle: var(--hb-ok-bg);
    --bs-success-text-emphasis: var(--hb-ok-ink);
    --bs-warning-bg-subtle: var(--hb-warn-bg);
    --bs-warning-text-emphasis: var(--hb-warn-ink);
    --bs-danger-bg-subtle: var(--hb-err-bg);
    --bs-danger-text-emphasis: var(--hb-err-ink);
    --bs-info-bg-subtle: var(--hb-info-bg);
    --bs-info-text-emphasis: var(--hb-info-ink);
    --bs-secondary-bg-subtle: var(--hb-neutro-bg);
    --bs-secondary-text-emphasis: var(--hb-neutro-ink);
    --bs-light-bg-subtle: var(--hb-bg);
    --bs-light-text-emphasis: var(--hb-ink);
}

/* Scuro: le varianti «primary» di Bootstrap seguono l'accento più chiaro */
:root[data-bs-theme="dark"] {
    --bs-primary: #5aa2e6;
    --bs-primary-rgb: 90, 162, 230;
    --bs-secondary-rgb: 169, 177, 185;
}
