/*
 * =====================================================================
 * Bonus Tariflow – Animazioni ed Effetti (animations.css)
 * =====================================================================
 * Progetto   : Landing Page Bonus Tariflow
 * Cliente    : Golem Net SRL SB
 * Creatore   : Francesco Vicari
 * =====================================================================
 * Struttura:
 *   1. Keyframe (fotogrammi chiave)
 *   2. Classi di rivelazione scroll (Intersection Observer)
 *   3. Effetti hero
 *   4. Effetti hover avanzati
 *   5. Micro-animazioni UI
 * =====================================================================
 */

/* ─────────────────────────────────────────────────────────────────── */
/* 1. KEYFRAME (fotogrammi chiave delle animazioni)                    */
/* ─────────────────────────────────────────────────────────────────── */

/* Fluttuazione verticale per l'immagine hero */
@keyframes fluttuazione {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-12px) rotate(0.3deg); }
  66%       { transform: translateY(-6px)  rotate(-0.2deg); }
}

/* Pulsazione del punto nel badge ARERA */
@keyframes pulsazione {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(0,196,216,.5); }
  50%       { opacity: 0.7; transform: scale(1.15); box-shadow: 0 0 0 5px rgba(0,196,216,0); }
}

/* Entrata dall'alto */
@keyframes scivoloDallAlto {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Entrata dal basso */
@keyframes scivola {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Entrata da sinistra */
@keyframes scivola-sx {
  from { opacity: 0; transform: translateX(-36px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Entrata da destra */
@keyframes scivola-dx {
  from { opacity: 0; transform: translateX(36px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Comparsa per opacità */
@keyframes dissolvenza {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scala dall'interno */
@keyframes ingrandisci {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Onda orizzontale (sfondo hero) */
@keyframes ondaOrizzontale {
  0%   { transform: translateX(-50%) scaleY(1); }
  50%  { transform: translateX(0%)   scaleY(1.05); }
  100% { transform: translateX(-50%) scaleY(1); }
}

/* Shimmer per skeleton loading */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Rotazione icona di caricamento */
@keyframes rotazione {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Contatore numeri (tick visivo) */
@keyframes ticchettio {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────────── */
/* 2. CLASSI DI RIVELAZIONE SCROLL (Intersection Observer)             */
/* ─────────────────────────────────────────────────────────────────── */

/* Stato iniziale: invisibile prima che entri nel viewport */
.rivela,
.rivela-sx,
.rivela-dx,
.rivela-scala {
  opacity: 0;
  will-change: opacity, transform;
}

.rivela      { transform: translateY(32px); }
.rivela-sx   { transform: translateX(-40px); }
.rivela-dx   { transform: translateX(40px); }
.rivela-scala{ transform: scale(0.94); }

/* Stato visibile: aggiunto da JavaScript tramite IntersectionObserver */
.rivela.visibile,
.rivela-sx.visibile,
.rivela-dx.visibile,
.rivela-scala.visibile {
  opacity: 1;
  transform: translate(0) scale(1);
  transition:
    opacity  0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ritardi staggered per animazioni in sequenza */
.ritardo-1 { transition-delay: 0.10s; }
.ritardo-2 { transition-delay: 0.20s; }
.ritardo-3 { transition-delay: 0.30s; }
.ritardo-4 { transition-delay: 0.40s; }
.ritardo-5 { transition-delay: 0.50s; }
.ritardo-6 { transition-delay: 0.60s; }

/* ─────────────────────────────────────────────────────────────────── */
/* 3. EFFETTI HERO                                                      */
/* ─────────────────────────────────────────────────────────────────── */

/* Blob di sfondo animato (blob 1) */
.hero-blob-1 {
  position: absolute;
  top: -20%;
  right: -10%;
  width: 700px;
  height: 700px;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  background: radial-gradient(circle, rgba(0,196,216,.06) 0%, transparent 65%);
  animation: morfologia 12s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Blob di sfondo animato (blob 2) */
.hero-blob-2 {
  position: absolute;
  bottom: -15%;
  left: -8%;
  width: 500px;
  height: 500px;
  border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
  background: radial-gradient(circle, rgba(29,111,164,.06) 0%, transparent 65%);
  animation: morfologia 16s ease-in-out infinite alternate-reverse;
  pointer-events: none;
}

@keyframes morfologia {
  0%   { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
  33%  { border-radius: 70% 30% 40% 60% / 60% 40% 50% 40%; }
  66%  { border-radius: 30% 70% 60% 40% / 50% 60% 40% 60%; }
  100% { border-radius: 60% 40% 30% 70% / 40% 50% 70% 30%; }
}

/* Animazione d'ingresso del testo hero (innescata al caricamento) */
.hero__testo > * {
  animation: scivola 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero__testo > *:nth-child(1) { animation-delay: 0.1s; }
.hero__testo > *:nth-child(2) { animation-delay: 0.2s; }
.hero__testo > *:nth-child(3) { animation-delay: 0.3s; }
.hero__testo > *:nth-child(4) { animation-delay: 0.4s; }
.hero__testo > *:nth-child(5) { animation-delay: 0.5s; }
.hero__testo > *:nth-child(6) { animation-delay: 0.6s; }

.hero__visuale {
  animation: ingrandisci 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

/* ─────────────────────────────────────────────────────────────────── */
/* 4. EFFETTI HOVER AVANZATI                                           */
/* ─────────────────────────────────────────────────────────────────── */

/* Effetto tilt 3D sulle card (gestito via JS) */
.card-tilt {
  transform-style: preserve-3d;
  transform: perspective(1000px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Linea animata sotto i link di navigazione */
.nav-links__link {
  position: relative;
}

.nav-links__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--c-teal);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width var(--t-media);
}

.nav-links__link:hover::after,
.nav-links__link[aria-current="page"]::after {
  width: 60%;
}

/* Icona freccia nei bottoni primari */
.btn-primario .icona-freccia,
.btn-teal .icona-freccia {
  transition: transform var(--t-veloce);
}

.btn-primario:hover .icona-freccia,
.btn-teal:hover .icona-freccia {
  transform: translateX(4px);
}

/* Alone teal su hover per le carte processo */
.processo-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(0,196,216,.06) 0%, transparent 70%);
  transition: opacity var(--t-media);
  pointer-events: none;
}

.processo-card { position: relative; }
.processo-card:hover::before { opacity: 1; }

/* ─────────────────────────────────────────────────────────────────── */
/* 5. MICRO-ANIMAZIONI UI                                              */
/* ─────────────────────────────────────────────────────────────────── */

/* Transizione fluida delle schede (se in futuro si aggiungono tab) */
.scheda-transizione {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scheda-transizione.nascosta {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  position: absolute;
}

/* Barra di progresso lettura */
#barra-progresso {
  transition: width 0.1s linear;
}

/* Animazione comparsa del menu mobile */
.nav-mobile {
  animation: scivoloDallAlto 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Glow pulsante sul numero statistiche quando entrano in vista */
.stat-item__numero.conta {
  animation: ticchettio 0.05s ease-in-out;
}

/* Indicatore di caricamento (accessibilità) */
.caricamento {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(0,196,216,.3);
  border-top-color: var(--c-teal);
  border-radius: 50%;
  animation: rotazione 0.8s linear infinite;
}
