/* ============================================================
   AVIS Arona — Layer "enhance"
   Animazioni e componenti di alto livello caricati su tutte le pagine:
   - marquee CTA infinito  - particelle live  - blocchi grafici SVG/CSS
   - sezioni promo          - wizard "Diventa donatore"  - QR
   Tutto responsive e rispettoso di prefers-reduced-motion.
   ============================================================ */

:root {
  --avis-red: #e2051b;
  --avis-red-dark: #9f0011;
  --avis-blue: #174a9c;
  --avis-blue-light: #1d70b8;
  --avis-gold: #f2b84b;
  --avis-space: #05070d;
  --enh-radius: 18px;
}

/* Nasconde il tagline accanto al logo solo su schermi molto stretti */
@media (max-width: 400px) {
  .brand__text { display: none; }
}

/* Rete AVIS nel footer + griglia a 4 colonne */
.footer-network a { font-weight: 600; }

/* Allinea "Apri sezione" (e link simili) in fondo alle card, sempre alla stessa
   altezza anche con testi di lunghezza diversa. */
.info-card { display: flex; flex-direction: column; }
.info-card > .text-link { margin-top: auto; align-self: flex-start; padding-top: 6px; }
@media (min-width: 1041px) {
  .footer-grid { grid-template-columns: 1.2fr .8fr .9fr .9fr; }
}
@media (min-width: 821px) and (max-width: 1040px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   1) PARTICELLE LIVE ("puntini")
   Canvas a tutto contenitore, dietro al contenuto. data-particles
   ============================================================ */
.particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}
.has-particles { position: relative; isolation: isolate; }
/* IMPORTANTE: alza solo il CONTENUTO sopra il canvas, NON il canvas stesso,
   altrimenti il canvas entra nel flusso e dilata la sezione. */
.has-particles > .container { position: relative; z-index: 1; }
/* Su mobile niente particelle: alleggerisce e azzera ogni rischio di layout. */
@media (max-width: 760px) {
  .particles { display: none !important; }
}

/* ============================================================
   2) MARQUEE CTA INFINITO
   "Diventa donatore · Incomincia a donare ·" — link alla donazione
   ============================================================ */
.marquee-cta {
  position: relative;
  display: block;
  overflow: hidden;
  text-decoration: none;
  background:
    linear-gradient(100deg, var(--avis-red-dark) 0%, var(--avis-red) 42%, var(--avis-blue) 100%);
  border-block: 1px solid rgba(255, 255, 255, .14);
  padding-block: clamp(14px, 2.4vw, 26px);
  isolation: isolate;
}
.marquee-cta::before,
.marquee-cta::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 12%;
  z-index: 2;
  pointer-events: none;
}
.marquee-cta::before { left: 0;  background: linear-gradient(90deg, var(--avis-red-dark), transparent); }
.marquee-cta::after  { right: 0; background: linear-gradient(270deg, var(--avis-blue), transparent); }

.marquee-cta__track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: marqueeMove 26s linear infinite;
}
.marquee-cta:hover .marquee-cta__track,
.marquee-cta:focus-visible .marquee-cta__track { animation-play-state: paused; }

.marquee-cta__item {
  display: inline-flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
  padding-inline: clamp(9px, 1.5vw, 21px);
  color: #fff;
  font-weight: 800;
  letter-spacing: .01em;
  font-size: clamp(1.15rem, 3.4vw, 2.1rem);
  text-transform: uppercase;
}
.marquee-cta__item span { display: inline-flex; align-items: center; gap: clamp(18px, 3vw, 42px); }
.marquee-cta__drop {
  width: .8em; height: .8em; flex: 0 0 auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
  animation: dropPulse 1.8s ease-in-out infinite;
}
.marquee-cta__item .ghost {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .85);
}
@keyframes marqueeMove {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes dropPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* ============================================================
   3) BLOCCHI GRAFICI SVG/CSS (sostituiscono le foto "stock")
   ============================================================ */
.graphic {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--enh-radius);
  overflow: hidden;
  background: radial-gradient(120% 120% at 80% 0%, #fff 0%, var(--soft) 60%, #e7eefb 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.graphic svg { width: 100%; height: 100%; display: block; }
.graphic--blood { background: radial-gradient(120% 120% at 20% 10%, #fff 0%, #fdeef0 55%, #fbdfe3 100%); }
.graphic--lake  { background: radial-gradient(120% 120% at 80% 0%, #eaf3ff 0%, #d7e7fb 60%, #c4dbf6 100%); }
.graphic--night { background: radial-gradient(120% 130% at 50% 0%, #16233f 0%, #0b1426 60%, var(--avis-space) 100%); }

.float-slow { animation: floatY 7s ease-in-out infinite; }
.float-mid  { animation: floatY 5s ease-in-out infinite; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.spin-slow { transform-box: fill-box; transform-origin: center; animation: spin 26s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse-ring { transform-box: fill-box; transform-origin: center; animation: pulseRing 3s ease-out infinite; }
@keyframes pulseRing {
  0%   { opacity: .6; transform: scale(.6); }
  100% { opacity: 0;  transform: scale(1.3); }
}

/* ============================================================
   4) SEZIONE PROMO / EVENTI
   ============================================================ */
.promo-band {
  position: relative;
  background:
    radial-gradient(80% 140% at 0% 0%, rgba(226, 5, 27, .12), transparent 55%),
    radial-gradient(80% 140% at 100% 100%, rgba(23, 74, 156, .14), transparent 55%),
    var(--paper);
  overflow: hidden;
}
.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(16px, 2.4vw, 24px);
}
.promo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(20px, 2.6vw, 28px);
  border-radius: var(--enh-radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(22, 33, 31, .08);
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease;
}
.promo-card:hover { transform: translateY(-4px); box-shadow: 0 26px 60px rgba(22, 33, 31, .14); }
.promo-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--avis-red), var(--avis-blue));
}
.promo-card__tag {
  align-self: flex-start;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--avis-red);
  background: rgba(226, 5, 27, .08);
  padding: 5px 11px;
  border-radius: 999px;
}
.promo-card--new .promo-card__tag { color: var(--avis-blue); background: rgba(23, 74, 156, .1); }
.promo-card h3 { margin: 2px 0 0; font-size: 1.25rem; line-height: 1.2; }
.promo-card p { margin: 0; color: var(--muted); }
.promo-card .text-link { margin-top: auto; }
.promo-card__meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: .85rem; color: var(--ink); font-weight: 600;
}
.promo-card__meta span { display: inline-flex; align-items: center; gap: 6px; }

/* fascia "lampeggiante" badge novità */
.tag-live::after {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: #25c26e; margin-left: 7px;
  box-shadow: 0 0 0 0 rgba(37, 194, 110, .6);
  animation: liveDot 1.6s ease-out infinite;
  display: inline-block;
}
@keyframes liveDot {
  0%   { box-shadow: 0 0 0 0 rgba(37, 194, 110, .55); }
  100% { box-shadow: 0 0 0 9px rgba(37, 194, 110, 0); }
}

/* ============================================================
   5) WIZARD "DIVENTA DONATORE"
   ============================================================ */
.wizard-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(100% 140% at 0% 0%, #16233f 0%, transparent 55%),
    radial-gradient(120% 160% at 100% 0%, rgba(226, 5, 27, .55) 0%, transparent 50%),
    linear-gradient(160deg, #0b1426, var(--avis-space));
}
.wizard-hero__inner {
  position: relative;
  z-index: 1;
  padding: clamp(48px, 8vw, 96px) 0 clamp(36px, 6vw, 64px);
  display: grid;
  gap: 18px;
  max-width: 760px;
}
.wizard-hero .eyebrow { color: #ffd2d2; }
.wizard-hero h1 { color: #fff; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; margin: 0; }
.wizard-hero__lead { color: rgba(255, 255, 255, .86); font-size: 1.08rem; margin: 0; max-width: 60ch; }
.wizard-hero__stats {
  display: flex; flex-wrap: wrap; gap: clamp(18px, 4vw, 44px); margin-top: 10px;
}
.wizard-hero__stat strong { display: block; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1; }
.wizard-hero__stat span { font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }

.wizard {
  position: relative;
  margin: clamp(-40px, -6vw, -56px) auto 0;
  max-width: 760px;
  background: #fff;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .18);
  overflow: hidden;
  z-index: 5;
}
.wizard__head {
  padding: clamp(20px, 3vw, 30px) clamp(20px, 3.4vw, 34px) 0;
}
.wizard__progress {
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}
.wizard__progress span {
  display: block;
  height: 100%;
  width: 12%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--avis-red), var(--avis-blue));
  transition: width .45s cubic-bezier(.65, 0, .35, 1);
}
.wizard__meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; font-size: .82rem; color: var(--muted); font-weight: 600;
}
.wizard__meta b { color: var(--avis-red); }

.wizard__steps { position: relative; }
.wizard-step {
  display: block; /* senza JS: tutti i passi visibili (form unico accessibile) */
  padding: clamp(18px, 3.2vw, 32px) clamp(20px, 3.4vw, 34px) clamp(22px, 3.4vw, 34px);
  border: 0;
  margin: 0;
}
.js-ready .wizard-step { display: none; animation: stepIn .45s cubic-bezier(.2, .7, .2, 1); }
.js-ready .wizard-step.is-active { display: block; }
/* Barra di navigazione e progress: utili solo con JS */
.wizard__head,
.wizard__actions { display: none; }
.js-ready .wizard__head { display: block; }
.js-ready .wizard__actions { display: flex; }
.wizard__nojs { display: block; padding: 0 clamp(20px, 3.4vw, 34px) clamp(24px, 3.4vw, 34px); }
.js-ready .wizard__nojs { display: none; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wizard-step__eyebrow { color: var(--avis-red); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .74rem; margin: 0 0 6px; }
.wizard-step h2 { margin: 0 0 6px; font-size: clamp(1.3rem, 3.6vw, 1.7rem); }
.wizard-step p.help { margin: 0 0 18px; color: var(--muted); }

/* scelte a "carta" */
.choice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}
.choice:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(22, 33, 31, .08); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__dot {
  width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px;
  border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; transition: border-color .2s ease;
}
.choice__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--avis-red); transform: scale(0); transition: transform .2s ease; }
.choice__body strong { display: block; line-height: 1.2; }
.choice__body span { font-size: .86rem; color: var(--muted); }
.choice input:checked ~ .choice__dot { border-color: var(--avis-red); }
.choice input:checked ~ .choice__dot::after { transform: scale(1); }
.choice:has(input:checked) { border-color: var(--avis-red); background: rgba(226, 5, 27, .04); box-shadow: 0 12px 26px rgba(226, 5, 27, .1); }
.choice input:focus-visible ~ .choice__dot { outline: 3px solid rgba(23, 74, 156, .35); outline-offset: 2px; }

/* campi */
.wz-field { display: grid; gap: 6px; margin-bottom: 16px; }
.wz-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.wz-field label { font-weight: 600; font-size: .94rem; }
.wz-field .req { color: var(--avis-red); }
.wz-field input,
.wz-field select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.wz-field input:focus,
.wz-field select:focus { outline: none; border-color: var(--avis-blue); box-shadow: 0 0 0 4px rgba(23, 74, 156, .14); }
.wz-field input[aria-invalid="true"] { border-color: var(--avis-red); box-shadow: 0 0 0 4px rgba(226, 5, 27, .12); }
.wz-error { color: var(--avis-red); font-size: .82rem; min-height: 1em; }
.wz-hint { color: var(--muted); font-size: .82rem; }

/* Data di nascita a 3 menu (Giorno/Mese/Anno): ottima su desktop e mobile. */
.dob-grid { display: grid; grid-template-columns: 0.85fr 1.3fr 0.95fr; gap: 10px; }
.dob-grid select { width: 100%; }
@media (max-width: 380px) { .dob-grid { grid-template-columns: 1fr 1.2fr 1fr; gap: 7px; } }

/* range età/peso con feedback */
.gauge {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 800; font-size: 1.4rem; color: var(--avis-blue);
}
.gauge small { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* avviso requisito non soddisfatto */
.wz-gate {
  display: none;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(242, 184, 75, .14);
  border: 1px solid rgba(242, 184, 75, .5);
  color: #6b4e12;
  font-size: .9rem;
  margin-top: 6px;
}
.wz-gate.is-shown { display: flex; }

/* consensi */
.consent-block { display: grid; gap: 12px; margin-top: 4px; }
.consent {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: .9rem; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
}
.consent input { margin-top: 3px; width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--avis-red); }
.consent.optional { color: var(--muted); }

/* azioni */
.wizard__actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 clamp(20px, 3.4vw, 34px) clamp(22px, 3.4vw, 34px);
}
.wizard__actions .spacer { flex: 1; }
.btn-ghost {
  background: transparent; border: 1.5px solid var(--line); color: var(--ink);
  padding: 12px 20px; border-radius: 999px; font-weight: 700; cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.btn-ghost:hover { border-color: var(--avis-blue); background: var(--soft); }
.btn-ghost[disabled] { opacity: .4; cursor: not-allowed; }
/* I pulsanti .button usano display:inline-flex che sovrascriverebbe l'attributo
   [hidden]: forziamo il nascondimento cosi "Avanti"/"Invia" si mostrano al
   momento giusto (Invia solo al passo finale, Avanti solo prima). */
.wizard__actions [hidden] { display: none !important; }

/* riepilogo */
.summary-list { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.summary-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; background: var(--soft); border-radius: 10px; }
.summary-list b { color: var(--muted); font-weight: 600; }
.summary-list span { font-weight: 700; text-align: right; }

/* esito */
.wizard-done { text-align: center; padding: clamp(28px, 5vw, 52px) clamp(20px, 3.4vw, 34px); }
.wizard-contacts { margin: 20px auto 6px; max-width: 540px; }
.wizard-contacts__title { font-weight: 700; text-align: center; margin: 0 0 12px; color: var(--ink); }
.wizard-done__check {
  width: 78px; height: 78px; margin: 0 auto 16px;
}
.wizard-done h2 { margin: 0 0 8px; }
.wizard-done p { color: var(--muted); max-width: 48ch; margin: 0 auto 18px; }

/* QR card */
.qr-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: clamp(18px, 3vw, 30px);
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--enh-radius);
  background: linear-gradient(135deg, #fff, var(--soft));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.qr-card__code {
  flex: 0 0 auto; width: 148px; height: 148px; padding: 10px;
  background: #fff; border-radius: 14px; border: 1px solid var(--line);
}
.qr-card__code img, .qr-card__code svg { width: 100%; height: 100%; display: block; }
.qr-card__body { flex: 1 1 260px; }
.qr-card__body h3 { margin: 0 0 6px; }
.qr-card__body p { margin: 0; color: var(--muted); }

/* ============================================================
   REVEAL extra
   ============================================================ */
.reveal-up { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.reveal-up.is-visible { opacity: 1; transform: none; }
/* Fail-safe: senza JS (o se l'observer non parte) il contenuto resta visibile. */
html:not(.js-ready) .reveal-up { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 620px) {
  .wz-grid { grid-template-columns: 1fr; }
  .wizard { border-radius: 18px; }
  .wizard__actions { flex-wrap: wrap; }
  .summary-list li { flex-direction: column; gap: 2px; }
  .summary-list span { text-align: left; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .marquee-cta__track { animation: none; transform: none; }
  .marquee-cta__drop,
  .float-slow, .float-mid, .spin-slow, .pulse-ring,
  .tag-live::after { animation: none; }
  .reveal-up { opacity: 1; transform: none; transition: none; }
  .wizard-step { animation: none; }
}
