/**
 * GOQUEER Glitch Effects
 * Text Distortion & Glitch Animations
 */

/* ========== DISTORTION VARIANT 1 - Stretch & Skew ========== */
.glitch {
    display: inline-block;
    animation: distortion-1 30s infinite;
    text-transform: lowercase;
}

@keyframes distortion-1 {
    0%, 3%, 100% {
        transform: skew(0deg) scaleX(1) scaleY(1);
        filter: blur(0);
    }
    0.5% {
        transform: skew(-5deg) scaleX(1.1) scaleY(0.95);
        filter: blur(1px);
    }
    1% {
        transform: skew(5deg) scaleX(0.9) scaleY(1.1);
        filter: blur(0);
    }
    1.5% {
        transform: skew(-3deg) scaleX(1.05) scaleY(0.98);
        filter: blur(1px);
    }
    2% {
        transform: skew(0deg) scaleX(1) scaleY(1);
        filter: blur(0);
    }
}

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

.glitch::before {
    color: #61FF70;
    animation: distortion-layer-1 30s infinite;
}

.glitch::after {
    color: #FF1493;
    animation: distortion-layer-2 30s infinite 0.05s;
}

@keyframes distortion-layer-1 {
    0%, 3%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0) scaleY(1);
        opacity: 0;
    }
    0.5% {
        clip-path: inset(25% 0 35% 0);
        transform: translateX(-15px) scaleY(1.3);
        opacity: 0.8;
    }
    1% {
        clip-path: inset(60% 0 10% 0);
        transform: translateX(10px) scaleY(0.7);
        opacity: 0.9;
    }
    1.5% {
        clip-path: inset(40% 0 45% 0);
        transform: translateX(-8px) scaleY(1.1);
        opacity: 0.7;
    }
}

@keyframes distortion-layer-2 {
    0%, 3%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0) scaleY(1);
        opacity: 0;
    }
    0.5% {
        clip-path: inset(15% 0 55% 0);
        transform: translateX(12px) scaleY(0.8);
        opacity: 0.7;
    }
    1% {
        clip-path: inset(70% 0 5% 0);
        transform: translateX(-14px) scaleY(1.4);
        opacity: 0.8;
    }
    1.5% {
        clip-path: inset(35% 0 50% 0);
        transform: translateX(9px) scaleY(0.9);
        opacity: 0.6;
    }
}

/* ========== DISTORTION VARIANT 2 - Fast Wobble ========== */
.glitch-fast {
    position: relative;
    display: inline-block;
    animation: distortion-2 2s infinite;
}

@keyframes distortion-2 {
    0%, 85%, 100% {
        transform: skew(0deg) scaleX(1);
    }
    87% {
        transform: skew(-8deg) scaleX(1.15);
    }
    89% {
        transform: skew(8deg) scaleX(0.85);
    }
    91% {
        transform: skew(-4deg) scaleX(1.08);
    }
}

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

.glitch-fast::before {
    color: #00FFFF;
    animation: distortion-fast-1 2s infinite;
}

.glitch-fast::after {
    color: #FFFF00;
    animation: distortion-fast-2 2s infinite 0.1s;
}

@keyframes distortion-fast-1 {
    0%, 85%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateY(0);
        opacity: 0;
    }
    87% {
        clip-path: inset(20% 0 60% 0);
        transform: translateY(-8px);
        opacity: 0.7;
    }
    89% {
        clip-path: inset(55% 0 25% 0);
        transform: translateY(8px);
        opacity: 0.8;
    }
}

@keyframes distortion-fast-2 {
    0%, 85%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateY(0);
        opacity: 0;
    }
    87% {
        clip-path: inset(30% 0 45% 0);
        transform: translateY(10px);
        opacity: 0.6;
    }
    89% {
        clip-path: inset(65% 0 15% 0);
        transform: translateY(-10px);
        opacity: 0.7;
    }
}

/* ========== DISTORTION VARIANT 3 - Slow Wave ========== */
.glitch-slow {
    position: relative;
    display: inline-block;
    animation: distortion-3 64s infinite;
}

@keyframes distortion-3 {
    0%, 2.5%, 100% {
        transform: skew(0deg) scaleY(1);
        filter: blur(0);
    }
    0.4% {
        transform: skew(-6deg) scaleY(1.2);
        filter: blur(2px);
    }
    0.8% {
        transform: skew(6deg) scaleY(0.8);
        filter: blur(1px);
    }
    1.2% {
        transform: skew(-3deg) scaleY(1.1);
        filter: blur(2px);
    }
    1.6% {
        transform: skew(0deg) scaleY(1);
        filter: blur(0);
    }
}

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

.glitch-slow::before {
    color: #61FF70;
    animation: distortion-slow-1 64s infinite;
}

.glitch-slow::after {
    color: #9D00FF;
    animation: distortion-slow-2 64s infinite 0.05s;
}

@keyframes distortion-slow-1 {
    0%, 2.5%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0) scaleX(1);
        opacity: 0;
    }
    0.4% {
        clip-path: inset(10% 0 70% 0);
        transform: translateX(-20px) scaleX(1.3);
        opacity: 0.9;
    }
    0.8% {
        clip-path: inset(50% 0 30% 0);
        transform: translateX(15px) scaleX(0.7);
        opacity: 0.8;
    }
    1.2% {
        clip-path: inset(25% 0 55% 0);
        transform: translateX(-10px) scaleX(1.15);
        opacity: 0.7;
    }
}

@keyframes distortion-slow-2 {
    0%, 2.5%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0) scaleX(1);
        opacity: 0;
    }
    0.4% {
        clip-path: inset(35% 0 45% 0);
        transform: translateX(18px) scaleX(0.8);
        opacity: 0.8;
    }
    0.8% {
        clip-path: inset(65% 0 15% 0);
        transform: translateX(-22px) scaleX(1.4);
        opacity: 0.9;
    }
    1.2% {
        clip-path: inset(40% 0 40% 0);
        transform: translateX(12px) scaleX(1.1);
        opacity: 0.7;
    }
}

/* ========== DISTORTION VARIANT 4 - Subtle Shift ========== */
.glitch-subtle {
    position: relative;
    display: inline-block;
    animation: distortion-4 5s infinite;
}

@keyframes distortion-4 {
    0%, 96%, 100% {
        transform: skew(0deg);
    }
    97% {
        transform: skew(-2deg) scaleX(1.03);
    }
    98% {
        transform: skew(2deg) scaleX(0.97);
    }
}

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

.glitch-subtle::before {
    color: #FF1493;
    animation: distortion-subtle-1 5s infinite;
}

.glitch-subtle::after {
    color: #00FFFF;
    animation: distortion-subtle-2 5s infinite 0.3s;
}

@keyframes distortion-subtle-1 {
    0%, 96%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
        opacity: 0;
    }
    97% {
        clip-path: inset(30% 0 50% 0);
        transform: translateX(-6px);
        opacity: 0.5;
    }
}

@keyframes distortion-subtle-2 {
    0%, 96%, 100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
        opacity: 0;
    }
    97.5% {
        clip-path: inset(45% 0 35% 0);
        transform: translateX(6px);
        opacity: 0.4;
    }
}

/* Animation delay variations */
.glitch:nth-of-type(1) { animation-delay: 0s; }
.glitch:nth-of-type(2) { animation-delay: 0.8s; }
.glitch:nth-of-type(3) { animation-delay: 1.6s; }
.glitch:nth-of-type(4) { animation-delay: 2.4s; }
.glitch:nth-of-type(5) { animation-delay: 0.4s; }
.glitch:nth-of-type(6) { animation-delay: 1.2s; }
.glitch:nth-of-type(7) { animation-delay: 2s; }
.glitch:nth-of-type(8) { animation-delay: 2.8s; }

.glitch-fast:nth-of-type(1) { animation-delay: 0.3s; }
.glitch-fast:nth-of-type(2) { animation-delay: 0.9s; }
.glitch-fast:nth-of-type(3) { animation-delay: 1.5s; }
.glitch-fast:nth-of-type(4) { animation-delay: 0.6s; }
.glitch-fast:nth-of-type(5) { animation-delay: 1.2s; }
.glitch-fast:nth-of-type(6) { animation-delay: 1.8s; }

.glitch-slow:nth-of-type(1) { animation-delay: 0.5s; }
.glitch-slow:nth-of-type(2) { animation-delay: 2s; }
.glitch-slow:nth-of-type(3) { animation-delay: 3.5s; }

.glitch-subtle:nth-of-type(1) { animation-delay: 0.7s; }
.glitch-subtle:nth-of-type(2) { animation-delay: 1.9s; }
.glitch-subtle:nth-of-type(3) { animation-delay: 3.1s; }
.glitch-subtle:nth-of-type(4) { animation-delay: 4.3s; }
.glitch-subtle:nth-of-type(5) { animation-delay: 1.4s; }
.glitch-subtle:nth-of-type(6) { animation-delay: 2.6s; }
.glitch-subtle:nth-of-type(7) { animation-delay: 3.8s; }
.glitch-subtle:nth-of-type(8) { animation-delay: 0.9s; }

/* Page Title Overlay Glitch */
.glitch-slow.page-title-overlay {
    display: block;
}

.glitch-slow.page-title-overlay::before,
.glitch-slow.page-title-overlay::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    mix-blend-mode: screen;
}

.glitch-slow.page-title-overlay::before {
    color: #61FF70;
    animation: distortion-slow-1 64s infinite;
}

.glitch-slow.page-title-overlay::after {
    color: #9D00FF;
    animation: distortion-slow-2 64s infinite 0.05s;
}
