.kamado-product-images,
.kamado-product-image-track {
    display: contents;
}

.kamado-product-image-progress {
    display: none;
}

#kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link .kamado-product-image-track > img ~ img {
    display: none !important;
}

#kamadobono :is(.products, .products-slider) .product :is(.sold-out-overlay, .discount-badge, .custom-product-label) {
    z-index: 2;
}

@media (hover: hover) and (pointer: fine) {
    #kamadobono :is(.products, .products-slider) .product .kamado-product-images:not(.is-swipeable) {
        display: block;
        position: relative;
        overflow: hidden;
        margin-bottom: 35px;
        border-radius: 8px;
        line-height: 0;
    }

    #kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link .kamado-product-images:not(.is-swipeable) .kamado-product-image-track > img {
        margin: 0 !important;
    }

    #kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link .kamado-product-images:not(.is-swipeable) .kamado-product-image-track > .kamado-product-image-secondary {
        display: block !important;
        position: absolute;
        inset: 0;
        height: 100% !important;
        object-fit: cover;
        filter: opacity(0);
        pointer-events: none;
    }

    #kamadobono :is(.products, .products-slider) .product .kamado-product-images.is-ready:not(.is-swipeable):hover img:first-child,
    #kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link:focus-visible .kamado-product-images.is-ready:not(.is-swipeable) img:first-child {
        filter: opacity(0);
    }

    #kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link .kamado-product-images.is-ready:not(.is-swipeable):hover .kamado-product-image-secondary,
    #kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link:focus-visible .kamado-product-images.is-ready:not(.is-swipeable) .kamado-product-image-secondary {
        filter: opacity(1);
    }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .kamado-product-images:not(.is-swipeable) .kamado-product-image-track > img {
        transition: filter 180ms ease;
    }
}

@media (max-width: 767px) and (any-pointer: coarse), (max-height: 500px) and (hover: none) and (pointer: coarse) {
    #kamadobono :is(.products, .products-slider) .product .kamado-product-images.is-swipeable {
        display: block;
        position: relative;
        overflow: hidden;
        margin-bottom: 35px;
        border-radius: 8px;
        line-height: 0;
    }

    #kamadobono :is(.products, .products-slider) .product .is-swipeable .kamado-product-image-track {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .kamado-product-image-track::-webkit-scrollbar {
        display: none;
    }

    #kamadobono :is(.products, .products-slider) .product .woocommerce-loop-product__link .is-swipeable .kamado-product-image-track > img {
        display: block !important;
        width: 100% !important;
        min-width: 0;
        margin: 0 !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    #kamadobono :is(.products, .products-slider) .product .is-swipeable .kamado-product-image-track > img ~ img {
        height: 100% !important;
        object-fit: cover;
        contain: size;
    }

    .is-swipeable .kamado-product-image-progress {
        display: block;
        position: absolute;
        z-index: 1;
        bottom: 8px;
        left: 50%;
        width: min(52%, 54px);
        height: 4px;
        border-radius: 4px;
        background: rgb(0 0 0 / 40%);
        box-shadow: 0 0 0 1px rgb(0 0 0 / 20%);
        overflow: hidden;
        pointer-events: none;
        transform: translateX(-50%);
    }

    .kamado-product-image-progress::before {
        content: '';
        display: block;
        width: calc(100% / var(--photo-count));
        height: 100%;
        border-radius: inherit;
        background: #fff;
        transform: translateX(calc(var(--photo-index, 0) * 100%));
    }
}

@media (prefers-reduced-motion: no-preference) {
    .is-swipeable.is-hinting .kamado-product-image-track > img {
        animation: kamado-product-photo-peek 1.15s ease-in-out;
    }
}

@keyframes kamado-product-photo-peek {
    0%, 100% { transform: translateX(0); }
    45%, 60% { transform: translateX(-15%); }
}
