/**
 * True Seamless Infinite Scroll 
 * A completely rewritten CSS implementation for perfectly smooth infinite scrolling
 */

/* Main container */
.bmwp-infinite-slider-container {
    position: relative;
    width: 100%;
    background-color: var(--base);
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow: hidden; /* Important - contains the scrolling content */
}

/* Fixed fade overlays on desktop only */
@media (min-width: 1026px) {
    .bmwp-infinite-slider-container::before,
    .bmwp-infinite-slider-container::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 15%;
        z-index: 10;
        pointer-events: none;
    }

    .bmwp-infinite-slider-container::before {
        left: 0;
        background: linear-gradient(to right, var(--base) 0%, transparent 100%);
    }

    .bmwp-infinite-slider-container::after {
        right: 0;
        background: linear-gradient(to left, var(--base) 0%, transparent 100%);
    }
}

/* Row of products */
.wc-sku-products-grid {
    display: flex;
    white-space: nowrap;
    gap: 24px;
}

@media (min-width: 1026px) {
    /* Basic setup for infinite scrolling */
    .wc-sku-products-grid.infinite-scroll {
        width: max-content; /* Important - allows content to define width */
    }

    /* First row - moves left */
    .wc-sku-products-grid.infinite-scroll:not(.is-reversed) {
        animation: scroll-left 140s linear infinite;
    }

    /* First row - slower */
    .wc-sku-products-grid.infinite-scroll.is-slower:not(.is-reversed) {
        animation: scroll-left 180s linear infinite;
    }

    /* First row - faster */
    .wc-sku-products-grid.infinite-scroll.is-faster:not(.is-reversed) {
        animation: scroll-left 100s linear infinite;
    }

    /* Second row - always moves right */
    .wc-sku-products-grid.infinite-scroll.is-reversed {
        animation: scroll-right 140s linear infinite;
    }

    /* Second row - slower */
    .wc-sku-products-grid.infinite-scroll.is-reversed.is-slower {
        animation: scroll-right 180s linear infinite;
    }

    /* Second row - faster */
    .wc-sku-products-grid.infinite-scroll.is-reversed.is-faster {
        animation: scroll-right 100s linear infinite;
    }

    /* Pause on hover */
    .wc-sku-products-grid.infinite-scroll.on-hover-paused:hover {
        animation-play-state: paused;
    }

    /* True seamless scroll animations */
    @keyframes scroll-left {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(calc(-50%));
        }
    }

    @keyframes scroll-right {
        0% {
            transform: translateX(calc(-50%));
        }
        100% {
            transform: translateX(0);
        }
    }
}
/* Product styling */
.wc-sku-product {
    flex: 0 0 450px; /* Fixed width */
    height: 450px;
    position: relative;
    overflow: hidden;
    background-color: #000;
    box-sizing: border-box;
}

.wc-sku-product figure {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

.wc-sku-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wc-sku-product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(180deg, rgba(13, 8, 9, 0.09) 0%, var(--contrast) 40%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 0 30px;
}

.wc-sku-product:hover .wc-sku-product-overlay {
    opacity: 1;
}

.wc-sku-product-title {
    color: #fff;
    font-size: 22px; /* Slightly smaller font size to fit more text */
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    width: 100%; /* Full width of container */

    /* Text wrapping */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;

    /* Remove truncation */
    display: block;
    overflow: visible;

    /* Better readability */
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);

    /* Ensure it doesn't crowd the button */
    max-height: 70%;
    overflow-y: auto;
}

.wc-sku-product-button {
    background-color: #e61e25;
    color: #fff;
    padding: 12px 24px;
    font-weight: bold;
    text-decoration: none;
    border: none;
    transition: background-color 0.3s ease;
}

.wc-sku-product-button:hover {
    background-color: white;
    color: #000;
}

/* Accessibility */
@media (prefers-reduced-motion) {
    .wc-sku-products-grid.infinite-scroll:not(.is-reversed) {
        animation: scroll-left 240s linear infinite;
    }
    .wc-sku-products-grid.infinite-scroll.is-reversed {
        animation: scroll-right 240s linear infinite;
    }
}

@media screen and (max-width: 1025px) {
    .bmwp-infinite-slider-container {
        padding: 20px 0;
        gap: 15px;
        overflow: visible; /* Allow content to be visible outside container */
    }

    /* Disable animations completely for mobile */
    .wc-sku-products-grid.infinite-scroll {
        animation: none;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        padding: 10px 0; /* Add padding for better touch experience */
        scrollbar-width: none; /* Hide scrollbar on Firefox */
        -ms-overflow-style: none; /* Hide scrollbar on IE/Edge */
    }

    /* Hide scrollbar on Chrome/Safari */
    .wc-sku-products-grid.infinite-scroll::-webkit-scrollbar {
        display: none;
    }

    /* Add visual cue that content is scrollable */
    .wc-sku-products-grid.infinite-scroll::after {
        content: "";
        flex: 0 0 20px;
        height: 1px; /* Invisible spacer to encourage scrolling */
    }

    /* Don't duplicate products on mobile */
    .wc-sku-products-grid.infinite-scroll .wc-sku-product:nth-child(n + 8),
    .is-reversed {
        display: none !important;
    }

    .wc-sku-product {
        flex: 0 0 250px; /* Fixed width */
        height: 250px;
    }

    .wc-sku-product-title {
        font-size: 18px;
    }

    .wc-sku-product-button {
        padding: 8px 16px;
        font-size: 16px;
    }

    /* Smaller gap between rows */
    .bmwp-infinite-slider-container {
        gap: 10px;
    }

    .bmwp-infinite-slider-container::before,
    .bmwp-infinite-slider-container::after {
        width: 7.5%; /* Width of the fade */
    }
}
