/* 
 * Image Loading Optimizations
 * This file contains styles to improve image loading experience
 */

/* All hero sections get a dark background that matches image tone */
.hero-section {
    background-color: #333;
    transition: background-image 0.3s ease-in;
    will-change: background-image;
    background-size: cover !important;
    background-position: center !important;
    position: relative;
    height: 400px;
    overflow: hidden;
}

/* Home page hero section is taller */
.home-hero {
    height: 100vh;
    min-height: 600px;
}

/* Set similar background colors for each specific hero section to match image tone */
.tours-hero {
    background-color: #1a3553;
}

.transportation-hero {
    background-color: #2c3035; 
}

.visa-hero {
    background-color: #2d3142;
}

.contact-hero {
    background-color: #2a4b66;
}

/* Overlay backdrop to help with transition */
.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 0;
}

/* This ensures content appears above the overlay */
.hero-section .container {
    position: relative;
    z-index: 2; /* Increased z-index to ensure content is visible */
    height: 100%;
    display: flex;
    align-items: center;
}

/* Make sure text is visible */
.hero-section h1, 
.hero-section p,
.hero-section .lead,
.hero-section .hero-text {
    color: #fff !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    position: relative;
    z-index: 3;
}

/* Fade-in animation for hero content */
.hero-section .row {
    animation: fadeIn 0.5s ease-in forwards;
    position: relative;
    z-index: 2;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Optimized image loading for cards 
   Only apply opacity transition to hero background images, not content images */
.card-img-top {
    background-color: #f0f0f0;
    min-height: 200px; /* Minimum height to prevent layout shifts */
    opacity: 1; /* Default visible */
}

/* Hero background images are preloaded via JavaScript */
.preload-image {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* All images get a base background color to prevent white flash */
img {
    background-color: #f8f9fa;
}

/* Only apply fade-in effect to images that need it */
.fade-in-image {
    transition: opacity 0.3s ease-in;
}

/* Fix for hero sections to ensure background images are visible */
.hero-section.fade-in-image {
    opacity: 1 !important;
}

/* Script to add class 'loaded' to images after they load */
@media (min-width: 1px) {
    head::after {
        content: '';
        display: none;
    }
    img[src] {
        background-color: transparent;
    }
}
