/* Lightweight catalog variation thumbnails. */
.ssb-catalog-thumbs {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 4px;
    clear: both;
    position: relative;
    float: none !important;
    width: 100%;
    max-width: 100%;
    margin: 0 0 9px;
    min-height: 36px;
    overflow: hidden;
    box-sizing: border-box;
    line-height: 1;
}

.ssb-catalog-thumb {
    display: inline-flex !important;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}


.ssb-catalog-thumb.ssb-responsive-hidden {
    display: none !important;
}

.ssb-catalog-thumb:hover,
.ssb-catalog-thumb:focus,
.ssb-catalog-thumb.is-active {
    border-color: #555;
    box-shadow: 0 0 0 1px #555;
    outline: none;
}

.ssb-catalog-thumb img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain;
    object-position: center;
    border: 0 !important;
}

.ssb-catalog-thumb-more {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 24px;
    height: 36px;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: #555;
    white-space: nowrap;
}


.ssb-catalog-thumb-more.ssb-no-more-hidden {
    display: none !important;
}

@media (max-width: 767px) {
    .ssb-catalog-thumbs {
        gap: 3px;
        min-height: 31px;
        margin-bottom: 8px;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
    }

    .ssb-catalog-thumb {
        /* Reserve room for the +XX counter, then let the four previews
           shrink evenly to the actual width of each two-column card. */
        flex: 0 1 calc((100% - 42px) / 4);
        width: calc((100% - 42px) / 4);
        max-width: 31px;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    /* Hard fallback: never allow the fifth preview to overflow a two-column card. */
    .ssb-catalog-thumb:nth-child(n+5) {
        display: none !important;
    }

    .ssb-catalog-thumb-more {
        /* Fixed counter lane keeps +XX/+XXX fully inside the product card. */
        flex: 0 0 30px;
        width: 30px;
        min-width: 30px;
        height: 31px;
        padding: 0;
        justify-content: flex-start;
        font-size: 11px;
        overflow: visible;
    }
}
