/* ============================================
   Article Images CSS - Paragu.ai
   Separate styling for article images
   ============================================ */

/* ============================================
   BASE IMAGE STYLES
   ============================================ */

/* All article images should fit their container */
.article-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

/* ============================================
   FEATURED/LEAD STORY IMAGES
   ============================================ */

/* Lead story image container */
.lead-story-image {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    position: relative;
}

.lead-story-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Featured article with image */
.featured-article .lead-story-image {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    margin: 0;
}

/* ============================================
   ARTICLE CARD IMAGES
   ============================================ */

/* Story card image container */
.story-card-image {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.story-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* Article card image (generic) */
.article-card .article-image {
    width: 100%;
    height: 200px;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.article-card .story-card-image {
    border-radius: 20px 20px 0 0;
    margin: 0;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */

/* Image zoom on card hover */
.article-card:hover .article-img,
.article-card:hover .story-card-image img {
    transform: scale(1.05);
}

/* Featured article hover */
.featured-article:hover .lead-story-image img {
    transform: scale(1.02);
}

/* ============================================
   PLACEHOLDER IMAGES
   ============================================ */

/* When no image is available */
.article-image-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.article-card .article-image-placeholder {
    height: 200px;
    aspect-ratio: unset;
    border-radius: 20px 20px 0 0;
}

.placeholder-icon {
    font-size: 3rem;
    opacity: 0.8;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet - 768px to 1023px */
@media (max-width: 1023px) {
    .lead-story-image {
        aspect-ratio: 16 / 9;
    }

    .featured-article .lead-story-image {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .story-card-image {
        aspect-ratio: 16 / 9;
    }
}

/* Mobile - Below 768px */
@media (max-width: 768px) {
    .lead-story-image {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 16 / 9;
        border-radius: 0;
    }

    .featured-article .lead-story-image {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 16 / 9;
        border-radius: 0;
    }

    .story-card-image {
        aspect-ratio: 16 / 9;
        border-radius: 16px 16px 0 0;
    }

    .article-card .article-image {
        height: 180px;
    }

    .article-image-placeholder {
        font-size: 2rem;
    }

    .placeholder-icon {
        font-size: 2rem;
    }
}

/* Large screens - Above 1024px */
@media (min-width: 1024px) {
    /* Featured article images */
    .featured-article .lead-story-image {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    /* Article grid images */
    .article-card .story-card-image {
        aspect-ratio: 16 / 9;
    }
}

/* ============================================
   IMAGE LOADING STATES
   ============================================ */

/* Image loading animation */
.article-img[data-loading="true"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: imageLoading 1.5s infinite;
}

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

/* Image loaded state */
.article-img[data-loaded="true"] {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   LAZY LOADING SUPPORT
   ============================================ */

/* Lazy loading without blur effect */
.article-img[loading="lazy"] {
    /* No blur effect */
    transition: opacity 0.3s ease;
}

.article-img[loading="lazy"].loaded {
    opacity: 1;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus styles for keyboard navigation */
.article-card:focus-within .article-img,
.featured-article:focus-within .lead-story-image img {
    outline: 3px solid var(--ai-blue, #00D4FF);
    outline-offset: -3px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .article-img,
    .story-card-image img,
    .lead-story-image img {
        transition: none;
        transform: none !important;
    }

    .article-card:hover .article-img,
    .article-card:hover .story-card-image img,
    .featured-article:hover .lead-story-image img {
        transform: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .article-img,
    .lead-story-image,
    .story-card-image {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .article-img {
        max-height: 400px;
        object-fit: contain;
    }
}
