.gallery-helper-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000; /* wp's core mobile nav container is 100000 */
    display: flex;
    justify-content: center;
    align-items: center;
}
.gallery-helper-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center
}

.gallery-helper-image {
    max-width: 100%;
    max-height: 100%;
    transition: opacity 0.3s ease;
    cursor: grab;
}
.gallery-helper-lightbox .wp-block-image figure:hover {
    cursor: pointer;
}

.gallery-helper-caption {
    color: white;
  line-height:40px;
position:absolute;
width:100%;
}

.gallery-helper-close,
.gallery-helper-prev,
.gallery-helper-next {
    position: absolute;
    border: none;
    font-size: 20px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.gallery-helper-close:focus,
.gallery-helper-prev:focus,
.gallery-helper-next:focus {
    outline: 2px solid #007cba;
    outline-offset: 0px;
    background: rgba(0, 0, 0, 0.9);
}

.gallery-helper-close:hover,
.gallery-helper-prev:hover,
.gallery-helper-next:hover {
    background: rgba(0, 0, 0, 0.9);
}

.gallery-helper-close {
    top: -10px;
    right: -10px;
}

.gallery-helper-prev {
    left: -50px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-helper-next {
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 768px) {
    .gallery-helper-prev,
    .gallery-helper-next {
        display: none; /* Hide navigation buttons on mobile - use swipe instead */
    }

    .gallery-helper-content {
        max-width: 95%;
        max-height: 95%;
    }

    .gallery-helper-close {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        color: white;
    }

    .gallery-helper-modal {
        padding: 20px;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .gallery-helper-content {
        max-width: 100%;
        max-height: 100%;
    }

    .gallery-helper-modal {
        padding: 10px;
    }
}

/* ===== Carousel ===== */
.gallery-helper-carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-helper-carousel.horizontal {
    height: 500px;
    max-height: 80vh;
}

.gallery-helper-carousel.vertical {
    width: 100%;
    height: 600px;
    max-height: 90vh;
}

.carousel-track {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.gallery-helper-carousel.vertical .carousel-track {
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.gallery-helper-carousel.vertical .carousel-slide {
    width: 100%;
    flex: 0 0 100%;
}

.carousel-slide img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.carousel-slide figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
    text-align: center;
    font-size: 14px;
}

.carousel-btn {
    position: absolute;
    z-index: 10;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 28px;
    padding: 12px 18px;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
    line-height: 1;
    border-radius: 4px;
}

.carousel-btn:hover,
.carousel-btn:focus {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.carousel-btn:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.gallery-helper-carousel.horizontal .carousel-prev {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-helper-carousel.horizontal .carousel-next {
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-helper-carousel.vertical .carousel-prev {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.gallery-helper-carousel.vertical .carousel-next {
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.gallery-helper-carousel:focus {
    outline: none;
}

.gallery-helper-carousel:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: -2px;
}

.gallery-helper-carousel.gallery-helper-lightbox .carousel-slide {
    cursor: pointer;
}

/* Carousel responsive */
@media (max-width: 768px) {
    .gallery-helper-carousel.horizontal {
        height: 350px;
        max-height: 60vh;
    }

    .gallery-helper-carousel.vertical {
        height: 450px;
        max-height: 70vh;
    }

    .carousel-btn {
        font-size: 22px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .gallery-helper-carousel.horizontal {
        height: 260px;
        max-height: 50vh;
    }

    .gallery-helper-carousel.vertical {
        height: 350px;
        max-height: 60vh;
    }

    .carousel-btn {
        font-size: 18px;
        padding: 8px 12px;
    }

    .gallery-helper-carousel.horizontal .carousel-prev {
        left: 6px;
    }

    .gallery-helper-carousel.horizontal .carousel-next {
        right: 6px;
    }
}
