/* base.css — reset minimale, font self-hosted (OFL, spediti nel tema in assets/fonts/), tipografia
   istituzionale (Barlow Condensed display + Barlow testo), accessibilità base. security_institute
   (istituto di vigilanza privata). I token vivono in tokens.css: qui si consumano, non si ridichiarano. */

/* --- Font self-hosted (no Google Fonts, zero-live). I woff2 OFL sono spediti nel tema (assets/fonts/).
   theme.json dichiara le stesse famiglie/pesi: le due dichiarazioni puntano agli stessi file. --- */
@font-face { font-family:"Barlow Condensed"; font-style:normal; font-weight:600; font-display:swap;
  src:url("../assets/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family:"Barlow Condensed"; font-style:normal; font-weight:700; font-display:swap;
  src:url("../assets/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family:"Barlow"; font-style:normal; font-weight:400; font-display:swap;
  src:url("../assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family:"Barlow"; font-style:normal; font-weight:500; font-display:swap;
  src:url("../assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family:"Barlow"; font-style:normal; font-weight:600; font-display:swap;
  src:url("../assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@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;
  font-variant-ligatures: common-ligatures contextual;
}

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; }

/* Il footer non deve «salire» sulle pagine più corte della finestra: la colonna tiene l'altezza e il main
   cresce (si vede solo sulle pagine brevi — qui la Privacy). */
.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 che WP mette sui loro figli DIRETTI COLLASSA attraverso la
   banda — che non ha né padding-top né border-top — e la trascina giù, scoprendo una striscia di fondo
   sopra l'header. Si azzerano i figli diretti; i margini INTERNI restano quelli voluti. */
.hero > *, .section > *, .cta-band > *, .page-head > *, .cta-bar > * { margin-block: 0; }

/* Tipografia display: Barlow Condensed, pesi 600/700. Titoli in tono-frase; il MAIUSCOLO è riservato agli
   occhielli e alle etichette, dove il tracciamento lo rende leggibile.
   ⚠ `text-wrap: balance` pareggia le righe ma non impedisce la VEDOVA — l'ultima parola sola in fondo.
   `pretty` è la modalità pensata proprio per l'ultima riga; si tengono entrambe, con `pretty` per ultima
   a vincere dove esiste. */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; font-kerning: normal; font-feature-settings: "kern" 1, "liga" 1; letter-spacing: var(--tracking-display); line-height: var(--lh-snug); text-wrap: balance; text-wrap: pretty; }
h1 { font-size: var(--text-3xl); line-height: var(--lh-tight); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); font-weight: 600; }
p { text-wrap: pretty; }

/* Occhiello = Barlow maiuscolo tracciato. Su fondo chiaro è --accent-ink (5,77); su fondo NAVY la variante
   --light usa l'ottone pieno, che lì porta testo (5,15). ⚠ L'ottone pieno non è mai testo su chiaro. */
.eyebrow {
  font-family: var(--font-body); font-weight: 600; font-size: var(--text-sm);
  letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--accent-ink);
  margin: 0 0 var(--space-3);
}
.eyebrow--light { color: var(--accent); }
.eyebrow--center { text-align: center; }

/* Filetto: il segno ricorrente. Non è testo → l'ottone pieno qui è legittimo anche su fondo chiaro. */
.rule { border: 0; height: 0; border-top: 3px solid var(--accent); width: 52px; margin: var(--space-4) 0; }
.rule--center { margin-inline: auto; }
.rule--light { border-color: var(--accent); }

/* Utilità tipografiche. ⚠ --ink-muted vale SOLO su fondo chiaro; sul scuro il secondario è --on-dark-muted.
   ⚠ La misura di lettura sta sul PARAGRAFO, mai sul contenitore del display: in `ch` il limite si calcola
   sul font del CORPO e strozzerebbe un titolo da 40px. */
.lead { font-size: var(--text-md); line-height: 1.55; color: var(--ink-muted); max-width: 62ch; }
.muted { color: var(--ink-muted); }
.small { font-size: var(--text-sm); }
.measure { max-width: var(--container-narrow); }
/* Su fondo scuro il lead cambia colore, non misura. */
.on-dark .lead, .lead--on-dark { color: var(--on-dark-muted); }

/* Layout di base */
.container { width: min(100% - (var(--gutter) * 2), var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-y); background: var(--paper); position: relative; z-index: 1; }
.section--tint { background: var(--surface); }
.section--navy { background: var(--brand); color: var(--on-dark); }
.section--tight { padding-block: calc(var(--section-y) * 0.66); }
/* Un reveal orizzontale sborda: si taglia in X. L'elenco copre OGNI banda di primo livello, non solo
   quelle che portano `.section` — una banda con classe propria senza il taglio allarga la pagina oltre il
   viewport (difetto che si misura sul sito vivo al `load`, non sul mock). */
/* ⚠ L'elenco deve coprire OGNI banda di primo livello, non solo quelle che portano `.section`. Mancavano
   `.centrale`, `.anchored` e `.trustbar`: dentro la prima un elemento in rivelazione (spostato di -28px)
   e dentro la seconda il marchio inciso (che l'animazione porta a scala 1,045) uscivano dal viewport e
   allargavano la pagina di 10px a 390, 360 e 320.
   ⚠⚠ Il difetto è DIPENDENTE DAL TEMPO: esiste solo in una parte del ciclo dell'animazione, quindi una
   misura sola può trovarlo a zero. Va misurato ripetutamente nel tempo, ed è così che è saltato fuori. */
.section, .hero, .cta-band, .page-head, .mosaic, .sedi-band, .centrale, .anchored, .trustbar { overflow-x: clip; }

/* Accessibilità: focus visibile ovunque, skip-link.
   ⚠⚠ Il focus è RIBALTATO sulle superfici navy: --accent-ink fa 2,16 sul navy (invisibile), l'ottone 5,15.
   Senza questo ribaltamento la navigazione da tastiera nella barra istituzionale e nel footer non mostra
   dove si trova il fuoco — che è un difetto di accessibilità, non un dettaglio estetico. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.topbar :focus-visible, .site-header :focus-visible, .site-footer :focus-visible,
.hero__panel :focus-visible, .section--navy :focus-visible, .cta-band :focus-visible,
.tile--navy :focus-visible, .centrale :focus-visible { outline-color: var(--accent); }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--night); color: var(--on-dark); padding: var(--space-3) var(--space-4);
}
.skip-link:focus { left: var(--space-4); top: var(--space-4); }

/* Scroll-reveal (reveal.js, IntersectionObserver): fail-visible senza JS e con reduced-motion.
   ⚠ Il reveal MUOVE e basta, non sfuma: un testo in dissolvenza attraversa la soglia AA mentre entra, e un
   elemento a opacity 0 può impedire alle immagini che contiene di scaricarsi. Solo transform. */
.js .reveal { transform: translateY(24px); }
.js .reveal--left { transform: translateX(-28px); }
.js .reveal--right { transform: translateX(28px); }
.js .reveal--rise { transform: translateY(52px); }
.js .reveal--drop { transform: translateY(-20px); }
.js .reveal.is-visible {
  transform: none;
  transition: transform .7s var(--ease);
  transition-delay: calc(var(--reveal-i, 0) * 90ms);
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.is-visible { transform: none; transition: none; }
}
