/* Responsive Image Optimizations */

/* Base responsive image rules */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive image with srcset support */
.responsive-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Hero images - different sizes for different devices */
.hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 768px) {
    .hero-image {
        height: 500px;
    }
}

@media (min-width: 1200px) {
    .hero-image {
        height: 600px;
    }
}

/* Gallery thumbnails with responsive sizing */
.gallery-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

@media (min-width: 576px) {
    .gallery-thumbnail {
        height: 250px;
    }
}

@media (min-width: 992px) {
    .gallery-thumbnail {
        height: 300px;
    }
}

/* Gallery images with proper aspect ratios */
.gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.gallery-image:hover {
    transform: scale(1.05);
}

/* Hero section background images */
.hero-section {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Card images */
.card-img-top {
    height: 200px;
    object-fit: cover;
    object-position: center;
}

/* Blog post images */
.blog-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

/* Avatar and profile images */
.avatar {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
}

.profile-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
}

/* Responsive image containers */
.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 0.375rem;
}

.image-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

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

/* Mobile optimizations */
@media (max-width: 575.98px) {
    .gallery-image {
        height: 150px;
    }
    
    .card-img-top {
        height: 150px;
    }
    
    .blog-image {
        max-height: 250px;
    }
    
    .profile-image {
        width: 100px;
        height: 100px;
    }
}

/* Tablet optimizations */
@media (min-width: 576px) and (max-width: 991.98px) {
    .gallery-image {
        height: 180px;
    }
    
    .card-img-top {
        height: 180px;
    }
    
    .blog-image {
        max-height: 350px;
    }
}

/* Loading placeholder for images */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Lazy loading optimization */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

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

/* Carousel image styles - responsive without cropping */
.carousel-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
    max-height: 60vh;
}

/* Carousel container styling */
.carousel-inner {
    background-color: #f8f9fa;
}

/* Carousel links */
.carousel-item a {
    display: block;
    text-decoration: none;
    text-align: center;
}

/* Carousel native resolution options */
.carousel-image-native {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    object-position: center;
}

.carousel-image-aspect {
    width: 100%;
    height: 50vh;
    object-fit: contain;
    object-position: center;
    background-color: #000;
}

.carousel-image-letterbox {
    width: 100%;
    height: 400px;
    object-fit: contain;
    object-position: center;
    background-color: #f8f9fa;
}

/* Responsive carousel heights */
@media (max-width: 575.98px) {
    .carousel-item img {
        max-height: 40vh;
    }
    
    .carousel-image-native {
        max-height: 40vh;
    }
    
    .carousel-image-aspect {
        height: 30vh;
    }
    
    .carousel-image-letterbox {
        height: 250px;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .carousel-item img {
        max-height: 50vh;
    }
    
    .carousel-image-native {
        max-height: 50vh;
    }
    
    .carousel-image-aspect {
        height: 40vh;
    }
    
    .carousel-image-letterbox {
        height: 350px;
    }
}

@media (min-width: 992px) {
    .carousel-item img {
        max-height: 60vh;
    }
}