/* =========================================================
   COD Home Builder - Lightweight Product Gallery
   Mobile-first | No external libraries
   ========================================================= */

.codhb-product-gallery-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    background: #f1f2f4;
    overflow: hidden;
    touch-action: pan-y;
}

.codhb-product-gallery-wrap .codhb-product-main-img {
    transition: opacity 0.14s ease, transform 0.14s ease;
    will-change: opacity;
}

.codhb-product-gallery-wrap .codhb-product-main-img.is-changing {
    opacity: 0.35;
    transform: scale(0.992);
}

.codhb-product-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    padding: 8px;
    background: var(--codhb-product-card-bg, #ffffff);
}

.codhb-product-gallery-item {
    appearance: none;
    border: 1px solid var(--codhb-product-border-color, #e5e7eb);
    padding: 0;
    margin: 0;
    width: 100%;
    overflow: hidden;
    border-radius: 11px;
    background: #f3f4f6;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    opacity: 0.72;
    transition: border-color 0.14s ease, opacity 0.14s ease, transform 0.14s ease;
}

.codhb-product-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.codhb-product-gallery-item.is-active {
    opacity: 1;
    border-color: var(--codhb-product-accent-color, #16a34a);
}

.codhb-product-gallery-item:active {
    transform: scale(0.97);
}

@media (max-width: 640px) {
    .codhb-product-gallery {
        gap: 5px;
        padding: 6px;
    }

    .codhb-product-gallery-item {
        border-radius: 9px;
    }

    .codhb-product-gallery-wrap .codhb-product-main-img.is-changing {
        opacity: 0.45;
        transform: scale(0.996);
    }
}

@media (min-width: 641px) {
    .codhb-product-gallery-item:hover {
        opacity: 1;
        border-color: var(--codhb-product-accent-color, #16a34a);
    }
}