/*
 * first-visit choreography. elements opt in with data-intro, so components never
 * list each other: drop (the header), settle (main zooms out of the glyph), fade.
 * the glyph's own grow-in lives with the glyph in hero.css.
 */
@layer intro {
    /* returning visitors and sub pages land on the settled page */
    :root.is-intro-skipped {
        --intro: 0s;
    }

    /* a direct visit to a sub page lands on its open panel; the script lifts this once it is open */
    :root.is-landing *,
    :root.is-landing ::backdrop {
        transition: none;
    }

    body {
        animation: intro-lock var(--intro);
    }

    [data-intro="drop"] {
        animation: intro-drop calc(var(--intro) * 0.3) var(--intro) ease both;
    }

    [data-intro="settle"] {
        transform-origin: 50% var(--glyph-center);
        animation: intro-settle calc(var(--intro) / 2) var(--intro) cubic-bezier(0.33, 1, 0.68, 1) both;
    }

    [data-intro="fade"] {
        animation: intro-fade calc(var(--intro) * 0.3) calc(var(--intro) * 1.2) ease both;
    }

    /* no scrolling until the page has settled */
    @keyframes intro-lock {
        0%,
        100% {
            overflow: hidden;
        }
    }

    @keyframes intro-drop {
        from {
            translate: 0 -110%;
            opacity: 0;
        }
    }

    @keyframes intro-settle {
        from {
            scale: 1.4286;
            translate: 0 calc(50vh - var(--glyph-center));
        }
    }

    @keyframes intro-fade {
        from {
            opacity: 0;
        }
    }
}

@layer motion {
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0s !important;
            animation-delay: 0s !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0s !important;
        }
    }
}
