/* ==========================================
   CINEMATIC ANIMATIONS
   ========================================== */

/* Hardware Acceleration & Transform Reset Fix */
.animate-reveal,
.animate-scale,
.animate-slide-in,
.animate-stagger > *,
.animate-fade-up,
.animate-zoom,
.animate-fade-in,
.animate-pulse,
.animate-slide-right,
.animate-slide-left {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* Ensure transforms fully reset to none when visible */
.animate-reveal.visible,
.animate-scale.visible,
.animate-slide-in.visible,
.animate-fade-up.visible,
.animate-zoom.visible,
.animate-slide-right.visible,
.animate-slide-left.visible {
    transform: none !important;
}

/* Keyframes */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slowZoom {
    from {
        transform: scale(1.1);
    }

    to {
        transform: scale(1.2);
    }
}

/* Class-based Triggers */
.animate-up {
    animation: fadeUp 1s var(--ease-out) forwards;
}

/*
 * ANIMATIONS - Now visible by default for non-JS fallback
 * Animations trigger on scroll via IntersectionObserver in JS
 */

.animate-reveal {
    opacity: 1;
    transition: all 1s var(--ease-out);
}

.animate-reveal.animate-ready {
    opacity: 0;
}

.animate-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-scale {
    opacity: 1;
    transform: scale(1);
    transition: all 0.8s var(--ease-out);
}

.animate-scale.animate-ready {
    opacity: 0;
    transform: scale(0.9);
}

.animate-scale.visible {
    opacity: 1;
    transform: scale(1);
}

.animate-slide-in {
    opacity: 1;
    transform: translateX(0);
    transition: all 1s var(--ease-out);
}

.animate-slide-in.animate-ready {
    opacity: 0;
    transform: translateX(-50px);
}

[dir="rtl"] .animate-slide-in.animate-ready {
    transform: translateX(50px);
}

.animate-slide-in.visible {
    opacity: 1;
    transform: translateX(0);
}

.animate-stagger>* {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s var(--ease-out);
}

.animate-stagger.animate-ready>* {
    opacity: 0;
    transform: translateY(20px);
}

.animate-stagger.visible>* {
    opacity: 1;
    transform: translateY(0);
}

.animate-stagger.visible>*:nth-child(1) {
    transition-delay: 0.1s;
}

.animate-stagger.visible>*:nth-child(2) {
    transition-delay: 0.2s;
}

.animate-stagger.visible>*:nth-child(3) {
    transition-delay: 0.3s;
}

.animate-stagger.visible>*:nth-child(4) {
    transition-delay: 0.4s;
}

.animate-stagger.visible>*:nth-child(5) {
    transition-delay: 0.5s;
}

.animate-stagger.visible>*:nth-child(6) {
    transition-delay: 0.6s;
}

.animate-fade-up {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s var(--ease-out);
}

.animate-fade-up.animate-ready {
    opacity: 0;
    transform: translateY(30px);
}

.animate-fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Zoom Animation */
.animate-zoom {
    opacity: 1;
    transform: scale(1);
    transition: all 0.8s var(--ease-out);
}

.animate-zoom.animate-ready {
    opacity: 0;
    transform: scale(0.95);
}

.animate-zoom.visible {
    opacity: 1;
    transform: scale(1);
}

/* Fade In Animation */
.animate-fade-in {
    opacity: 1;
    transition: all 0.6s var(--ease-out);
}

.animate-fade-in.animate-ready {
    opacity: 0;
}

.animate-fade-in.visible {
    opacity: 1;
}

/* Pulse Animation */
.animate-pulse {
    opacity: 1;
}

.animate-pulse.animate-ready {
    opacity: 0;
    animation: pulseIn 1s var(--ease-out) forwards;
}

.animate-pulse.visible {
    opacity: 1;
}

@keyframes pulseIn {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide Right Animation */
.animate-slide-right {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s var(--ease-out);
}

.animate-slide-right.animate-ready {
    opacity: 0;
    transform: translateX(-40px);
}

[dir="rtl"] .animate-slide-right.animate-ready {
    transform: translateX(40px);
}

.animate-slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Left Animation */
.animate-slide-left {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s var(--ease-out);
}

.animate-slide-left.animate-ready {
    opacity: 0;
    transform: translateX(40px);
}

[dir="rtl"] .animate-slide-left.animate-ready {
    transform: translateX(-40px);
}

.animate-slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Parallax Effect on Bg Layers */
.parallax-bg {
    transition: none;
    animation: slowZoom 20s infinite alternate;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Delays */
.delay-1 {
    animation-delay: 0.2s;
    transition-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
    transition-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
    transition-delay: 0.6s;
}

/* Loader Animation */
.loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

.loading .loader {
    opacity: 1;
}

body:not(.loading) .loader {
    opacity: 0;
    pointer-events: none;
}

.loader-logo {
    width: 100px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.loader-line {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.loader-line::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: var(--primary);
    animation: loadLine 3s ease-in-out forwards;
}

@keyframes loadLine {
    0% {
        width: 0%;
        left: 0;
    }

    50% {
        width: 70%;
        left: 0;
    }

    100% {
        width: 100%;
        left: 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}