/*
 * base.css
 * ─────────────────────────────────────────────────────────────
 * Reset moderno, base tipografica, utilities globali,
 * accessibilità (skip link, focus visible, sr-only).
 * ─────────────────────────────────────────────────────────────
 */

/* ── RESET MODERNO ──────────────────────────────────────────── */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
}

/* Rispetta 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;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-light);
  line-height: var(--lh-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition:
    background-color var(--t-base) var(--ease),
    color var(--t-base) var(--ease);
}

/* ── ELEMENTI BASE ──────────────────────────────────────────── */

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

img {
  object-fit: cover;
}

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

address {
  font-style: normal;
}

/* ── TIPOGRAFIA BASE ────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
  max-width: var(--max-w-text);
  line-height: var(--lh-relaxed);
}

strong {
  font-weight: var(--fw-medium);
}

em {
  font-style: italic;
}

/* ── SKIP TO CONTENT ────────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: var(--z-toast);
  background: var(--c-ink);
  color: var(--c-ivory);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--fs-xs);
  font-family: var(--font-body);
  letter-spacing: var(--ls-wide);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: top var(--t-fast);
}

.skip-link:focus {
  top: var(--sp-4);
  outline: 2px solid var(--c-gold);
  outline-offset: 2px;
}

/* ── FOCUS VISIBLE ──────────────────────────────────────────── */

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

/* ── UTILITIES ──────────────────────────────────────────────── */

/* Screen reader only */
.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;
}

/* Contenitore pagina */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--container-px);
  box-sizing: border-box;
}

/* Extra-small screens: padding minimo garantito */
@media (max-width: 399px) {
  .container {
    --container-px: var(--sp-4);
  }
}

/* Contenitore stretto (testo, about) */
.container--narrow {
  max-width: var(--max-w-narrow);
}

/* Sezione standard */
.section {
  padding-block: var(--sp-24);
}

@media (min-width: 768px) {
  .container {
    --container-px: var(--sp-10);
  }
}

@media (min-width: 1024px) {
  .container {
    --container-px: var(--sp-16);
  }
  .section {
    padding-block: var(--sp-32);
  }
}

/* Background variants */
.bg-primary   { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-ink       { background-color: var(--bg-footer); color: var(--c-ivory); }

/* Text align */
.text-center { text-align: center; }
.text-left   { text-align: left; }

/* Display */
.hidden { display: none !important; }

/* Overflow hidden per parent di elementi animati */
.overflow-clip { overflow: hidden; }

/* ── ANIMAZIONI GLOBALI ─────────────────────────────────────── */

/* Fade up — classe base, JS aggiunge .visible */
.anim-fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--t-slow) var(--ease),
    transform var(--t-slow) var(--ease);
}

.anim-fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.delay-1 { transition-delay: 80ms; }
.delay-2 { transition-delay: 160ms; }
.delay-3 { transition-delay: 240ms; }
.delay-4 { transition-delay: 320ms; }
.delay-5 { transition-delay: 400ms; }

/* Fade in semplice */
.anim-fade-in {
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}
.anim-fade-in.visible {
  opacity: 1;
}

/* ── BREADCRUMB ─────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding-block: var(--sp-6);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: var(--ls-wide);
}

.breadcrumb__sep {
  color: var(--border-strong);
  user-select: none;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--t-fast);
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb__current {
  color: var(--text-secondary);
}

/* ── PAGE HEADER (inner pages) ──────────────────────────────── */

.page-header {
  padding-top: calc(var(--nav-h) + var(--sp-16));
  padding-bottom: var(--sp-16);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.page-header__label {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: var(--sp-4);
}

.page-header__title {
  font-size: var(--fs-3xl);
  margin-bottom: var(--sp-6);
}

.page-header__desc {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  max-width: 56ch;
  line-height: var(--lh-relaxed);
}

/* ── SEZIONE LABEL + TITOLO (pattern ricorrente) ──────────────── */

.section-label {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: var(--sp-4);
}

.section-title {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-6);
  line-height: var(--lh-snug);
}

.section-body {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  max-width: 58ch;
}

/* ── DIVISORE DECORATIVO ────────────────────────────────────── */

.divider {
  width: 48px;
  height: 1px;
  background: var(--c-gold);
  margin-block: var(--sp-8);
}

.divider--center {
  margin-inline: auto;
}
