/**
 * Premium Lazy Loading & Skeleton Shimmer Stylesheet
 * Ensures Zero Cumulative Layout Shift (CLS) and smooth progressive image rendering
 */

/* 1. Progressive Image Lazy Loading */
img.lazy-io-img {
    opacity: 0;
    filter: blur(8px);
    transition: opacity 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, filter;
}

img.lazy-io-img.is-loaded {
    opacity: 1 !important;
    filter: blur(0) !important;
}

/* Fallback for browsers with JS disabled */
no-js img.lazy-io-img {
    opacity: 1 !important;
    filter: none !important;
}

/* 2. Skeleton Shimmer Placeholder Effect */
.lazy-skeleton {
    position: relative;
    overflow: hidden;
    background-color: #f1f3f5;
    border-radius: inherit;
}

.lazy-skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.45) 40%,
        rgba(255, 255, 255, 0.7) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: skeletonShimmer 1.6s infinite ease-in-out;
}

@keyframes skeletonShimmer {
    100% {
        transform: translateX(100%);
    }
}

/* 3. Lazy Component Deferred Container */
.lazy-component {
    min-height: 120px;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.lazy-component.not-loaded {
    opacity: 0;
    transform: translateY(16px);
}

.lazy-component.is-loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Component Skeleton Mockup */
.component-skeleton-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    width: 100%;
}

.skeleton-box {
    background: #e9ecef;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-box::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: skeletonShimmer 1.6s infinite ease-in-out;
}

/* Aspect ratio preservation helper to stop layout shifts */
.aspect-1-1 { aspect-ratio: 1 / 1; }
.aspect-4-3 { aspect-ratio: 4 / 3; }
.aspect-16-9 { aspect-ratio: 16 / 9; }
