/**
 * Exakt Product Carousel — a row of product cards that slides sideways.
 *
 * Built on a NATIVE horizontal scroller (overflow-x + scroll-snap) rather than a
 * transform-driven track: touch, trackpad and keyboard dragging all work with no
 * JS, and the row degrades to a plain scrollable list if the script never loads.
 * The JS only adds arrow buttons and optional autoplay on top.
 *
 * @package exakt-slider
 * @since   0.2.0
 */

.exakt-product-carousel {
    --exakt-carousel-per-view: 4;
    --exakt-carousel-gap: 22px;
    position: relative;
    width: 100%;
}

.exakt-carousel-title {
    text-align: center;
    margin: 0 0 22px;
}

.exakt-carousel-frame {
    position: relative;
}

.exakt-carousel-track {
    display: flex;
    gap: var(--exakt-carousel-gap);
    margin: 0;
    padding: 4px 2px 14px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* Hide the scrollbar but keep the element scrollable. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.exakt-carousel-track::-webkit-scrollbar {
    display: none;
}

.exakt-carousel-track:focus-visible {
    outline: 2px solid var(--exakt-slider-btn-bg, #E61577);
    outline-offset: 4px;
}

.exakt-carousel-item {
    /* N across minus the gaps they share. flex:0 0 stops cards stretching when
       there are fewer products than per_view. */
    flex: 0 0 calc(
        (100% - (var(--exakt-carousel-per-view) - 1) * var(--exakt-carousel-gap))
        / var(--exakt-carousel-per-view)
    );
    scroll-snap-align: start;
    min-width: 0;
}

.exakt-carousel-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--exakt-slider-slide-bg, #fff);
    border: 1px solid var(--exakt-border, #E6E1E3);
    text-decoration: none;
    transition: transform .2s ease, border-color .2s ease;
}

.exakt-carousel-card:hover,
.exakt-carousel-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--exakt-slider-btn-bg, #E61577);
}

.exakt-carousel-thumb {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff;
}

.exakt-carousel-thumb img {
    width: 100%;
    height: 100%;
    /* contain, not cover: product shots are packshots on white and cropping them
       cuts the bottle off. */
    object-fit: contain;
    display: block;
}

.exakt-carousel-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--exakt-slider-btn-bg, #E61577);
    color: var(--exakt-slider-btn-color, #fff);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 8px;
}

.exakt-carousel-name {
    display: block;
    padding: 16px 16px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--exakt-slider-name-color, #231F20);
}

.exakt-carousel-price {
    display: block;
    padding: 8px 16px 18px;
    font-size: 15px;
    font-weight: 700;
    color: var(--exakt-slider-price-color, #231F20);
}

.exakt-carousel-price del {
    opacity: .55;
    font-weight: 400;
    margin-right: 6px;
}

/* Arrows — hidden until the JS decides the row actually overflows -------- */

.exakt-carousel-arrow {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: var(--exakt-slider-arrow-bg, #303030);
    color: var(--exakt-slider-arrow-color, #fff);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    transition: background .2s ease, opacity .2s ease;
}

.exakt-carousel-arrow[hidden] {
    display: none;
}

.exakt-carousel-arrow:hover,
.exakt-carousel-arrow:focus-visible {
    background: var(--exakt-slider-btn-bg, #E61577);
}

.exakt-carousel-arrow:disabled {
    opacity: .35;
    cursor: default;
}

.exakt-carousel-arrow svg { width: 20px; height: 20px; }
.exakt-carousel-prev { left: -18px; }
.exakt-carousel-next { right: -18px; }

@media (max-width: 1240px) {
    .exakt-carousel-prev { left: 2px; }
    .exakt-carousel-next { right: 2px; }
}

/* Responsive step-down ---------------------------------------------------- */

@media (max-width: 1024px) {
    .exakt-product-carousel { --exakt-carousel-per-view: 3; }
}

@media (max-width: 768px) {
    .exakt-product-carousel { --exakt-carousel-per-view: 2; --exakt-carousel-gap: 14px; }
}

@media (max-width: 480px) {
    .exakt-product-carousel { --exakt-carousel-per-view: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .exakt-carousel-track { scroll-behavior: auto; }
    .exakt-carousel-card:hover { transform: none; }
}
