
.glitch {
    position: relative;
    display: inline-block;
    overflow: visible;
}

.glitch::before,
.glitch::after {
    clip-path: inset(100%);
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    animation-delay: var(--glitch-delay, 10s);
    overflow: visible;
    display: inline;
}

.glitch::before {
    white-space: nowrap;
    animation: glitchTop var(--glitch-duration-1, 11.1s) infinite steps(1, end) var(--glitch-delay, 10s);

}

.glitch::after {
    animation: glitchBottom var(--glitch-duration-2, 5.8s) infinite steps(1, end) var(--glitch-delay, 10s);
    white-space: nowrap;
}

@keyframes glitchBottom {
    0% {
        clip-path: inset(90% 0 90% 0);
    }
    1% {
        clip-path: inset(3% 0 70% 0);
        transform: translate(-2px, -3px);
        filter: hue-rotate(-30deg) saturate(2);
    }
    5% {
        clip-path: inset(60% 0 0% 0);
        transform: translate(2px, 0);
        filter: hue-rotate(-15deg) saturate(4);
    }
    8% {
        clip-path: inset(40% 0 60% 0);
        filter: hue-rotate(-10deg) saturate(1);
    }
    12% {
        clip-path: inset(45% 0 50%);
        transform: translate(-2px, 0);
        filter: hue-rotate(+40deg) saturate(0.5);
    }
    14% {
        clip-path: inset(30% 0 30%);
        transform: translate(2px, 3px);
        filter: hue-rotate(+40deg) saturate(0.5);
    }
    15% {
        clip-path: inset(90% 0 90% 0);
    }
    100% {
        clip-path: inset(50% 0 50% 0);
    }
}


@keyframes glitchTop {
    0% {
        clip-path: inset(0 0 70% 0);
        transform: translate(2px, 0)
    }
    1% {
        clip-path: inset(15% 0 30% 0%);
    }
    2% {
        clip-path: inset(50% 0 45% 0);
        transform: translate(-6px, 0)
    }
    3.5% {
        clip-path: inset(70% 0 0% 0);
        transform: translate(3px, -2px)
    }
    4.5% {
        clip-path: inset(70% 0 30% 0);
        transform: translate(3px, -20px)
    }
    44% {
        clip-path: inset(60% 0 0% 0);
        transform: translate(-1px, 0);
    }
    45% {
        clip-path: inset(30% 0 15% 0%);
        filter: hue-rotate(10deg) saturate(2);
    }
    46% {
        clip-path: inset(40% 0 55% 0);
        transform: translate(6px, 0);
        filter: hue-rotate(30deg) saturate(2);
    }
    47% {
        clip-path: inset(0% 0 50% 0);
        transform: translate(-1px, -1px);
        filter: hue-rotate(40deg) saturate(3);
    }
    55% {
        clip-path: inset(50% 0 50% 0);
        transform: translate(-0px, 0px);
        filter: hue-rotate(0deg) saturate(1);
    }
    100% {
        clip-path: inset(100% 0% 0% 0);
    }
}
