.glitch-logo {
    --glitch-logo-image: url("/assets/img/logo_black.png");
    position: relative;
    display: inline-flex;
    width: fit-content;
    isolation: isolate;
    text-decoration: none;
}

.glitch-logo--nav {
    --glitch-logo-image: url("/assets/img/logo_green.png");
}

.navbar.scrolled .glitch-logo--nav,
.glitch-logo--black {
    --glitch-logo-image: url("/assets/img/logo_black.png");
}

.glitch-logo--green {
    --glitch-logo-image: url("/assets/img/logo_green.png");
}

.glitch-logo > img {
    position: relative;
    z-index: 1;
}

.glitch-logo::before,
.glitch-logo::after {
    position: absolute;
    z-index: 2;
    inset: 0;
    background: var(--glitch-logo-image) center / contain no-repeat;
    content: "";
    opacity: 0;
    pointer-events: none;
}

.studio-footer-logo {
    margin-bottom: 48px;
}

.studio-footer-logo > img {
    margin-bottom: 0 !important;
}

@media (hover: hover) and (pointer: fine) {
    .glitch-logo:hover {
        animation: brand-glitch-frame .58s steps(2, end) infinite;
    }

    .glitch-logo:hover > img {
        animation: brand-glitch-image .36s steps(2, end) infinite;
    }

    .glitch-logo:hover::before {
        opacity: .82;
        filter: drop-shadow(-3px 0 0 #79ee9d);
        clip-path: polygon(0 8%, 100% 8%, 100% 24%, 0 24%, 0 51%, 100% 51%, 100% 62%, 0 62%);
        animation: brand-glitch-slice-a .29s steps(2, end) infinite;
    }

    .glitch-logo:hover::after {
        opacity: .64;
        filter: drop-shadow(3px 0 0 rgba(255, 255, 255, .9));
        clip-path: polygon(0 29%, 100% 29%, 100% 43%, 0 43%, 0 70%, 100% 70%, 100% 89%, 0 89%);
        animation: brand-glitch-slice-b .37s steps(2, end) infinite;
    }
}

.glitch-logo.is-glitch-active {
    animation: brand-glitch-frame .58s steps(2, end) infinite;
}

.glitch-logo.is-glitch-active > img {
    animation: brand-glitch-image .36s steps(2, end) infinite;
}

.glitch-logo.is-glitch-active::before {
    opacity: .82;
    filter: drop-shadow(-3px 0 0 #79ee9d);
    clip-path: polygon(0 8%, 100% 8%, 100% 24%, 0 24%, 0 51%, 100% 51%, 100% 62%, 0 62%);
    animation: brand-glitch-slice-a .29s steps(2, end) infinite;
}

.glitch-logo.is-glitch-active::after {
    opacity: .64;
    filter: drop-shadow(3px 0 0 rgba(255, 255, 255, .9));
    clip-path: polygon(0 29%, 100% 29%, 100% 43%, 0 43%, 0 70%, 100% 70%, 100% 89%, 0 89%);
    animation: brand-glitch-slice-b .37s steps(2, end) infinite;
}

@keyframes brand-glitch-frame {
    0%, 100% { transform: translate(0, 0); }
    24% { transform: translate(-1px, 0); }
    25% { transform: translate(2px, -1px); }
    52% { transform: translate(0, 1px); }
    53% { transform: translate(-2px, 0); }
    78% { transform: translate(1px, 0); }
}

@keyframes brand-glitch-image {
    0%, 100% { filter: none; transform: translate(0, 0); }
    34% { filter: contrast(1.3); transform: translate(-2px, 0); }
    67% { filter: brightness(1.15) contrast(1.12); transform: translate(2px, 0); }
}

@keyframes brand-glitch-slice-a {
    0%, 100% { transform: translateX(-4px); }
    50% { transform: translateX(5px); }
}

@keyframes brand-glitch-slice-b {
    0%, 100% { transform: translateX(5px); }
    50% { transform: translateX(-5px); }
}

@media (max-width: 767px) {
    .studio-footer-logo {
        margin-bottom: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glitch-logo:hover,
    .glitch-logo:hover > img,
    .glitch-logo:hover::before,
    .glitch-logo:hover::after,
    .glitch-logo.is-glitch-active,
    .glitch-logo.is-glitch-active > img,
    .glitch-logo.is-glitch-active::before,
    .glitch-logo.is-glitch-active::after {
        animation: none !important;
    }

    .glitch-logo:hover::before,
    .glitch-logo:hover::after,
    .glitch-logo.is-glitch-active::before,
    .glitch-logo.is-glitch-active::after {
        opacity: 0;
    }
}
