/* magnesiopercrampi.it: stile rigoroso, fondo bianco, linee sottili, blu notte */
:root {
  --fondo: #ffffff;
  --superficie: #f5f7fa;
  --inchiostro: #16202e;
  --grigio: #56627a;
  --notte: #24406b;
  --notte-tenue: #e8edf5;
  --filo: #d5dce6;
  --filo-forte: #24406b;
  --segnale: #b3261e;
  --wykres: var(--notte);
  --wykres-tlo: var(--filo);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0e131b;
    --superficie: #151c27;
    --inchiostro: #e4e9f1;
    --grigio: #9aa7bb;
    --notte: #8fb0e3;
    --notte-tenue: #1b2638;
    --filo: #2a3547;
    --filo-forte: #8fb0e3;
    --segnale: #ff8a80;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--inchiostro);
  font: 1rem/1.68 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
  overflow-wrap: break-word;
}
a { color: var(--notte); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--notte); outline-offset: 2px; }

.cornice { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }

.salta { position: absolute; left: -999px; top: 0; background: var(--notte); color: var(--fondo); padding: 0.4rem 0.8rem; }
.salta:focus { left: 0.5rem; z-index: 10; }

/* intestazione: nome a sinistra, indice a destra, un solo filo sotto */
.sito { border-top: 4px solid var(--notte); border-bottom: 1px solid var(--filo); background: var(--fondo); }
.sito-riga { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.8rem; }
.sito-nome { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--inchiostro); text-decoration: none; font-weight: 600; letter-spacing: 0.01em; }
.sito-nome em { font-style: normal; color: var(--notte); }
.sito-segno { width: 0.85rem; height: 0.85rem; border: 2px solid var(--notte); border-radius: 50%; position: relative; flex: none; }
.sito-segno::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--notte); }
.sito-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem 1rem; }
.sito-nav a { color: var(--grigio); text-decoration: none; font-size: 0.84rem; }
.sito-nav a:hover { color: var(--notte); text-decoration: underline; }

/* scheda */
.scheda { padding-top: 1.4rem; padding-bottom: 1rem; }
.okruszki { font-size: 0.78rem; color: var(--grigio); margin-bottom: 1.2rem; }
.okruszki a { color: var(--grigio); }
.okruszki span { margin: 0 0.35rem; }
.sopratitolo {
  margin: 0 0 0.35rem;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  color: var(--notte);
}
h1 { font-size: clamp(1.45rem, 4.2vw, 2rem); line-height: 1.22; font-weight: 650; margin: 0 0 0.5rem; letter-spacing: -0.005em; }
.revisione { font-size: 0.78rem; color: var(--grigio); margin: 0 0 1.6rem; padding-bottom: 1rem; border-bottom: 1px solid var(--filo); }
.revisione:has(time:empty) { display: none; }

/* sintesi in apertura: filo a sinistra, etichetta in maiuscoletto */
.referto > p:first-child {
  margin: 0 0 1.6rem;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--filo-forte);
  font-size: 1.04rem;
}
.referto > p:first-child::before {
  content: "In sintesi";
  display: block;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  color: var(--notte);
  margin-bottom: 0.2rem;
}
.referto h2 {
  font-size: 1.2rem;
  line-height: 1.35;
  font-weight: 650;
  margin: 2.4rem 0 0.7rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--filo);
}
.referto h3 { font-size: 1rem; font-weight: 650; margin: 1.4rem 0 0.3rem; }
.referto p, .referto ul, .referto ol { margin: 0 0 1rem; }
.referto ul, .referto ol { padding-left: 1.2rem; }
.referto li { margin-bottom: 0.3rem; }
.referto strong { font-weight: 650; }

/* tabelle: scorrono in orizzontale dentro il proprio riquadro */
.tabela { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.1rem 0 1.4rem; border-top: 2px solid var(--filo-forte); border-bottom: 1px solid var(--filo); }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: 0.85rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
th {
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grigio);
  border-bottom: 1px solid var(--filo);
  vertical-align: bottom;
}
td { padding: 0.5rem 0.65rem; border-top: 1px solid var(--filo); vertical-align: top; }
tbody tr:first-child td { border-top: 0; }
tbody tr:nth-child(even) td { background: var(--superficie); }

/* chiusura */
.chiusura { margin-top: 3rem; border-top: 1px solid var(--filo); background: var(--superficie); color: var(--grigio); font-size: 0.84rem; }
.chiusura-griglia { display: grid; grid-template-columns: 1fr; gap: 1rem 2.5rem; padding-top: 1.6rem; padding-bottom: 1rem; }
@media (min-width: 40rem) { .chiusura-griglia { grid-template-columns: 3fr 2fr; } }
.chiusura-nome { margin: 0 0 0.3rem; color: var(--inchiostro); font-weight: 600; }
.chiusura-titolo { margin: 0 0 0.3rem; font-variant: small-caps; text-transform: lowercase; letter-spacing: 0.12em; color: var(--notte); }
.chiusura-griglia p { margin-top: 0; }
.chiusura-nav { list-style: none; margin: 0; padding: 0; }
.chiusura-nav li { padding: 0.15rem 0; border-bottom: 1px solid var(--filo); }
.chiusura-nav a { color: var(--grigio); text-decoration: none; }
.chiusura-nav a:hover { color: var(--notte); text-decoration: underline; }
.chiusura-fondo { padding-bottom: 2.2rem; }
.avvertenza { margin: 0 0 0.8rem; padding: 0.7rem 0.9rem; border: 1px solid var(--filo); border-left: 3px solid var(--segnale); background: var(--fondo); color: var(--inchiostro); font-size: 0.82rem; }
.copia { margin: 0; font-size: 0.76rem; }

/* dopisane przez build.py: obraz pod pierwszym akapitem i wykresy slupkowe */
.obraz { margin: 1.4rem 0 1.6rem; }
.obraz img { display: block; width: 100%; height: auto; border-radius: 10px; }
.wykres { margin: 1.3rem 0 1.5rem; }
.wykres figcaption { font-weight: 600; margin-bottom: .6rem; }
.wykres-wiersz { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .6rem; margin: 0 0 .55rem; font-size: .9rem; }
.wykres-etykieta { grid-column: 1 / -1; line-height: 1.35; }
.wykres-pasek { display: block; height: .7rem; margin-top: .25rem; border-radius: 99px; background: var(--wykres-tlo, rgba(127, 127, 127, .18)); overflow: hidden; align-self: center; }
.wykres-pasek span { display: block; height: 100%; border-radius: 99px; background: var(--wykres, #24406b); }
.wykres-wartosc { font-variant-numeric: tabular-nums; font-weight: 600; align-self: center; margin-top: .25rem; }
.wykres-nota { font-size: .8rem; opacity: .8; margin: .5rem 0 0; }
