/* =====================================================================
   Componenti riusabili FdT — v1 (09/10/2026)
   base · bottone C1 · form a due passi · comparse allo scroll · stelo
   · fisarmonica FAQ · video al tocco
   Movimento: solo transform/opacity, tutto spento con prefers-reduced-motion.
   ===================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0; background: var(--bianco); color: var(--testo);
  font-family: var(--font-testo); font-size: var(--t-corpo); line-height: var(--interlinea);
  overflow-x: hidden;
}
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3 { font-family: var(--font-titoli); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: 0.005em; }
p { margin: 0 0 var(--s-4); }
a { color: var(--verde); }
strong { font-weight: 700; }
.contenitore { width: 100%; max-width: var(--larghezza); margin-inline: auto; padding-inline: var(--gutter); }
.solo-lettori { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--giallo); outline-offset: 3px; }

/* ---------- Bottone C1 (landing/CLAUDE.md §8.1) ----------
   Su fondo chiaro: verde, testo bianco (8,8:1), base gialla + ombra.
   Su fondo verde (.su-verde): giallo, testo verde (5,3:1), base verde scuro. */
.c1 {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  width: 100%; max-width: 30rem; min-height: 56px; padding: 0.85rem 1.4rem;
  border: 0; border-radius: var(--raggio-piccolo); cursor: pointer;
  font: 700 1.125rem/1.2 var(--font-testo); text-decoration: none; text-align: center;
  -webkit-tap-highlight-color: transparent;
  background: var(--verde); color: var(--bianco);
  box-shadow: 0 5px 0 var(--giallo), 0 9px 14px rgba(12, 85, 62, 0.22);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background-color 0.12s ease-out;
}
.c1 .freccia { display: inline-block; font-size: 1.25rem; line-height: 1; color: var(--giallo); transition: transform 0.2s ease-out; }
.c1:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--giallo), 0 3px 6px rgba(12, 85, 62, 0.18); background: var(--verde-scuro); }
.su-verde .c1 { background: var(--giallo); color: var(--verde-scuro); box-shadow: 0 5px 0 var(--verde-notte), 0 9px 14px rgba(0, 0, 0, 0.28); }
.su-verde .c1 .freccia { color: var(--verde-scuro); }
.su-verde .c1:active { box-shadow: 0 1px 0 var(--verde-notte), 0 3px 6px rgba(0, 0, 0, 0.2); background: var(--giallo-scuro); }
.su-verde .c1:focus-visible { outline-color: var(--bianco); }
@media (hover: hover) { .c1:hover .freccia { transform: translateX(5px); } }
.c1[disabled] { cursor: progress; opacity: 0.85; }
/* Riflesso «quando esiti»: una luce attraversa il bottone (0,9 s) */
.c1::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; pointer-events: none; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-150%) skewX(-20deg); opacity: 0;
}
.su-verde .c1::after { background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent); }
.c1.riflesso::after { animation: c1-riflesso 0.9s ease-out 1 both; }
@keyframes c1-riflesso {
  0% { transform: translateX(-150%) skewX(-20deg); opacity: 1; }
  100% { transform: translateX(330%) skewX(-20deg); opacity: 1; }
}

/* Bottone secondario (passo 2): contorno verde, mai C1 */
.btn-secondario {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 52px;
  padding: 0.75rem 1.25rem; border: 2px solid var(--verde); border-radius: var(--raggio-piccolo);
  background: var(--bianco); color: var(--verde); font: 700 1.0625rem/1.2 var(--font-testo); cursor: pointer;
  transition: transform 0.12s ease-out, background-color 0.12s ease-out;
}
.btn-secondario:active { transform: translateY(2px); background: var(--verde-velo); }

/* ---------- Form a due passi ---------- */
.modulo { display: grid; gap: 1.05rem; }
.campo { display: grid; gap: 0.3rem; }
.campo > label, .campo > .etichetta { font-weight: 700; color: var(--verde-scuro); font-size: 1rem; }
.campo .aiuto { font-size: var(--t-piccolo); color: var(--testo-tenue); line-height: 1.4; margin: 0; }
.campo input[type="text"], .campo input[type="email"], .campo input[type="tel"] {
  width: 100%; min-height: 50px; padding: 0.7rem 0.85rem;
  font: 400 1.0625rem/1.3 var(--font-testo); color: var(--testo);   /* ≥ 16 px: iOS non zooma */
  background: var(--bianco); border: 2px solid var(--bordo); border-radius: var(--raggio-piccolo);
  transition: border-color 0.15s ease-out;
}
.campo input:focus { border-color: var(--verde); outline: 3px solid rgba(251, 191, 59, 0.7); outline-offset: 1px; }
.campo.errore input { border-color: #b3261e; }
.campo .msg-errore { color: #b3261e; font-size: var(--t-piccolo); font-weight: 700; margin: 0; }
.campo .msg-errore:empty { display: none; }
.spunta { display: grid; grid-template-columns: 28px 1fr; gap: 0.7rem; align-items: start; font-size: var(--t-piccolo); line-height: 1.45; cursor: pointer; }
.spunta input { width: 26px; height: 26px; margin: 0; accent-color: var(--verde); }
.trappola { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.chip-gruppo { border: 0; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.chip-gruppo legend { font-weight: 700; color: var(--verde-scuro); font-size: 1rem; padding: 0; margin-bottom: 0.45rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem 1rem;
  border: 2px solid var(--bordo); border-radius: 999px; background: var(--bianco);
  font-weight: 700; font-size: 1rem; color: var(--verde-scuro);
  transition: transform 0.12s ease-out, background-color 0.12s ease-out, border-color 0.12s ease-out;
}
.chip input:checked + span { background: var(--verde); border-color: var(--verde); color: var(--bianco); }
.chip input:focus-visible + span { outline: 3px solid var(--giallo); outline-offset: 2px; }
.chip input:active + span { transform: scale(0.96); }
.nota-form { font-size: var(--t-piccolo); color: var(--verde); font-weight: 700; margin: 0.9rem 0 0; }
.informativa { font-size: var(--t-piccolo); color: var(--testo-tenue); line-height: 1.45; margin: 0.6rem 0 0; }
.errore-invio { background: #fdecea; color: #8c1d18; border-radius: var(--raggio-piccolo); padding: 0.75rem 0.9rem; font-size: var(--t-piccolo); margin: 0; }
.errore-invio[hidden] { display: none; }

/* ---------- Comparse allo scroll ---------- */
.js [data-rivela] { opacity: 0; transform: translateY(28px); transition: opacity var(--durata) var(--curva), transform var(--durata) var(--curva); }
.js [data-rivela].visibile { opacity: 1; transform: none; }
.js [data-rivela="sinistra"] { transform: translateX(-28px); }
.js [data-rivela="scala"] { transform: scale(0.94); }
.js [data-rivela].visibile[data-rivela="sinistra"], .js [data-rivela].visibile[data-rivela="scala"] { transform: none; }

/* ---------- Stelo: cresce lungo la pagina con lo scroll ---------- */
.stelo { position: absolute; top: 0; bottom: 0; left: 0.7rem; width: 3px; pointer-events: none; z-index: 1; }
.stelo__fusto { position: absolute; inset: 0; border-radius: 3px; background: linear-gradient(var(--giallo), var(--verde) 12%, var(--verde) 88%, var(--giallo)); transform-origin: top; transform: scaleY(0); }
.stelo__nodo { position: absolute; left: -6px; width: 15px; height: 15px; border-radius: 50%; background: var(--giallo); box-shadow: 0 0 0 4px rgba(251, 191, 59, 0.25); transform: scale(0); transition: transform 0.5s var(--curva); }
.stelo__nodo.acceso { transform: scale(1); }
@media (min-width: 64rem) { .stelo { left: max(1rem, calc((100vw - var(--larghezza)) / 2 - 1.25rem)); } }

/* ---------- Fisarmonica FAQ ---------- */
.faq { border-top: 2px solid var(--bordo); }
.faq details { border-bottom: 2px solid var(--bordo); }
.faq summary {
  display: grid; grid-template-columns: 1fr 36px; align-items: center; gap: 1rem;
  min-height: 60px; padding: 1rem 0; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 1.125rem; color: var(--verde-scuro);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .segno { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--verde-chiaro); transition: transform 0.3s var(--curva), background-color 0.2s; }
.faq summary .segno::before, .faq summary .segno::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2.5px; border-radius: 2px; background: var(--verde); transform: translate(-50%, -50%); }
.faq summary .segno::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform 0.3s var(--curva); }
.faq details[open] summary .segno { background: var(--giallo); transform: rotate(180deg); }
.faq details[open] summary .segno::after { transform: translate(-50%, -50%) rotate(0deg); }
.faq .risposta { padding: 0 0 1.2rem; max-width: var(--larghezza-testo); }
.faq details[open] .risposta { animation: faq-apri 0.4s var(--curva); }
@keyframes faq-apri { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Video al tocco ---------- */
.video { position: relative; border-radius: var(--raggio); overflow: hidden; background: var(--verde-scuro); aspect-ratio: 16 / 9; box-shadow: var(--ombra-leggera); }
.video img, .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.video button { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: transparent; cursor: pointer; }
.video .play {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  background: var(--giallo); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--curva);
}
.video .play::before { content: ""; position: absolute; left: 30px; top: 23px; border-left: 24px solid var(--verde-scuro); border-top: 15px solid transparent; border-bottom: 15px solid transparent; }
.video .play::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--giallo); opacity: 0; animation: alone 2.4s ease-out infinite; }
@keyframes alone { 0% { transform: scale(0.85); opacity: 0.8; } 100% { transform: scale(1.35); opacity: 0; } }
@media (hover: hover) { .video button:hover .play { transform: scale(1.08); } }

/* ---------- Movimento ridotto: tutto fermo, tutto visibile ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js [data-rivela] { opacity: 1 !important; transform: none !important; }
  .stelo__fusto { transform: none !important; }
  .stelo__nodo { transform: scale(1) !important; }
}
