/* ============================================
   ANIMATIONS.CSS - Smooth Scroll & Micro-interactions
   ============================================ */

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fade-in on scroll animation */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for cards */
.ep-card {
    animation: fadeInUp 0.6s ease-out backwards;
}

.ep-card:nth-child(1) {
    animation-delay: 0.1s;
}

.ep-card:nth-child(2) {
    animation-delay: 0.2s;
}

.ep-card:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button hover effects */
.ep-btn {
    position: relative;
    overflow: hidden;
}

.ep-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ep-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Link hover underline effect */
.ep-nav__link,
.ep-mega-menu__link {
    position: relative;
}

.ep-nav__link::after,
.ep-mega-menu__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-solar-500);
    transition: width var(--transition-base);
}

.ep-nav__link:hover::after,
.ep-mega-menu__link:hover::after {
    width: 100%;
}

/* Card image zoom on hover */
.ep-card img {
    transition: transform var(--transition-slow);
}

.ep-card:hover img {
    transform: scale(1.05);
}

/* Pulse animation for CTA buttons */
@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(12, 163, 110, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(12, 163, 110, 0);
    }
}

.ep-btn--primary:hover {
    animation: pulse 2s infinite;
}

/* Loading spinner */
.ep-loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-gray-200);
    border-top-color: var(--color-solar-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Skeleton loading for content */
.ep-skeleton {
    background: linear-gradient(90deg,
            var(--color-gray-200) 25%,
            var(--color-gray-100) 50%,
            var(--color-gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Parallax effect for hero */
.ep-hero__background {
    transition: transform 0.1s ease-out;
}

/* Number counter animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ep-stat__value {
    animation: countUp 0.8s ease-out;
}

/* Slide in from left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hero content animation */
.ep-hero__eyebrow {
    animation: slideInLeft 0.6s ease-out 0.2s backwards;
}

.ep-hero__title {
    animation: slideInLeft 0.6s ease-out 0.4s backwards;
}

.ep-hero__subtitle {
    animation: slideInLeft 0.6s ease-out 0.6s backwards;
}

.ep-hero__cta {
    animation: slideInLeft 0.6s ease-out 0.8s backwards;
}

/* Focus visible styles */
*:focus-visible {
    outline: 2px solid var(--color-solar-500);
    outline-offset: 4px;
    border-radius: var(--radius-base);
}

/* Smooth color transitions */
a,
button,
.ep-card,
.ep-nav__link {
    transition: all var(--transition-base);
}

/* Image lazy load fade in */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}