/* ===========================================================
   PERFORMANCE-OPTIMIZED SCROLL ANIMATIONS
   Using CSS transforms & opacity for GPU acceleration
   =========================================================== */

/* Base state for all scroll animations - invisible and transformed */
.scroll-fade-up,
.scroll-fade-in,
.scroll-slide-left,
.scroll-slide-right,
.scroll-scale-up,
.scroll-rotate-in,
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

/* Fade Up - Slides up while fading in */
.scroll-fade-up {
    transform: translateY(40px);
}

.scroll-fade-up.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In - Simple fade without movement */
.scroll-fade-in {
    transform: none;
}

.scroll-fade-in.in-view {
    opacity: 1;
}

/* Slide from Left */
.scroll-slide-left {
    transform: translateX(-60px);
}

.scroll-slide-left.in-view {
    opacity: 1;
    transform: translateX(0);
}

/* Slide from Right */
.scroll-slide-right {
    transform: translateX(60px);
}

.scroll-slide-right.in-view {
    opacity: 1;
    transform: translateX(0);
}

/* Scale Up - Grows while fading in */
.scroll-scale-up {
    transform: scale(0.9);
}

.scroll-scale-up.in-view {
    opacity: 1;
    transform: scale(1);
}

/* Rotate In - Rotates slightly while fading in */
.scroll-rotate-in {
    transform: rotate(-5deg) scale(0.95);
}

.scroll-rotate-in.in-view {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Generic animate class */
.animate-on-scroll {
    transform: translateY(30px);
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ===== STAGGERED ANIMATIONS ===== */
/* Add delays for child elements */
.stagger-children>* {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stagger-children.in-view>*:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-children.in-view>*:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-children.in-view>*:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-children.in-view>*:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-children.in-view>*:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-children.in-view>*:nth-child(6) {
    transition-delay: 0.6s;
}

.stagger-children.in-view>* {
    opacity: 1;
    transform: translateY(0);
}

/* ===== REVEAL ANIMATIONS ===== */
@keyframes revealFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandWidth {
    from {
        width: 0;
        opacity: 0;
    }

    to {
        width: 100%;
        opacity: 1;
    }
}

/* Reveal effect for underlines or borders */
.reveal-line {
    position: relative;
    overflow: hidden;
}

.reveal-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-line.in-view::after {
    width: 100%;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    .scroll-fade-up,
    .scroll-fade-in,
    .scroll-slide-left,
    .scroll-slide-right,
    .scroll-scale-up,
    .scroll-rotate-in,
    .animate-on-scroll,
    .stagger-children>* {
        animation: none !important;
        transition: opacity 0.3s ease !important;
        transform: none !important;
    }
}

/* Prevent animations on page load */
.preload * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
}

/* Mobile optimization - faster animations */
@media (max-width: 768px) {

    .scroll-fade-up,
    .scroll-fade-in,
    .scroll-slide-left,
    .scroll-slide-right,
    .scroll-scale-up,
    .scroll-rotate-in,
    .animate-on-scroll {
        transition-duration: 0.5s;
    }

    .stagger-children>* {
        transition-duration: 0.4s;
    }
}