.legacy-gallery {
    --flow-stage-top: 14vh;
    --flow-stage-height: 80vh;
    --flow-reflection-gap: 8px;
    padding: 0;
}

.legacy-gallery .gallery-title,
.legacy-gallery .gallery-controls output,
.legacy-gallery .gallery-controls button {
    position: absolute;
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.legacy-gallery .gallery-strip {
    position: absolute;
    top: var(--flow-stage-top);
    left: 0;
    width: 100%;
    height: var(--flow-stage-height);
    min-height: 0;
    display: block;
    padding: 0;
    overflow: hidden;
    scroll-snap-type: none;
    touch-action: pan-y;
}

.legacy-gallery .photo {
    position: absolute;
    inset: 0 auto auto 0;
    display: block;
    width: var(--flow-width);
    height: var(--flow-height);
    appearance: none;
    padding: 0;
    border: 0;
    background: transparent;
    transform: translate(var(--flow-x), var(--flow-y));
    cursor: pointer;
    transition: transform .28s ease-out, width .28s ease-out, height .28s ease-out;
}

.legacy-gallery .photo img,
.legacy-gallery .photo.is-current img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.legacy-gallery .photo .photo-reflection {
    position: absolute;
    top: calc(100% + var(--flow-reflection-gap));
    left: 0;
    transform: scaleY(-1);
    opacity: .1;
    pointer-events: none;
}

.legacy-gallery .photo.is-offscreen {
    visibility: hidden;
}

.legacy-gallery .gallery-controls {
    position: absolute;
    top: calc(var(--flow-stage-top) + var(--flow-stage-height) * .9 - 16px);
    left: 10%;
    width: 80%;
    display: block;
    height: 16px;
    margin: 0;
    z-index: 1;
}

.legacy-gallery .gallery-controls::before,
.legacy-gallery .gallery-controls::after {
    content: '';
    position: absolute;
    top: 0;
    height: 10px;
    border-radius: 25px;
    pointer-events: none;
}

.legacy-gallery .gallery-controls::before {
    left: 1%;
    width: 98%;
    background: #dedede url('/assets/original/ui/white_slider_bg.png') center / 100% 100% no-repeat;
}

.legacy-gallery .gallery-controls::after {
    left: var(--flow-thumb-offset, 20px);
    max-width: 40%;
    width: 100px;
    background: #777 url('/assets/original/ui/white_slider_handle.png') center / 100% 100% no-repeat;
}

.legacy-gallery .gallery-controls:focus-within::after {
    outline: 2px solid #777;
    outline-offset: 2px;
}

.legacy-gallery .gallery-controls input {
    position: absolute;
    z-index: 1;
    inset: -10px 0 0;
    width: 100%;
    height: 30px;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    touch-action: none;
}

.legacy-gallery .lightbox {
    inset: 0;
    width: max-content;
    height: max-content;
    max-width: calc(100vw - 40px);
    max-height: calc(100dvh - 40px);
    margin: auto;
    border: 10px solid #fff;
    background: #fff;
    color: #454545;
    box-shadow: 0 0 9px #0007;
    overflow: visible;
}

.legacy-gallery .lightbox::backdrop {
    background: #777b;
}

.legacy-gallery .lightbox-figure {
    display: block;
    height: auto;
    padding: 0;
}

.legacy-gallery .lightbox img {
    display: block;
    max-width: calc(100vw - 60px);
    max-height: calc(100dvh - 80px);
}

.legacy-gallery .lightbox figcaption {
    padding-top: .4rem;
}

.legacy-gallery .lightbox button {
    min-width: 30px;
    min-height: 30px;
    border-color: #fff;
    background: #222;
    color: #fff;
}

.legacy-gallery .lightbox [data-close] {
    top: -24px;
    right: -24px;
}

@media (max-width: 700px) {
    .legacy-gallery {
        --flow-stage-top: max(14vh, 7rem);
        --flow-stage-height: min(80vh, calc(100dvh - 8rem));
        --flow-reflection-gap: 5px;
    }
}
