/* Performance Optimizations CSS */
/* Critical rendering path optimizations */

/* Reduce layout shifts */
.blog-section,
.mobile-blog-section,
.related-resources-section,
.mobile-related-resources,
.mobile-faq-section {
    contain: layout style paint;
}

/* Optimize font loading */
@font-face {
    font-family: 'FontAwesome';
    src: url('../fonts/fa-solid-900.woff2') format('woff2');
    font-display: swap;
}

/* Lazy loading placeholder */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* Optimize images */
img {
    max-width: 100%;
    height: auto;
    loading: lazy;
}

/* First image should load immediately */
.blog-item:first-child img,
.resource-card:first-child img {
    loading: eager;
}

/* Reduce paint complexity */
.blog-card,
.resource-card,
.blog-item,
.resource-item,
.faq-item {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Critical CSS for above-the-fold content */
.title-hd {
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.sec-containter {
    min-height: 200px;
}

/* Optimize for Core Web Vitals */
/* Largest Contentful Paint (LCP) */
.blog-details-content {
    contain: layout;
}

/* First Input Delay (FID) */
button,
.btn,
.resource-link,
.read-more {
    touch-action: manipulation;
}

/* Cumulative Layout Shift (CLS) */
.blog-image {
    aspect-ratio: 16/9;
    background-color: #f0f0f0;
}

.resource-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Reduce complexity on mobile */
    .blog-card:hover,
    .resource-card:hover {
        transform: none;
    }
    
    /* Optimize touch targets */
    .faq-question,
    .resource-link,
    .read-more {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Reduce motion on mobile */
    * {
        transition-duration: 0.2s;
    }
}

/* Print styles */
@media print {
    .blog-section,
    .related-resources-section,
    .mobile-blog-section,
    .mobile-related-resources {
        break-inside: avoid;
    }
    
    .resource-card,
    .blog-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .blog-card,
    .resource-card,
    .blog-item,
    .resource-item {
        border: 2px solid;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .blog-section,
    .related-resources-section {
        background: #fff;
        color: #000;
    }
    
    .blog-card,
    .resource-card {
        background: #2d2d2d;
        color: #ffffff;
    }
    
    .blog-content h3 a,
    .resource-content h3 {
        color: #ffffff;
    }
    
    .blog-content p,
    .resource-content p {
        color: #cccccc;
    }
}

/* 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;
}

/* Focus management */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

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

/* Reduce bundle size with efficient selectors */
.btn-primary,
.btn-outline-primary,
.btn-view-all {
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Optimize repaints */
.blog-image img,
.resource-icon {
    will-change: auto;
}

.blog-card:hover .blog-image img {
    will-change: transform;
}

.blog-card:not(:hover) .blog-image img {
    will-change: auto;
}
