.lightbox {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: rgba(255,255,255,.80);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
    overscroll-behavior: contain;
    transition: opacity 300ms ease, backdrop-filter 300ms ease, visibility 0s linear 300ms;
}
.lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}
.lightbox.is-closing {
    opacity: 0;
    pointer-events: none;
    transition: opacity 620ms cubic-bezier(.16, 1, .3, 1) 140ms, backdrop-filter 620ms ease 140ms;
}
.lightbox__stage {
    position: absolute;
    inset: clamp(44px, 5vw, 72px) clamp(44px, 7vw, 112px);
    display: grid;
    place-items: center;
    overflow: hidden;
    touch-action: none;
    cursor: default;
}
.lightbox__stage.is-zoomed,
.lightbox__stage.is-dragging { cursor: default; }
.lightbox__image {
    display: block;
    flex: none;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    opacity: 0;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    cursor: default;
}
.lightbox__image.is-loaded { opacity: 1; }
.lightbox__image.is-animating {
    transition: transform 240ms cubic-bezier(.2, .75, .25, 1), opacity var(--motion-normal) ease;
}
.lightbox__close,
.lightbox__nav {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    opacity: .62;
    transition: opacity var(--motion-fast) ease;
}
.lightbox__close:hover,
.lightbox__nav:hover { opacity: 1; }
.lightbox__close {
    top: 14px;
    right: 18px;
    width: 42px;
    height: 42px;
    font-size: 34px;
    font-weight: 200;
    line-height: 1;
}
.lightbox__nav {
    top: 50%;
    width: 48px;
    height: 72px;
    transform: translateY(-50%);
    font-size: 28px;
}
.lightbox__nav--prev { left: 8px; }
.lightbox__nav--next { right: 8px; }
.lightbox__nav[hidden] { display: none; }
.lightbox__loader {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(0, 0, 0, .16);
    border-top-color: rgba(0, 0, 0, .62);
    border-radius: 50%;
    opacity: 0;
    animation: rs-lightbox-spin 700ms linear infinite;
    transition: opacity var(--motion-fast) ease;
}
.lightbox.is-loading .lightbox__loader { opacity: 1; }
.lightbox__meta {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 15px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    transform: translateX(-50%);
    white-space: nowrap;
}
.lightbox__category {
    color: inherit;
    font-size: 11px;
    letter-spacing: .04em;
    opacity: .7;
    transition: opacity var(--motion-fast) ease;
}
.lightbox__category[hidden] { display: none; }
.lightbox__counter {
    font-size: 10px;
    letter-spacing: .08em;
    opacity: .4;
}

.lightbox__return-image {
    position: fixed;
    z-index: 102;
    display: block;
    max-width: none;
    max-height: none;
    margin: 0;
    pointer-events: none;
    transform-origin: center center;
    will-change: transform, opacity;
    transition: transform 540ms cubic-bezier(.16, 1, .3, 1), opacity 220ms ease 300ms;
}
.lightbox__return-image.is-returning {
    opacity: .04;
}

@keyframes rs-lightbox-spin { to { transform: rotate(360deg); } }

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
    opacity: 1;
    outline: 1px solid currentColor;
    outline-offset: -3px;
}
