/**
 * Backyard Beef - Shared Animations
 * Reusable animation keyframes and component styles
 */

/* ==========================================================================
   Crossfade Slideshow
   Used for: Food images on landing page
   ========================================================================== */

.slideshow {
    position: relative;
}

.slideshow-slide {
    position: absolute;
    top: 0;
    left: 0;
    animation: crossfade 8s ease-in-out infinite;
}

.slideshow-slide:nth-child(1) {
    animation-delay: 0s;
}

.slideshow-slide:nth-child(2) {
    animation-delay: 4s;
}

@keyframes crossfade {
    0%, 45% { opacity: 1; }
    50%, 95% { opacity: 0; }
    100% { opacity: 1; }
}


/* ==========================================================================
   Scroll Animations
   Used for: How It Works timeline, batch grid
   ========================================================================== */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Animation variants */
.animate-fade-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-fade-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-scale-up {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-fade-left.is-visible,
.animate-fade-right.is-visible,
.animate-scale-up.is-visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Staggered delays for grid items */
.animate-on-scroll[data-delay="1"],
.animate-fade-left[data-delay="1"],
.animate-fade-right[data-delay="1"],
.animate-scale-up[data-delay="1"] { transition-delay: 0.1s; }

.animate-on-scroll[data-delay="2"],
.animate-fade-left[data-delay="2"],
.animate-fade-right[data-delay="2"],
.animate-scale-up[data-delay="2"] { transition-delay: 0.2s; }

.animate-on-scroll[data-delay="3"],
.animate-fade-left[data-delay="3"],
.animate-fade-right[data-delay="3"],
.animate-scale-up[data-delay="3"] { transition-delay: 0.3s; }

.animate-on-scroll[data-delay="4"],
.animate-fade-left[data-delay="4"],
.animate-fade-right[data-delay="4"],
.animate-scale-up[data-delay="4"] { transition-delay: 0.4s; }

.animate-on-scroll[data-delay="5"],
.animate-fade-left[data-delay="5"],
.animate-fade-right[data-delay="5"],
.animate-scale-up[data-delay="5"] { transition-delay: 0.5s; }

/* ==========================================================================
   Number Step Indicators
   Used for: How it works steps
   ========================================================================== */

.step-number {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.step-number:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(111, 88, 64, 0.3);
}

/* ==========================================================================
   Section Dividers
   Organic wave shapes
   ========================================================================== */

.section-divider-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.section-divider-wave svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}


/* ==========================================================================
   Timeline Animations
   Used for: How It Works phase timeline
   ========================================================================== */

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #e8e4df; /* earth-200 */
    transform: translateX(-50%);
}

.timeline-line-fill {
    position: absolute;
    left: 50%;
    top: 0;
    width: 4px;
    background: #6f5840; /* earth-700 */
    transform: translateX(-50%);
    height: 0;
    transition: height 0.3s ease-out;
}

/* Mobile timeline (left-aligned) */
@media (max-width: 767px) {
    .timeline-line,
    .timeline-line-fill {
        left: 24px;
    }
}


/* ==========================================================================
   Batch Grid Animation
   Used for: How It Works batch filling visualization
   ========================================================================== */

.batch-cell {
    transition: all 0.3s ease-out;
}

.batch-cell.filled {
    background-color: #6f5840; /* earth-700 */
    transform: scale(1.05);
}

.batch-cell.filling {
    animation: pulse-fill 0.5s ease-out;
}

@keyframes pulse-fill {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.05); }
}


/* ==========================================================================
   Reduced Motion
   Respect user preferences for reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .slideshow-slide,
    .animate-on-scroll,
    .animate-fade-left,
    .animate-fade-right,
    .animate-scale-up,
    .timeline-line-fill,
    .batch-cell,
    .step-number {
        animation: none;
        transition: none;
    }

    .animate-on-scroll,
    .animate-fade-left,
    .animate-fade-right,
    .animate-scale-up {
        opacity: 1;
        transform: none;
    }

    .slideshow-slide:nth-child(2) {
        display: none;
    }

    .step-number:hover {
        transform: none;
    }
}
