/* ==========================================
   Animations CSS - Keyframes & Transitions
   ========================================== */

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

/* Pulse Animation for Start Journey Button */
@keyframes pulse {

    0%,
    100% {
        box-shadow:
            0 0 0 0 rgba(124, 58, 237, 0.4),
            var(--shadow-lg);
    }

    50% {
        box-shadow:
            0 0 0 15px rgba(124, 58, 237, 0),
            var(--shadow-lg);
    }
}

/* Glow Animation */
@keyframes glow {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(124, 58, 237, 0.4),
            0 0 40px rgba(124, 58, 237, 0.2),
            0 0 60px rgba(124, 58, 237, 0.1);
    }

    50% {
        box-shadow:
            0 0 30px rgba(124, 58, 237, 0.6),
            0 0 60px rgba(124, 58, 237, 0.4),
            0 0 90px rgba(124, 58, 237, 0.2);
    }
}

/* Float Animation for Background Elements */
@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(50px, -30px) rotate(5deg);
    }

    50% {
        transform: translate(20px, -60px) rotate(-5deg);
    }

    75% {
        transform: translate(-30px, -30px) rotate(3deg);
    }
}

/* Blink Animation for Cursor */
@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Fade In Down Animation */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

/* Fade In Left Animation */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

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

/* Fade In Right Animation */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

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

/* Scale In Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Shake Animation */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

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

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

/* ==========================================
   Animation Classes
   ========================================== */

/* Button Glow Effect */
.btn--glow {
    animation: pulse 2s infinite;
}

.btn--glow:hover {
    animation: glow 1.5s ease-in-out infinite;
}

/* Entrance Animations */
.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slower) ease forwards;
}

.animate-fade-in-down {
    animation: fadeInDown var(--transition-slower) ease forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft var(--transition-slower) ease forwards;
}

.animate-fade-in-right {
    animation: fadeInRight var(--transition-slower) ease forwards;
}

.animate-scale-in {
    animation: scaleIn var(--transition-slow) ease forwards;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

/* Pre-animation State (for scroll-triggered animations) */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all var(--transition-slower) ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Animation Delays */
.stagger-1 {
    animation-delay: 100ms;
}

.stagger-2 {
    animation-delay: 200ms;
}

.stagger-3 {
    animation-delay: 300ms;
}

.stagger-4 {
    animation-delay: 400ms;
}

.stagger-5 {
    animation-delay: 500ms;
}

.stagger-6 {
    animation-delay: 600ms;
}

/* Section Transition */
.section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slower) ease, transform var(--transition-slower) ease;
}

.section.active,
.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Card Hover Transitions */
.skill-card,
.project-card,
.mindset-card {
    transition:
        transform var(--transition-base) ease,
        box-shadow var(--transition-base) ease,
        border-color var(--transition-base) ease,
        background var(--transition-base) ease;
}

/* Demo expansion animation */
.skill-card__demo {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all var(--transition-slow) ease;
}

.skill-card__demo:not(.hidden) {
    max-height: 500px;
    opacity: 1;
}

/* Modal Animations */
.modal {
    transition:
        opacity var(--transition-base) ease,
        visibility var(--transition-base) ease;
}

.modal__content {
    transition: transform var(--transition-base) ease;
}

/* Button Icon Arrow Animation */
.btn .btn__icon {
    transition: transform var(--transition-fast) ease;
}

.btn:hover .btn__icon {
    transform: translateX(4px);
}

/* Nav Dot Transitions */
.nav-dot {
    transition:
        background var(--transition-fast) ease,
        transform var(--transition-fast) ease,
        box-shadow var(--transition-fast) ease;
}

/* Link Underline Animation */
a.animated-underline {
    position: relative;
}

a.animated-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base) ease;
}

a.animated-underline:hover::after {
    width: 100%;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* Shimmer Loading Effect */
.shimmer {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s 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;
        scroll-behavior: auto !important;
    }

    .btn--glow {
        animation: none;
    }

    .landing__bg-animation::before,
    .landing__bg-animation::after {
        animation: none;
    }

    .intro__line .cursor {
        animation: none;
        opacity: 1;
    }

    .section {
        opacity: 1;
        transform: none;
    }

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }

    .spinner {
        animation: none;
        border-color: var(--color-primary);
    }
}