/*
  BASE — reset, tipografia di base, stati globali
  samuelmantega.com v2 · design-architect

  Ordine di import atteso (owned da section-builder in ogni HTML):
    tokens.css → base.css → components.css → pages.css → hero.css
  Nessun @import qui dentro: solo <link> separati in HTML.
*/

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Niente scroll-behavior: smooth — incompatibile con Lenis (che fornisce già
     lo smooth scroll da main.js) e in conflitto con il pin di ScrollTrigger:
     le due implementazioni si contendono la posizione e lo scroll rimbalza a 0,
     impedendo alla hero di avanzare. Non reintrodurlo. */
}

body,
h1, h2, h3, h4, p,
figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-h3); /* default prudente; i display più grandi
    (.hero__title, .section__title) impostano un tracking più stretto
    in components.css, tarato sulla propria dimensione. */
  color: var(--text);
}

p {
  max-width: 65ch;
}

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

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

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

button {
  cursor: pointer;
}

/* ---- Selezione testo ---- */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ---- Focus ---- */
:focus {
  outline: none;
}

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

/* ---- Scrollbar ---- */
html {
  scrollbar-color: var(--text-muted) var(--bg);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-raised);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-deep);
}

/* ---- Fallback: browser senza container query units (cqw) ----
   --fs-hero (tokens.css) è tarato su cqw per seguire la colonna reale della
   hero invece del viewport. Dove cqw non è supportato, torna alla vecchia
   formula in vw invece di risolvere a un valore rotto/vuoto. */
@supports not (container-type: inline-size) {
  :root {
    --fs-hero: clamp(2.75rem, 2rem + 5vw, 6.5rem);
  }
}

/* ---- prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Utility minime ---- */
.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;
}

.u-muted {
  color: var(--text-muted);
}

.u-accent {
  color: var(--accent);
}

.u-mono {
  font-family: var(--font-mono);
}
