/* Thumbnail Performance Optimizations */
/* =================================== */

/* Remove all loading delays and animations */
.item-thumb {
    /* Instant loading - no transitions on initial load */
    transition: none !important;
    
    /* Optimize image rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    
    /* Prevent layout shifts */
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    
    /* Ensure immediate display */
    opacity: 1 !important;
    transform: none !important;
    
    /* Remove any filters that slow down rendering */
    filter: none !important;
    
    /* Optimize for speed */
    will-change: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Remove loading shimmer effect entirely */
.item-thumb.loading {
    background: transparent !important;
    animation: none !important;
    opacity: 1 !important;
}

/* Disable shimmer animation */
@keyframes shimmer {
    /* Empty - disables the animation */
}

/* Optimize preview container */
.item-box .preview {
    /* Remove any transitions that delay display */
    transition: transform 0.2s ease !important;
    
    /* Optimize rendering */
    contain: layout style paint;
    
    /* Prevent unnecessary repaints */
    will-change: transform;
}

/* Only add hover effects after image is loaded */
.item-thumb.loaded {
    transition: all 0.3s ease !important;
}

.item-box:hover .item-thumb.loaded {
    transform: scale(1.05) !important;
    filter: brightness(1.2) contrast(1.1) !important;
}

/* Optimize for different screen sizes */
@media (max-width: 768px) {
    .item-thumb {
        /* Even faster on mobile */
        transition: none !important;
        transform: none !important;
    }
    
    .item-box:hover .item-thumb {
        /* Minimal effects on mobile for performance */
        transform: scale(1.02) !important;
        filter: brightness(1.1) !important;
    }
}

/* Preload optimization */
.item-thumb[data-src] {
    /* For lazy loading - show immediately when src is set */
    opacity: 1 !important;
    transition: none !important;
}

/* Remove any loading states that cause delays */
.item-box.loading,
.preview.loading {
    opacity: 1 !important;
    animation: none !important;
}

/* Optimize grid rendering */
.item-boxes {
    /* Optimize container rendering */
    contain: layout;
    
    /* Prevent unnecessary reflows */
    will-change: auto;
}

/* Fast fade-in for loaded images only */
.item-thumb.instant-load {
    opacity: 1 !important;
    animation: none !important;
    transition: none !important;
}

/* Critical performance fixes */
.item-thumb {
    /* Prevent any delays */
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    
    /* Ensure immediate visibility */
    visibility: visible !important;
    display: block !important;
}

/* Remove staggered animations that delay display */
.item-box:nth-child(n) {
    animation: none !important;
    animation-delay: 0s !important;
}

/* Optimize for immediate display */
.animate-on-scroll {
    animation: none !important;
}

/* Performance-first approach */
.item-box {
    /* Remove entrance animations */
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    
    /* Only animate on hover */
    transition: transform 0.2s ease !important;
}

/* Fast hover effects only after everything is loaded */
.item-box.ready:hover {
    transform: translateY(-8px) !important;
}

/* Disable complex animations on slower devices */
@media (prefers-reduced-motion: reduce) {
    .item-thumb,
    .item-box,
    .preview {
        animation: none !important;
        transition: none !important;
    }
}

/* Network-aware optimizations */
@media (prefers-reduced-data: reduce) {
    .item-thumb {
        /* Minimal effects for slow connections */
        filter: none !important;
        transform: none !important;
    }
}

/* Critical rendering path optimization */
.item-thumb {
    /* Prioritize thumbnail loading */
    content-visibility: auto;
    contain-intrinsic-size: 320px 180px;
}

/* Remove any CSS that blocks rendering */
.item-box .preview::before {
    /* Disable shimmer overlay that delays display */
    display: none !important;
}

/* Instant visibility for all thumbnails */
.item-box,
.preview,
.item-thumb {
    /* Force immediate display */
    opacity: 1 !important;
    visibility: visible !important;
}
