/* ==========================================================================
   HOGWARTS LEGACY 2 ITALIA — animationpage.css
   Modulo dedicato a tutte le animazioni della pagina.
   - Hero-inner: entrata lenta dall'alto verso il basso in dissolvenza (>= 2s)
   - Pulsanti: salita lenta dal basso verso l'alto in dissolvenza (>= 2s)
   - Canvas magico in primo piano (z-index: 95, pointer-events: none)
   - Effetti di luce, bagliori e shimmer privi di flickering
   ========================================================================== */

/* ==========================================================================
   1. HERO: ANIMAZIONI D'ENTRATA LENTE (>= 2 SECONDI) CON ANIMATE.CSS
   Testi scendono dall'alto in dissolvenza (2.2s).
   I pulsanti salgono dal basso in dissolvenza (2.2s) e partono DOPO che i testi hanno finito.
   ========================================================================== */

/* Testi dell'Hero: badge, h1, subtitle e lead */
.hero-text-anim.animate__fadeInDown {
  --animate-duration: 2.2s !important;
  -webkit-animation-duration: 2.2s !important;
  animation-duration: 2.2s !important;
  animation-delay: 0s !important;
  -webkit-animation-fill-mode: both !important;
  animation-fill-mode: both !important;
  -webkit-animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* Pulsanti: partono ESATTAMENTE al termine dell'animazione dei testi (delay 2.2s) con durata 2.2s */
.hero-btn-anim.animate__fadeInUp {
  --animate-duration: 2.2s !important;
  -webkit-animation-duration: 2.2s !important;
  animation-duration: 2.2s !important;
  animation-delay: 2.2s !important;
  -webkit-animation-fill-mode: both !important;
  animation-fill-mode: both !important;
  -webkit-animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* Leggero scaglionamento di 0.15s per il secondo pulsante (Facebook) pur restando nel blocco */
.hero-btn-facebook.hero-btn-anim.animate__fadeInUp {
  animation-delay: 2.35s !important;
}

/* Ottimizzazione Responsive per schermi Mobile e Tablet */
@media (max-width: 768px) {
  @-webkit-keyframes mobileHeroFadeInDown {
    from {
      opacity: 0;
      -webkit-transform: translate3d(0, -35px, 0);
      transform: translate3d(0, -35px, 0);
    }
    to {
      opacity: 1;
      -webkit-transform: translate3d(0, 0, 0);
      transform: translate3d(0, 0, 0);
    }
  }
  @keyframes mobileHeroFadeInDown {
    from {
      opacity: 0;
      transform: translate3d(0, -35px, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @-webkit-keyframes mobileBtnFadeInUp {
    from {
      opacity: 0;
      -webkit-transform: translate3d(0, 35px, 0);
      transform: translate3d(0, 35px, 0);
    }
    to {
      opacity: 1;
      -webkit-transform: translate3d(0, 0, 0);
      transform: translate3d(0, 0, 0);
    }
  }
  @keyframes mobileBtnFadeInUp {
    from {
      opacity: 0;
      transform: translate3d(0, 35px, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  .hero-text-anim.animate__fadeInDown {
    -webkit-animation-name: mobileHeroFadeInDown !important;
    animation-name: mobileHeroFadeInDown !important;
    --animate-duration: 2.2s !important;
    animation-duration: 2.2s !important;
  }
  .hero-btn-anim.animate__fadeInUp {
    -webkit-animation-name: mobileBtnFadeInUp !important;
    animation-name: mobileBtnFadeInUp !important;
    --animate-duration: 2.2s !important;
    animation-duration: 2.2s !important;
    animation-delay: 2.2s !important;
  }
  .hero-btn-facebook.hero-btn-anim.animate__fadeInUp {
    animation-delay: 2.35s !important;
  }
}

/* ==========================================================================
   1b. HERO SLIDESHOW: CROSSFADE OGNI 10 SECONDI
   ========================================================================== */
.hero-slideshow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  will-change: opacity;
  transform: translateZ(0);
}
.hero-slide-active {
  opacity: 1;
}

/* ==========================================================================
   2. CANVAS MAGICO (FONDAMENTALE: z-index 95 per stare sopra le sezioni)
   ========================================================================== */
#magicCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none; /* Cliccabilità totale su tutti i bottoni e link */
  z-index: 95;          /* Visibile sopra a hero, sfondi e card, sotto l'header (100) */
  opacity: 1;
  display: block;
  transform: translateZ(0);
}

/* ==========================================================================
   3. TITOLI DI SEZIONE: GLOW MAGICO PULSANTE ORO & CIANO
   ========================================================================== */
h2,
.hero h1 {
  animation: magicTitleGlow 4.5s ease-in-out infinite;
  transform: translateZ(0);
}

@keyframes magicTitleGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3), 0 3px 25px rgba(0, 0, 0, 0.9);
  }
  50% {
    text-shadow: 0 0 25px rgba(245, 158, 11, 0.75), 0 0 45px rgba(56, 189, 248, 0.45), 0 3px 25px rgba(0, 0, 0, 0.9);
  }
}

/* ==========================================================================
   4. LE 4 CASE DI HOGWARTS: SHIMMER INCANTATO (pillShimmer)
   ========================================================================== */
.houses-strip {
  transform: translateZ(0);
}

.house-pill {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.house-pill:hover {
  transform: translateY(-3px) scale(1.05);
}

.house-pill::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  animation: pillShimmerGlow 3.8s ease-in-out infinite alternate;
  will-change: opacity;
}

.house-gryffindor::after {
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.85), inset 0 0 8px rgba(239, 68, 68, 0.45);
  animation-delay: 0s;
}
.house-slytherin::after {
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.85), inset 0 0 8px rgba(16, 185, 129, 0.45);
  animation-delay: 0.95s;
}
.house-ravenclaw::after {
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.85), inset 0 0 8px rgba(56, 189, 248, 0.45);
  animation-delay: 1.9s;
}
.house-hufflepuff::after {
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.85), inset 0 0 8px rgba(245, 158, 11, 0.45);
  animation-delay: 2.85s;
}

@keyframes pillShimmerGlow {
  0%   { opacity: 0.25; }
  100% { opacity: 0.95; }
}

/* ==========================================================================
   5. FEATURE LIST: BORDO CHE PULSA ORO/CIANO & ICONE MAGICHE
   ========================================================================== */
.feature-list article {
  position: relative;
  transform: translateZ(0);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s ease;
}
.feature-list article:hover {
  transform: translateX(8px);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.22);
}

.feature-list article::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border-left: 4px solid var(--magic);
  box-shadow: -6px 0 24px rgba(56, 189, 248, 0.5);
  opacity: 0;
  pointer-events: none;
  animation: featureGlowPulse 5.5s ease-in-out infinite alternate;
  will-change: opacity;
}
.feature-list article:nth-child(2)::before { animation-delay: 1.8s; }
.feature-list article:nth-child(3)::before { animation-delay: 3.6s; }

@keyframes featureGlowPulse {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

.feature-list article i {
  display: inline-block;
  animation: magicIconSpin 5.5s ease-in-out infinite;
  will-change: transform, color;
  transform: translateZ(0);
}
.feature-list article:nth-child(2) i { animation-delay: 1.8s; }
.feature-list article:nth-child(3) i { animation-delay: 3.6s; }

@keyframes magicIconSpin {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    color: var(--gold);
  }
  30% {
    transform: scale(1.18) rotate(-7deg);
    color: var(--magic-light);
  }
  70% {
    transform: scale(1.12) rotate(6deg);
    color: var(--gold-light);
  }
}

/* ==========================================================================
   6. CARDS INCANTATE: LEVITAZIONE & AURA MAGIA ANTICA
   ========================================================================== */
.cards {
  transform: translateZ(0);
}

.card {
  position: relative;
  transform: translateZ(0);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-9px);
  box-shadow: 0 14px 45px rgba(245, 158, 11, 0.3), 0 0 25px rgba(56, 189, 248, 0.25);
}
.card:hover i {
  transform: scale(1.18);
  color: var(--gold-light);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.32), inset 0 0 20px rgba(245, 158, 11, 0.12);
  opacity: 0.15;
  pointer-events: none;
  animation: cardAuraAlive 5s ease-in-out infinite alternate;
  will-change: opacity;
}
.card:nth-child(2)::before { animation-delay: 1.65s; }
.card:nth-child(3)::before { animation-delay: 3.3s; }

@keyframes cardAuraAlive {
  0%   { opacity: 0.15; }
  100% { opacity: 0.95; }
}

/* ==========================================================================
   7. COMMUNITY HUB: AURA NEON DISCORD & FACEBOOK
   ========================================================================== */
.hub-box {
  position: relative;
  transform: translateZ(0);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}
.hub-box:hover {
  transform: translateY(-6px);
}

.hub-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.2;
  animation: hubAuraCycle 4.5s ease-in-out infinite alternate;
  will-change: opacity;
}

.hub-box.discord-box::before {
  box-shadow: 0 0 35px rgba(88, 101, 242, 0.45), inset 0 0 15px rgba(88, 101, 242, 0.15);
  animation-delay: 0s;
}
.hub-box.facebook-box::before {
  box-shadow: 0 0 35px rgba(24, 119, 242, 0.45), inset 0 0 15px rgba(24, 119, 242, 0.15);
  animation-delay: 2.25s;
}

@keyframes hubAuraCycle {
  0%   { opacity: 0.2; }
  100% { opacity: 0.85; }
}

/* ==========================================================================
   8. CORNICE DEL VIDEO (videoBorder) & PULSANTE PLAY INCANTATO (playPulse)
   ========================================================================== */
.video {
  position: relative;
  transform: translateZ(0);
  transition: transform 0.3s ease;
}

.video::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1px solid rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 45px rgba(56, 189, 248, 0.4), 0 0 25px rgba(245, 158, 11, 0.3);
  pointer-events: none;
  opacity: 0.3;
  animation: videoGlowPulse 4s ease-in-out infinite alternate;
  will-change: opacity;
}

@keyframes videoGlowPulse {
  0% {
    opacity: 0.25;
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.35);
  }
  100% {
    opacity: 0.95;
    border-color: rgba(56, 189, 248, 0.75);
    box-shadow: 0 0 65px rgba(56, 189, 248, 0.6), 0 0 30px rgba(245, 158, 11, 0.45);
  }
}

.play {
  animation: magicPlayPulse 2.6s ease-in-out infinite;
  will-change: transform, box-shadow;
  transform: translateZ(0);
}
@keyframes magicPlayPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.45);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 65px rgba(245, 158, 11, 0.95), 0 0 95px rgba(56, 189, 248, 0.45);
  }
}

/* ==========================================================================
   9. ROTELLINA DELLO SCROLL (.scroll-down / .mouse)
   ========================================================================== */
.scroll-down {
  transform: translate3d(-50%, 0, 0);
  will-change: transform;
}
.mouse {
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.45);
  animation: mouseCandleGlow 2.5s ease-in-out infinite alternate;
  transform: translateZ(0);
}
@keyframes mouseCandleGlow {
  0%   { box-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
  100% { box-shadow: 0 0 28px rgba(245, 158, 11, 0.8), 0 0 45px rgba(56, 189, 248, 0.35); }
}

.mouse i {
  animation: magicScrollWheel 1.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  will-change: transform, opacity;
  transform: translateZ(0);
}
@keyframes magicScrollWheel {
  0% {
    opacity: 0;
    transform: translate3d(0, -2px, 0);
  }
  25% {
    opacity: 1;
    box-shadow: 0 0 10px var(--gold-light);
  }
  75% {
    opacity: 0.9;
    transform: translate3d(0, 16px, 0);
    box-shadow: 0 0 14px var(--magic-light);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
}

/* ==========================================================================
   10. CTA FINALE: SFERE DI LUCE ETEREE (ctaOrbs)
   ========================================================================== */
.cta-final {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}
.cta-final .wrap {
  position: relative;
  z-index: 3;
}
.cta-final::before {
  content: "";
  position: absolute;
  inset: -15%;
  width: 130%;
  height: 130%;
  background: radial-gradient(circle at 20% 50%, rgba(56, 189, 248, 0.15) 0%, transparent 48%),
              radial-gradient(circle at 80% 50%, rgba(245, 158, 11, 0.15) 0%, transparent 48%);
  pointer-events: none;
  z-index: 1;
  animation: ctaOrbsFloat 8.5s ease-in-out infinite alternate;
  will-change: transform, opacity;
  transform: translateZ(0);
}
@keyframes ctaOrbsFloat {
  0% {
    transform: translate3d(-20px, 0, 0) scale(1);
    opacity: 0.65;
  }
  100% {
    transform: translate3d(20px, 0, 0) scale(1.22);
    opacity: 1;
  }
}

/* ==========================================================================
   11. BADGE NON UFFICIALE: AURA INCANTATA
   ========================================================================== */
.badge-unofficial {
  animation: badgeAuraGlow 3.8s ease-in-out infinite alternate;
  will-change: box-shadow;
}
@keyframes badgeAuraGlow {
  0%   { box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
  100% { box-shadow: 0 0 28px rgba(245, 158, 11, 0.6), 0 0 15px rgba(56, 189, 248, 0.25); }
}
