/* ==========================================
   animations.css - Animations & Keyframes
   ========================================== */

/* ==========================================
   KEYFRAME DEFINITIONS
   ========================================== */

/* Logo Pulse Glow */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 255, 136, 0.3),
            inset 0 0 10px rgba(0, 255, 136, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(0, 255, 136, 0.6),
            inset 0 0 20px rgba(0, 255, 136, 0.2);
    }
}

/* Navigation Active Line */
@keyframes glow-line {
    0%, 100% {
        opacity: 0.5;
        transform: scaleX(0.8);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

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

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

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

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

/* Simple Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Lightbox Slide */
@keyframes lightboxSlide {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Glitch Effect */
@keyframes glitch {
    0%, 100% {
        text-shadow: 
            2px 0 var(--retro-glow),
            -2px 0 var(--highlight-red);
        transform: translate(0);
    }
    20% {
        text-shadow: 
            2px 0 var(--highlight-red),
            -2px 0 var(--retro-glow);
        transform: translate(-2px, 2px);
    }
    40% {
        text-shadow: 
            -2px 0 var(--retro-glow),
            2px 0 var(--highlight-red);
        transform: translate(-2px, -2px);
    }
    60% {
        text-shadow: 
            2px 0 var(--highlight-red),
            -2px 0 var(--retro-glow);
        transform: translate(2px, 2px);
    }
    80% {
        text-shadow: 
            -2px 0 var(--retro-glow),
            2px 0 var(--highlight-red);
        transform: translate(2px, -2px);
    }
}

/* Glitch Text Clip */
@keyframes glitch-clip {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
    5% {
        clip-path: polygon(0 0, 100% 0, 100% 55%, 0 55%);
    }
    10% {
        clip-path: polygon(0 40%, 100% 40%, 100% 85%, 0 85%);
    }
    15% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* Slide In animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes slideInBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Bounce */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Shake */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

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

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Scan Line (Retro CRT Effect) */
@keyframes scan-line {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

/* Flicker (Neon Effect) */
@keyframes flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        opacity: 1;
        text-shadow: 
            0 0 4px var(--retro-glow),
            0 0 11px var(--retro-glow),
            0 0 19px var(--retro-glow);
    }
    20%, 24%, 55% {
        opacity: 0.4;
        text-shadow: none;
    }
}

/* ==========================================
   ANIMATION CLASSES
   ========================================== */

/* Glitch Effect Class */
.glitch {
    position: relative;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-clip 0.5s infinite;
    color: var(--retro-glow);
    z-index: -1;
}

.glitch::after {
    animation: glitch-clip 0.5s infinite reverse;
    color: var(--highlight-red);
    z-index: -2;
}

/* Fade Animations */
.fade-in {
    animation: fadeIn var(--duration-base) ease forwards;
}

.fade-in-up {
    animation: fadeInUp var(--duration-base) ease forwards;
}

.fade-in-down {
    animation: fadeInDown var(--duration-base) ease forwards;
}

.fade-in-left {
    animation: fadeInLeft var(--duration-base) ease forwards;
}

.fade-in-right {
    animation: fadeInRight var(--duration-base) ease forwards;
}

/* Scale Animation */
.scale-in {
    animation: scaleIn var(--duration-base) ease forwards;
}

/* Slide Animations */
.slide-in-left {
    animation: slideInLeft var(--duration-base) ease forwards;
}

.slide-in-right {
    animation: slideInRight var(--duration-base) ease forwards;
}

.slide-in-top {
    animation: slideInTop var(--duration-base) ease forwards;
}

.slide-in-bottom {
    animation: slideInBottom var(--duration-base) ease forwards;
}

/* Bounce Animation */
.bounce {
    animation: bounce 1s ease infinite;
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease;
}

/* Rotate Animation */
.rotate {
    animation: rotate 2s linear infinite;
}

/* Typewriter Animation */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--ink-black);
    animation: 
        typewriter 3s steps(40, end),
        blink 0.75s step-end infinite;
}

/* Flicker Animation */
.flicker {
    animation: flicker 3s ease-in-out infinite;
}

/* ==========================================
   HOVER EFFECTS
   ========================================== */

/* Hover Lift */
.hover-lift {
    transition: transform var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* Hover Grow */
.hover-grow {
    transition: transform var(--transition-base);
}

.hover-grow:hover {
    transform: scale(1.05);
}

/* Hover Shrink */
.hover-shrink {
    transition: transform var(--transition-base);
}

.hover-shrink:hover {
    transform: scale(0.95);
}

/* Hover Rotate */
.hover-rotate {
    transition: transform var(--transition-base);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Hover Glow */
.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

/* Hover Shadow */
.hover-shadow {
    transition: box-shadow var(--transition-base);
}

.hover-shadow:hover {
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   TRANSITION UTILITIES
   ========================================== */

.transition-all {
    transition: all var(--transition-base);
}

.transition-fast {
    transition-duration: var(--duration-fast);
}

.transition-slow {
    transition-duration: var(--duration-slow);
}

.transition-none {
    transition: none;
}

/* Easing Functions */
.ease-linear {
    transition-timing-function: linear;
}

.ease-in {
    transition-timing-function: ease-in;
}

.ease-out {
    transition-timing-function: ease-out;
}

.ease-in-out {
    transition-timing-function: ease-in-out;
}

/* ==========================================
   ANIMATION DELAYS
   ========================================== */

.delay-100 {
    animation-delay: 100ms;
}

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

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

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

.delay-1000 {
    animation-delay: 1000ms;
}

/* ==========================================
   SPECIAL EFFECTS
   ========================================== */

/* Scan Line Overlay */
.scan-line::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(0, 255, 136, 0.4),
        transparent
    );
    animation: scan-line 8s linear infinite;
    pointer-events: none;
    z-index: var(--z-max);
}

/* CRT Screen Effect */
.crt-effect {
    position: relative;
}

.crt-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
}

/* ==========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* Use GPU acceleration for animations */
.gpu-accelerate {
    will-change: transform;
    transform: translateZ(0);
}

/* Reduce motion for accessibility */
@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;
    }
    
    .glitch,
    .flicker,
    .bounce,
    .rotate {
        animation: none !important;
    }
}