/**
 * Image & Rendering Performance Optimization CSS
 * Tuân thủ chuẩn Core Web Vitals (LCP, INP, CLS) & CSS Containment.
 */

img {
    max-width: 100%;
    height: auto;
}

/* Aspect-ratio reservation on cards to prevent CLS (no global will-change VRAM bloat) */
.product-image img,
.product-card img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.thumbnail-item img,
.thumbnail-row img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (prefers-reduced-motion: no-preference) {
    .thumbnail-item img,
    .thumbnail-row img {
        transition: transform 0.2s ease;
    }
}

.category-image img,
.brand-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.hero {
    background-attachment: scroll;
}

/* Defer rendering of heavy strictly below-the-fold sections (paired with contain-intrinsic-size to prevent CLS) */
footer.site-footer,
footer[role="contentinfo"],
#catalog-gallery-section,
.related-products-section,
.p4p-deferred-section {
    content-visibility: auto;
    contain-intrinsic-size: auto none auto 420px;
}
