/* ========== Animations ========== */

/* Windmill Blade Rotation */
@keyframes windmill-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.windmill-blades {
    animation: windmill-spin 8s linear infinite;
    transform-origin: center center;
}

.windmill-blades-2 {
    animation: windmill-spin 12s linear infinite;
    transform-origin: center center;
}

.windmill-blades-3 {
    animation: windmill-spin 10s linear infinite reverse;
    transform-origin: center center;
}

/* Fade In Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

/* Apply Animations */
.hero-content .hero-badge {
    animation: fadeInDown 0.8s ease-out;
}

.hero-content h1 {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-content p {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-btns {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

/* Post Card Hover Effects */
.post-card {
    animation: fadeInUp 0.6s ease-out both;
}

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

/* Glow Effect on Hover */
.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-normal);
    background: linear-gradient(135deg, rgba(0, 158, 95, 0.08), rgba(25, 118, 210, 0.05));
    pointer-events: none;
    z-index: 1;
}

.post-card:hover::before {
    opacity: 1;
}

.post-card {
    position: relative;
}

.post-card > * {
    position: relative;
    z-index: 2;
}

/* Pulse animation for CTA */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 158, 95, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 158, 95, 0);
    }
}

.resource-cta .btn-primary {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Gradient border animation */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-secondary), var(--color-accent), var(--color-primary));
    background-size: 200% 100%;
    animation: gradient-shift 4s linear infinite;
    z-index: 4;
}

/* Loading shimmer effect */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-card) 25%,
        var(--color-bg-card-hover) 50%,
        var(--color-bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* Scroll reveal (triggered by JS) */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Smooth scrollbar for dark theme */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
}

/* Number counting animation helper */
.count-animate {
    display: inline-block;
    transition: all var(--transition-normal);
}

/* Floating animation for decorative elements */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .windmill-blades,
    .windmill-blades-2,
    .windmill-blades-3 {
        animation: none;
    }

    .hero-particles {
        animation: none;
    }

    .hero-section::after {
        animation: none;
    }
}
