/**
 * SEMTAK Lazy Load Styles v1.0.0
 *
 * Styles for lazy loading placeholders and fade-in animations.
 */

/* Base lazy image styles */
.semtak-lazy,
.semtak-lazy-hybrid {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Loading state */
.semtak-loading {
    opacity: 0.5;
}

/* Loaded state - fade in */
.semtak-loaded {
    opacity: 1;
}

/* Error state */
.semtak-error {
    opacity: 1;
    background-color: #f0f0f0;
}

/* Blur placeholder specific styles */
.semtak-lazy[style*="background-image"],
.semtak-lazy-hybrid[style*="background-image"] {
    /* Smooth blur transition */
    filter: blur(5px);
    transform: scale(1.05);
}

.semtak-loaded[style*="background-image"] {
    filter: blur(0);
    transform: scale(1);
}

/* Prevent layout shift - ensure images have dimensions */
.semtak-lazy,
.semtak-lazy-hybrid {
    min-height: 1px;
}

/* Skeleton loading animation (optional - for color placeholders) */
@keyframes semtak-skeleton {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.semtak-lazy.semtak-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: semtak-skeleton 1.5s ease-in-out infinite;
}

/* Noscript fallback - hide original when JS loads */
.semtak-lazy + noscript img,
.semtak-lazy-hybrid + noscript img {
    display: none;
}

/* Show noscript images when JS is disabled */
html:not(.js) .semtak-lazy + noscript img,
html:not(.js) .semtak-lazy-hybrid + noscript img {
    display: block;
}

html:not(.js) .semtak-lazy,
html:not(.js) .semtak-lazy-hybrid {
    display: none;
}

/* Responsive container for lazy images */
.semtak-lazy-container {
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
}

.semtak-lazy-container .semtak-lazy,
.semtak-lazy-container .semtak-lazy-hybrid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Aspect ratio containers (for preventing layout shift) */
.semtak-lazy-ratio-16-9 {
    padding-bottom: 56.25%;
}

.semtak-lazy-ratio-4-3 {
    padding-bottom: 75%;
}

.semtak-lazy-ratio-1-1 {
    padding-bottom: 100%;
}

.semtak-lazy-ratio-3-2 {
    padding-bottom: 66.67%;
}

.semtak-lazy-ratio-2-3 {
    padding-bottom: 150%;
}

/* Print styles - show all images */
@media print {
    .semtak-lazy,
    .semtak-lazy-hybrid {
        opacity: 1 !important;
        filter: none !important;
        transform: none !important;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .semtak-lazy,
    .semtak-lazy-hybrid,
    .semtak-loaded {
        transition: none;
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .semtak-lazy,
    .semtak-lazy-hybrid {
        background-color: #ffffff;
        border: 1px solid #000000;
    }
}
