/* Die gemeinsame Lightbox (lightbox.js). Tokens der Hauptgalerie mit denselben Werten als Rückfall. */

[data-lightbox] {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 48px 0 16px;
    background: var(--gallery-overlay-large-bg, rgba(0, 0, 0, .96));
}

.lightbox[hidden] {
    display: none;
}

.lightbox__stage {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(92vw, 1200px);
    flex: 1 1 auto;
    min-height: 0;
}

.lightbox__stage img {
    max-width: 100%;
    max-height: calc(100vh - 12rem);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
}

.lightbox__stage figcaption {
    margin: 8px 0;
    color: #fff;
    font-size: .9rem;
    text-align: center;
}

.lightbox__close,
.lightbox__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #fff;
    background: var(--gallery-control-bg, rgba(255, 255, 255, .12));
    border: 1px solid var(--gallery-control-border, rgba(255, 255, 255, .22));
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--gallery-control-shadow, 0 8px 24px rgba(0, 0, 0, .28));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background .2s ease, border-color .2s ease;
}

.lightbox__close[hidden],
.lightbox__nav[hidden],
.lightbox__counter[hidden] {
    display: none;
}

.lightbox__close:hover,
.lightbox__nav:hover {
    background: var(--gallery-control-bg-hover, rgba(255, 255, 255, .2));
    border-color: var(--gallery-control-border-hover, rgba(255, 255, 255, .35));
}

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.lightbox__close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1;
    width: 3rem;
    height: 3rem;
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
}

.lightbox__nav svg {
    display: block;
    pointer-events: none;
}

.lightbox__nav--prev {
    left: 16px;
}

.lightbox__nav--next {
    right: 16px;
}

.lightbox__counter {
    position: fixed;
    top: 12px;
    left: 16px;
    display: flex;
    align-items: center;
    min-height: 3rem;
    color: #fff;
    font-size: .9375rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .lightbox {
        padding-top: 56px;
    }

    .lightbox__close,
    .lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .lightbox__nav--prev {
        left: 8px;
    }

    .lightbox__nav--next {
        right: 8px;
    }

    .lightbox__stage {
        width: 100%;
        padding: 0 12px;
        box-sizing: border-box;
    }
}
