/* NewsSearcher Images - Responsive CSS */

/* Main container for NewsSearcher images */
.newsearcher-image-container {
    width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--background-color, #ffffff);
}

/* Dark theme support */
[data-theme="dark"] .newsearcher-image-container {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: var(--background-color, #1a1a1a);
}

/* Banner image styling */
.newsearcher-banner-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Desktop banner dimensions (21:9 ratio) - 1344x300 */
@media (min-width: 769px) {
    .newsearcher-banner .newsearcher-banner-img {
        aspect-ratio: 21/9;
        max-height: 300px;
    }
    
    .newsearcher-banner-img:hover {
        transform: scale(1.02);
    }
}

/* Mobile banner dimensions (5:4 ratio) - 600x200 */
@media (max-width: 768px) {
    .newsearcher-banner .newsearcher-banner-img {
        aspect-ratio: 5/4;
        max-height: 200px;
    }
    
    .newsearcher-image-container {
        margin: 1rem 0;
        border-radius: 6px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .newsearcher-banner .newsearcher-banner-img {
        max-height: 160px;
    }
    
    .newsearcher-image-container {
        margin: 0.8rem 0;
        border-radius: 4px;
    }
}

/* Caption styling */
.newsearcher-image-caption {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
}

[data-theme="dark"] .newsearcher-image-caption {
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.newsearcher-image-caption small {
    color: var(--text-secondary, #666);
    font-size: 0.8rem;
    font-style: italic;
}

[data-theme="dark"] .newsearcher-image-caption small {
    color: var(--text-secondary, #aaa);
}

/* Article header integration */
.article-header + .newsearcher-image-container {
    margin-top: 1rem;
}

.newsearcher-image-container + .article-content {
    margin-top: 1.5rem;
}

/* Sources page styling */
.sources-image-container {
    width: 100%;
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: var(--background-color, #f8f9fa);
}

[data-theme="dark"] .sources-image-container {
    background: var(--background-color, #2a2a2a);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sources-banner-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Sources banner dimensions */
@media (min-width: 769px) {
    .sources-banner .sources-banner-img {
        aspect-ratio: 16/9;
        max-height: 200px;
    }
}

@media (max-width: 768px) {
    .sources-banner .sources-banner-img {
        aspect-ratio: 16/9;
        max-height: 150px;
    }
}

/* Loading states */
.newsearcher-banner-img[loading="lazy"] {
    background: linear-gradient(90deg, 
        rgba(200, 200, 200, 0.2) 25%, 
        rgba(200, 200, 200, 0.4) 50%, 
        rgba(200, 200, 200, 0.2) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

[data-theme="dark"] .newsearcher-banner-img[loading="lazy"] {
    background: linear-gradient(90deg, 
        rgba(100, 100, 100, 0.2) 25%, 
        rgba(100, 100, 100, 0.4) 50%, 
        rgba(100, 100, 100, 0.2) 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Print styles */
@media print {
    .newsearcher-image-container,
    .sources-image-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .newsearcher-image-caption {
        background: none;
        border-top: 1px solid #ddd;
    }
}

/* High contrast accessibility */
@media (prefers-contrast: high) {
    .newsearcher-image-container,
    .sources-image-container {
        border: 2px solid currentColor;
    }
    
    .newsearcher-image-caption {
        border-top: 2px solid currentColor;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .newsearcher-banner-img {
        transition: none;
    }
    
    .newsearcher-banner-img:hover {
        transform: none;
    }
    
    .newsearcher-banner-img[loading="lazy"] {
        animation: none;
    }
}