/**
 * Motion, Transitions & Scroll-driven Animations
 * CT TerraMach Website
 */

/* Fade-In Animation (Static above-the-fold) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Standard Scroll Reveal classes (Used by JS Fallback/Observer) */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Progressive Scroll-driven Animations (Native browser engine compositor) */
@supports ((animation-timeline: view()) and (animation-range: entry)) {
    /* Prevent JS interaction conflict */
    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
        animation: nativeReveal linear both;
        animation-timeline: view();
        animation-range: entry 5% entry 40%;
    }
}

@keyframes nativeReveal {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Pulse / Interactive micro-animations */
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.pulse-primary {
    animation: pulseGlow 2s infinite;
}

/* Media Query: Respect user OS preferences for reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
    .reveal-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}
