/**
 * loading-skeletons.css - Loading indicators and skeleton screens
 * Provides visual feedback during image loading for better UX
 */

/* Skeleton placeholder for images */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Image container with skeleton */
.image-with-skeleton {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.image-with-skeleton img {
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.image-with-skeleton .skeleton {
    z-index: 0;
}

/* Hide skeleton when image is loaded */
.image-with-skeleton img.lazy-loaded + .skeleton,
.image-with-skeleton img.high-quality-loaded + .skeleton {
    display: none;
}

/* Loading spinner for critical images */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Hide spinner when image is loaded */
.image-with-skeleton img.lazy-loaded ~ .loading-spinner,
.image-with-skeleton img.high-quality-loaded ~ .loading-spinner {
    display: none;
}

/* Gallery item skeleton */
.masonry-item {
    position: relative;
}

.masonry-item .skeleton {
    min-height: 200px;
}

/* Portfolio card skeleton */
.portfolio-event-card .card-img-wrapper {
    position: relative;
}

.portfolio-event-card .card-img-wrapper .skeleton {
    min-height: 300px;
}

/* Ticker item skeleton */
.ticker-item {
    position: relative;
}

.ticker-item .skeleton {
    min-height: 180px;
}

@media (max-width: 768px) {
    .ticker-item .skeleton {
        min-height: 120px;
    }
    
    .portfolio-event-card .card-img-wrapper .skeleton {
        min-height: 200px;
    }
    
    .masonry-item .skeleton {
        min-height: 150px;
    }
}

/* Hero image skeleton */
#hero-bg {
    position: relative;
}

#hero-bg.skeleton-loading {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 2s ease-in-out infinite;
}

/* Error state styling */
.lazy-error {
    opacity: 0.5 !important;
    filter: grayscale(100%);
}

.lazy-error::after {
    content: "⚠️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0.7;
}

/* Progress bar for image loading */
.image-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #333;
    transition: width 0.3s ease;
    z-index: 3;
}

/* Fade-in animation class */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
