@layer components {
    @scope (.hero) to (.glyph > *) {
        :scope {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding-block-start: calc(var(--glyph-top) + var(--glyph-height));
        }

        .hero-subtext {
            margin-block: 36px 20px;
            text-align: center;
            text-transform: uppercase;
            font-size: var(--text-md);
            font-weight: 400;
        }
    }

    /* the spinning, blending wordmark box; it grows out of a circle on first visit */
    @scope (.glyph) {
        :scope {
            --glyph-seed: 176px;
            position: absolute;
            inset-block-start: var(--glyph-center);
            inset-inline-start: 50%;
            translate: -50% -50%;
            container-type: size;
            overflow: hidden;
            /* safari skips the rounded overflow clip for animated children inside a
               transformed box; any mask makes it clip them to the border radius */
            mask-image: linear-gradient(#000, #000);
            width: var(--content-width);
            height: var(--glyph-height);
            border: var(--border);
            border-radius: 26px;
            background: var(--bg);
            animation:
                glyph-grow var(--intro) cubic-bezier(1, 0, 0.89, 0.2) both,
                glyph-round calc(var(--intro) / 2) calc(var(--intro) / 2) ease-out both;
        }

        /* script sets --glyph-rotation, --glyph-spin and --glyph-offset per box */
        .glyph-box {
            position: absolute;
            inset-block-start: 0;
            inset-inline-start: 0;
            mix-blend-mode: difference;
            animation: glyph-spin var(--glyph-spin, 180s) linear infinite;
        }

        .glyph-marquee {
            display: flex;
            white-space: nowrap;
            animation: glyph-breathe 26s ease-in-out infinite;
        }

        .glyph-word {
            /* pure white so the difference blend inverts exactly */
            color: #fff;
            font-weight: 700;
            font-size: 400px;
            animation: glyph-scroll 130s linear infinite var(--glyph-offset, 0s);
        }
    }

    @keyframes glyph-grow {
        from {
            width: var(--glyph-seed);
            height: var(--glyph-seed);
        }
        50% {
            width: 106vw;
            height: 106vh;
        }
    }

    @keyframes glyph-round {
        from {
            border-radius: 9999px;
        }
    }

    @keyframes glyph-spin {
        from {
            transform: translate(calc(50cqw - 50%), calc(50cqh - 50%)) rotate(var(--glyph-rotation, 0deg));
        }
        to {
            transform: translate(calc(50cqw - 50%), calc(50cqh - 50%)) rotate(calc(var(--glyph-rotation, 0deg) + 360deg));
        }
    }

    @keyframes glyph-breathe {
        50% {
            scale: 1.3;
        }
    }

    @keyframes glyph-scroll {
        to {
            translate: -100%;
        }
    }
}
