@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

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

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes skillBarFill {
    0% {
        width: 0;
    }
    100% {
        width: var(--target-width);
    }
}

/* Wave background should always be visible - exclude from entrance animations */
.wave-background {
    opacity: 1 !important;
}

.wave-layer {
    opacity: 0.8 !important;
}

/*
 * Hero Section Entrance Animations
 * Animate specific elements instead of using a broad selector
 * to ensure the wave background is never accidentally hidden.
 */
.profile-image-wrapper,
.hero-title,
.hero-subtitle,
.hero-description,
.hero-stats {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.hero-title {
    animation-delay: 0.3s;
}

.hero-subtitle {
    animation-delay: 0.5s;
}

.hero-description {
    animation-delay: 0.7s;
}

.hero-stats {
    animation-delay: 0.9s;
}

.profile-image-wrapper {
    animation-delay: 0.1s;
}

/* Section animations - improved stability */
.section {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s ease;
}

.section-content {
    opacity: 1;
    animation: none;
}

/* Timeline animations - more stable */
.timeline-item {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.6s ease;
}

.timeline-item.animate {
    animation: slideIn 0.6s ease forwards;
}

.timeline-item:nth-child(1).animate { animation-delay: 0.1s; }
.timeline-item:nth-child(2).animate { animation-delay: 0.2s; }
.timeline-item:nth-child(3).animate { animation-delay: 0.3s; }

/* Card hover animations */
.experience-card,
.engagement-card,
.skill-category {
    transition: all 0.3s ease;
}

.experience-card:hover,
.skill-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Skill bar animations - prevent layout shift */
.skill-item {
    opacity: 1;
}

.skill-item.animate .skill-bar {
    animation: skillBarFill 1s ease forwards;
}

/* Button and link animations */
.external-link {
    position: relative;
    overflow: hidden;
}

.external-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.external-link:hover::before {
    left: 100%;
}

/* Scroll animations */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-bounce-in {
    animation: bounceIn 0.8s ease forwards;
}

/* Loading animations */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.loading {
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

/* Hover effects for interactive elements */
.section-header {
    position: relative;
}

.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.section-header:hover::before {
    width: 100%;
}

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

/* Focus animations for accessibility */
.section-header:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile touch animations */
@media (hover: none) and (pointer: coarse) {
    .experience-card:active,
    .engagement-card:active {
        transform: scale(0.98);
    }
}

/* Prevent animation jumping on load */
body {
    overflow-x: hidden;
}

.hero-section {
    overflow: hidden;
}

/* 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;
        scroll-behavior: auto !important;
    }
}