/* Each image owns its loading state. Small icons are left untouched. */
/* Legacy section masks should never cover complete product or category groups. */
.home-shop-container > .box-overlay,
.promotion-categories-container > .box-overlay,
.popular-products > .holder-popular > .box-overlay {
    display: none;
}

/* Keep the same card widths before Owl Carousel creates its wrapper. */
@media (min-width: 992px) {
    .new-products .owl-carousel:not(.owl-loaded) > .s-test {
        flex: 0 0 25%;
        max-width: 25%;
    }
    .popular-products .owl-carousel:not(.owl-loaded) > .plp-card {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

img.image-loading:not([data-src]) {
    background: #f5f6f8 linear-gradient(100deg, #f5f6f8 25%, #eceef2 45%, #f5f6f8 65%) 100% 0 / 220% 100%;
    animation: image-loading-shimmer 1.35s ease-in-out infinite;
}

/* The real image replaces the shared bitmap only when this image enters view. */
img[data-src], .plp-card__media img[data-src] { object-fit: cover; }
/* The wide placeholder must fill square, portrait, and banner image boxes alike. */
img[data-src][src="/images/bg/bg-rectangle.webp"] {
    background-color: #eee;
    object-fit: cover;
}
/* Keep the homepage category row in place while each image is loading. */
.promotion-category img {
    display: block;
    width: 140px;
    height: 140px;
    max-width: 100%;
    object-fit: contain;
}
@media (max-width: 768px) {
    .promotion-category img { width: 95px; height: 95px; }
}
*:has(> img.image-error) { background: #f5f6f8; }
img.image-error { object-fit: cover; }

/* Reserve the narrow desktop header promotion strip while its GIF is pending. */
@media (min-width: 992px) {
    .tophead .img-top-header { display: block; min-height: 52px; }
}

@keyframes image-loading-shimmer { to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) {
    img.image-loading:not([data-src]) { animation: none; }
}
