/* Vendor storefront gallery — [core_vendor_gallery]. BEM-ish, RTL-first, theme-agnostic. */

.core-vendor-gallery {
    --cpvg-size: 300px;
    --cpvg-gap: 16px;
    --cpvg-radius: 8px;
    margin: 0 0 24px;
}

.core-vendor-gallery__title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 700;
}

/* Desktop: tiles fill the row at --cpvg-size (300px by default) and never shrink below it. */
.core-vendor-gallery__grid {
    display: grid;
    gap: var(--cpvg-gap);
    grid-template-columns: repeat(auto-fill, minmax(var(--cpvg-size), 1fr));
}

.core-vendor-gallery__item {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: var(--cpvg-radius);
    background: #f3f4f6;
    aspect-ratio: 1 / 1;
}

.core-vendor-gallery__link {
    display: block;
    width: 100%;
    height: 100%;
}

.core-vendor-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease-in-out;
}

.core-vendor-gallery__link:hover .core-vendor-gallery__image,
.core-vendor-gallery__link:focus-visible .core-vendor-gallery__image {
    transform: scale(1.04);
}

.core-vendor-gallery__caption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    margin: 0;
    padding: 28px 12px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 13px;
    line-height: 1.6;
    pointer-events: none;
}

.core-vendor-gallery__empty,
.core-vendor-gallery--empty {
    padding: 16px;
    border: 1px dashed #d1d5db;
    border-radius: var(--cpvg-radius);
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

/*
 * Mobile: a single touch-swipeable horizontal strip instead of a wrapped grid.
 * scroll-snap gives the hard stop between tiles; touch-action: pan-x keeps the
 * gesture as a scroll rather than letting a theme hijack it.
 */
@media (max-width: 782px) {
    .core-vendor-gallery__grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        overscroll-behavior-x: contain;
        touch-action: pan-x pan-y;
        /* Bleed to the container edges so the strip reads as scrollable. */
        margin-inline: calc(var(--cpvg-gap) * -1);
        padding-inline: var(--cpvg-gap);
        /* Hide the scrollbar on browsers that show it, keep the gesture. */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .core-vendor-gallery__grid::-webkit-scrollbar {
        display: none;
    }

    .core-vendor-gallery__item {
        flex: 0 0 auto;
        width: 150px;
        scroll-snap-align: start;
    }
}

@media (max-width: 360px) {
    .core-vendor-gallery__item {
        width: 130px;
    }
}

/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
    .core-vendor-gallery__grid {
        scroll-behavior: auto;
    }

    .core-vendor-gallery__image {
        transition: none;
    }
}