/* ============================================
   ANIMATIONS - APEIRON
   Keyframes y animaciones
   ============================================ */

/* ----------------------------------------
   Keyframes
---------------------------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes glow {
    0%,
    100% {
        box-shadow: 0 0 5px var(--color-accent-yellow);
    }
    50% {
        box-shadow:
            0 0 20px var(--color-accent-yellow),
            0 0 30px var(--color-accent-orange);
    }
}

@keyframes slideStripe {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ----------------------------------------
   Scroll Animations
---------------------------------------- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for grid items */
.features__grid .animate-on-scroll:nth-child(1) {
    transition-delay: 0s;
}
.features__grid .animate-on-scroll:nth-child(2) {
    transition-delay: 0.1s;
}
.features__grid .animate-on-scroll:nth-child(3) {
    transition-delay: 0.2s;
}
.features__grid .animate-on-scroll:nth-child(4) {
    transition-delay: 0.3s;
}
.features__grid .animate-on-scroll:nth-child(5) {
    transition-delay: 0.4s;
}
.features__grid .animate-on-scroll:nth-child(6) {
    transition-delay: 0.5s;
}

.characters__grid .animate-on-scroll:nth-child(1) {
    transition-delay: 0s;
}
.characters__grid .animate-on-scroll:nth-child(2) {
    transition-delay: 0.15s;
}
.characters__grid .animate-on-scroll:nth-child(3) {
    transition-delay: 0.3s;
}

.zones__timeline .animate-on-scroll:nth-child(1) {
    transition-delay: 0s;
}
.zones__timeline .animate-on-scroll:nth-child(2) {
    transition-delay: 0.2s;
}
.zones__timeline .animate-on-scroll:nth-child(3) {
    transition-delay: 0.4s;
}

/* ----------------------------------------
   Hover Animations
---------------------------------------- */
.hover-lift {
    transition: transform var(--transition-smooth);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform var(--transition-smooth);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--transition-smooth);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow-yellow);
}

/* ----------------------------------------
   Loading States
---------------------------------------- */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(245, 240, 225, 0.1),
        transparent
    );
    animation: slideStripe 1.5s infinite;
}

/* ----------------------------------------
   Page Load Animation
---------------------------------------- */
.page-loaded .hero__subtitle {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.page-loaded .hero__title {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

.page-loaded .hero__tagline {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

.page-loaded .hero__description {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

.page-loaded .hero__cta {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.6s;
    opacity: 0;
}

.page-loaded .nav {
    animation: fadeInDown 0.6s ease forwards;
    animation-delay: 0.1s;
}

/* ----------------------------------------
   Reduced Motion
---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .animate-on-scroll.visible {
        opacity: 1;
        transform: none;
    }

    .page-loaded .hero__subtitle,
    .page-loaded .hero__title,
    .page-loaded .hero__tagline,
    .page-loaded .hero__description,
    .page-loaded .hero__cta,
    .page-loaded .nav {
        animation: none;
        opacity: 1;
    }

    .loading::after {
        animation: none;
    }
}

.hero-parallax {
    position: relative;
    display: inline-block;

    /* Tweakables */
    --parallax-strength: 60; /* px max travel per axis */
    --parallax-ease: 0.12; /* 0.01 - 0.5 */
    --shadow1-scale: 1; /* movement multiplier */
    --shadow1-offset-x: 10px;
    --shadow1-offset-y: 10px;
    --shadow2-scale: 3;
    --shadow2-offset-x: 18px;
    --shadow2-offset-y: 18px;

    /* Runtime */
    --tx: 0px;
    --ty: 0px;
}
.hero-parallax__img {
    position: relative;
    z-index: 3;
    display: block;
}
.hero-parallax__shadow {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: auto;
    transform: translate3d(
        calc(var(--tx) * var(--shadow1-scale) - var(--shadow1-offset-x)),
        calc(var(--ty) * var(--shadow1-scale) + var(--shadow1-offset-y)),
        0
    );
    will-change: transform;
    pointer-events: none;
}
.hero-parallax__shadow--2 {
    z-index: 1;
    transform: translate3d(
        calc(var(--tx) * var(--shadow2-scale) - var(--shadow2-offset-x)),
        calc(var(--ty) * var(--shadow2-scale) + var(--shadow2-offset-y)),
        0
    );
}
@media (prefers-reduced-motion: reduce) {
    .hero-parallax__shadow {
        transform: none !important;
    }
}
