/* ============================================================
   ANIMATIONS
   ============================================================ */

/* ==================== KEYFRAMES ==================== */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes wave {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-12px); }
    60% { transform: translateY(-6px); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes particle-float {
    0% { transform: translate(0, 0) scale(1); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes reveal-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes reveal-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes reveal-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes code-line {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* ==================== SCROLL REVEAL CLASSES ==================== */
.reveal-up,
.reveal-left,
.reveal-right {
    opacity: 0;
    will-change: transform, opacity;
}

.reveal-up.revealed {
    animation: reveal-up 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-delay: var(--delay, 0s);
}

.reveal-left.revealed {
    animation: reveal-left 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-delay: var(--delay, 0s);
}

.reveal-right.revealed {
    animation: reveal-right 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-delay: var(--delay, 0s);
}

/* ==================== CODE HIGHLIGHTING ==================== */
.code-keyword { color: #c678dd; }
.code-string { color: #98c379; }
.code-type { color: #e5c07b; }
.code-variable { color: #e06c75; }
.code-property { color: #61afef; }
.code-comment { color: #5c6370; font-style: italic; }
.code-number { color: #d19a66; }
.code-bracket { color: #abb2bf; }
.code-punctuation { color: #abb2bf; }

[data-theme="light"] .code-keyword { color: #7c3aed; }
[data-theme="light"] .code-string { color: #059669; }
[data-theme="light"] .code-type { color: #d97706; }
[data-theme="light"] .code-variable { color: #dc2626; }
[data-theme="light"] .code-property { color: #2563eb; }
[data-theme="light"] .code-comment { color: #9ca3af; }
[data-theme="light"] .code-number { color: #ea580c; }
[data-theme="light"] .code-bracket { color: #374151; }
[data-theme="light"] .code-punctuation { color: #374151; }

/* Code line animation */
.code-line {
    display: block;
    opacity: 0;
    animation: code-line 0.4s ease forwards;
}

.code-line:nth-child(1) { animation-delay: 0.8s; }
.code-line:nth-child(2) { animation-delay: 0.9s; }
.code-line:nth-child(3) { animation-delay: 1.0s; }
.code-line:nth-child(4) { animation-delay: 1.1s; }
.code-line:nth-child(5) { animation-delay: 1.2s; }
.code-line:nth-child(6) { animation-delay: 1.3s; }
.code-line:nth-child(7) { animation-delay: 1.4s; }
.code-line:nth-child(8) { animation-delay: 1.5s; }
.code-line:nth-child(9) { animation-delay: 1.6s; }
.code-line:nth-child(10) { animation-delay: 1.7s; }
.code-line:nth-child(11) { animation-delay: 1.8s; }
.code-line:nth-child(12) { animation-delay: 1.9s; }
.code-line:nth-child(13) { animation-delay: 2.0s; }
.code-line:nth-child(14) { animation-delay: 2.1s; }

/* ==================== PARTICLES ==================== */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0;
    animation: particle-float var(--duration, 8s) linear infinite;
    animation-delay: var(--particle-delay, 0s);
}

/* ==================== TIMELINE DOT PULSE ==================== */
.timeline__dot {
    animation: pulse-ring 2s ease-in-out infinite;
}

/* ==================== HOVER LIFT ==================== */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

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

    .reveal-up,
    .reveal-left,
    .reveal-right {
        opacity: 1;
    }

    html { scroll-behavior: auto; }
}
