:root {
    color-scheme: dark;

    --rivet-bg:
        #030507;

    --rivet-panel:
        rgba(4, 8, 12, 0.72);

    --rivet-border:
        rgba(255, 255, 255, 0.18);

    --rivet-text:
        #f5f7f9;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: var(--rivet-bg);
}

body {
    overflow: hidden;
}

.rivet-intro__stage {
    position: relative;

    display: grid;
    place-items: center;

    width: 100vw;
    height: 100dvh;
    min-height: 100vh;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 25% 72%,
            rgba(17, 65, 101, 0.42),
            transparent 38%
        ),
        radial-gradient(
            circle at 78% 70%,
            rgba(121, 47, 14, 0.30),
            transparent 34%
        ),
        radial-gradient(
            circle at 50% 45%,
            #09131d 0%,
            #04080c 48%,
            #020304 100%
        );
}

/*
 * Desktop cinematic:
 * show the complete 16:9 composition.
 * Never crop the logo or finished rivet.
 */
.rivet-intro__video {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: center center;

    background: transparent;
}

/*
 * Stable controls independent of video framing.
 */
.rivet-intro__actions {
    position: absolute;
    z-index: 10;

    left: 50%;

    bottom:
        max(
            1.25rem,
            calc(env(safe-area-inset-bottom) + 0.75rem)
        );

    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 0.7rem;

    width:
        min(
            calc(100vw - 2rem),
            34rem
        );

    padding:
        0.8rem;

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    border-radius:
        1.25rem;

    background:
        linear-gradient(
            to bottom,
            rgba(4, 8, 12, 0.28),
            rgba(4, 8, 12, 0.74)
        );

    backdrop-filter:
        blur(18px);

    opacity: 0;
    visibility: hidden;

    transform:
        translate(
            -50%,
            14px
        );

    transition:
        opacity 420ms ease,
        transform 420ms ease,
        visibility 420ms;
}

.rivet-intro__actions.is-visible {
    opacity: 1;
    visibility: visible;

    transform:
        translate(
            -50%,
            0
        );
}

.rivet-intro__button,
.rivet-intro__replay,
.rivet-intro__skip {
    appearance: none;

    border:
        1px solid
        var(--rivet-border);

    border-radius:
        999px;

    font:
        600 0.95rem/1
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    letter-spacing:
        0.03em;
}

.rivet-intro__button {
    min-width:
        9rem;

    padding:
        0.95rem 1.35rem;

    color:
        var(--rivet-text);

    text-decoration:
        none;

    text-align:
        center;

    background:
        rgba(7, 13, 19, 0.82);

    backdrop-filter:
        blur(14px);
}

.rivet-intro__button--primary {
    color:
        #07111d;

    background:
        #f3f5f6;

    border-color:
        #f3f5f6;
}

.rivet-intro__replay {
    flex-basis:
        100%;

    padding:
        0.72rem 1rem;

    color:
        rgba(255, 255, 255, 0.80);

    background:
        rgba(0, 0, 0, 0.18);

    cursor:
        pointer;
}

.rivet-intro__skip {
    position:
        absolute;

    z-index:
        12;

    top:
        max(
            1rem,
            calc(
                env(safe-area-inset-top)
                + 0.5rem
            )
        );

    right:
        max(
            1rem,
            calc(
                env(safe-area-inset-right)
                + 0.5rem
            )
        );

    padding:
        0.7rem 1rem;

    color:
        rgba(255, 255, 255, 0.72);

    background:
        rgba(0, 0, 0, 0.28);

    cursor:
        pointer;

    backdrop-filter:
        blur(10px);
}

/*
 * Phones:
 * the source is already 9:16.
 *
 * Common useful viewport range:
 * ~360x780 through ~430x932 CSS px.
 *
 * Keep the whole cinematic visible while allowing
 * very small screens to use the available height.
 */
@media (max-width: 799px) {
    .rivet-intro__stage {
        background:
            radial-gradient(
                circle at 50% 72%,
                rgba(18, 61, 93, 0.42),
                transparent 42%
            ),
            radial-gradient(
                circle at 70% 72%,
                rgba(116, 44, 12, 0.23),
                transparent 32%
            ),
            #030507;
    }

    .rivet-intro__video {
        object-fit:
            contain;

        object-position:
            center center;
    }

    .rivet-intro__actions {
        width:
            calc(
                100vw
                - 1.25rem
                - env(safe-area-inset-left)
                - env(safe-area-inset-right)
            );

        bottom:
            max(
                0.6rem,
                calc(
                    env(safe-area-inset-bottom)
                    + 0.4rem
                )
            );

        padding:
            0.65rem;

        gap:
            0.55rem;

        border-radius:
            1rem;
    }

    .rivet-intro__button {
        flex:
            1 1 8.5rem;

        min-width:
            0;

        padding:
            0.9rem 1rem;
    }

    .rivet-intro__replay {
        padding:
            0.68rem 0.9rem;
    }

    .rivet-intro__skip {
        top:
            max(
                0.7rem,
                calc(
                    env(safe-area-inset-top)
                    + 0.35rem
                )
            );

        right:
            max(
                0.7rem,
                calc(
                    env(safe-area-inset-right)
                    + 0.35rem
                )
            );
    }
}

/*
 * Short phones / landscape phones.
 */
@media (max-height: 700px) {
    .rivet-intro__actions {
        bottom:
            max(
                0.35rem,
                env(safe-area-inset-bottom)
            );

        padding:
            0.5rem;
    }

    .rivet-intro__button {
        padding:
            0.72rem 0.9rem;
    }

    .rivet-intro__replay {
        padding:
            0.55rem 0.8rem;
    }
}

/*
 * Large desktop:
 * constrain the visual height slightly so the UI
 * does not sit directly on top of the final rivet.
 */
@media (min-width: 1200px) {
    .rivet-intro__video {
        width:
            min(
                100vw,
                1600px
            );

        left:
            50%;

        transform:
            translateX(-50%);
    }

    .rivet-intro__actions {
        bottom:
            2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rivet-intro__video {
        display:
            none;
    }

    .rivet-intro__actions {
        opacity:
            1;

        visibility:
            visible;

        transform:
            translate(
                -50%,
                0
            );
    }

    .rivet-intro__skip {
        display:
            none;
    }
}
