/* DSPT · variante C «Un problema alla volta»
   Si appoggia a ../comune/stile.css e aggiunge i capitoli bloccati,
   il passaggio problema → soluzione e l'indice in basso. */

body { transition: background-color .9s var(--curva); }
html.astra-attivo body { background: #f8f4ff; }
html.astra-attivo .testata.scorsa { background: rgba(248, 244, 255, .94); box-shadow: 0 1px 0 #e2d6f5, 0 8px 24px -16px rgba(54, 5, 108, .25); }

/* ---------- Apertura ---------- */
#apertura .velo { max-width: 46rem; }
#apertura .riga { max-width: 30ch; }

/* ---------- Capitoli ---------- */
.capitolo { position: relative; z-index: 1; }
.capitolo__pannello {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: 7rem var(--margine) 8.5rem;
}
.anima .capitolo { height: 270vh; }
.anima .capitolo__pannello { position: sticky; top: 0; height: 100vh; height: 100svh; }

.capitolo__testo { position: relative; max-width: 46rem; display: grid; }
.anima .capitolo__testo > .problema,
.anima .capitolo__testo > .soluzione { grid-area: 1 / 1; align-self: center; }

.problema__frase {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.1rem, 4.7vw, 4.5rem); line-height: 1.04; letter-spacing: -0.035em;
  margin: 0; color: var(--inchiostro); text-wrap: balance;
}
.problema__chi {
  display: flex; align-items: center; gap: .8rem;
  margin: 1.6rem 0 0; font-weight: 650; font-size: 1.08rem; color: var(--testo-2);
}
.problema__chi::before { content: ""; width: 2.25rem; height: 2px; border-radius: 2px; background: var(--blu); flex: none; }

.soluzione { margin-top: 3rem; }
.anima .soluzione { margin-top: 0; }
.soluzione__era { margin: 0 0 1.1rem; font-weight: 600; font-size: 1.08rem; line-height: 1.5; color: var(--testo-2); max-width: 46ch; }
.soluzione__era span {
  background-image: linear-gradient(var(--blu), var(--blu));
  background-repeat: no-repeat; background-position: 0 58%; background-size: 100% 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.soluzione__riga {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.75rem, 3.4vw, 3.15rem); line-height: 1.1; letter-spacing: -0.03em;
  margin: 0; color: var(--inchiostro); max-width: 22ch; text-wrap: balance;
}
.soluzione .azioni { margin-top: 2.25rem; }

/* Capitoli ASTRA: viola */
.capitolo[data-tema="astra"] {
  --fondo: #f8f4ff; --inchiostro: #24043f; --testo-2: #4d3a66;
  --blu: #4b28c3; --blu-scuro: #36056c; --ciano: #8f38f6; --linea: #e2d6f5;
}
.capitolo[data-tema="astra"] .velo::before {
  background: radial-gradient(closest-side, rgba(248, 244, 255, .94) 0%, rgba(248, 244, 255, .8) 55%, rgba(248, 244, 255, 0) 100%);
}
.capitolo[data-tema="astra"] .bottone { box-shadow: 0 10px 24px -10px rgba(75, 40, 195, .6); }
.capitolo[data-tema="astra"] .bottone:hover { background: #36056c; }
.capitolo[data-tema="astra"] .collegamento { text-decoration-color: rgba(75, 40, 195, .4); }

/* ---------- Indice dei problemi ---------- */
.indice {
  position: fixed; z-index: 15; left: var(--margine); right: var(--margine); bottom: 1.1rem;
  padding: .75rem 1.1rem .85rem; border-radius: 16px;
  background: rgba(245, 249, 252, .92); border: 1px solid var(--linea);
  box-shadow: 0 14px 32px -22px rgba(2, 60, 95, .45);
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .5s var(--curva), transform .6s var(--curva), visibility 0s linear .6s, background-color .9s var(--curva), border-color .9s var(--curva);
}
.indice.visibile { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
html.astra-attivo .indice { background: rgba(248, 244, 255, .94); border-color: #e2d6f5; }
.indice ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(19, minmax(0, 1fr)); gap: .45rem; }
.indice a {
  display: flex; flex-direction: column; justify-content: flex-end; gap: .5rem;
  min-height: 2.75rem; padding-top: .25rem;
  text-decoration: none; color: var(--testo-2); font: 600 .86rem/1.2 var(--testo);
  transition: color .3s;
}
.indice__nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indice__barra { display: block; height: 3px; border-radius: 3px; background: var(--linea); overflow: hidden; transition: height .4s var(--curva); }
.indice__barra i { display: block; height: 100%; background: var(--blu); transform-origin: left center; transform: scaleX(0); }
.indice .voce-astra .indice__barra { background: #e2d6f5; }
.indice .voce-astra .indice__barra i { background: #4b28c3; }
.indice a:hover { color: var(--blu-scuro); }
.indice .voce-astra a:hover { color: #36056c; }
.indice a:hover .indice__barra, .indice a:focus-visible .indice__barra { height: 5px; }
.indice a[aria-current="step"] { color: var(--inchiostro); font-weight: 750; }
.indice .voce-astra a[aria-current="step"] { color: #24043f; }
.indice a[aria-current="step"] .indice__barra { height: 5px; }
.indice__ora { display: none; }
.no-scena .indice { background: var(--fondo); }

/* Schermi medi e telefono: i nomi lasciano posto a «3 di 10 · Nome» */
/* Con 19 problemi l'indice mostra sempre il nome di quello attuale e le barre */
@media (min-width: 0px) {
  .indice__nome { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .indice__ora { display: flex; gap: .6rem; align-items: baseline; margin: 0 0 .15rem; font: 600 .95rem/1.3 var(--testo); color: var(--testo-2); }
  .indice__ora b { color: var(--inchiostro); font-weight: 750; }
  .indice a { justify-content: center; }
}

@media (max-width: 860px) {
  .indice { left: 0; right: 0; bottom: 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0; padding: .65rem 1rem calc(.35rem + env(safe-area-inset-bottom)); }
  .indice ol { gap: .35rem; }

  #apertura { padding-bottom: 9rem; }
  .capitolo__pannello { align-items: flex-end; padding: 6rem 1rem 8rem; }
  .problema__frase { font-size: clamp(1.85rem, 7.6vw, 2.6rem); }
  .problema__chi { margin-top: 1.1rem; font-size: 1rem; }
  .soluzione__era { font-size: 1rem; }
  .soluzione__riga { font-size: clamp(1.45rem, 6.2vw, 2rem); }
  .soluzione .azioni { margin-top: 1.6rem; gap: 1rem 1.5rem; }
  .capitolo .velo::before { inset: -3rem -1rem; }
}

/* Movimento ridotto: niente blocchi, il problema e la soluzione si leggono di seguito */
@media (prefers-reduced-motion: reduce) {
  .capitolo { height: auto !important; }
  .capitolo__pannello { position: static !important; height: auto !important; }
  body, .indice { transition: none; }
}
