/* =====================================================
   CRITICAL LOADING STYLES - Prevent FOUC
   ===================================================== */

/* Hide content until styles load to prevent flash */
.featured-tours-section {
    opacity: 0;
    transition: opacity var(--motion-base) ease;
}

.featured-tours-section.loaded {
    opacity: 1;
}

/* Loading skeleton for featured tours */
.featured-tours-loading {
    display: flex;
    gap: 1.5rem;
    padding: 2rem 0;
    justify-content: center;
}

.skeleton-card {
    width: 320px;
    height: 240px;
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border-color) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-lg);
}

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

/* Ensure header and hero load first */
.getyourguide-header,
.hero-section {
    position: relative;
    z-index: 1000;
}

/* Prevent layout shift */
.tour-card-skeleton {
    min-height: 350px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

/* Critical sections stay visible */
.getyourguide-header,
.hero-section,
.search-section {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Homepage: reserve vertical space before JS hydrates (PSI CLS — reviews/blog modules) */
#homepageReviews {
    min-height: 760px;
    contain: layout style;
}
#homepageBlog {
    min-height: 920px;
    contain: layout style;
}

/* Hero shell: before hero-premium injects .hero-premium (only truly empty div) */
#heroSection:empty {
    min-height: 700px;
}
@media (max-width: 768px) {
    #heroSection:empty {
        min-height: 320px;
        max-height: 380px;
    }
}

/* Featured tours + categories: moderate reserve to limit CLS when modules hydrate */
#featuredTours {
    min-height: 260px;
}
@media (min-width: 769px) {
    #featuredTours {
        min-height: 420px;
    }
}

#tourCategories {
    min-height: 180px;
}
@media (min-width: 769px) {
    #tourCategories {
        min-height: 240px;
    }
}

/* About block — align with index placeholder */
#homepageAbout {
    min-height: 300px;
}