/* 
Image Optimization and Uniform Sizing
This stylesheet provides consistent image handling across the site
*/

/* Lazy loading for all images */
img[loading="lazy"] {
    transition: opacity 0.3s ease;
}

/* Global image container for feature sections */
.feature-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 450px;
    margin: 0 auto;
    height: auto;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

/* Loading placeholder for images */
.feature-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMjAiIGN5PSIyMCIgcj0iMTgiIHN0cm9rZT0iIzZjNzU3ZCIgc3Ryb2tlLXdpZHRoPSI0Ii8+CjxwYXRoIGQ9Im0xMyAyMCA3IDcgMTAtMTAiIHN0cm9rZT0iIzZjNzU3ZCIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+') no-repeat center;
    background-size: contain;
    opacity: 0.3;
    z-index: 1;
}

.feature-image-container.loaded::before {
    display: none;
}

/* For hero section specifically */
.hero-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 600px;
    height: auto;
    margin: 0 auto;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

/* Feature images styling */
.feature-image {
    width: 100%;
    height: auto;
    object-fit: contain;  /* Maintain aspect ratio without cropping */
    max-height: 400px;
    z-index: 2;
    position: relative;
    border-radius: 0;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.feature-image:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

/* Hero image styling */
.hero-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 450px;
    z-index: 2;
    position: relative;
    border-radius: 0;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.hero-image:hover {
    transform: scale(1.01);
    filter: brightness(1.03);
}

/* For About page and other profile images */
.profile-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 180px;
    height: 180px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 50%;
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover to ensure the profile photo fills the container */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .feature-image-container {
        height: auto;
        max-height: 300px;
    }
    
    .hero-image-container {
        height: auto;
        max-height: 350px;  /* Larger for hero image on tablets */
    }
    
    .feature-image {
        max-height: 300px;
    }
    
    .hero-image {
        max-height: 350px;  /* Larger for hero image on tablets */
    }
    
    .profile-image-container {
        width: 150px;
        height: 150px;
    }
}

/* Small screen optimization */
@media (max-width: 576px) {
    .feature-image-container {
        max-height: 250px;
    }
    
    .hero-image-container {
        max-height: 300px;  /* Larger for hero image on mobile */
    }
    
    .feature-image {
        max-height: 250px;
    }
    
    .hero-image {
        max-height: 300px;  /* Larger for hero image on mobile */
    }
    
    .profile-image-container {
        width: 120px;
        height: 120px;
    }
}

/* For card images and thumbnails */
.card-image-container {
    position: relative;
    height: 180px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
    border-radius: 8px;
}

.card-image:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Post content images */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 20px 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-content img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Featured post images */
.featured-post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.featured-post-image:hover {
    transform: scale(1.02);
}

/* User avatar images */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Support page pricing plan icons */
.plan-icon-container {
    height: 60px;
    width: 60px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.plan-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Progressive loading and WebP support */
.image-progressive {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.5s ease;
}

.image-progressive.loading {
    opacity: 0.7;
    filter: blur(2px);
}

.image-progressive.loaded {
    opacity: 1;
    filter: none;
}

/* Responsive image utilities */
.img-responsive {
    width: 100%;
    height: auto;
    max-width: 100%;
}

.img-responsive-fixed {
    width: 100%;
    object-fit: cover;
}

/* Image aspect ratio containers */
.aspect-ratio-16-9 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 8px;
}

.aspect-ratio-4-3 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    border-radius: 8px;
}

.aspect-ratio-1-1 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
    border-radius: 8px;
}

.aspect-ratio-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Performance optimized images */
.performance-image {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Print media optimizations */
@media print {
    .feature-image-container,
    .hero-image-container,
    .card-image-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .feature-image:hover,
    .hero-image:hover,
    .card-image:hover {
        transform: none;
        filter: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .feature-image-container,
    .hero-image-container,
    .card-image-container {
        background: transparent;
    }
    
    .feature-image-container::before {
        opacity: 0.5;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .feature-image,
    .hero-image,
    .card-image,
    .post-content img,
    .featured-post-image {
        transition: none;
    }
    
    .feature-image:hover,
    .hero-image:hover,
    .card-image:hover,
    .post-content img:hover,
    .featured-post-image:hover {
        transform: none;
    }
}