/* GAMBEA product gallery 1.0.2. Catalog/related-product selectors are untouched. */
.gambea-pg-desktop,
.gambea-pg-mobile {
    min-width: 0;
}

.gambea-pg-desktop .custom-gallery-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.gambea-pg-desktop .custom-gallery-columns > .custom-gallery-item {
    position: relative;
    display: block;
    min-width: 0;
    margin: 0;
    overflow: hidden;
}

/* The site's old stylesheet hides the native gallery-image class globally. */
.gambea-pg-desktop .custom-gallery-columns > .gambea-pg-primary.woocommerce-product-gallery__image {
    display: block !important;
}

.gambea-pg-desktop .custom-gallery-item > img[data-gambea-pg-image] {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.gambea-pg-desktop .custom-gallery-item > video[data-gambea-pg-video] {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gambea-pg-desktop .gambea-pg-empty {
    visibility: hidden;
}

.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel] {
    --gambea-pg-ratio: 4 / 5;
    position: relative;
    width: 100%;
    min-width: 0;
    margin: 0;
    aspect-ratio: var(--gambea-pg-ratio);
}

/* Also usable while Flickity is loading or if the script fails to load. */
.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel]:not(.flickity-enabled) {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel] .gallery-cell[data-gambea-pg-cell] {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    scroll-snap-align: start;
}

/* Scoped replacement of the site's global padding-bottom:125%/height:auto rule. */
.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel] .flickity-viewport {
    position: relative;
    width: 100%;
    height: 100% !important;
    padding-bottom: 0;
    overflow: hidden;
}

.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel] .flickity-slider {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
}

.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel].is-draggable .flickity-viewport {
    touch-action: pan-y;
    cursor: grab;
}

.gambea-pg-mobile .gallery-flickity[data-gambea-pg-carousel] .flickity-viewport.is-pointer-down {
    cursor: grabbing;
}

.gambea-pg-mobile .gallery-cell[data-gambea-pg-cell] > img[data-gambea-pg-image],
.gambea-pg-mobile .gallery-cell[data-gambea-pg-cell] > video[data-gambea-pg-video] {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
}

.gambea-pg-noscript img {
    display: block;
    width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .gambea-pg-desktop[data-gambea-pg-root] {
        display: none !important;
    }

    .gambea-pg-noscript-desktop {
        display: none !important;
    }

    .gambea-pg-mobile[data-gambea-pg-mobile] {
        display: block;
    }
}

@media (min-width: 769px) {
    .gambea-pg-mobile[data-gambea-pg-mobile] {
        display: none !important;
    }

    .gambea-pg-noscript-mobile {
        display: none !important;
    }
}
