/* Animations and Transitions */

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

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

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

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

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

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Hero Animations */
@keyframes heroTitleReveal {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroBadgeReveal {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroSubtitleReveal {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes heroCtaReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(26, 58, 82, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(26, 58, 82, 0.8);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Page Load Animations */
.page-loaded .hero-badge {
    animation: heroBadgeReveal 0.8s ease-out forwards;
}

.page-loaded .hero-title {
    animation: heroTitleReveal 0.9s ease-out 0.1s forwards;
    opacity: 0;
}

.page-loaded .hero-subtitle {
    animation: heroSubtitleReveal 1s ease-out 0.2s forwards;
    opacity: 0;
}

.page-loaded .hero-ctas {
    animation: heroCtaReveal 1s ease-out 0.3s forwards;
    opacity: 0;
}

/* Card Animations */
.info-card {
    animation: fadeInUp 0.6s ease-out;
}

.news-card {
    transition: all 0.3s ease;
}

.research-card {
    transition: all 0.3s ease;
}

.stat-card {
    transition: all 0.3s ease;
}

/* Link Hover Effects */
a {
    position: relative;
}

/* Underline Animation */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Button Animations */
button {
    position: relative;
    overflow: hidden;
}

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

button:active::before {
    width: 300px;
    height: 300px;
}

/* Smooth Page Transitions */
.fade-in-page {
    animation: fadeInUp 0.5s ease-out;
}

.fade-out-page {
    animation: fadeInUp 0.5s ease-out reverse;
}

/* Sticky Header Animation */
.navbar.scrolled {
    animation: slideInDown 0.3s ease-out;
}

/* Mobile Menu Animation */
.mobile-menu.active {
    animation: slideInDown 0.3s ease-out;
}

.hamburger.active {
    animation: pulse 0.3s ease-out;
}

/* Scroll Reveal Animations */
.scroll-reveal {
    opacity: 0;
}

.scroll-reveal.in-view {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Staggered Animations */
.stagger-item {
    opacity: 0;
}

.stagger-item.in-view {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-item:nth-child(1).in-view { animation-delay: 0s; }
.stagger-item:nth-child(2).in-view { animation-delay: 0.1s; }
.stagger-item:nth-child(3).in-view { animation-delay: 0.2s; }
.stagger-item:nth-child(4).in-view { animation-delay: 0.3s; }
.stagger-item:nth-child(5).in-view { animation-delay: 0.4s; }
.stagger-item:nth-child(6).in-view { animation-delay: 0.5s; }

/* Smooth Transitions for Interactive Elements */
input, select, textarea {
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(26, 58, 82, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Tooltip Animation */
.tooltip {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* Image Lazy Load */
img[loading="lazy"] {
    animation: fadeInUp 0.5s ease-out;
}

/* No transition for reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
