/* ============================================================
   base.css — RESET, @FONT-FACE, TIPOGRAFIA DI BASE
   Carica sempre dopo tokens.css. Nessun componente qui:
   solo la normalizzazione del browser e gli stili dei tag HTML.
============================================================ */

/* ---------- @font-face locale (Latin subset) ----------
   File scaricati da fonts.gstatic.com (subset U+0000-00FF + latin-ext
   essenziali). Un singolo woff2 per famiglia copre tutti i pesi perche'
   sono variable fonts. font-display:swap per minimizzare FOIT; fallback
   di sistema coerenti via size-adjust/ascent-override per azzerare CLS
   durante il font swap.
   Questi file sostituiscono i raleway-400/700 e robotoslab-300/700
   originari che erano duplicati (stesso hash). I vecchi file restano
   nella cartella come "legacy" e non sono piu' referenziati. */

/* Fallback che matcha le metriche di Raleway: elimina il jump al swap */
@font-face {
  font-family: 'Raleway Fallback';
  src: local('Arial');
  size-adjust: 99%;
  ascent-override: 95%;
  descent-override: 25%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Roboto Slab Fallback';
  src: local('Georgia');
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 400 700;              /* variable font: copre 400/600/700 */
  font-display: swap;
  src: url('../fonts/raleway-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: 'Roboto Slab';
  font-style: normal;
  font-weight: 400 700;              /* variable font: copre 400/700 */
  font-display: swap;
  src: url('../fonts/robotoslab-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;
}

/* ---------- RESET minimo ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font);
  font-size: var(--fs-lg);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- MEDIA & FORM ---------- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* ---------- TIPOGRAFIA BASE ----------
   Il gold metodo-de-cenzo usa Raleway (--font) per TUTTI gli heading,
   NON il serif. Il serif (Roboto Slab) resta disponibile come variabile
   ma va applicato esplicitamente solo dove serve.
*/
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: var(--fw-bold);
  line-height: 1.25;
  color: var(--dark);
  margin-bottom: 20px;
}

h1 { font-size: 36px; }
h2 { font-size: 28px; }
h3 { font-size: 24px; }
h4 { font-size: 21px; }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

p {
  line-height: var(--lh-normal);
  margin-bottom: 24px;
}
p:last-child { margin-bottom: 0; }

strong,
b {
  font-weight: var(--fw-bold);
}

small {
  font-size: var(--fs-sm);
}

/* ---------- SELEZIONE TESTO ---------- */
::selection {
  background: var(--orange);
  color: var(--white);
}

/* ---------- MOBILE FINE-TUNE TIPOGRAFIA ---------- */
@media (max-width: 768px) {
  body { font-size: 18px; }
  h1 { font-size: 28px; }
  h2 { font-size: 24px; }
  h3 { font-size: 21px; }
}
