.ecomGallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ecomGallery:not(.ecomGalleryUseDots) {
    padding-bottom: 26px;
    margin-inline: -20px;
}

@media (min-width: 1024px) {
    .ecomGallery {
        position: sticky;
        top: 50px;
    }

    .ecomGallery:not(.ecomGalleryUseDots) {
        padding: 0;
        margin-inline: 0;
    }
}

.ecomGalleryUseDots {
    gap: 16px;
}

.ecomGalleryUseDots .ecomGalleryThumb {
    background: #008fbe !important;
}

.ecomGalleryMain {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    /* Allow vertical page scroll, capture horizontal ourselves. */
    touch-action: pan-y;
}

.ecomGalleryMain.isGrabbing {
    cursor: grabbing;
}

@media (min-width: 1024px) {
    .ecomGalleryMain {
        border-radius: 10px;
    }
}

.ecomGalleryMainTrack {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.ecomGalleryMainSlide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    line-height: 0;
}

.ecomGalleryMainSlide img,
.ecomGalleryMainImage {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    pointer-events: none;
    aspect-ratio: 1 / 1;
}

.ecomGalleryThumbs {
    display: flex;
    align-items: center;
    justify-content: safe center;
    gap: 8px;
    padding-inline: 16px;
    border-radius: 60px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    cursor: grab;
    user-select: none;
}

.ecomGalleryThumbs.isGrabbing {
    cursor: grabbing;
}

.ecomGalleryThumbs::-webkit-scrollbar {
    display: none;
}

@media (min-width: 1024px) {
    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumbs {
        justify-content: safe flex-start;
        gap: 4px;
        padding-inline: 0;
        border-radius: 0;
    }
}

.ecomGalleryThumb {
    flex: 0 0 auto !important;
    width: 6px !important;
    height: 6px !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: var(--ecomColorAccent) !important;
    opacity: 0.5;
    cursor: pointer;
    overflow: hidden;
    transition:
        width 240ms var(--ecomEaseOut),
        opacity 200ms var(--ecomEaseOut),
        transform 220ms var(--ecomEaseOut) !important;
    appearance: none;
    -webkit-appearance: none;
    text-transform: none !important;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05) !important;
}

.ecomGalleryThumb.isActive {
    width: 16px !important;
    border-radius: 30px !important;
    opacity: 1;
}

.ecomGalleryThumb:active {
    transform: scale(0.8);
    transition-duration: 100ms !important;
}

.ecomGalleryThumbImage {
    display: none;
}

@media (min-width: 1024px) {
    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb {
        flex: 0 0 60px !important;
        width: 60px !important;
        height: 60px !important;
        border: 2px solid transparent !important;
        border-radius: 5px !important;
        background: transparent !important;
        opacity: 1;
        box-shadow: none !important;
        transition:
            padding 200ms var(--ecomEaseOut),
            border-color 200ms var(--ecomEaseOut),
            transform 160ms var(--ecomEaseOut) !important;
    }

    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb.isActive {
        padding: 3px !important;
        border-color: var(--ecomColorAccent) !important;
        flex-basis: 60px !important;
        width: 60px !important;
        border-radius: 5px !important;
    }

    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb:active {
        transform: scale(0.97);
    }

    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumbImage {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 5px;
        opacity: 0.4;
        transition: opacity 200ms var(--ecomEaseOut),
                    border-radius 200ms var(--ecomEaseOut);
    }

    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb.isActive .ecomGalleryThumbImage,
    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb:focus-visible .ecomGalleryThumbImage {
        opacity: 1;
    }

    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb.isActive .ecomGalleryThumbImage {
        border-radius: 3px;
    }
}

@media (hover: hover) and (pointer: fine) {
    .ecomGalleryThumb:hover {
        opacity: 0.75;
    }

    .ecomGalleryThumb.isActive:hover {
        opacity: 1;
    }
}

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb:hover {
        opacity: 1;
    }

    .ecomGallery:not(.ecomGalleryUseDots) .ecomGalleryThumb:hover .ecomGalleryThumbImage {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ecomGalleryThumb,
    .ecomGalleryThumbImage {
        transition: none;
    }

    .ecomGalleryThumb:active {
        transform: none;
    }
}
