/**
 * Image Component Styles
 * Handles responsive images, lazy loading, and placeholders
 */

/* Responsive Images */
picture {
    display: block;
    width: 100%;
}

picture img {
    display: block;
    width: 100%;
    height: auto;
}

/* Lazy Loading Placeholder Effect */
img[loading="lazy"] {
    background-color: var(--color-snow);
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"]:not([src]) {
    opacity: 0;
}

/* Logo Styles */
.logo {
    display: block;
    height: auto;
    max-width: 100%;
    transition: height 0.3s ease;
}

.logo-text {
    font-family: var(--font-family-headings);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-licorice);
}

/* Avatar Styles */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-placeholder {
    display: inline-block;
    flex-shrink: 0;
}

/* Image Placeholders */
.about-image-placeholder,
.testimonial-image {
    position: relative;
    overflow: hidden;
    background-color: var(--color-snow);
}

.about-image-placeholder {
    height: 400px;
    border-radius: 8px;
}

.testimonial-image {
    height: 500px;
}

.testimonial-image-placeholder {
    width: 100%;
    height: 100%;
    background-color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .about-image-placeholder {
        height: 300px;
        margin-top: 2rem;
    }
    
    .testimonial-image {
        height: 300px;
    }
}

/* Loading state for images */
img[loading="lazy"] {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Blur-up effect for progressive image loading */
.img-blur-up {
    filter: blur(10px);
    transition: filter 0.3s ease-in-out;
}

.img-blur-up.loaded {
    filter: blur(0);
}

/* Aspect ratio containers for responsive images */
.img-container {
    position: relative;
    overflow: hidden;
}

.img-container::before {
    content: '';
    display: block;
    padding-top: 75%; /* 4:3 aspect ratio */
}

.img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Specific aspect ratios */
.img-container-16-9::before {
    padding-top: 56.25%; /* 16:9 */
}

.img-container-1-1::before {
    padding-top: 100%; /* 1:1 square */
}

.img-container-21-9::before {
    padding-top: 42.857%; /* 21:9 ultrawide */
}

/* WebP support detection fallback */
.no-webp picture source[type="image/webp"] {
    display: none;
}

/* Print styles */
@media print {
    img[loading="lazy"] {
        opacity: 1 !important;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    img[loading="lazy"],
    .img-blur-up {
        animation: none;
        transition: none;
    }
}
