/* ============================================================
   Reset + base + tipografia
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-weight: var(--fw-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: var(--fw-head);
  line-height: var(--lh-head);
  color: var(--c-text);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { max-width: 70ch; }

a { color: var(--accent-d); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent); }

ul, ol { padding-left: 1.2em; }

:focus-visible { outline: 3px solid var(--c-blue); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--c-yellow); color: var(--c-text); }

/* Accessibilità: skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--c-text); color: #fff; padding: .75rem 1.25rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; color: #fff; }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap;
}

/* Container */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container--narrow { width: min(100% - 2.5rem, var(--container-narrow)); margin-inline: auto; }

/* Sezioni */
.section { padding-block: var(--space-xl); }
.section--alt { background: var(--c-bg-alt); }
.section__head { text-align: center; max-width: 42rem; margin: 0 auto var(--space-lg); }
.section__head p { margin-inline: auto; color: var(--c-text-soft); }
.section__kicker {
  display: inline-block; font-weight: var(--fw-head); letter-spacing: .08em;
  text-transform: uppercase; font-size: var(--fs-small); color: var(--accent);
  margin-bottom: .5rem;
}

/* ============================================================
   Robustezza testo lungo (utile con la traduzione Google Translate)
   Le lingue tradotte (es. tedesco) producono parole molto più lunghe: senza
   queste regole sfondano i container. Difese globali: spezza le parole lunghe
   e permetti ai figli di flex/grid di rimpicciolirsi (default min-width:auto
   causa overflow).
   ============================================================ */
body { overflow-wrap: break-word; }
h1, h2, h3, h4, h5, h6,
p, li, a, span, dd, dt, figcaption, blockquote, label, button, .btn, td, th {
  overflow-wrap: break-word;
  word-break: break-word;
}
/* Sillabazione automatica solo sui titoli, dove le parole lunghe pesano di più. */
h1, h2, h3, h4 { -webkit-hyphens: auto; hyphens: auto; }

/* I figli di flex/grid devono poter scendere sotto la larghezza del contenuto. */
.grid > *, .counters > *, .hero__inner > *, .hero__text,
.site-header__inner > *, .header-actions > *, .card, .card__body,
.section__head, .entry-content, .prose, .footer__inner > * {
  min-width: 0;
}

/* Troncamento con ellipsis per i componenti stretti (utility riusabili). */
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.text-clamp-2 {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: break-word;
}

/* Utilità */
.text-center { text-align: center; }
.mt-lg { margin-top: var(--space-lg); }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
