/*
 * Decca product carousel.
 * Product cards themselves are the normal WooCommerce content-product.php
 * output, so this CSS only controls carousel layout/navigation.
 */
.decca-product-carousel {
    --decca-carousel-desktop: 4;
    --decca-carousel-tablet: 2;
    --decca-carousel-mobile: 1;
    --decca-carousel-gap: 20px;
    --decca-carousel-visible: var(--decca-carousel-desktop);
    position: relative;
    width: 100%;
    min-width: 0;
}

/* Keep the original Decca carousel control location: top-right above the cards.
 * The buttons themselves use the site's Liquid/Flickity classes and SVG artwork. */
.decca-product-carousel__controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

/* Liquid/Flickity normally positions carousel arrows absolutely. Override only
 * the positioning here so these controls stay in the original Decca location. */
.decca-product-carousel__controls .flickity-prev-next-button {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: 0 !important;
}

.decca-product-carousel__controls .flickity-prev-next-button:disabled {
    opacity: .35;
    cursor: default;
}

.decca-product-carousel__viewport {
    width: 100%;
    overflow: hidden;
}

/* Override the normal WooCommerce archive grid only for this carousel track. */
.decca-product-carousel ul.products.decca-product-carousel__track {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    gap: var(--decca-carousel-gap) !important;
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    transform: translate3d(0, 0, 0);
    transition: transform .35s ease;
    will-change: transform;
}

.decca-product-carousel ul.products.decca-product-carousel__track::before,
.decca-product-carousel ul.products.decca-product-carousel__track::after {
    display: none !important;
    content: none !important;
}

.decca-product-carousel ul.products.decca-product-carousel__track > li.product {
    float: none !important;
    flex: 0 0 calc(
        (100% - (var(--decca-carousel-visible) - 1) * var(--decca-carousel-gap)) /
        var(--decca-carousel-visible)
    ) !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
}

/* Keep theme product cards at equal height where the card supports flex. */
.decca-product-carousel ul.products.decca-product-carousel__track > li.product {
    height: auto;
}

@media (max-width: 1024px) {
    .decca-product-carousel {
        --decca-carousel-visible: var(--decca-carousel-tablet);
    }
}

@media (max-width: 767px) {
    .decca-product-carousel {
        --decca-carousel-visible: var(--decca-carousel-mobile);
    }

}

@media (prefers-reduced-motion: reduce) {
    .decca-product-carousel ul.products.decca-product-carousel__track {
        transition: none;
    }
}
