body.lightbox-open {
    overflow: hidden;
}

.gallery-item img[role="button"] {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(100vw - 24px, 1120px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
}

.lightbox-figure {
    margin: 0;
    max-height: calc(100vh - 40px);
}

.lightbox-image {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 110px);
    border-radius: 14px;
    box-shadow: 0 12px 42px rgba(0, 0, 0, 0.45);
}

.lightbox-caption {
    color: #f2f6f2;
    text-align: center;
    margin-top: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.lightbox-close,
.lightbox-nav {
    border: none;
    background: rgba(255, 255, 255, 0.93);
    color: #1b2a1d;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    font-size: 1.8rem;
    line-height: 1;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    transform: scale(1.06);
    background: #ffffff;
    outline: 2px solid #81c784;
    outline-offset: 2px;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

@media (max-width: 768px) {
    .lightbox-dialog {
        width: calc(100vw - 12px);
        gap: 6px;
    }

    .lightbox-close,
    .lightbox-nav {
        width: 42px;
        height: 42px;
    }

    .lightbox-nav {
        position: fixed;
        bottom: 22px;
        z-index: 3;
    }

    .lightbox-prev {
        left: 18px;
    }

    .lightbox-next {
        right: 18px;
    }

    .lightbox-image {
        max-height: calc(100vh - 160px);
    }

    .lightbox-caption {
        font-size: 0.88rem;
        margin-top: 10px;
    }
}
