/* base.css — reset, tipografia, contenitori, cromo condiviso di thermo_hydraulic_store.
   Consuma SOLO i token di tokens.css: nessun valore letterale di colore qui dentro. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

img, svg, video { max-width: 100%; height: auto; display: block; }

/* ⚠⚠ Block-gap di WordPress. Le bande full-bleed (hero/section/cta-bar/page-head) sono figlie del
   `wp:post-content`, che ha il flow-layout WP → 24px di gap automatico fra i figli → si vede il bianco del
   body FRA una banda e l'altra (regola 11, lezione dura Sirtel). E il gap sui figli DIRETTI di una banda
   COLLASSA attraverso la banda e la trascina giù: va azzerato anche lì, non solo sul post-content. */
.wp-block-post-content > * { margin-block: 0; }
.hero > *, .section > *, .cta-bar > *, .page-head > *, .brands > *, .band > * { margin-block: 0; }

/* ⚠ Lo sticky è confinato dal wrapper `.wp-block-template-part`: `display: contents` lo scioglie.
   L'approccio `:has()` + wrapper non basta. */
.wp-block-template-part { display: contents; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--lh-snug);
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); line-height: var(--lh-tight); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); letter-spacing: -0.008em; }
h4 { font-size: var(--text-md); letter-spacing: 0; }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { color: var(--brand-dark); }

/* Anello di focus. ⚠ --focus vale sulle superfici CHIARE; su ogni campitura blu viene RIBALTATO in
   components.css. Un anello invisibile è un difetto di accessibilità, non un dettaglio. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip link: primo elemento focalizzabile del documento, porta a #main. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brand); color: var(--on-dark);
  padding: var(--space-3) var(--space-5);
  font-weight: 600; text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* --- Contenitori e sezioni --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); background: var(--paper); }
.section--alt { background: var(--surface); }
.section--tight { padding-block: calc(var(--section-y) * 0.62); }

/* Full-bleed. ⚠ `calc(50% - 50vw)` risolve il 50% sulla CELLA di griglia, non sul container: la formula
   corretta compensa il gutter, e va provata ai DUE estremi del viewport, non solo a 1440. */
.full-bleed {
  margin-inline: calc(-1 * max(var(--gutter), (100vw - var(--container)) / 2));
}

/* --- Occhiello di sezione --- */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 var(--space-3);
}
.eyebrow::before {
  content: ""; inline-size: 1.75rem; block-size: 2px;
  background: var(--accent); flex: none;
}
.section--alt .eyebrow { color: var(--accent-ink); }

.section-intro { max-width: 62ch; margin: 0 0 var(--space-7); }
.section-intro .lead { font-size: var(--text-md); color: var(--ink-muted); margin: 0; }

/* ⚠ La misura di lettura (`ch`) va sul PARAGRAFO, MAI sul contenitore: sul contenitore strozza i display.
   E la misura ottimale è PER VIEWPORT — 52–74 caratteri su schermo largo, 34–48 a 390px. */
.prose { max-width: 68ch; }
.prose p { color: var(--ink-muted); }
.prose > :last-child { margin-bottom: 0; }

/* --- Bottoni --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  /* ⚠ La scorciatoia `transition:` SOSTITUISCE quella che l'elemento aveva già: si elencano le proprietà. */
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--sm { padding: 0.6rem 1.1rem; }

/* Primario = BLU con testo bianco (7,04). */
.btn--primary { background: var(--brand); color: var(--on-dark); border-color: var(--brand); }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-dark); }

/* ⚠⚠ ACCENTO = arancione con testo INCHIOSTRO (6,75). Mai bianco: bianco su arancione fa 2,45. */
.btn--accent { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn--accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--ink); }

.btn--ghost { background: transparent; color: var(--brand); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--brand-dark); border-color: var(--brand); }

/* Su campitura blu: il fantasma diventa chiaro, e il focus si RIBALTA. */
.btn--ghost-on-dark { background: transparent; color: var(--on-dark); border-color: rgba(255,255,255,.5); }
.btn--ghost-on-dark:hover { background: rgba(255,255,255,.12); color: var(--on-dark); border-color: var(--on-dark); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* --- Micro-animazioni (regola 2) ---
   ⚠⚠ Il reveal MUOVE, NON SFUMA. Due ragioni misurate: (1) un testo vicino alla soglia AA scende SOTTO
   durante la dissolvenza, e axe lo cogliere solo a metà transizione, dove sembra rumore del test;
   (2) un elemento a `opacity:0` NON FA SCARICARE le immagini che contiene, quindi le foto arrivano tardi
   o risultano rotte a un controllo che misura al `load`. Solo `transform`.
   Fail-visible: senza JS (`html` senza `.js`) e sotto `prefers-reduced-motion` non si muove nulla. */
.js .reveal {
  transform: translateY(22px);
  transition: transform .62s cubic-bezier(.22,.7,.24,1);
  transition-delay: calc(var(--reveal-i, 0) * 70ms);
  will-change: transform;
}
.js .reveal.is-visible { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.is-visible { transform: none; transition: none; }
  .btn:hover { transform: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* Le sezioni con reveal orizzontali usano `clip`, MAI `hidden`: `hidden` romperebbe lo sticky dell'header. */
.section, .hero { overflow-x: clip; }
