/* base.css — reset minimale, font self-hosted (OFL, spediti nel tema in assets/fonts/), tipografia e
   accessibilità. pipeline_rehab (risanamento condotte e servizi idrici).
   I token vivono in tokens.css: qui si consumano, non si ridichiarano colori. */

/* --- Font self-hosted (no Google Fonts, zero-live). theme.json dichiara le stesse famiglie/pesi:
   le due dichiarazioni puntano agli stessi file. --- */
@font-face { font-family:"Public Sans"; font-style:normal; font-weight:400; font-display:swap;
  src:url("../assets/fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family:"Public Sans"; font-style:normal; font-weight:500; font-display:swap;
  src:url("../assets/fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family:"Public Sans"; font-style:normal; font-weight:600; font-display:swap;
  src:url("../assets/fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family:"Public Sans"; font-style:normal; font-weight:700; font-display:swap;
  src:url("../assets/fonts/public-sans-latin-700-normal.woff2") format("woff2"); }
/* Del display servono i pesi alti: e' un semi-condensato da segnaletica, sotto il 600 perde la voce. */
@font-face { font-family:"Encode Sans SC"; font-style:normal; font-weight:600; font-display:swap;
  src:url("../assets/fonts/encode-sans-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family:"Encode Sans SC"; font-style:normal; font-weight:700; font-display:swap;
  src:url("../assets/fonts/encode-sans-semi-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family:"Encode Sans SC"; font-style:normal; font-weight:800; font-display:swap;
  src:url("../assets/fonts/encode-sans-semi-condensed-latin-800-normal.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* ⚠ Con la testata fissa, un salto all'ancora porterebbe il titolo SOTTO la testata: lo
   `scroll-padding-top` glielo tiene sotto gli occhi. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--space-5)); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

/* ⚠ `height:auto` non e' decorativo: senza, l'attributo `height` del markup resta mentre la larghezza
   si riduce e l'immagine esce SCHIACCIATA. */
img, svg, picture { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
button { font: inherit; cursor: pointer; }

.wp-site-blocks { display: flex; flex-direction: column; min-height: 100vh; }
.wp-site-blocks > main { flex: 1 0 auto; }

/* Le bande full-bleed sono figlie del post-content, che ha il block-gap WP: senza questo si vedono
   strisce del fondo body fra una banda e l'altra (regola 11). */
.wp-block-post-content > * { margin-block: 0; }
/* ⚠ Non basta azzerare le bande: il block-gap sui loro figli DIRETTI COLLASSA attraverso la banda e la
   trascina giu', scoprendo una striscia di fondo sopra la testata. */
.hero > *, .section > *, .page-head > *, .cta-bar > *, .topbar > *,
.contact-band > *, .notfound > * { margin-block: 0; }

/* --- Display: semi-condensato in pesi alti. --- */
h1, h2, h3, h4 {
  font-family: var(--font-accent);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-display);
  text-wrap: pretty;
  color: inherit;
}
h1 { font-size: var(--text-3xl); font-weight: 800; line-height: var(--lh-tight); }
h2 { font-size: var(--text-2xl); line-height: var(--lh-tight); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-base); letter-spacing: 0; }

p { text-wrap: pretty; }

/* ⚠ La misura di lettura sta sul PARAGRAFO, MAI sul contenitore: sul contenitore strozzerebbe i display
   grandi alla misura del font del CORPO. Ed e' per VIEWPORT. */
.prose p, .lead, .section-intro p { max-width: 68ch; }
@media (max-width: 599.98px) { .prose p, .lead, .section-intro p { max-width: 44ch; } }

.lead { font-size: var(--text-md); color: var(--ink-muted); }

/* ⭐⭐ REGOLA OWNER: una sezione SENZA foto deve prendere TUTTA l'area e andare a capo da sola, mai una
   colonna stretta a sinistra con la meta' destra vuota. Qui cambia il TELAIO, non solo il contenuto:
   due colonne di testo invece della misura singola. Si vede solo sui monitor larghi. */
.section--text .prose { max-width: none; columns: 2; column-gap: var(--space-8); }
.section--text .prose p { max-width: none; }
@media (max-width: 860px) { .section--text .prose { columns: 1; } }

/* Occhiello: filetto rosso + maiuscoletto spaziato. Colore --accent-ink (6.50 su carta),
   MAI --accent, che a 4.52 ha il margine esaurito. */
.eyebrow {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 var(--space-3);
  display: flex; align-items: center; gap: var(--space-3);
}
.eyebrow::before { content: ""; width: 26px; height: 3px; background: var(--accent); flex: none; }

/* --- Accessibilità: focus sempre visibile, skip link primo focalizzabile. --- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: var(--on-dark);
  padding: var(--space-3) var(--space-5); border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Scroll-reveal (regola 2). Fail-visible: senza JS tutto e' gia' visibile. --- */
.js .reveal { opacity: 0; transform: translateY(22px); }
.js .reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  transition-delay: calc(var(--reveal-i, 0) * 70ms);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.is-visible { opacity: 1; transform: none; transition: none; }
}

/* ⚠ `overflow-x: clip`, MAI `hidden`: hidden romperebbe lo sticky della testata. */
.section, .hero { overflow-x: clip; }
