/* Gestionale · edizione RERUM (31/10/2026): palette e titoli del brand, sopra tokens.css.
   Si attiva con <html data-edition="rerum"> (index.html, portale.html); senza l'attributo resta lo stile neutro.
   Fonte: "RERUM Brand Identity Development" (Cecilia, ott 2026) riassunto in HELMET/documenti/codice_colore_rerum_2026-10-28/.
   "Non colori. Materiali." Regola 90/10: i neutri riempiono (CRETA, CARBO, NIX, NOX), LAPIS è la firma (azione primaria,
   selezione, focus), gli accenti solo in elementi piccoli (stati, puntini, filetti), mai come fondo di grandi superfici.
   Le tinte e i toni più scuri/chiari sono derivati dai colori della palette per tenere il contrasto del testo ≥ 4.5:1.
     CRETA #EDEEE9 · CARBO #313030 · NIX #FFFFFF · NOX #000000 · LAPIS #9DB5BC
     MINIUM #BF1B1B · FLAMMA #ED3F1C · AMBRA #ED8008 · OCHRA #BF7C2A · TERRA #C0632E · ARENA #BFA07A
     PULVIS #D9C3B0 · SALVIA #B7B183 · OLIVA #736B1E · UMBRA #736356 · MALVA #594C56 · INDICUM #315B7B
   Titoli: logotipo HUPLA METRIC, maiuscolo. La licenza del font non c'è ancora: finché manca i titoli usano Chakra Petch
   (OFL, gratuito, lo stesso della pagina del codice colore), in public/fonts/ con la sua licenza. Quando arriva HUPLA METRIC
   basta aggiungere qui il suo @font-face: è già primo nella lista di --font-display. */

@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url("../fonts/ChakraPetch-600-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; }
@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url("../fonts/ChakraPetch-600-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url("../fonts/ChakraPetch-700-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; }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url("../fonts/ChakraPetch-700-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------------------------------------------------------------- tema chiaro (e stampa) */
:root[data-edition="rerum"] {
  --brand-default: #9DB5BC;

  --background: #EDEEE9;                /* CRETA */
  --foreground: #313030;                /* CARBO: 11:1 su CRETA */
  --foreground-2: #4A4846;
  --card: #FFFFFF;                      /* NIX */
  --popover: #FFFFFF;
  --sidebar: #F5F5F2;
  --muted: #E3E4DE;             --muted-foreground: #65645F;
  --secondary: #E3E4DE;
  --accent: #E2E9EB;            --accent-foreground: #315B7B;    /* tinta LAPIS, testo INDICUM */
  --primary: #9DB5BC;           --primary-foreground: #313030;   /* LAPIS con CARBO sopra (6:1) */
  --primary-hover: #8BA7AF;
  --primary-text: #315B7B;              /* INDICUM come testo e link: LAPIS sul chiaro non si legge */
  --primary-line: #C3D3D8;
  --destructive: #BF1B1B;       --destructive-foreground: #FFFFFF;   /* MINIUM */
  --success: #5C5617;                   /* OLIVA più scuro */
  --warning: #86500F;                   /* OCHRA più scuro */
  --border: rgb(49 48 48 / 0.12);
  --input: rgb(49 48 48 / 0.20);
  --input-bg: #FFFFFF;
  --ring: #9DB5BC;
  --ring-soft: rgb(157 181 188 / 0.45);
  --placeholder: #77766F;
  --faint-foreground: #8E8D87;
  --row-hover: #F4F4F0;
  --topbar-glass: rgb(237 238 233 / 0.86);
  --overlay: rgb(20 20 19 / 0.40);

  --chart-1: #9DB5BC; --chart-2: #B7B183; --chart-3: #ED8008; --chart-4: #736356; --chart-5: #BF1B1B;

  /* stati: active LAPIS/INDICUM · waiting AMBRA · done OLIVA · errore MINIUM · altro MALVA · voli LAPIS scuro */
  --grey:   #5E5C57;  --grey-bg:   #ECEBE6;
  --blue:   #315B7B;  --blue-bg:   #E2E9EB;
  --green:  #5C5617;  --green-bg:  #E9E8DA;
  --amber:  #86500F;  --amber-bg:  #FCEBD7;
  --red:    #A8191A;  --red-bg:    #F7E4E4;
  --purple: #594C56;  --purple-bg: #EBE7EA;
  --teal:   #3D5F67;  --teal-bg:   #E6EEF0;
  --dark:   #EDEEE9;  --dark-bg:   #313030;
  --warn-dot: #ED8008;

  /* vendita · costo (TERRA) · margine (OLIVA): mai confondibili, mai LAPIS */
  --cost:   #9A4B1D;  --cost-bg:   #FAF1EA;  --cost-line:   #EACFBC;
  --margin: #5C5617;  --margin-bg: #F3F2E6;  --margin-line: #D8D5B4;

  --font-display: "HUPLA METRIC", "Hupla Metric", "Chakra Petch", "DIN Condensed", "Arial Narrow", var(--font-sans);
}

/* ---------------------------------------------------------------- tema scuro (default a schermo): stesse voci del chiaro */
@media screen {
  :root[data-edition="rerum"]:not([data-theme="light"]) {
    --background: #181817;              /* fra NOX e CARBO */
    --foreground: #EDEEE9;              /* CRETA */
    --foreground-2: #CFD0CA;
    --card: #222221;
    --popover: #2A2A29;
    --sidebar: #1D1D1C;
    --muted: #2E2E2D;           --muted-foreground: #A3A49E;
    --secondary: #2E2E2D;
    --accent: #2C3436;          --accent-foreground: #C4D5DA;
    --primary: #9DB5BC;         --primary-foreground: #313030;
    --primary-hover: #B2C6CC;
    --primary-text: #9DB5BC;            /* LAPIS: 8:1 sul fondo */
    --primary-line: #4A5A5F;
    --destructive: #D23A2A;     --destructive-foreground: #FFFFFF;
    --success: #B7B183;                 /* SALVIA */
    --warning: #F0922E;                 /* AMBRA */
    --border: rgb(237 238 233 / 0.10);
    --input: rgb(237 238 233 / 0.16);
    --input-bg: rgb(237 238 233 / 0.045);
    --ring: #9DB5BC;
    --ring-soft: rgb(157 181 188 / 0.40);
    --placeholder: #8E8D87;
    --faint-foreground: #7E7D78;
    --row-hover: #262625;
    --topbar-glass: rgb(24 24 23 / 0.88);
    --overlay: rgb(0 0 0 / 0.6);

    --chart-1: #9DB5BC; --chart-2: #B7B183; --chart-3: #ED8008; --chart-4: #BFA07A; --chart-5: #ED3F1C;

    --grey:   #B3B2AC;  --grey-bg:   rgb(237 238 233 / 0.10);
    --blue:   #9DB5BC;  --blue-bg:   rgb(157 181 188 / 0.16);
    --green:  #B7B183;  --green-bg:  rgb(183 177 131 / 0.16);
    --amber:  #F0922E;  --amber-bg:  rgb(237 128 8 / 0.15);
    --red:    #F07A66;  --red-bg:    rgb(191 27 27 / 0.26);
    --purple: #C4AFC0;  --purple-bg: rgb(89 76 86 / 0.55);
    --teal:   #A3C2C4;  --teal-bg:   rgb(157 181 188 / 0.11);
    --dark:   #EDEEE9;  --dark-bg:   #3A3A39;
    --warn-dot: #ED8008;

    --cost:   #E09A6E;  --cost-bg:   #251E19;  --cost-line:   #45362B;
    --margin: #B7B183;  --margin-bg: #23231F;  --margin-line: #3E3D2F;
  }
}

/* ---------------------------------------------------------------- titoli nel carattere del brand, in maiuscolo */
:root[data-edition="rerum"] :is(.page-head h1, .page-head.sub-head h2, .card-h h2, .drawer-h h2, .modal .mh h2, .pl-gh h2, .pt-main h1, .pt-card > .h h2, .pt-section-t) {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}
:root[data-edition="rerum"] .pl-gh h2 .pl-gt { font: inherit; text-transform: inherit; letter-spacing: inherit; }   /* titolo-bottone del gruppo */
:root[data-edition="rerum"] .card-h h2, :root[data-edition="rerum"] .pt-card > .h h2 { font-size: 15px; }
:root[data-edition="rerum"] .sidebar :is(.grp, .nav-group, .np-code, .np-title) { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; }

/* marchio: targhetta ottagonale con smussi a 45°, come la versione a targhetta del logo */
:root[data-edition="rerum"] :is(.brand-mark, .pt-mark) {
  border-radius: 0;
  clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%);
  font-family: var(--font-display);
}
