.product-gallery-slider {
    position: relative;
    width: 100%;
    margin: 40px 0;
    padding-bottom: 35px;
}

.product-gallery-slider__slide {
    height: auto;
}

.product-gallery-slider__media {
    position: relative;
    display: block;
    width: 100%;
    height: auto !important;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #f5f5f5 !important;
    cursor: pointer;
}

.product-gallery-slider__media img,
.product-gallery-slider__media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-gallery-slider__media:hover img,
.product-gallery-slider__media:hover video {
    transform: scale(1.03);
}


/* Video */

.product-gallery-slider__media--video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.product-gallery-slider__play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.product-gallery-slider__play::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 52%;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid #222;
    transform: translate(-40%, -50%);
}


/* Navigation */

.product-gallery-slider__prev,
.product-gallery-slider__next {
    position: absolute;
    top: calc(50% - 18px);
    z-index: 5;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transform: translateY(-50%);
}

.product-gallery-slider__prev {
    left: 15px;
}

.product-gallery-slider__next {
    right: 15px;
}

.product-gallery-slider__prev::before,
.product-gallery-slider__next::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    border-top: 2px solid #222;
    border-right: 2px solid #222;
}

.product-gallery-slider__prev::before {
    left: 18px;
    transform: translateY(-50%) rotate(-135deg);
}

.product-gallery-slider__next::before {
    right: 18px;
    transform: translateY(-50%) rotate(45deg);
}

.product-gallery-slider__prev.swiper-button-disabled,
.product-gallery-slider__next.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
}


/* Pagination */

.product-gallery-slider__pagination {
    position: absolute;
    bottom: 0 !important;
    left: 0;
    width: 100%;
    text-align: center;
}

.product-gallery-slider__pagination .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
}


/* Popup */

.product-gallery-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    visibility: hidden;
    opacity: 0;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.product-gallery-popup.is-open {
    visibility: visible;
    opacity: 1;
}

.product-gallery-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.product-gallery-popup__dialog {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    max-width: calc(100vw - 80px);
    max-height: calc(100vh - 80px);
}

.product-gallery-popup__content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    overflow: hidden;
    background: #fff;
}

.product-gallery-popup__content img,
.product-gallery-popup__content video {
    display: block;
    width: min(900px, calc(100vw - 80px));
    height: auto;
    max-width: min(1200px, calc(100vw - 80px));
    max-height: min(800px, calc(100vh - 80px));
    object-fit: contain;
}

.product-gallery-popup__close {
    position: absolute;
    top: -20px;
    right: -20px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0 0 4px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 32px;
    line-height: 1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    cursor: pointer;
}

body.product-gallery-popup-open {
    overflow: hidden;
}


@media (max-width: 767px) {
    .product-gallery-slider {
        margin: 25px 0;
    }

    .product-gallery-slider__prev,
    .product-gallery-slider__next {
        width: 38px;
        height: 38px;
    }

    .product-gallery-slider__prev {
        left: 8px;
    }

    .product-gallery-slider__next {
        right: 8px;
    }

    .product-gallery-slider__prev::before {
        left: 16px;
    }

    .product-gallery-slider__next::before {
        right: 16px;
    }

    .product-gallery-slider__play {
        width: 52px;
        height: 52px;
    }

    .product-gallery-slider__play::after {
        border-top-width: 8px;
        border-bottom-width: 8px;
        border-left-width: 13px;
    }


    /* Popup */

    .product-gallery-popup {
        padding: 20px;
    }

    .product-gallery-popup__dialog {
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }

    .product-gallery-popup__content img,
    .product-gallery-popup__content video {
        width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }

    .product-gallery-popup__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
}