body.gallery-lightbox-open { overflow: hidden; }

.gallery-lightbox-trigger {
    cursor: zoom-in;
    transition: filter 0.2s ease;
}

.gallery-lightbox-trigger:hover { filter: brightness(0.92); }

.gallery-lightbox-trigger:focus-visible {
    outline: 3px solid var(--route-orange, var(--orange, #c85b2a));
    outline-offset: 3px;
}

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

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2600;
    display: grid;
    place-items: center;
    padding: clamp(0.75rem, 2.5vw, 2rem);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.gallery-lightbox.is-open { opacity: 1; }

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 12, 8, 0.92);
    backdrop-filter: blur(8px);
}

.gallery-lightbox-panel {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
}

.gallery-lightbox-close,
.gallery-lightbox-arrow {
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(12, 29, 19, 0.7);
    color: var(--route-white, var(--white, #fff));
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-arrow:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(31, 65, 44, 0.9);
}

.gallery-lightbox-close:focus-visible,
.gallery-lightbox-arrow:focus-visible {
    outline: 3px solid #deb477;
    outline-offset: 3px;
}

.gallery-lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
}

.gallery-lightbox-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.gallery-lightbox-arrow svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.gallery-lightbox-prev { margin-right: clamp(0.5rem, 2vw, 1.5rem); }
.gallery-lightbox-next { margin-left: clamp(0.5rem, 2vw, 1.5rem); }

.gallery-lightbox-figure {
    display: grid;
    min-width: 0;
    min-height: 0;
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    gap: 0.75rem;
    margin: 0;
}

.gallery-lightbox-figure img {
    display: block;
    align-self: center;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

.gallery-lightbox-figure figcaption {
    display: flex;
    width: min(100%, 900px);
    min-height: 1.5rem;
    align-items: baseline;
    justify-content: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    text-align: center;
}

.gallery-lightbox-counter {
    flex: 0 0 auto;
    color: #deb477;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

@media (max-width: 520px) {
    .gallery-lightbox {
        padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
    }

    .gallery-lightbox-panel {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        column-gap: 0.75rem;
    }

    .gallery-lightbox-figure {
        grid-column: 1 / 3;
        grid-row: 1;
        width: 100%;
        padding-top: 3.5rem;
    }

    .gallery-lightbox-prev,
    .gallery-lightbox-next {
        grid-row: 2;
        margin: 0;
    }

    .gallery-lightbox-prev { justify-self: end; }
    .gallery-lightbox-next { justify-self: start; }

    .gallery-lightbox-arrow {
        width: 48px;
        height: 48px;
    }

    .gallery-lightbox-figure figcaption {
        display: grid;
        gap: 0.25rem;
        font-size: 0.72rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-lightbox,
    .gallery-lightbox-trigger { transition: none; }
}
