/* =========================================================
   HEADER STYLES - UNIFICATO
   Tutti gli stili per header e menu in un unico file
   ========================================================= */

/* Colore di sfondo dell'header - da Customizer (--header-bg) */
#gh-head.gh-head,
.gh-head,
body .gh-head,
body:not(.is-head-transparent) .gh-head,
body.is-head-dark:not(.is-head-transparent) .gh-head,
body.is-head-brand:not(.is-head-transparent) .gh-head,
body.is-head-left-logo .gh-head,
body.is-head-middle-logo .gh-head,
body.is-head-stacked .gh-head {
    background-color: var(--header-bg, #2f6f8f) !important;
    height: 80px !important;
}

/* Altezza header mobile - più spazio per logo e icone */
@media (max-width: 768px) {
    #gh-head,
    #gh-head .gh-head-inner {
        height: 56px !important;
    }
}

/* Colore del testo/titolo nell'header - UNIVERSALE */
#gh-head .gh-head-logo,
.gh-head-logo,
.gh-head-logo a,
body .gh-head-logo,
body .gh-head-logo a,
body.is-head-dark .gh-head-logo,
body.is-head-dark .gh-head-logo a,
body.is-head-brand .gh-head-logo,
body.is-head-brand .gh-head-logo a,
body.is-head-transparent .gh-head-logo,
body.is-head-transparent .gh-head-logo a {
    color: #ffffff !important;
}

/* Colore dell'icona di ricerca - UNIVERSALE */
#gh-head .gh-search,
.gh-search,
body .gh-search,
body.is-head-dark .gh-search,
body.is-head-brand .gh-search,
body.is-head-transparent .gh-search {
    color: #ffffff !important;
}

/* Icona hamburger migliorata: 3 linee, bordi arrotondati */
#gh-head .gh-burger,
.gh-burger {
    width: 28px;
    height: 24px;
    /* Linea centrale (le altre due sono :before e :after) */
    background-image: linear-gradient(#ffffff, #ffffff);
    background-size: 22px 2px;
    background-position: 3px 11px;
    background-repeat: no-repeat;
}
#gh-head .gh-burger:before,
#gh-head .gh-burger:after,
.gh-burger:before,
.gh-burger:after,
body .gh-burger:before,
body .gh-burger:after,
body.is-head-dark .gh-burger:before,
body.is-head-dark .gh-burger:after,
body.is-head-brand .gh-burger:before,
body.is-head-brand .gh-burger:after,
body.is-head-transparent .gh-burger:before,
body.is-head-transparent .gh-burger:after {
    background-color: #ffffff !important;
    width: 22px;
    left: 3px;
    height: 2px;
    border-radius: 2px;
}
.gh-burger:before {
    top: 5px;
}
.gh-burger:after {
    bottom: 5px;
}
/* Nascondi linea centrale (background) quando menu aperto - burger diventa X */
.is-head-open #gh-head .gh-burger,
.is-head-open .gh-burger {
    background-image: none !important;
}

/* =========================================================
   NASCONDI TRE PUNTINI - Rimosso completamente
   ========================================================= */
.gh-head .nav-more-toggle,
.gh-head .nav-more-wrapper,
.gh-head .nav-more-item,
.gh-head .gh-dropdown {
    display: none !important;
}

/* =========================================================
   MENU DESKTOP STYLES (min-width: 769px)
   ========================================================= */
@media (min-width: 769px) {
    /* Nascondi search nel brand e burger su desktop - evita duplicati */
    .gh-head-brand .gh-search {
        display: none !important;
    }
    
    /* Nascondi icona ricerca nel menu su desktop */
    .gh-search-menu-trigger-wrapper {
        display: none !important;
    }
    #gh-head .gh-burger,
    .gh-burger {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Mostra menu su desktop - REGOLA CRITICA */
    .gh-head-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Layout flex per menu desktop */
    .gh-head-menu .nav {
        display: flex;
        flex-direction: row;
        gap: 2rem;
        align-items: center;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    /* Rimuove bullet points e reset lista */
    .gh-head-menu ul,
    .gh-head-menu .gh-head-menu-list,
    .gh-head-menu .nav {
        list-style: none !important;
        margin: 0;
        padding: 0;
    }
    
    .gh-head-menu ul li,
    .gh-head-menu .gh-head-menu-list li,
    .gh-head-menu .nav li,
    .gh-head-menu .nav .menu-item {
        list-style: none !important;
        margin: 0;
        padding: 0;
    }
    
    .gh-head-menu ul li::before,
    .gh-head-menu .gh-head-menu-list li::before,
    .gh-head-menu .nav li::before {
        content: none;
        display: none;
    }
    
    /* Fix opacity: sovrascrive opacity:0 dal CSS compilato screen.css */
    .gh-head-menu .nav li,
    .gh-head-menu .nav .menu-item,
    .gh-head-menu .nav > li {
        opacity: 1 !important;
    }
    
    /* Colore link menu desktop - selettori consistenti */
    .gh-head-menu .nav a,
    .gh-head-menu .nav .menu-item a,
    .gh-head-menu a,
    #gh-head .gh-head-menu .nav a,
    #gh-head .gh-head-menu a {
        color: #ffffff !important;
        text-decoration: none;
        transition: opacity 0.2s ease;
    }
    
    /* Hover link menu desktop */
    .gh-head-menu .nav a:hover,
    .gh-head-menu .nav .menu-item a:hover,
    .gh-head-menu a:hover {
        opacity: 0.8;
        color: #ffffff !important;
    }
    
    /* Dropdown menu Tipologie - Desktop */
    .gh-head-menu .nav .menu-item-has-children {
        position: relative;
    }
    
    .gh-head-menu .nav .submenu-toggle {
        display: none; /* Su desktop non serve, hover gestisce il dropdown */
    }
    
    .gh-head-menu .nav .tipologie-link {
        cursor: default; /* Su desktop non è cliccabile, solo hover */
    }
    
    .gh-head-menu .nav .tipologie-submenu {
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #ffffff;
        min-width: 240px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-radius: 4px;
        padding: 0;
        margin-top: 8px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
        z-index: 1000;
        list-style: none;
        overflow: hidden;
    }
    
    .gh-head-menu .nav .menu-item-has-children:hover .tipologie-submenu,
    .gh-head-menu .nav .menu-item-has-children:focus-within .tipologie-submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .gh-head-menu .nav .tipologie-submenu li {
        margin: 0;
        padding: 0;
        border-bottom: 1px solid #eee;
    }
    
    .gh-head-menu .nav .tipologie-submenu li:last-child {
        border-bottom: none;
    }
    
    /* Link submenu Tipologie - specificità maggiore per sovrascrivere regola generale */
    .gh-head-menu .nav .tipologie-submenu a,
    #gh-head .gh-head-menu .nav .tipologie-submenu a,
    .gh-head-menu .nav .tipologie-submenu .tipologia-item a {
        display: block;
        padding: 15px 20px;
        color: #333 !important;
        text-decoration: none;
        transition: background-color 0.2s ease, color 0.2s ease;
        font-size: 1.6rem;
        font-weight: 500;
        font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
        line-height: 1.5;
    }
    
    .gh-head-menu .nav .tipologie-submenu a:hover,
    #gh-head .gh-head-menu .nav .tipologie-submenu a:hover,
    .gh-head-menu .nav .tipologie-submenu .tipologia-item a:hover {
        background-color: #f5f5f5;
        color: #8B5E3C !important;
        opacity: 1 !important;
    }
}

/* =========================================================
   MENU MOBILE STYLES (max-width: 768px)
   ========================================================= */
@media (max-width: 768px) {
    /* Annulla regole Ghost - gap e griglia */
    #gh-head .gh-head-inner {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 0 !important;
    }

    /* Menu e actions: display:none + reset position (annulla Ghost position:fixed) */
    #gh-head .gh-head-menu,
    #gh-head .gh-head-actions {
        display: none !important;
        position: absolute !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Layout header mobile: logo a sinistra, search e burger a destra */
    #gh-head .gh-head-brand,
    .gh-head-brand {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 12px;
    }

    .gh-head-brand-wrapper {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .gh-head-brand-wrapper .gh-head-logo {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Burger a destra (flex-shrink: 0 evita che si comprimi) */
    #gh-head .gh-head-brand .gh-burger {
        flex-shrink: 0;
    }

    /* Lente di ingrandimento accanto al burger su mobile (flex-shrink: 0 per allineamento) */
    #gh-head .gh-head-brand .gh-search,
    .gh-head-brand .gh-search {
        flex-shrink: 0;
    }

    /* Nascondi search in actions su mobile/tablet - evita duplicati */
    .gh-head-actions .gh-search {
        display: none !important;
    }
    
    /* Burger menu sempre visibile su mobile/tablet */
    #gh-head .gh-burger,
    .gh-burger {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Mostra menu quando aperto - ripristina */
    .is-head-open .gh-head-menu,
    .is-head-open #gh-head .gh-head-menu {
        display: block !important;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* Nascondi contenuto principale quando menu è aperto */
    .is-head-open .site-content,
    .is-head-open .gh-main,
    .is-head-open .cover,
    .is-head-open .feed-header,
    .is-head-open .post-feed,
    .is-head-open .gh-canvas,
    .is-head-open .gh-foot {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    
    /* Previeni scroll del body e html quando menu è aperto */
    .is-head-open,
    .is-head-open body,
    .is-head-open html {
        overflow: hidden !important;
        height: 100% !important;
    }
    
    /* Header fullscreen quando menu aperto */
    .is-head-open #gh-head {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 100vw !important;
        z-index: 3999999 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        opacity: 1 !important;
        visibility: visible !important;
        background-color: #ffffff !important;
    }
    
    .is-head-open #gh-head .gh-head-inner {
        display: flex !important;
        flex-direction: column !important;
        min-height: calc(100vh - max(56px, env(safe-area-inset-top))) !important;
        background-color: #ffffff !important;
        padding-top: max(56px, env(safe-area-inset-top)) !important;
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
    
    /* Menu visibile quando aperto */
    .is-head-open #gh-head .nav {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
    }
    
    /* Styling pulito per menu mobile aperto - stile zeroassenze.it */
    .is-head-open #gh-head .gh-head-menu {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        padding: 80px 24px 40px !important;
        text-align: left !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Elementi lista menu visibili con spacing pulito */
    .is-head-open #gh-head .nav {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .is-head-open #gh-head .nav li,
    .is-head-open #gh-head .nav .menu-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        list-style: none !important;
        margin: 0 0 8px 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    /* Link menu visibili e cliccabili - stile pulito e leggibile */
    .is-head-open #gh-head .nav li a,
    .is-head-open #gh-head .nav .menu-item a {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 16px 24px !important;
        font-size: 1.8rem !important;
        line-height: 1.6 !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        border-radius: 8px !important;
        transition: background-color 0.2s ease, color 0.2s ease !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Hover effect per link menu mobile */
    .is-head-open #gh-head .nav li a:hover,
    .is-head-open #gh-head .nav .menu-item a:hover {
        background-color: #f5f5f5 !important;
        color: #000000 !important;
    }
    
    /* Active state per link menu mobile */
    .is-head-open #gh-head .nav li a:active,
    .is-head-open #gh-head .nav .menu-item a:active {
        background-color: #e8e8e8 !important;
    }
    
    /* Testo menu NERO quando aperto su mobile - selettori consistenti */
    .is-head-open #gh-head .gh-head-menu,
    .is-head-open #gh-head .gh-head-menu *,
    .is-head-open #gh-head .nav,
    .is-head-open #gh-head .nav *,
    .is-head-open #gh-head .nav li,
    .is-head-open #gh-head .nav .menu-item,
    .is-head-open #gh-head .nav li a,
    .is-head-open #gh-head .nav .menu-item a,
    .is-head-open #gh-head .nav li a:visited,
    .is-head-open #gh-head .nav li a:hover,
    .is-head-open #gh-head .nav li a:active,
    .is-head-open #gh-head .nav li a:focus,
    .is-head-open #gh-head .gh-head-menu a,
    .is-head-open #gh-head .gh-head-menu a:visited,
    .is-head-open #gh-head .gh-head-menu a:hover,
    .is-head-open #gh-head .gh-head-menu a:active,
    .is-head-open #gh-head .gh-head-menu a:focus {
        color: #000000 !important;
    }
    
    /* Logo e icona ricerca neri quando menu aperto */
    .is-head-open #gh-head .gh-head-logo,
    .is-head-open #gh-head .gh-head-logo a {
        color: #000000 !important;
    }
    
    .is-head-open #gh-head .gh-search {
        color: #000000 !important;
    }
    
    /* Burger menu nero quando menu aperto (icona X) - posizioni corrette per bottone 24px */
    .is-head-open #gh-head .gh-burger:before,
    .is-head-open #gh-head .gh-burger:after,
    .is-head-open .gh-burger:before,
    .is-head-open .gh-burger:after {
        background-color: #000000 !important;
        border-radius: 2px;
        top: 11px !important;
        bottom: auto !important;
        transform: rotate(45deg);
    }
    .is-head-open #gh-head .gh-burger:after,
    .is-head-open .gh-burger:after {
        top: auto !important;
        bottom: 11px !important;
        transform: rotate(-45deg);
    }
    
    /* Dropdown menu Tipologie - Mobile: flex per freccia vicina a "Argomenti" */
    .is-head-open #gh-head .nav .tipologie-menu-item {
        display: flex !important;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .is-head-open #gh-head .nav .tipologie-menu-item > a {
        flex: 0 0 auto !important;
        width: auto !important;
        padding-right: 12px !important;
        cursor: pointer;
    }
    
    .is-head-open #gh-head .nav .tipologie-menu-item .submenu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: static;
        flex-shrink: 0;
        margin-left: 0;
        background: none;
        border: none;
        color: #000000 !important;
        cursor: pointer;
        padding: 8px;
        width: 32px;
        height: 32px;
        border-radius: 4px;
        transition: background-color 0.2s ease;
        z-index: 10;
    }
    
    .is-head-open #gh-head .nav .tipologie-menu-item .submenu-toggle:hover {
        background-color: #f5f5f5;
    }
    
    .is-head-open #gh-head .nav .tipologie-menu-item .submenu-toggle svg {
        width: 16px;
        height: 16px;
        transition: transform 0.2s ease;
    }
    
    .is-head-open #gh-head .nav .tipologie-menu-item .submenu-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }
    
    .is-head-open #gh-head .nav .tipologie-submenu {
        display: none;
        list-style: none;
        margin: 0;
        padding: 0;
        width: 100%;
    }
    
    .is-head-open #gh-head .nav .submenu-toggle[aria-expanded="true"] + .tipologie-submenu {
        display: block;
        flex-basis: 100% !important;
        margin-top: 8px;
        padding-left: 0;
    }
    
    .is-head-open #gh-head .nav .tipologie-submenu li {
        margin: 0;
        padding: 0;
        border-bottom: 1px solid #eee;
    }
    
    .is-head-open #gh-head .nav .tipologie-submenu li:last-child {
        border-bottom: none;
    }
    
    .is-head-open #gh-head .nav .tipologie-submenu a {
        display: block;
        padding: 15px 48px;
        color: #333 !important;
        text-decoration: none;
        font-size: 1.6rem;
        font-weight: 500;
        line-height: 1.5;
        transition: background-color 0.2s ease, color 0.2s ease;
        font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    }
    
    .is-head-open #gh-head .nav .tipologie-submenu a:hover {
        background-color: #f5f5f5;
        color: #8B5E3C !important;
    }
    
    /* Nascondi icona ricerca in basso al menu hamburger quando aperto */
    .is-head-open .gh-search-menu-trigger-wrapper {
        display: none !important;
    }
    
}

/* =========================================================
   FEED: Data nera, numero nota blu come header
   ========================================================= */
.feed-calendar,
.post-feed .feed-calendar {
    color: #000 !important;
}

.feed-title .feed-note-number,
.post-feed .feed-title .feed-note-number {
    color: var(--header-bg, #2f6f8f) !important;
}

/* =========================================================
   STILI PER PAGINE ARGOMENTO
   ========================================================= */

/* Nasconde il calendario nelle pagine argomento, categoria, tipologia, format e tag */
body.tax-argomento .feed-calendar,
.tax-argomento .feed-calendar,
body.category .feed-calendar,
.category .feed-calendar,
body.tax-tipologia .feed-calendar,
.tax-tipologia .feed-calendar,
body.tax-format .feed-calendar,
.tax-format .feed-calendar,
body.tag .feed-calendar,
.tag .feed-calendar {
    display: none !important;
}

/* Colore del numero della nota nelle pagine argomento, categoria, tipologia, format e tag */
body.tax-argomento .feed-title .feed-note-number,
body.tax-argomento .feed-wrapper .feed-title .feed-note-number,
body.tax-argomento .feed .feed-wrapper .feed-title .feed-note-number,
body.tax-argomento article.feed .feed-title .feed-note-number,
.tax-argomento .feed-title .feed-note-number,
.tax-argomento .feed-wrapper .feed-title .feed-note-number,
.tax-argomento .feed .feed-wrapper .feed-title .feed-note-number,
.tax-argomento article.feed .feed-title .feed-note-number,
body.category .feed-title .feed-note-number,
body.category .feed-wrapper .feed-title .feed-note-number,
body.category .feed .feed-wrapper .feed-title .feed-note-number,
body.category article.feed .feed-title .feed-note-number,
.category .feed-title .feed-note-number,
.category .feed-wrapper .feed-title .feed-note-number,
.category .feed .feed-wrapper .feed-title .feed-note-number,
.category article.feed .feed-title .feed-note-number,
body.tax-tipologia .feed-title .feed-note-number,
body.tax-tipologia .feed-wrapper .feed-title .feed-note-number,
body.tax-tipologia .feed .feed-wrapper .feed-title .feed-note-number,
body.tax-tipologia article.feed .feed-title .feed-note-number,
.tax-tipologia .feed-title .feed-note-number,
.tax-tipologia .feed-wrapper .feed-title .feed-note-number,
.tax-tipologia .feed .feed-wrapper .feed-title .feed-note-number,
.tax-tipologia article.feed .feed-title .feed-note-number,
body.tax-format .feed-title .feed-note-number,
body.tax-format .feed-wrapper .feed-title .feed-note-number,
body.tax-format .feed .feed-wrapper .feed-title .feed-note-number,
body.tax-format article.feed .feed-title .feed-note-number,
.tax-format .feed-title .feed-note-number,
.tax-format .feed-wrapper .feed-title .feed-note-number,
.tax-format .feed .feed-wrapper .feed-title .feed-note-number,
.tax-format article.feed .feed-title .feed-note-number,
body.tag .feed-title .feed-note-number,
body.tag .feed-wrapper .feed-title .feed-note-number,
body.tag .feed .feed-wrapper .feed-title .feed-note-number,
body.tag article.feed .feed-title .feed-note-number,
.tag .feed-title .feed-note-number,
.tag .feed-wrapper .feed-title .feed-note-number,
.tag .feed .feed-wrapper .feed-title .feed-note-number,
.tag article.feed .feed-title .feed-note-number {
    color: #2f6f8f !important;
}

/* Riduci margin-bottom sezione "ULTIME RIFLESSIONI" */
.feed-header {
    margin-bottom: 2rem;
}

/* =========================================================
   HOMEPAGE BLOG STYLES
   Nascondi data, commenti, tempo di lettura
   Colora numero in blu
   Adegua spaziatura
   ========================================================= */

/* Nascondi data, commenti e tempo di lettura nella homepage del blog */
body.home.blog .feed-date,
body.blog.home .feed-date,
body.home.blog .post-feed .feed-date,
body.blog.home .post-feed .feed-date,
body.home.blog .feed-length,
body.blog.home .feed-length,
body.home.blog .post-feed .feed-length,
body.blog.home .post-feed .feed-length,
body.home.blog .feed-comments,
body.blog.home .feed-comments,
body.home.blog .post-feed .feed-comments,
body.blog.home .post-feed .feed-comments {
    display: none !important;
    visibility: hidden !important;
}

/* Colora il numero della nota in blu nella homepage del blog */
body.home.blog .feed-title .feed-note-number,
body.blog.home .feed-title .feed-note-number,
body.home.blog .feed-wrapper .feed-title .feed-note-number,
body.blog.home .feed-wrapper .feed-title .feed-note-number,
body.home.blog .feed .feed-wrapper .feed-title .feed-note-number,
body.blog.home .feed .feed-wrapper .feed-title .feed-note-number,
body.home.blog article.feed .feed-title .feed-note-number,
body.blog.home article.feed .feed-title .feed-note-number,
body.home.blog .post-feed .feed-title .feed-note-number,
body.blog.home .post-feed .feed-title .feed-note-number {
    color: #2f6f8f !important;
}

/* Adegua spaziatura feed-right nella homepage del blog (meno elementi) */
body.home.blog .feed-right,
body.blog.home .feed-right,
body.home.blog .post-feed .feed-right,
body.blog.home .post-feed .feed-right {
    margin-top: 0.5rem !important;
}

/* Rimuovi separatori prima di feed-length e feed-comments nella homepage del blog */
body.home.blog .feed-length::before,
body.blog.home .feed-length::before,
body.home.blog .feed-comments::before,
body.blog.home .feed-comments::before,
body.home.blog .post-feed .feed-length::before,
body.blog.home .post-feed .feed-length::before,
body.home.blog .post-feed .feed-comments::before,
body.blog.home .post-feed .feed-comments::before {
    display: none !important;
    content: none !important;
}

