/* Animations & Keyframes */
/* All @keyframes animations used throughout the application */

/* ========================================
   FADE & SLIDE ANIMATIONS
   ======================================== */

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes highlightSection {
    0% { background-color: rgba(102, 126, 234, 0.1); }
    100% { background-color: transparent; }
}

/* ========================================
   PATTERN & PARTICLE ANIMATIONS
   ======================================== */

@keyframes movePattern {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* ========================================
   PULSE & FLOAT ANIMATIONS
   ======================================== */

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

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

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

@keyframes offline-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ========================================
   LOADING & SHIMMER ANIMATIONS
   ======================================== */

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   TYPEWRITER EFFECT
   ======================================== */

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-primary); }
}

/* ========================================
   GRADIENT & MORPHING ANIMATIONS
   ======================================== */

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

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

/* ========================================
   UTILITY CLASSES FOR ANIMATIONS
   ======================================== */

/* Generic fade in */
.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Float effect */
.float-effect {
    animation: float 3s ease-in-out infinite;
}

/* Loading shimmer effect */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-surface) 0%,
        var(--bg-elevated) 50%,
        var(--bg-surface) 100%
    );
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--accent-primary);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

/* Glowing effect */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    background-size: 200% 200%;
    animation: gradient-morph 3s ease infinite;
    border-radius: inherit;
    z-index: -1;
    filter: blur(10px);
    opacity: 0.5;
}

/* Particle container */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: var(--accent-primary);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.3;
    animation: float-particle linear infinite;
}

/* ========================================
   PROGRESSIVE REVEAL FOR SECTIONS
   ======================================== */

.section {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section.visible,
.section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   SMOOTH TRANSITIONS
   ======================================== */

/* Smooth scroll enhancement for targeted sections */
section:target {
    animation: highlightSection 2s ease-in-out;
}

/* Smooth transitions for theme changes */
.theme-transitions-enabled * {
    transition: background-color 0.3s ease,
               color 0.3s ease,
               border-color 0.3s ease,
               box-shadow 0.3s ease !important;
}

/* ========================================
   ACCESSIBILITY - REDUCED MOTION
   ======================================== */

@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;
    }

    .particle {
        animation: none !important;
    }

    .loading-shimmer {
        animation: none !important;
        background: var(--bg-surface) !important;
    }

    .typewriter {
        animation: none !important;
        border-right: none !important;
    }

    .glow-effect::before {
        animation: none !important;
    }
}

/* ========================================
   LAZY LOADING STATES
   ======================================== */

/* Lazy Loading - Performance Optimization */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-load.loaded {
    opacity: 1;
}

.lazy-load.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}
