/* Swipeable product-card gallery (mobile/touch). Desktop shows the first image only. */
.mk-card-gallery {
    position: relative;
    display: block;
    width: 100%;
}

.mk-card-gallery__track {
    display: block;
}

.mk-card-gallery__slide {
    display: block;
}

.mk-card-gallery__slide img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    -webkit-user-drag: none;
}

/* Desktop: single image, no dots (keeps the original look and loads nothing extra) */
.mk-card-gallery__slide:not(:first-child),
.mk-card-gallery__dots {
    display: none;
}

@media (max-width: 991px) {
    .mk-card-gallery__track {
        display: flex;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x pan-y;
    }

    .mk-card-gallery__track::-webkit-scrollbar {
        display: none;
    }

    .mk-card-gallery__slide,
    .mk-card-gallery__slide:not(:first-child) {
        display: block;
        overflow: hidden;
        flex: 0 0 100%;
        width: 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .mk-card-gallery[data-count="1"] .mk-card-gallery__dots {
        display: none;
    }

    .mk-card-gallery__dots {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 8px;
        display: flex;
        justify-content: center;
        gap: 5px;
        pointer-events: none;
        z-index: 2;
    }

    .mk-card-gallery__dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.75);
        box-shadow: 0 0 2px rgba(0, 0, 0, 0.45);
        transition: background-color .2s, transform .2s;
    }

    .mk-card-gallery__dot.is-active {
        background: #b92d5e;
        transform: scale(1.25);
    }
}

/* ------------------------------------------------------------------
   Show product photos in full on phones.
   A site-wide inline rule (not in this repo; likely Appearance ->
   Customize -> Additional CSS) zooms every catalog image:
     @media (max-width:768px){ ul.products li.product a img { transform: scale(1.4); object-fit: cover } }
   which crops photos at the card edges. Neutralise it for card images.
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
    /* Bigger photo area without cropping: trim the side padding of the image block
       (theme default is 12.5px). Raise/lower this to make photos larger/smaller. */
    ul.products li.product .product__header {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    ul.products li.product .product__header > a {
        display: block;
        overflow: hidden;
    }

    /* The zoom is computed per photo by product-card-swipe.js (--mk-scale / --mk-tx / --mk-ty):
       as large as possible while the whole product stays inside the frame. */
    ul.products li.product .product__header img:not(.onsale):not(.onsale-offer) {
        transform: scale(var(--mk-scale, 1)) translate(var(--mk-tx, 0%), var(--mk-ty, 0%)) !important;
        transform-origin: 50% 50% !important;
        object-fit: contain !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
}
