/* ========================================
   E.M.O. DIGITAL OMNIVERSE - Animations
   Advanced animation effects
   ======================================== */

/* ==================== LOADING ANIMATION ==================== */
.loader {
    position: fixed;
    inset: 0;
    background: var(--space-black);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-ring {
    width: 80px;
    height: 80px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: loader-spin 1s linear infinite;
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== SCROLL REVEAL ==================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ==================== GLITCH EFFECT ==================== */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch:hover::before {
    animation: glitch-effect-1 0.3s infinite;
    color: var(--neon-cyan);
    opacity: 0.8;
}

.glitch:hover::after {
    animation: glitch-effect-2 0.3s infinite;
    color: var(--warm-orange);
    opacity: 0.8;
}

@keyframes glitch-effect-1 {

    0%,
    100% {
        clip-path: inset(0 0 85% 0);
        transform: translate(-3px, 0);
    }

    25% {
        clip-path: inset(15% 0 65% 0);
        transform: translate(3px, 0);
    }

    50% {
        clip-path: inset(35% 0 45% 0);
        transform: translate(-3px, 0);
    }

    75% {
        clip-path: inset(55% 0 25% 0);
        transform: translate(3px, 0);
    }
}

@keyframes glitch-effect-2 {

    0%,
    100% {
        clip-path: inset(85% 0 0 0);
        transform: translate(3px, 0);
    }

    25% {
        clip-path: inset(65% 0 15% 0);
        transform: translate(-3px, 0);
    }

    50% {
        clip-path: inset(45% 0 35% 0);
        transform: translate(3px, 0);
    }

    75% {
        clip-path: inset(25% 0 55% 0);
        transform: translate(-3px, 0);
    }
}

/* ==================== NEON FLICKER ==================== */
.neon-flicker {
    animation: neon-flicker 3s infinite alternate;
}

@keyframes neon-flicker {

    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        text-shadow:
            0 0 10px var(--neon-cyan),
            0 0 20px var(--neon-cyan),
            0 0 40px var(--neon-cyan);
    }

    20%,
    24%,
    55% {
        text-shadow: none;
    }
}

/* ==================== FLOAT ANIMATION ==================== */
.float {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ==================== PARTICLE BURST ==================== */
.particle-burst {
    position: relative;
}

.particle-burst::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: var(--neon-cyan);
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, -50%);
}

.particle-burst:hover::after {
    animation: particle-burst 0.5s ease-out;
}

@keyframes particle-burst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(5);
    }
}

/* ==================== SCAN LINE ==================== */
.scan-lines {
    position: relative;
    overflow: hidden;
}

.scan-lines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 2px,
            rgba(0, 0, 0, 0.1) 4px);
    pointer-events: none;
    opacity: 0.3;
}

/* ==================== TYPING EFFECT ==================== */
.typing {
    overflow: hidden;
    border-right: 2px solid var(--neon-cyan);
    white-space: nowrap;
    animation:
        typing 3s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--neon-cyan);
    }
}

/* ==================== WARP SPEED ==================== */
.warp-transition {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent, var(--space-black));
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.warp-transition.active {
    opacity: 1;
    animation: warp-speed 0.8s ease-in-out;
}

@keyframes warp-speed {
    0% {
        transform: scale(1);
        filter: blur(0);
    }

    50% {
        transform: scale(1.2);
        filter: blur(10px);
    }

    100% {
        transform: scale(1);
        filter: blur(0);
    }
}

/* ==================== CARD TILT ==================== */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* ==================== STAGGER ANIMATION ==================== */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: stagger-in 0.5s ease forwards;
}

.stagger-item:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-item:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-item:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes stagger-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== RIPPLE EFFECT ==================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ripple:hover::before {
    width: 300%;
    height: 300%;
}