/* ============================================================
   BASE — element defaults + a few utility classes.
   Lightweight reset tuned for accessible reading.
   ============================================================ */

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--text-body);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-strong);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); font-weight: var(--weight-medium); }

p { margin: 0 0 var(--space-4); text-wrap: pretty; }

a {
  color: var(--text-link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--duration-fast) var(--ease-standard);
}
a:hover { color: var(--text-link-hover); }

/* Accessible focus — high-visibility ring (Designers Italia) */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--border-width-strong) solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--blue-200); color: var(--neutral-900); }

/* height:auto mantiene le proporzioni quando la larghezza è limitata dal
   contenitore (le copertine con object-fit sovrascrivono con la loro classe). */
img { max-width: 100%; height: auto; display: block; }
hr { border: none; border-top: var(--border-width) solid var(--border-default); margin: var(--space-6) 0; }

/* Skip link — accessibility staple for PA sites */
.skip-link {
  position: absolute; left: var(--space-2); top: -3rem;
  background: var(--surface-brand); color: var(--white);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  z-index: 1000; transition: top var(--duration-base) var(--ease-standard);
}
.skip-link:focus { top: var(--space-2); color: var(--white); }

/* Reading container */
.reading { max-width: var(--container-narrow); }
.reading p { font-family: var(--font-reading); font-size: var(--text-md); line-height: var(--leading-relaxed); }

/* Visually hidden but screen-reader accessible */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
