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

/* Lightbox overlay */
.gem-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;

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

    padding: 32px;

    background: rgba(0, 0, 0, 0.9);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.gem-gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gem-gallery-lightbox__inner {
    position: relative;

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

    width: 100%;
    height: 100%;
}

.gem-gallery-lightbox__swiper {
    width: min(92vw, 1600px);
    height: min(90vh, 1100px);

    overflow: hidden;
}

.gem-gallery-lightbox .swiper-wrapper {
    align-items: center;
}

.gem-gallery-lightbox .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
}

.gem-gallery-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
    margin: 0;
}

.gem-gallery-lightbox__figure img {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;
    max-height: calc(90vh - 70px);

    object-fit: contain;

    user-select: none;
    -webkit-user-drag: none;
}

.gem-gallery-lightbox__caption {
    max-width: 900px;
    margin-top: 12px;
    padding: 0 16px;

    color: #fff;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

/* Close button */
.gem-gallery-lightbox__close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 100003;

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

    width: 44px;
    height: 44px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.45);
    color: #fff;

    font: inherit;
    cursor: pointer;
}

.gem-gallery-lightbox__close span {
    display: block;
    margin-top: -3px;

    font-size: 36px;
    font-weight: 300;
    line-height: 1;
}

.gem-gallery-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Swiper navigation */
.gem-gallery-lightbox .swiper-button-prev,
.gem-gallery-lightbox .swiper-button-next {
    width: 52px;
    height: 52px;

    color: #fff;
    background-color: #333;
    border-radius: 50%;
    border:none;
}

.gem-gallery-lightbox .swiper-button-prev::after,
.gem-gallery-lightbox .swiper-button-next::after {
    font-size: 22px;
}

.gem-gallery-lightbox .swiper-button-prev {
    left: 12px;
}

.gem-gallery-lightbox .swiper-button-next {
    right: 12px;
}

/* Fraction */
.gem-gallery-lightbox .swiper-pagination {
    bottom: 0;

    color: #fff;
    font-size: 13px;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* 背景ページのスクロール停止 */
html:has(body.gem-lightbox-open) {
    overflow: hidden;
}

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

/* Focus */
.gem-gallery-lightbox button:focus-visible,
.gem-gallery-lightbox-trigger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Tablet / Mobile */
@media screen and (max-width: 768px) {

    .gem-gallery-lightbox {
        padding: 0;
    }

    .gem-gallery-lightbox__swiper {
        width: 100vw;
        height: 100dvh;
    }

    .gem-gallery-lightbox__figure {
        padding: 56px 18px 48px;
        box-sizing: border-box;
    }

    .gem-gallery-lightbox__figure img {
        max-width: 100%;
        max-height: calc(100dvh - 130px);
    }

    .gem-gallery-lightbox__caption {
        margin-top: 10px;
        padding: 0 8px;
        font-size: 12px;
    }

    .gem-gallery-lightbox__close {
        top: 12px;
        right: 12px;

        width: 40px;
        height: 40px;
    }

    .gem-gallery-lightbox__close span {
        font-size: 32px;
    }

    .gem-gallery-lightbox .swiper-button-prev,
    .gem-gallery-lightbox .swiper-button-next {
        width: 30px;
        height: 30px;
        top: 50%;
        margin-top: 0;
        transform: translateY(-50%);
    }

    .gem-gallery-lightbox .swiper-button-prev::after,
    .gem-gallery-lightbox .swiper-button-next::after {
        font-size: 14px;
    }

    .gem-gallery-lightbox .swiper-button-prev {
        left: 4px;
    }

    .gem-gallery-lightbox .swiper-button-next {
        right: 4px;
    }

    .gem-gallery-lightbox .swiper-pagination {
        bottom: 18px;
    }
}
