/**
 * Image SEO Enhancement Styles
 * Styles for improved image accessibility and SEO
 */

/* Broken image styling */
img.broken-image {
    opacity: 0.5;
    filter: grayscale(100%);
    border: 2px dashed #ccc;
    background: #f8f8f8;
    padding: 10px;
}

/* Auto-generated alt text indicator (for debugging) */
img[data-alt-auto="true"] {
    /* Add a subtle border for debugging - remove in production */
    /* border: 1px solid rgba(0, 255, 0, 0.2); */
}

/* Processed images indicator (for debugging) */
img[data-image-seo-processed="true"] {
    /* Add a subtle border for debugging - remove in production */
    /* border: 1px solid rgba(0, 0, 255, 0.1); */
}

/* Enhanced image hover effects */
img[title]:hover {
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

/* High priority images (above the fold) */
img[fetchpriority="high"] {
    /* Ensure these load first */
    content-visibility: auto;
}

/* Lazy loaded images */
img[loading="lazy"] {
    /* Smooth loading transition */
    transition: opacity 0.3s ease;
}

/* Image accessibility improvements */
img {
    /* Ensure all images have proper sizing */
    max-width: 100%;
    height: auto;
}

/* Special styling for loading images */
img[src*="filters-load.gif"] {
    /* These are decorative loading indicators */
    /* No additional styling needed beyond alt/title */
}

/* Focus styles for images in links */
a img:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Image captions styling */
figcaption {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Article body images */
.article-body img {
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 10px 0;
}

/* Responsive images in articles */
@media (max-width: 768px) {
    .article-body img {
        width: 100%;
        height: auto;
        margin: 15px 0;
    }
}

/* Image gallery styling */
.image-gallery img {
    transition: transform 0.2s ease;
}

.image-gallery img:hover {
    transform: scale(1.02);
}

/* Alt text for screen readers when image is broken */
img.broken-image::after {
    content: attr(alt);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 3px;
    display: none; /* Hidden by default, can be shown with JS if needed */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    img {
        filter: contrast(1.2);
    }

    img.broken-image {
        border: 2px solid #000;
        background: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    img {
        transition: none;
    }

    .image-gallery img:hover {
        transform: none;
    }
}
