/* Xsodex Gallery Lightbox — лёгкий просмотрщик изображений (без внешних зависимостей) */
html.xs-lightbox-lock {
    overflow: hidden;
}

.xs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .22s ease;
    -webkit-tap-highlight-color: transparent;
}

.xs-lightbox.is-open {
    display: flex;
    opacity: 1;
}

.xs-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 14, 18, .92);
    backdrop-filter: blur(2px);
}

.xs-lightbox__stage {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2vw, 28px);
    width: 100%;
    max-width: 1500px;
    padding: clamp(48px, 7vh, 84px) clamp(8px, 3vw, 32px);
    box-sizing: border-box;
}

.xs-lightbox__figure {
    position: relative;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.xs-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 190px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: #1b1e24;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
    transition: opacity .18s ease;
}

.xs-lightbox__img.is-loading {
    opacity: .35;
}

.xs-lightbox__caption {
    margin-top: 14px;
    max-width: 900px;
    color: #e9ecf1;
    font-size: 15px;
    line-height: 1.45;
    text-align: center;
}

.xs-lightbox__btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.xs-lightbox__btn:hover,
.xs-lightbox__btn:focus-visible {
    background: rgba(255, 255, 255, .26);
    outline: none;
}

.xs-lightbox__btn:active {
    transform: scale(.94);
}

.xs-lightbox__bar {
    position: absolute;
    z-index: 3;
    top: clamp(10px, 2.4vh, 22px);
    right: clamp(10px, 2.4vw, 26px);
    display: flex;
    align-items: center;
    gap: 12px;
}

.xs-lightbox__counter {
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
    letter-spacing: .04em;
    font-variant-numeric: tabular-nums;
}

.xs-lightbox__loader {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xs-lb-spin .8s linear infinite;
    pointer-events: none;
    opacity: 0;
}

.xs-lightbox.is-loading .xs-lightbox__loader {
    opacity: 1;
}

@keyframes xs-lb-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .xs-lightbox__stage {
        padding: 56px 6px 64px;
        gap: 4px;
    }
    .xs-lightbox__img {
        max-height: calc(100vh - 170px);
    }
    .xs-lightbox__btn {
        width: 44px;
        height: 44px;
    }
    .xs-lightbox__btn--prev,
    .xs-lightbox__btn--next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }
    .xs-lightbox__btn--prev { left: 6px; }
    .xs-lightbox__btn--next { right: 6px; }
    .xs-lightbox__btn--prev:active,
    .xs-lightbox__btn--next:active { transform: translateY(-50%) scale(.94); }
    .xs-lightbox__caption {
        font-size: 13px;
        padding: 0 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .xs-lightbox,
    .xs-lightbox__img,
    .xs-lightbox__btn {
        transition: none;
    }
    .xs-lightbox__loader { animation-duration: 1.6s; }
}
