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

.cp-gallery-lightbox {
    align-items: center;
    background: rgba(16, 18, 20, 0.94);
    bottom: 0;
    display: none;
    justify-content: center;
    left: 0;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: 0;
    z-index: 999999;
}

.cp-gallery-lightbox.is-open {
    display: flex;
}

.cp-gallery-lightbox__figure {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    justify-content: center;
    margin: 0;
    max-width: 100%;
    width: 100%;
}

.cp-gallery-lightbox__image {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    display: block;
    height: auto;
    max-height: calc(100dvh - 112px);
    max-width: 100%;
    object-fit: contain;
    width: auto;
}

.cp-gallery-lightbox__caption {
    color: #fff;
    font-family: brandon-regular, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    max-width: min(760px, 100%);
    text-align: center;
}

.cp-gallery-lightbox__counter {
    bottom: max(22px, env(safe-area-inset-bottom));
    color: rgba(255, 255, 255, 0.78);
    font-family: Arial, sans-serif;
    font-size: 13px;
    left: 50%;
    line-height: 1;
    position: absolute;
    transform: translateX(-50%);
}

.cp-gallery-lightbox__button {
    align-items: center;
    appearance: none;
    background: rgba(255, 255, 255, 0.16);
    border: 0;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-family: Arial, sans-serif;
    height: 44px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: absolute;
    transition: background-color 0.2s ease;
    width: 44px;
}

.cp-gallery-lightbox__button:hover,
.cp-gallery-lightbox__button:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

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

.cp-gallery-lightbox__close {
    font-size: 34px;
    right: max(16px, env(safe-area-inset-right));
    top: max(16px, env(safe-area-inset-top));
}

.cp-gallery-lightbox__prev,
.cp-gallery-lightbox__next {
    font-size: 44px;
    top: 50%;
    transform: translateY(-50%);
}

.cp-gallery-lightbox__prev {
    left: max(10px, env(safe-area-inset-left));
}

.cp-gallery-lightbox__next {
    right: max(10px, env(safe-area-inset-right));
}

@media (max-width: 767px) {
    .cp-gallery-lightbox {
        padding-left: 8px;
        padding-right: 8px;
    }

    .cp-gallery-lightbox__image {
        max-height: calc(100dvh - 104px);
    }

    .cp-gallery-lightbox__prev,
    .cp-gallery-lightbox__next {
        bottom: max(18px, env(safe-area-inset-bottom));
        top: auto;
        transform: none;
    }

    .cp-gallery-lightbox__counter {
        bottom: max(31px, env(safe-area-inset-bottom));
    }
}
