.listing-gallery {
    position: relative;
    width: 100%;
    display: block;
}

.listing-gallery__viewport {
    position: relative;
    display: block;
    width: 100%;
    height: 0;
    overflow: hidden;
    background: #f5f5f5;
}

.listing-gallery__track {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    margin: 0;
    padding: 0;
    transition: transform 0.35s ease;
    will-change: transform;
}

/*
 * Claue grid sets `.product-top a { height: 0 }` for the old photo link.
 * That also collapses our slide anchors — force them to fill the viewport.
 */
.listing-gallery__slide,
.products-grid .product-top .listing-gallery a.listing-gallery__slide,
.product-item-info .product-top .listing-gallery a.listing-gallery__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100% !important;
    position: relative;
    display: block !important;
    overflow: hidden;
    padding: 0 !important;
}

.listing-gallery__slide img,
.products-grid .product-top .listing-gallery a.listing-gallery__slide img,
.product-item-info .product-top .listing-gallery a.listing-gallery__slide img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    min-width: 100%;
    object-fit: cover;
    display: block !important;
    margin: 0 !important;
    border: 0;
    padding: 0;
    z-index: 1;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.listing-gallery__nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.72);
    color: #222;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.listing-gallery__nav:hover,
.listing-gallery__nav:focus {
    background: rgba(255, 255, 255, 0.95);
    outline: none;
}

.listing-gallery__nav--prev {
    left: 8px;
}

.listing-gallery__nav--next {
    right: 8px;
}

.listing-gallery__nav svg {
    width: 14px;
    height: 14px;
    display: block;
    pointer-events: none;
}

.product-item-info:hover .listing-gallery--multi .listing-gallery__nav,
.listing-gallery--multi:focus-within .listing-gallery__nav,
.listing-gallery--multi.is-touch .listing-gallery__nav {
    opacity: 1;
    visibility: visible;
}

.listing-gallery__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    gap: 3px;
    padding: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.12);
}

.listing-gallery__progress-segment {
    flex: 1 1 0;
    height: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.listing-gallery__progress-segment::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease;
}

.listing-gallery__progress-segment.is-active::after {
    background: rgba(40, 40, 40, 0.75);
}

/* Keep wishlist / labels above the gallery chrome */
.product-top > .actions-link,
.product-top > .product-label,
.product-image-content > .actions-secondary,
.product-image-content > .product-label,
.product-image-content > .mgs-quickview {
    z-index: 4;
}

@media (max-width: 767px) {
    .listing-gallery--multi .listing-gallery__nav {
        opacity: 1;
        visibility: visible;
    }
}
