/* SEO and Performance Optimizations */

/* Lazy Loading Images */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
}

/* WebP support detection */
.webp .img-webp {
    display: block;
}

.no-webp .img-webp {
    display: none;
}

.webp .img-fallback {
    display: none;
}

.no-webp .img-fallback {
    display: block;
}

/* Loading skeleton for images */
.image-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    min-height: 200px;
    border-radius: 4px;
}

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

/* Critical CSS for above-the-fold content */
.hero-section {
    min-height: 50vh;
    display: flex;
    align-items: center;
}

/* Performance optimizations */
.news-grid {
    contain: layout style paint;
}

.news-card {
    contain: layout style paint;
    will-change: transform;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip links for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s;
}

.skip-link:focus {
    top: 6px;
    opacity: 1;
}

/* Focus indicators */
*:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .article-content {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .breadcrumb,
    .btn,
    .share-buttons {
        display: none !important;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .news-card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}
