h1 {
    margin: 0 0 .25em;
    color: var(--color-white);
    font-family: "Zen Dots", sans-serif;
    font-size: clamp(2.3em, 5.4vw, 5.5em);
    font-weight: 400;
    line-height: 1.03;
    letter-spacing: 0.02em;
    text-shadow: 2px 3px 8px rgba(0, 0, 0, 0.8);
}

h1 .title-glitch {
    position: relative;
    display: block;
    width: fit-content;
    color: var(--color-red-bright);
    isolation: isolate;
    text-shadow:
        0 0 10px rgba(211, 51, 51, 0.22),
        0 0 22px rgba(211, 51, 51, 0.14);
}

h1 .title-glitch::before,
h1 .title-glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}

h1 .title-glitch::before {
    color: rgba(255, 255, 255, 0.9);
}

h1 .title-glitch::after {
    color: rgba(183, 40, 40, 0.95);
}

h1 .title-glitch.is-glitching {
    animation: digital-flicker 0.12s steps(2, end) 1;
}

h1 .title-glitch.is-glitching::before {
    opacity: 1;
    animation: digital-slice-a 0.12s steps(2, end) 1;
}

h1 .title-glitch.is-glitching::after {
    opacity: 1;
    animation: digital-slice-b 0.12s steps(2, end) 1;
}

@keyframes digital-flicker {
    0% {
        transform: translateX(0);
        filter: none;
    }

    20% {
        transform: translateX(-3px);
        filter: brightness(1.15);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-2px);
        filter: contrast(1.15);
    }

    80% {
        transform: translateX(2px);
    }

    100% {
        transform: translateX(0);
        filter: none;
    }
}

@keyframes digital-slice-a {
    0% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
    }

    15% {
        clip-path: inset(8% 0 68% 0);
        transform: translateX(-8px);
    }

    30% {
        clip-path: inset(28% 0 48% 0);
        transform: translateX(6px);
    }

    45% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
    }

    60% {
        clip-path: inset(56% 0 22% 0);
        transform: translateX(-10px);
    }

    75% {
        clip-path: inset(74% 0 8% 0);
        transform: translateX(7px);
    }

    100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
    }
}

@keyframes digital-slice-b {
    0% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
    }

    20% {
        clip-path: inset(18% 0 64% 0);
        transform: translateX(7px);
    }

    35% {
        clip-path: inset(38% 0 38% 0);
        transform: translateX(-6px);
    }

    50% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
    }

    70% {
        clip-path: inset(62% 0 18% 0);
        transform: translateX(10px);
    }

    85% {
        clip-path: inset(82% 0 4% 0);
        transform: translateX(-7px);
    }

    100% {
        clip-path: inset(0 0 100% 0);
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    h1 .title-glitch,
    h1 .title-glitch::before,
    h1 .title-glitch::after {
        animation: none !important;
        transform: none !important;
        filter: none !important;
    }
}
