/**
 * MuProductSlider styles — custom product gallery (no Slick, no FlexSlider).
 */

/* Container — keep WC's gallery dimensions, just become the host for our slider. */
.woocommerce-product-gallery.mu-gallery {
    opacity: 1;
    visibility: visible;
    position: relative;
    width: 100%;
    --mu-thumb-size: 68px;
    --mu-thumb-gap: 12px;
}

/* Hide wcavi variation galleries permanently — we read their image data
   but never render them. The canonical slider stays put. */
.woocommerce-product-gallery--wcavi {
    display: none !important;
}

/* ===== Main image area ===== */

.mu-gallery__main {
    position: relative;
    width: 100%;
    user-select: none;
}

.mu-gallery__viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 376px;
    border-radius: 10px;
    background: #F5F6F6;
}

@media (max-width: 768px) {
    .mu-gallery__viewport {
        min-height: 280px;
    }
}

.mu-gallery__track {
    display: flex;
    align-items: stretch;
    will-change: transform;
    transition: transform 0.35s ease;
    transform: translate3d(0, 0, 0);
}

.mu-gallery__track--notransition {
    transition: none !important;
}

/* Each slide takes the full viewport width. */
.mu-gallery__slide,
.mu-gallery.mu-gallery .woocommerce-product-gallery__image {
    flex: 0 0 100%;
    min-width: 0;
    width: 100%;
    height: 376px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #F5F6F6;
    border-radius: 10px;
    box-sizing: border-box;
    position: relative;
}

.mu-gallery__slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    pointer-events: auto;
}

/* ===== Main arrows =====
   Hidden — navigation is via thumbnails, keyboard, and swipe.
   The buttons stay in the DOM (for screen readers and programmatic API)
   but are visually and physically removed. */
.mu-gallery__nav {
    display: none !important;
}

/* ===== Thumbnail strip ===== */

.mu-gallery__thumbs {
    position: relative;
    margin-top: 20px;
    padding: 0 10px;
    min-height: var(--mu-thumb-size, 68px);
    display: flex;
    align-items: center;
}

.mu-gallery__thumb-viewport {
    position: relative;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 0;
}

.mu-gallery__thumb-track {
    display: flex;
    gap: var(--mu-thumb-gap, 12px);
    will-change: transform;
    transition: transform 0.3s ease;
    transform: translate3d(0, 0, 0);
    padding: 2px; /* room for the active border without clipping */
    margin: -2px;
}

.mu-gallery__thumb {
    flex: 0 0 var(--mu-thumb-size, 68px);
    width: var(--mu-thumb-size, 68px);
    height: var(--mu-thumb-size, 68px);
    padding: 0;
    margin: 0;
    background: #F5F6F6;
    background-color: #F5F6F6;
    border: 1px solid rgba(0, 0, 0, 0.45);
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    box-shadow: none;
    color: inherit;
    font: inherit;
    line-height: normal;
}

.mu-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 5px;
}

.mu-gallery__thumb:hover {
    opacity: 0.9;
}

.mu-gallery__thumb--active {
    opacity: 1;
    border-color: #000;
}

.mu-gallery__thumb:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Thumb strip arrows */

.mu-gallery__thumb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: transparent !important;
    background-color: transparent !important;
    border: none;
    box-shadow: none !important;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
    font: inherit;
    line-height: normal;
}

.mu-gallery__thumb-nav:hover,
.mu-gallery__thumb-nav:focus,
.mu-gallery__thumb-nav:active {
    background: transparent !important;
    background-color: transparent !important;
    color: #000;
    box-shadow: none !important;
}

.mu-gallery__thumb-nav svg {
    width: 32px;
    height: 32px;
    display: block;
    stroke: #000;
}

.mu-gallery__thumb-nav--prev { left: 0; }
.mu-gallery__thumb-nav--next { right: 0; }

.mu-gallery__thumb-nav--disabled {
    opacity: 0;
    pointer-events: none;
}

.mu-gallery__thumbs--single .mu-gallery__thumb-nav {
    display: none;
}

/* If there's only one image, hide the thumb strip entirely. */
.mu-gallery__thumbs--single {
    display: none;
}

/* ===== Elementor Site Kit button reset (kit-63 global `button` styles) =====
   Kit rule: .elementor-kit-63 button { background-color: var(--e-global-color-primary); }
   Higher specificity + !important so gallery thumbs keep #F5F6F6. */

.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb {
    background: #F5F6F6 !important;
    background-color: #F5F6F6 !important;
    border: 1px solid rgba(0, 0, 0, 0.45) !important;
    border-radius: 6px !important;
    padding: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
}

.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb:hover,
.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb:focus,
.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb:active,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb:hover,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb:focus,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb:active {
    background: #F5F6F6 !important;
    background-color: #F5F6F6 !important;
}

.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb--active {
    background: #F5F6F6 !important;
    background-color: #F5F6F6 !important;
    border-color: #000 !important;
}

.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb-nav,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb-nav {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #000 !important;
    padding: 0 !important;
}

.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb-nav:hover,
.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb-nav:focus,
.single-product .woocommerce-product-gallery.mu-gallery button.mu-gallery__thumb-nav:active,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb-nav:hover,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb-nav:focus,
.single-product .woocommerce-product-gallery.mu-gallery .mu-gallery__thumb-nav:active {
    background: transparent !important;
    background-color: transparent !important;
    color: #000 !important;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .mu-gallery__slide,
    .mu-gallery.mu-gallery .woocommerce-product-gallery__image {
        height: auto;
        min-height: 280px;
    }

    .mu-gallery__slide img {
        max-height: 60vw;
    }

    .mu-gallery__thumbs {
        padding: 0 10px;
    }

    .mu-gallery__thumb-nav {
        width: 32px;
        height: 32px;
    }

    .mu-gallery__thumb-nav svg {
        width: 22px;
        height: 22px;
    }

    .mu-gallery__nav {
        width: 36px;
        height: 36px;
    }

    .mu-gallery__nav--prev { left: 8px; }
    .mu-gallery__nav--next { right: 8px; }
}
