/**
 * Hero Header Zero Gap Fix
 * Removes ALL gaps between header and hero section on mobile - ONLY for front page
 */

/* Target ONLY front page hero section on mobile */
@media (max-width: 767px) {
    /* Front page specific selectors */
    body.home .hero:first-of-type,
    body.front-page .hero:first-of-type,
    body.page-template-front-page .hero:first-of-type,
    body.home section.hero.hero__style-one,
    body.front-page section.hero.hero__style-one,
    body.page-template-front-page section.hero.hero__style-one {
        margin-top: -45px !important; /* Negative margin to pull up (increased by 25px total) */
        padding-top: 40px !important; /* Reduced padding */
    }
    
    /* If there's a fixed/sticky header */
    body.home .stricky-fixed ~ .hero,
    body.front-page .stricky-fixed ~ .hero,
    body.page-template-front-page .stricky-fixed ~ .hero,
    body.home .header-fixed ~ .hero,
    body.front-page .header-fixed ~ .hero,
    body.page-template-front-page .header-fixed ~ .hero {
        margin-top: 0 !important;
        padding-top: 40px !important;
    }
    
    /* Direct positioning after header */
    body.home header + .hero,
    body.front-page header + .hero,
    body.page-template-front-page header + .hero,
    body.home .header-area + .hero,
    body.front-page .header-area + .hero,
    body.page-template-front-page .header-area + .hero,
    body.home .xb-header + .hero,
    body.front-page .xb-header + .hero,
    body.page-template-front-page .xb-header + .hero {
        margin-top: -55px !important; /* Pull hero up to meet header (increased by 25px total) */
        padding-top: 50px !important;
    }
    
    /* Main content area - front page only */
    body.home main > .hero:first-child,
    body.front-page main > .hero:first-child,
    body.page-template-front-page main > .hero:first-child,
    body.home #main > .hero:first-child,
    body.front-page #main > .hero:first-child,
    body.page-template-front-page #main > .hero:first-child {
        margin-top: -45px !important; /* Increased by 25px total */
    }
    
    /* Remove container top padding on front page */
    body.home .hero .container,
    body.front-page .hero .container,
    body.page-template-front-page .hero .container {
        padding-top: 0 !important;
    }
    
    /* Specific override for the hero__style-one class */
    body.home .hero.hero__style-one,
    body.front-page .hero.hero__style-one,
    body.page-template-front-page .hero.hero__style-one {
        margin-top: -50px !important; /* Increased by 25px total */
        padding-top: 45px !important;
    }
}

/* Extra small devices - front page only */
@media (max-width: 480px) {
    body.home .hero:first-of-type,
    body.front-page .hero:first-of-type,
    body.page-template-front-page .hero:first-of-type,
    body.home section.hero.hero__style-one,
    body.front-page section.hero.hero__style-one,
    body.page-template-front-page section.hero.hero__style-one {
        margin-top: -50px !important; /* Increased by 25px total */
        padding-top: 40px !important;
    }
}

/* Admin bar adjustment - front page only */
@media (max-width: 767px) {
    body.admin-bar.home .hero:first-of-type,
    body.admin-bar.front-page .hero:first-of-type,
    body.admin-bar.page-template-front-page .hero:first-of-type {
        margin-top: 0 !important; /* Don't use negative margin with admin bar */
        padding-top: 50px !important;
    }
}

/* Landscape mode - front page only */
@media (max-width: 767px) and (orientation: landscape) {
    body.home .hero:first-of-type,
    body.front-page .hero:first-of-type,
    body.page-template-front-page .hero:first-of-type {
        margin-top: -45px !important; /* Increased by 25px total */
        padding-top: 35px !important;
    }
}

/* Ultimate override for front page - highest specificity */
@media (max-width: 767px) {
    body.home section.hero.hero__style-one.bg_img,
    body.front-page section.hero.hero__style-one.bg_img,
    body.page-template-front-page section.hero.hero__style-one.bg_img {
        margin-top: -55px !important; /* Increased by 25px total */
        padding-top: 50px !important;
    }
    
    /* Remove any before pseudo element spacing */
    body.home .hero::before,
    body.front-page .hero::before,
    body.page-template-front-page .hero::before {
        top: 0 !important;
        margin-top: 0 !important;
    }
}

/* Ensure no gaps with different header states - front page only */
@media (max-width: 767px) {
    /* Normal header state */
    body.home:not(.scrolled) .hero:first-of-type,
    body.front-page:not(.scrolled) .hero:first-of-type,
    body.page-template-front-page:not(.scrolled) .hero:first-of-type {
        margin-top: -55px !important; /* Increased by 25px total */
    }
    
    /* Scrolled/sticky header state */
    body.home.scrolled .hero:first-of-type,
    body.front-page.scrolled .hero:first-of-type,
    body.page-template-front-page.scrolled .hero:first-of-type,
    body.home.sticky-active .hero:first-of-type,
    body.front-page.sticky-active .hero:first-of-type,
    body.page-template-front-page.sticky-active .hero:first-of-type {
        margin-top: 0 !important;
        padding-top: 40px !important;
    }
}

/* CRITICAL: Override inline styles on front page */
@media (max-width: 767px) {
    body.home .hero[style*="margin-top"],
    body.front-page .hero[style*="margin-top"],
    body.page-template-front-page .hero[style*="margin-top"] {
        margin-top: -55px !important; /* Increased by 25px total */
    }
    
    body.home .hero[style*="padding-top"],
    body.front-page .hero[style*="padding-top"],
    body.page-template-front-page .hero[style*="padding-top"] {
        padding-top: 50px !important;
    }
}