/* ─────────────────────────────────────────────────────────────────────────────
   base.css — Reset, tipografia, utilità e componenti condivisi LightAI
   Dipende da tokens.css (caricato prima).
───────────────────────────────────────────────────────────────────────────── */

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

/* ── Base ─────────────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Link ─────────────────────────────────────────────────────────────────── */
a {
  color: var(--ink);
  text-decoration: none;
  transition: color var(--t);
}
a:hover { color: var(--accent); }

/* ── Headings ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.05;
  text-wrap: balance;
}

h1 { font-size: clamp(44px, 6.1vw, 88px); letter-spacing: -0.045em; }
h2 { font-size: clamp(32px, 3.9vw, 56px); letter-spacing: -0.035em; }
h3 { font-size: clamp(22px, 2.5vw, 36px); letter-spacing: -0.03em;  }
h4 { font-size: clamp(18px, 1.7vw, 24px); letter-spacing: -0.02em;  }

/* ── Paragrafi ────────────────────────────────────────────────────────────── */
p { max-width: 70ch; }

/* ── Evidenziatore giallo ─────────────────────────────────────────────────── */
.mark {
  background: linear-gradient(transparent 60%, var(--highlight) 60% 92%, transparent 92%);
}

/* ── Container ────────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--px);
}

/* ── 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-width: 0;
}

/* ── Focus visibili (WCAG AA) ─────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Bottoni ──────────────────────────────────────────────────────────────── */

/* Base condivisa */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity var(--t), transform var(--t);
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:hover  { opacity: 0.88; }

/* Blu primario — grande (hero, CTA sezioni) */
.btn-primary {
  height: 56px;
  padding: 0 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 17px;
}

/* Blu primario — media (usato dove 56px è troppo) */
.btn-primary-sm {
  height: 44px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 15px;
}

/* Nero pillola — header CTA */
.btn-dark {
  height: 44px;
  padding: 0 20px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 500;
}

/* Nero pillola — grande (CTA finale gialla) */
.btn-dark-lg {
  height: 64px;
  padding: 0 32px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-pill);
  font-size: 18px;
}

/* Link sottolineato (stile "Cosa costruiamo") */
.btn-link {
  height: 56px;
  padding: 0 24px;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  transition: color var(--t), border-color var(--t);
}
.btn-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

/* ── Mono label ───────────────────────────────────────────────────────────── */
.mono-label {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ── Chip flow (catene servizi: bianco → blu → giallo) ───────────────────── */
.chip-chain {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--r-chip);
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}
.chip-white  { background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.chip-blue   { background: var(--accent);  color: #fff; font-weight: 500; }
.chip-yellow { background: var(--highlight); color: var(--ink); }
.chip-arrow  { color: var(--soft); font-size: 16px; flex-shrink: 0; }

/* ── Pulsazione (pallino attivo) ──────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.pulse { animation: pulse 1.6s ease-in-out infinite; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .container { padding-inline: var(--px-sm); }
  .btn-primary { height: 52px; font-size: 16px; }
  .btn-link    { height: 52px; font-size: 16px; }
}

/* ── Accessibilità: 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;
  }
  html { scroll-behavior: auto; }
}
