/**
 * Mobile Header Fix - Critical Styles
 * Ensures header stays fixed on mobile devices
 *
 * @package HITERS
 * @version 1.0.1
 */

/* ===================================================================
   MOBILE HEADER FIX - МАКСИМАЛЬНЫЙ ПРИОРИТЕТ
   =================================================================== */

/* Ultra high specificity for mobile header fix - применяется всегда */
html body header.site-header,
html body .site-header,
body header.site-header,
body .site-header,
header.site-header,
.site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100% !important;
    z-index: 9999 !important;
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -o-transform: none !important;
    margin: 0 !important;
    margin-top: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    will-change: auto !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

/* Дополнительно для мобильных экранов */
@media only screen and (max-width: 1024px) {
    html body header.site-header,
    html body .site-header,
    body header.site-header,
    body .site-header,
    header.site-header,
    .site-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        z-index: 9999 !important;
        transform: none !important;
        -webkit-transform: none !important;
        -moz-transform: none !important;
        -ms-transform: none !important;
        will-change: auto !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
        margin: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    @media only screen and (max-width: 1024px) {
        html body .site-header,
        body .site-header,
        .site-header {
            position: -webkit-sticky !important;
            position: sticky !important;
            position: fixed !important;
            top: 0 !important;
        }
    }
}

/* WordPress admin bar compatibility */
@media only screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px !important;
    }
}

@media only screen and (min-width: 783px) and (max-width: 1024px) {
    body.admin-bar .site-header {
        top: 32px !important;
    }
}

/* Ensure body has proper padding for fixed header */
@media only screen and (max-width: 1024px) {
    body {
        padding-top: 0 !important;
    }

    body.admin-bar {
        padding-top: 46px !important;
    }
}

@media only screen and (min-width: 783px) and (max-width: 1024px) {
    body.admin-bar {
        padding-top: 32px !important;
    }
}

/* Main content offset for fixed header */
@media only screen and (max-width: 1024px) {
    #main-content,
    main,
    .hero-section {
        margin-top: 0 !important;
    }

    body:not(.admin-bar) #main-content {
        padding-top: 80px !important;
    }

    body.admin-bar #main-content {
        padding-top: 80px !important;
    }
}

/* Prevent header from jumping on scroll */
@media only screen and (max-width: 1024px) {
    html {
        scroll-padding-top: 80px !important;
    }

    body.admin-bar html {
        scroll-padding-top: 126px !important;
    }
}

/* Force hardware acceleration for smooth scrolling */
@media only screen and (max-width: 1024px) {
    .site-header,
    .header-inner {
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
        perspective: 1000px !important;
        -webkit-perspective: 1000px !important;
    }
}
