/**
 * base.css — Componenti di base di CompitiAmo®
 *
 * Ricostruzione dei componenti già in uso sulle pagine pubbliche
 * (pill, tag, card, bottoni, sezioni morbide) più i componenti di form
 * che servono al flow di iscrizione e non esistono ancora sul sito.
 *
 * Dipende da tokens.css, che va caricato prima.
 */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* ============ LAYOUT ============ */

.container {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  position: relative;
}

.container-narrow {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
}

.section {
  padding: var(--sp-6) 0;
}

.section-soft {
  background: linear-gradient(180deg, rgba(237, 248, 246, .55) 0%, rgba(253, 247, 238, .35) 100%);
}

/* ============ TIPOGRAFIA ============ */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.12;
  margin: 0 0 var(--sp-3);
  color: var(--ink);
  overflow-wrap: break-word;
}

h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); font-variation-settings: "opsz" 96; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.6rem); font-variation-settings: "opsz" 48; }
h3 { font-size: 1.18rem; font-weight: 600; font-variation-settings: "opsz" 24; letter-spacing: -0.005em; }

p { margin: 0 0 var(--sp-3); }
.lede { font-size: 1.08rem; color: var(--muted); }
.muted { color: var(--muted); }
.quote { font-family: var(--font-display); font-size: 1.15rem; font-style: italic; }

/* ============ ETICHETTE ============ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: rgba(76, 182, 171, .12);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  border: 1px solid rgba(76, 182, 171, .18);
}

.pill.warm {
  background: rgba(196, 142, 95, .12);
  color: var(--warm-deep);
  border-color: rgba(196, 142, 95, .22);
}

.pill .pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.tag {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  margin: 6px 6px 0 0;
  font-size: .88rem;
  color: var(--accent-dark);
  font-weight: 600;
  border: 1px solid rgba(76, 182, 171, .15);
}

/* ============ BOTTONI ============ */

.btns { display: flex; flex-wrap: wrap; gap: 14px; margin-top: var(--sp-4); }

.btn {
  text-decoration: none;
  border: 0;
  cursor: pointer;
  border-radius: var(--radius-pill);
  padding: 15px 24px;
  font-weight: 700;
  font-size: 0.98rem;
  font-family: var(--font-body);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--white);
  box-shadow: 0 10px 22px rgba(43, 142, 132, .28);
}

.btn-primary:hover { box-shadow: 0 14px 28px rgba(43, 142, 132, .38); }

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.btn svg { width: 18px; height: 18px; }

/* ============ CARD ============ */

.card {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(216, 236, 232, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
}

.grid-2, .grid-3 { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ============ FORM (nuovi, per il flow di iscrizione) ============ */

.field { margin-bottom: var(--sp-3); }

.field label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: 7px;
  color: var(--ink);
}

.field .hint {
  display: block;
  font-size: .84rem;
  color: var(--muted);
  margin-top: 6px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(76, 182, 171, .15);
}

.field.is-error .input,
.field.is-error .select { border-color: var(--danger); }

.field .error {
  display: none;
  font-size: .86rem;
  color: var(--danger);
  margin-top: 6px;
}

.field.is-error .error { display: block; }

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  margin-bottom: var(--sp-2);
  cursor: pointer;
}

.check input { margin-top: 4px; flex: 0 0 auto; }
.check span { font-size: .94rem; }

/* Scelta slot: card selezionabili */
.option-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.option {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.option:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.option[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 182, 171, .18); }
.option[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

/* ============ STEPPER ============ */

.stepper { display: flex; gap: 8px; margin-bottom: var(--sp-4); }

.stepper .step {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--line);
}

.stepper .step.done { background: var(--accent-dark); }
.stepper .step.current { background: var(--accent); }

/* ============ STATI ============ */

.badge-stato {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.badge-stato.attesa { background: rgba(196, 142, 95, .14); color: var(--warm-deep); }
.badge-stato.ok     { background: rgba(76, 182, 171, .14); color: var(--accent-dark); }
.badge-stato.ko     { background: var(--danger-soft); color: var(--danger); }

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card { padding: 22px 20px; }
  .btn { width: 100%; }
  h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  h2 { font-size: clamp(1.5rem, 6vw, 2rem); }
  .pill { font-size: .78rem; padding: 7px 12px; }
  .tag { font-size: .82rem; padding: 6px 12px; }
  .section { padding: var(--sp-5) 0; }
}
