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

.fade-in {
    animation: fadeIn 1s ease-in;
}

/* Slide Up */
@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

/* Neon Pulse */
@keyframes neonPulse {
    0% {
        text-shadow: 
            0 0 5px var(--text),
            0 0 10px var(--text),
            0 0 20px var(--primary),
            0 0 40px var(--primary),
            0 0 80px var(--primary);
    }
    50% {
        text-shadow: 
            0 0 5px var(--text),
            0 0 15px var(--text),
            0 0 30px var(--primary),
            0 0 60px var(--primary),
            0 0 100px var(--primary);
    }
    100% {
        text-shadow: 
            0 0 5px var(--text),
            0 0 10px var(--text),
            0 0 20px var(--primary),
            0 0 40px var(--primary),
            0 0 80px var(--primary);
    }
}

.neon-pulse {
    animation: neonPulse 2s infinite;
}

/* Text Glow Animation */
@keyframes textGlow {
    0% {
        text-shadow: 
            0 0 10px var(--neon-cyan),
            0 0 20px var(--neon-cyan),
            0 0 30px var(--neon-cyan);
    }
    50% {
        text-shadow: 
            0 0 20px var(--neon-cyan),
            0 0 30px var(--neon-cyan),
            0 0 40px var(--neon-cyan),
            0 0 50px var(--neon-cyan);
    }
    100% {
        text-shadow: 
            0 0 10px var(--neon-cyan),
            0 0 20px var(--neon-cyan),
            0 0 30px var(--neon-cyan);
    }
}

/* Box Glow Animation */
@keyframes boxGlow {
    0% {
        box-shadow: 
            0 0 10px var(--neon-magenta),
            inset 0 0 5px var(--neon-magenta);
    }
    50% {
        box-shadow: 
            0 0 20px var(--neon-magenta),
            inset 0 0 10px var(--neon-magenta);
    }
    100% {
        box-shadow: 
            0 0 10px var(--neon-magenta),
            inset 0 0 5px var(--neon-magenta);
    }
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Glitch Animation */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Scanline Animation */
@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* Grid Movement */
@keyframes gridMove {
    0% {
        transform: perspective(1000px) rotateX(60deg) translateY(0);
    }
    100% {
        transform: perspective(1000px) rotateX(60deg) translateY(-100%);
    }
}

/* Retro Typing */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    50% { border-color: transparent; }
}

.typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary);
    animation: 
        typing 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

/* Rainbow Text */
@keyframes rainbow {
    0% { color: #ff0000; }
    17% { color: #ff00ff; }
    33% { color: #0000ff; }
    50% { color: #00ffff; }
    67% { color: #00ff00; }
    83% { color: #ffff00; }
    100% { color: #ff0000; }
}

.rainbow-text {
    animation: rainbow 4s linear infinite;
}

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

.scale-in {
    animation: scaleIn 0.5s ease-out;
}

/* Rotate In */
@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    to {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
}

.rotate-in {
    animation: rotateIn 0.7s ease-out;
}

/* Apply Animations to Elements */
.hero h1 {
    animation: fadeIn 1s ease-in, neonPulse 2s infinite;
}

.hero p {
    animation: slideUp 0.8s ease-out;
}

.project-card {
    animation: scaleIn 0.5s ease-out;
}

.skill-card {
    animation: rotateIn 0.7s ease-out;
}

.contact-form {
    animation: fadeIn 1s ease-in;
}

/* Button Hover Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

.btn:hover::after {
    left: 100%;
}

/* Apply Animations */
.glow-text {
    animation: textGlow 2s ease-in-out infinite;
}

.glow-box {
    animation: boxGlow 2s ease-in-out infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.glitch {
    animation: glitch 0.3s infinite;
}

/* Scanline Effect */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: scanline 4s linear infinite;
    pointer-events: none;
    z-index: 9999;
}

/* Grid Animation */
.animated-grid {
    animation: gridMove 30s linear infinite;
}

/* Pixel Text Animation */
@keyframes pixelate {
    0% {
        filter: blur(15px);
        opacity: 0;
        transform: scale(1.2);
    }
    25% {
        filter: blur(10px);
        opacity: 0.3;
        transform: scale(1.1);
    }
    50% {
        filter: blur(5px);
        opacity: 0.5;
        transform: scale(1.05);
    }
    75% {
        filter: blur(2px);
        opacity: 0.8;
        transform: scale(1.02);
    }
    100% {
        filter: blur(0);
        opacity: 1;
        transform: scale(1);
    }
}

.pixel-text {
    animation: pixelate 1.5s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    animation-fill-mode: backwards;
}

.pixel-text.delayed {
    animation-delay: 0.8s;
}

/* Pixel Assembly Animation */
@keyframes pixelAssemble {
    0% {
        transform: translate(var(--start-x, -100px), var(--start-y, -100px)) scale(0.1);
        opacity: 0;
        filter: blur(8px);
    }
    50% {
        transform: translate(var(--mid-x, 0), var(--mid-y, 0)) scale(1.2);
        opacity: 0.5;
        filter: blur(4px);
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.pixel-char {
    display: inline-block;
    position: relative;
    opacity: 0;
    transform-origin: center;
    animation: pixelAssemble 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Random starting positions for each character */
.pixel-text .pixel-char:nth-child(1) { --start-x: -200px; --start-y: -150px; --mid-x: 20px; --mid-y: 20px; animation-delay: 0s; }
.pixel-text .pixel-char:nth-child(2) { --start-x: 200px; --start-y: -120px; --mid-x: -20px; --mid-y: 15px; animation-delay: 0.1s; }
.pixel-text .pixel-char:nth-child(3) { --start-x: -180px; --start-y: 150px; --mid-x: 15px; --mid-y: -20px; animation-delay: 0.2s; }
.pixel-text .pixel-char:nth-child(4) { --start-x: 180px; --start-y: 120px; --mid-x: -15px; --mid-y: -15px; animation-delay: 0.3s; }
.pixel-text .pixel-char:nth-child(5) { --start-x: -150px; --start-y: -180px; --mid-x: 20px; --mid-y: 25px; animation-delay: 0.4s; }
.pixel-text .pixel-char:nth-child(6) { --start-x: 150px; --start-y: 180px; --mid-x: -25px; --mid-y: -20px; animation-delay: 0.5s; }
.pixel-text .pixel-char:nth-child(7) { --start-x: -200px; --start-y: -120px; --mid-x: 30px; --mid-y: 15px; animation-delay: 0.6s; }
.pixel-text .pixel-char:nth-child(8) { --start-x: 200px; --start-y: 150px; --mid-x: -20px; --mid-y: -25px; animation-delay: 0.7s; }
.pixel-text .pixel-char:nth-child(9) { --start-x: -180px; --start-y: -150px; --mid-x: 25px; --mid-y: 20px; animation-delay: 0.8s; }
.pixel-text .pixel-char:nth-child(10) { --start-x: 180px; --start-y: 120px; --mid-x: -30px; --mid-y: -15px; animation-delay: 0.9s; }
.pixel-text .pixel-char:nth-child(11) { --start-x: -150px; --start-y: -180px; --mid-x: 20px; --mid-y: 25px; animation-delay: 1s; }
.pixel-text .pixel-char:nth-child(12) { --start-x: 150px; --start-y: 180px; --mid-x: -25px; --mid-y: -20px; animation-delay: 1.1s; }
.pixel-text .pixel-char:nth-child(13) { --start-x: -200px; --start-y: -120px; --mid-x: 30px; --mid-y: 15px; animation-delay: 1.2s; }
.pixel-text .pixel-char:nth-child(14) { --start-x: 200px; --start-y: 150px; --mid-x: -20px; --mid-y: -25px; animation-delay: 1.3s; }
.pixel-text .pixel-char:nth-child(15) { --start-x: -180px; --start-y: -150px; --mid-x: 25px; --mid-y: 20px; animation-delay: 1.4s; }

/* Delayed text animation */
.pixel-text.delayed .pixel-char {
    animation-delay: calc(1.5s + var(--char-index, 0) * 0.1s);
}

/* Remove old pixel animations */
.pixel-text {
    display: inline-block;
} 