/**
 * Jerry's Spare Animations
 * Reusable keyframes and utility classes for motion design
 */

/* =========================================================================
   KEYFRAMES
   ========================================================================= */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

@keyframes pulseSoft {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* =========================================================================
   ANIMATION CLASSES
   ========================================================================= */

.anim-fade-in { animation: fadeIn var(--transition-slow) forwards; }
.anim-fade-up { animation: fadeUp var(--transition-slow) forwards; }
.anim-fade-down { animation: fadeDown var(--transition-slow) forwards; }
.anim-fade-left { animation: fadeInLeft var(--transition-slow) forwards; }
.anim-fade-right { animation: fadeInRight var(--transition-slow) forwards; }
.anim-scale-in { animation: scaleIn var(--transition-slow) forwards; }

/* Scroll trigger utility class (added by JS when entering viewport) */
.scroll-animate {
    opacity: 0;
    animation-fill-mode: forwards;
}

/* Staggered Children Animations */
.stagger-children > * {
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.hover-zoom-img {
    overflow: hidden;
}
.hover-zoom-img img {
    transition: transform var(--transition-slow);
}
.hover-zoom-img:hover img {
    transform: scale(1.05);
}

/* Marquee Container */
.marquee-track {
    display: flex;
    white-space: nowrap;
    animation: marquee 30s linear infinite;
    width: max-content;
}
.marquee-track:hover {
    animation-play-state: paused;
}

/* Preloader */
.preloader {
    position: fixed;
    inset: 0;
    background: var(--color-white);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}
.preloader.fade-out {
    opacity: 0;
    pointer-events: none;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* WhatsApp Pulse */
.whatsapp-float-btn {
    animation: pulseSoft 2s infinite;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
