/* ============================================================
   LAEF — Hero Animations (Plan C)
   Entrada escalonada + Parallax + Partículas doradas + Glow reactivo
   ============================================================ */

/* ---------- Entrance Animations ---------- */

/* Badge de "Liga Formativa Oficial" */
.hero-badge-animate {
    opacity: 0;
    transform: translateY(-18px);
    animation: heroFadeDown 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

/* Título H1 del hero */
.hero-title-line {
    opacity: 0;
    transform: translateX(-40px);
    animation: heroSlideRight 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards;
}

/* Párrafo descriptivo */
.hero-lead-animate {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.58s forwards;
}

/* Botón CTA */
.hero-cta-animate {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    animation: heroBounceIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.78s forwards;
}

/* Widget del torneo (derecha) */
.hero-widget-animate {
    opacity: 0;
    transform: translateX(50px);
    animation: heroSlideLeft 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

@keyframes heroFadeDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroSlideRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heroSlideLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heroBounceIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ---------- Parallax (CSS Variables, actualizadas por JS) ---------- */

/* ---------- Fondo Cancha 3D Diagonal Adaptable (Hero) ---------- */

.hero-pitch-3d-wrapper {
    position: absolute;
    inset: -10% 0;
    pointer-events: none;
    z-index: 0;
    perspective: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.32;
    overflow: hidden;
}

.field-mobile {
    display: none;
}

.hero-field-3d-svg {
    width: 85%;
    height: 85%;
    max-width: 950px;
    max-height: 520px;
    transform: rotateX(54deg) rotateZ(-16deg) scale(1.05);
    transform-style: preserve-3d;
    filter: drop-shadow(0 0 20px rgba(239, 203, 108, 0.45));
}

.hero-field-3d-svg path,
.hero-field-3d-svg circle,
.hero-field-3d-svg rect,
.hero-field-3d-svg line {
    stroke: var(--laef-gold);
    fill: none;
    stroke-width: 2.2;
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    animation: drawPitch3D 3.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

@keyframes drawPitch3D {
    to { stroke-dashoffset: 0; }
}

.pitch-grid-scan {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(239, 203, 108, 0.16) 50%,
        transparent 100%
    );
    transform: rotateX(54deg) rotateZ(-16deg);
    animation: pitchScan 4s linear infinite;
    pointer-events: none;
}

@keyframes pitchScan {
    0% { transform: rotateX(54deg) rotateZ(-16deg) translateY(-100%); }
    100% { transform: rotateX(54deg) rotateZ(-16deg) translateY(100%); }
}

/* Ajustes Responsivos para Mobile y Tablets */
@media (max-width: 991px) {
    .hero-pitch-3d-wrapper {
        opacity: 0.28;
        inset: -5% 0;
    }
    .field-desktop {
        display: none;
    }
    .field-mobile {
        display: block;
        width: 100%;
        height: 100%;
        max-width: 480px;
        max-height: 750px;
        transform: rotateX(42deg) rotateZ(12deg) scale(1.15);
    }
    .pitch-grid-scan {
        transform: rotateX(42deg) rotateZ(12deg);
    }
}

@media (max-width: 576px) {
    .hero-pitch-3d-wrapper {
        opacity: 0.24;
    }
    .field-mobile {
        width: 110%;
        height: 110%;
        max-width: 420px;
        max-height: 700px;
        transform: rotateX(38deg) rotateZ(10deg) scale(1.2);
    }
}

.hero-pitch-bg {
    --parallax-y: 0px;
    --mouse-x: 0px;
    --mouse-y: 0px;
    transform: translate(var(--mouse-x), calc(var(--parallax-y) + var(--mouse-y)));
    transition: transform 0.1s linear;
    will-change: transform;
}


/* ---------- Partículas doradas flotantes ---------- */

.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.hero-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(239, 203, 108, 0.75) 0%, rgba(245, 158, 11, 0.3) 60%, transparent 100%);
    will-change: transform, opacity;
    animation: particleFloat var(--float-duration, 8s) var(--float-delay, 0s) ease-in-out infinite alternate;
    opacity: 0;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg) scale(0.8);
    }

    15% {
        opacity: var(--float-opacity, 0.45);
    }

    85% {
        opacity: var(--float-opacity, 0.45);
    }

    100% {
        opacity: 0;
        transform: translateY(var(--float-travel, -60px)) rotate(180deg) scale(1.2);
    }
}

/* Desactivar en mobile para preservar batería */
@media (max-width: 768px) {
    .hero-particle {
        display: none;
    }
}


/* ---------- Glow reactivo al mouse (CSS Variables, actualizadas por JS) ---------- */

.hero-glow {
    --glow-left: -10%;
    --glow-top: -30%;
    left: var(--glow-left) !important;
    top: var(--glow-top) !important;
    /* Transición suave para el lerp en JS */
    transition: left 0.05s linear, top 0.05s linear;
    will-change: left, top;
}

/* En mobile el glow queda estático como siempre */
@media (max-width: 991px) {
    .hero-glow {
        left: -10% !important;
        top: -30% !important;
        transition: none;
    }
}


/* ---------- Respeto a prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {

    /* Mostrar todo directamente sin animación */
    .hero-badge-animate,
    .hero-title-line,
    .hero-lead-animate,
    .hero-cta-animate,
    .hero-widget-animate {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .hero-particle {
        display: none;
    }

    .hero-pitch-bg {
        transform: none;
        transition: none;
    }

    .hero-glow {
        transition: none;
    }
}