/* ============================================================
   BASE — reset, tipografia globale, elementi comuni
   ============================================================ */

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

* { margin: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, svg { display: block; max-width: 100%; }

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-optical-sizing: auto;
}

/* ---- Contenitore centrale ---- */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---- Sezioni ---- */
.section { padding-block: var(--space-xl); }
.section:first-of-type { padding-block: 0; }

/* ---- Etichetta capitolo (numero romano + titolo) ---- */
.chapter-label {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: var(--space-md);
}
.chapter-num {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-style: italic;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.chapter-eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.chapter-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  transform: translateY(-3px);
}

/* ---- Link testuale con sottolineatura animata ---- */
.link {
  color: var(--accent-ink);
  position: relative;
  transition: color var(--dur) var(--ease);
}
.link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.link:hover::after { transform: scaleX(1); }

/* ---- Accessibilità: focus visibile ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Rispetta la preferenza "riduci animazioni" ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
