/* Art (README R20, R23): the login films loop behind every utility page at --art-opacity (login 1). The layer fades in
   from the ground once the still (film 1's frame 0) is decoded or a film shows (film-art.js); the still stays under the
   films as the fallback. Centred pages: a full-screen feathered layer; .ec (login, expired): the right-hand box. */
.art {
    --art-opacity: 0.3;
    /* film strength left under text: --fg-mute, links and notices stay >= 4.5:1 on its black */
    --art-text: 0.1;
    position: fixed;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    /* the first reveal (user: 30% under the 1.2s crossfade) */
    transition: opacity 0.84s var(--ease);
    -webkit-mask-image: linear-gradient(
            to right,
            transparent,
            var(--mask) 6%,
            var(--mask) 94%,
            transparent
        ),
        linear-gradient(
            to bottom,
            transparent,
            var(--mask) 9%,
            var(--mask) 91%,
            transparent
        );
    mask-image: linear-gradient(
            to right,
            transparent,
            var(--mask) 6%,
            var(--mask) 94%,
            transparent
        ),
        linear-gradient(
            to bottom,
            transparent,
            var(--mask) 9%,
            var(--mask) 91%,
            transparent
        );
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
.art[data-full] {
    --art-opacity: 1;
}
.art[data-ready] {
    opacity: var(--art-opacity);
}
.art img,
.art video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}
.art video {
    opacity: 0;
    /* a leaving film holds under the incoming one for the fade, then drops */
    transition: opacity 0s 1.2s;
}
.art video[data-on] {
    z-index: 1;
    opacity: 1;
    transition: opacity 1.2s var(--ease);
}
/* film 1's first frame matches the still under it */
.art video[data-on='cut'] {
    transition: none;
}
/* the ground veils the film down to --art-text under the text: the stage column and the footer band */
.art::after {
    content: '';
    position: absolute;
    z-index: 2;
    inset: 0;
    background: var(--ground);
    opacity: calc(1 - var(--art-text) / var(--art-opacity));
    -webkit-mask-image: linear-gradient(
            to right,
            transparent calc(50% - var(--form) / 2 - 96px),
            var(--mask) calc(50% - var(--form) / 2 - 24px),
            var(--mask) calc(50% + var(--form) / 2 + 24px),
            transparent calc(50% + var(--form) / 2 + 96px)
        ),
        linear-gradient(to top, var(--mask) 140px, transparent 200px);
    mask-image: linear-gradient(
            to right,
            transparent calc(50% - var(--form) / 2 - 96px),
            var(--mask) calc(50% - var(--form) / 2 - 24px),
            var(--mask) calc(50% + var(--form) / 2 + 24px),
            transparent calc(50% + var(--form) / 2 + 96px)
        ),
        linear-gradient(to top, var(--mask) 140px, transparent 200px);
}
/* the kit's --accent link hover is under 4.5:1 on the veil over the darkest frame */
:where(body > .art ~ * a:hover) {
    color: var(--fg);
}

/* login, expired (Eclipse): the films own the right of the page, feathered into the ground; the form column sits left */
body:has(> .ec) {
    overflow-x: hidden;
}
.ec {
    /* the films' content lives in x 48-100% of the frame: size it so that half lands right of the form */
    --film: min(
        1920px,
        max(100vw, 177.78dvh),
        calc((100vw - var(--pad) - var(--form) - 48px) / 0.52)
    );
    position: relative;
    isolation: isolate;
    min-height: 100dvh;
}
.ec .art {
    inset: auto;
    top: 50%;
    right: 0;
    width: var(--film);
    aspect-ratio: 16 / 9;
    translate: 0 -50%;
    -webkit-mask-image: linear-gradient(to right, transparent, var(--mask) 40%),
        linear-gradient(
            to bottom,
            transparent,
            var(--mask) 9%,
            var(--mask) 91%,
            transparent
        );
    mask-image: linear-gradient(to right, transparent, var(--mask) 40%),
        linear-gradient(
            to bottom,
            transparent,
            var(--mask) 9%,
            var(--mask) 91%,
            transparent
        );
}
.ec-col {
    width: calc(var(--pad) * 2 + var(--form));
    max-width: 100%;
}
.ec-stage {
    justify-self: start;
}

@media not all and (max-width: 760px) {
    /* the form column sits left of the films' content */
    .ec .art::after {
        content: none;
    }
}

/* phone: the art is a full-screen layer behind the centred form, all of it under the veil */
@media (max-width: 760px) {
    .art::after {
        -webkit-mask-image: none;
        mask-image: none;
    }
    /* keep the films' content (x 48-100%) in view */
    .art img,
    .art video {
        object-position: 80% 50%;
    }
    .ec .art {
        inset: 0;
        width: auto;
        aspect-ratio: auto;
        translate: none;
        -webkit-mask-image: none;
        mask-image: none;
    }
    .ec-col {
        width: auto;
    }
    .ec-stage {
        justify-self: center;
    }
    :where(a:hover) {
        color: var(--fg);
    }
}
