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

/* Rotation Animation */
@keyframes rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

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

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

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--cyan-primary);
    animation: glitch-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 var(--pink-primary);
    animation: glitch-2 3s infinite linear alternate-reverse;
}

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

@keyframes glitch-1 {
    0% {
        clip-path: inset(40% 0 61% 0);
    }
    20% {
        clip-path: inset(92% 0 1% 0);
    }
    40% {
        clip-path: inset(43% 0 1% 0);
    }
    60% {
        clip-path: inset(25% 0 58% 0);
    }
    80% {
        clip-path: inset(54% 0 7% 0);
    }
    100% {
        clip-path: inset(58% 0 43% 0);
    }
}

@keyframes glitch-2 {
    0% {
        clip-path: inset(25% 0 58% 0);
    }
    20% {
        clip-path: inset(54% 0 7% 0);
    }
    40% {
        clip-path: inset(58% 0 43% 0);
    }
    60% {
        clip-path: inset(40% 0 61% 0);
    }
    80% {
        clip-path: inset(92% 0 1% 0);
    }
    100% {
        clip-path: inset(43% 0 1% 0);
    }
}

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

.pulse {
    animation: pulse 2s infinite;
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--cyan-primary),
                    0 0 10px var(--cyan-primary),
                    0 0 15px var(--cyan-primary);
    }
    50% {
        box-shadow: 0 0 10px var(--cyan-primary),
                    0 0 20px var(--cyan-primary),
                    0 0 30px var(--cyan-primary),
                    0 0 40px var(--pink-primary);
    }
}

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

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

/* 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 slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

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

/* Pixel Rain Animation */
.pixel-rain {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: pixelRainMove 20s linear infinite;
    opacity: 0.3;
}

@keyframes pixelRainMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 20px 20px;
    }
}

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

.scanline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    animation: scanline 8s linear infinite;
    z-index: 10;
}

/* Blink Animation */
@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.blink {
    animation: blink 1s infinite;
}

/* Character Animations */
.character {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.pacman {
    background: var(--yellow);
    bottom: 100px;
    left: -50px;
    clip-path: polygon(100% 50%, 0% 0%, 0% 100%);
    animation: pacmanMove 15s linear infinite;
}

@keyframes pacmanMove {
    0% {
        left: -50px;
    }
    100% {
        left: calc(100% + 50px);
    }
}

.ghost {
    background: var(--pink-primary);
    bottom: 100px;
    border-radius: 50% 50% 0 0;
    position: relative;
}

.ghost::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background:
        radial-gradient(circle at 5px 5px, transparent 5px, var(--pink-primary) 5px);
    background-size: 10px 10px;
}

.ghost-1 {
    animation: ghostMove1 18s linear infinite;
}

.ghost-2 {
    animation: ghostMove2 20s linear infinite;
}

@keyframes ghostMove1 {
    0% {
        left: -100px;
    }
    100% {
        left: calc(100% + 100px);
    }
}

@keyframes ghostMove2 {
    0% {
        left: -150px;
    }
    100% {
        left: calc(100% + 150px);
    }
}

/* Button Hover Effects */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

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

.shake {
    animation: shake 0.5s;
}

/* Countdown Number Change Animation */
@keyframes countdownChange {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: var(--yellow);
    }
    100% {
        transform: scale(1);
    }
}

.countdown-value.change {
    animation: countdownChange 0.3s;
}

/* Scroll Reveal Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation */
@keyframes loading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Neon Border Animation */
@keyframes neonBorder {
    0%, 100% {
        border-color: var(--cyan-primary);
        box-shadow: 0 0 10px var(--cyan-primary);
    }
    50% {
        border-color: var(--pink-primary);
        box-shadow: 0 0 20px var(--pink-primary);
    }
}

.neon-border {
    animation: neonBorder 3s infinite;
}

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

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

/* Pixel Dissolve */
@keyframes pixelDissolve {
    0% {
        filter: blur(0);
        opacity: 1;
    }
    100% {
        filter: blur(10px);
        opacity: 0;
    }
}

/* Zoom In Animation */
@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Flip Animation */
@keyframes flip {
    from {
        transform: perspective(400px) rotateY(0);
    }
    to {
        transform: perspective(400px) rotateY(360deg);
    }
}

/* Utility Classes for Animations */
.animate-on-scroll {
    opacity: 0;
}

.animate-on-scroll.animated {
    opacity: 1;
    animation-duration: 0.8s;
    animation-fill-mode: both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
