/* ==========================================================================
   BASE — impostazioni generali, tipografia, utilità
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

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

/* v0.8: pagine e frammenti in cinese semplificato */
:lang(zh) {
  font-family: var(--font-sans-zh);
  line-break: strict;           /* niente punteggiatura cinese a inizio riga */
  overflow-wrap: anywhere;      /* parole latine lunghe nelle colonne strette degli smartphone */
}
:lang(zh) body, html:lang(zh) { letter-spacing: 0.01em; }
html:lang(zh) h1, html:lang(zh) h2, html:lang(zh) h3, html:lang(zh) h4 { letter-spacing: 0; line-height: 1.35; }
html:lang(zh) body { line-height: 1.75; }
/* titoli originali in italiano o inglese dentro le pagine cinesi: carattere latino normale */
html:lang(zh) [lang="it"], html:lang(zh) [lang="en"] { font-family: var(--font-sans); overflow-wrap: break-word; }

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

h1, h2, h3, h4 {
  margin: 0 0 var(--space-4);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: inherit;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--space-4); }
ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25em; }

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

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--color-dark);
  color: #fff;
}
.skip-link:focus { top: 1rem; color: #fff; }

.eyebrow {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.lead { font-size: var(--fs-lg); color: var(--color-text-muted); }
.muted { color: var(--color-text-muted); }
.small { font-size: var(--fs-xs); }
