/* =========================================================
   LIGHTBOX / FULLSCREEN GALLERY VIEWER
   ========================================================= */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(4, 6, 5, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    opacity: 0;
    visibility: hidden;
    transition:
        opacity 260ms ease,
        visibility 260ms ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-stage {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    width: 100%;
    max-width: 1200px;
    height: 100%;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100% - 120px);

    object-fit: contain;

    border-radius: 6px;

    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);

    opacity: 0;
    transform: scale(0.97);
    transition:
        opacity 220ms ease,
        transform 220ms ease;
}

.lightbox.is-open .lightbox-image {
    opacity: 1;
    transform: scale(1);
}

.lightbox.is-loading .lightbox-image {
    opacity: 0;
}

/* --- Подпись --- */

.lightbox-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;

    margin-top: 18px;
    padding: 0 20px;

    text-align: center;
    color: #f1eadb;
}

.lightbox-caption strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-weight: 400;
}

.lightbox-caption span {
    max-width: 720px;
    font-size: 14px;
    line-height: 1.6;
    color: #a9aa9e;
}

.lightbox-counter {
    margin-top: 6px;
    font-size: 12px;
    letter-spacing: 0.16em;
    color: #c89b4b;
}

/* --- Кнопки --- */

.lightbox-btn {
    position: absolute;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 52px;
    height: 52px;

    padding: 0;

    color: #f1eadb;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(200, 155, 75, 0.35);
    border-radius: 50%;

    font-size: 22px;
    line-height: 1;
    cursor: pointer;

    transition:
        background 200ms ease,
        border-color 200ms ease,
        transform 200ms ease;
}

.lightbox-btn:hover {
    background: rgba(200, 155, 75, 0.18);
    border-color: rgba(200, 155, 75, 0.7);
}

.lightbox-btn:focus-visible {
    outline: 2px solid #c89b4b;
    outline-offset: 3px;
}

.lightbox-close {
    top: 22px;
    right: 22px;
    font-size: 20px;
}

.lightbox-prev {
    top: 50%;
    left: 22px;

    transform: translateY(-50%);
}

.lightbox-next {
    top: 50%;
    right: 22px;

    transform: translateY(-50%);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    transform: translateY(-50%) scale(1.06);
}

.lightbox-btn[hidden] {
    display: none;
}

/* --- Индикатор загрузки --- */

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;

    width: 42px;
    height: 42px;

    margin: -21px 0 0 -21px;

    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: #c89b4b;
    border-radius: 50%;

    animation: lightbox-spin 700ms linear infinite;

    pointer-events: none;
}

.lightbox-loader[hidden] {
    display: none;
}

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

body.lightbox-open {
    overflow: hidden;
}

/* --- Интерактивные триггеры --- */

.gallery-trigger {
    cursor: zoom-in;
}

.gallery-trigger:focus-visible {
    outline: 2px solid #c89b4b;
    outline-offset: 3px;
}

.gallery-figure:hover .gallery-figure-media img,
.gallery-item:hover img {
    filter: saturate(1) contrast(1.02);
}

@media (max-width: 767.98px) {
    .lightbox {
        padding: 16px;
    }

    .lightbox-btn {
        width: 44px;
        height: 44px;
    }

    .lightbox-close {
        top: 14px;
        right: 14px;
    }

    .lightbox-prev {
        left: 12px;
    }

    .lightbox-next {
        right: 12px;
    }

    .lightbox-image {
        max-height: calc(100% - 150px);
    }
}
