/* Horizontal Scroll Performance Optimizations */

/* GPU acceleration for smooth scrolling */
.products-scroll {
    will-change: scroll-position;
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
}

/* Optimize card rendering - NO global will-change */
.product-card-scroll {
    contain: layout style paint;
    content-visibility: auto;
}

/* Only apply will-change during animation phase */
.product-card-scroll.luxury-hidden {
    will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.product-card-scroll.luxury-in-view {
    will-change: auto;
}

/* Prevent layout shift with explicit dimensions */
.product-card-scroll img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
}

/* Optimize image rendering */
.product-card-scroll img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Reduce paint operations during scroll */
.product-card-scroll::before,
.product-card-scroll::after {
    content-visibility: auto;
}

/* Minimize repaints on animation */
.product-card-scroll.luxury-in-view {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize hover states - add will-change only on hover */
@media (hover: hover) {
    .product-card-scroll:hover {
        will-change: transform;
    }
    
    .product-card-scroll:not(:hover) {
        will-change: auto;
    }
}

/* Prevent CLS (Cumulative Layout Shift) */
.product-card-scroll__content {
    min-height: 120px;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .products-scroll {
        scroll-snap-type: x proximity;
        scroll-snap-stop: normal;
    }
    
    .product-card-scroll {
        scroll-snap-align: center;
    }
}

/* Reduce motion for better performance */
@media (prefers-reduced-motion: reduce) {
    .products-scroll {
        scroll-behavior: auto !important;
    }
    
    .product-card-scroll {
        will-change: auto;
    }
}
