/**
 * ASTRA STICKY HEADER - FIX DESKTOP & MOBILE 
 * Versione corretta per evitare conflitti layout desktop
 */

/* --- RESET & BASE --- */
body.is-scrolled {
    /* Il padding viene gestito diversamente per device per evitare buchi bianchi */
    transition: padding 0.3s ease;
}

/* --- LOGICA DESKTOP (Sopra 921px) --- */
@media (min-width: 922px) {
    body.is-scrolled {
        padding-top: 80px !important; /* Regola questa cifra in base all'altezza del tuo header desktop */
    }

    body.is-scrolled .ast-main-header-wrap {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 9999;
        background-color: #ffffff !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        animation: slideDown 0.3s ease-out;
    }

    /* Fix Admin Bar Desktop */
    body.admin-bar.is-scrolled .ast-main-header-wrap {
        top: 32px !important;
    }
}

/* --- LOGICA MOBILE (Sotto 921px) --- */
@media (max-width: 921px) {
    body.is-scrolled {
        padding-top: 70px !important; /* Altezza header mobile solitamente più bassa */
    }

    body.is-scrolled .site-header {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 9999;
        background-color: #ffffff !important;
    }

    /* Correzione Menu Mobile (il "muro bianco") */
    body.is-scrolled .main-header-bar-navigation,
    body.is-scrolled .ast-mobile-header-content {
        position: fixed !important;
        top: 70px !important; /* Deve combaciare con l'altezza header mobile */
        max-height: calc(100vh - 70px) !important;
        overflow-y: auto !important;
    }

    /* Fix Admin Bar Mobile */
    body.admin-bar.is-scrolled .site-header {
        top: 46px !important;
    }
    body.admin-bar.is-scrolled .main-header-bar-navigation {
        top: calc(46px + 70px) !important;
    }
}

/* --- ANIMAZIONE OPZIONALE --- */
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* --- PULIZIA ELEMENTI SECONDARI --- */
body.is-scrolled .ast-above-header-wrap,
body.is-scrolled .ast-below-header-wrap {
    display: none !important;
}