/* ============================================================
   Mobile Fixes - Cookie-free static site optimizations
   ============================================================ */

/* --- Header: sempre bianco su tutte le pagine (fisso o relativo) ---
   Il tema ha header{background:transparent} e su alcune pagine
   il JS rende l'header position:fixed sopra le immagini di copertina.
   Forziamo il bianco su tutta la catena. */
header.page_header,
header.page_header .header_inner,
header.page_header .header_top_bottom_holder,
header.page_header .header_bottom {
    background-color: #ffffff !important;
}

/* Shadow leggera quando l'header è sticky/fixed */
header.page_header.sticky,
header.page_header.scrolled,
header.page_header.fixed {
    box-shadow: 0 1px 4px rgba(0,0,0,0.10) !important;
}

/* --- Immagini responsive globale --- */
img { max-width: 100%; height: auto; }

/* --- Header mobile: logo sinistra, hamburger destra ---
   Il tema usa position:absolute su header_inner_left e nasconde img.normal
   sostituendola con img.mobile (che non esiste nel clone statico).
   Soluzione: header_bottom = positioning context, header_inner_left
   = absolute full-width con flexbox interno. */
@media only screen and (max-width: 1000px) {

    /* Nasconde la colonna destra (social icons) */
    .header_inner_right {
        display: none !important;
    }

    /* header_bottom: context per il posizionamento assoluto del bar */
    .header_bottom {
        position: relative !important;
        min-height: 65px !important;
        height: auto !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* header_inner_left: riempie tutta la barra, flex interno */
    .header_inner_left {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 65px !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        float: none !important;
    }

    /* Logo: a sinistra, sempre visibile */
    .logo_wrapper {
        order: 1 !important;
        flex: 1 !important;
        float: none !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Il tema nasconde img.normal su mobile (aspetta img.mobile che non c'è):
       lo forziamo visibile */
    header .logo_wrapper img,
    header .logo_wrapper img.normal,
    header .q_logo img.normal {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: 44px !important;
        width: auto !important;
        position: static !important;
        margin: 0 !important;
    }

    /* Hamburger: a destra */
    .mobile_menu_button {
        order: 2 !important;
        flex-shrink: 0 !important;
        float: none !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        cursor: pointer;
        background: none !important;
        border: none !important;
    }

    /* Icona hamburger: 3 linee sottili pure CSS */
    .hbg-icon {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        width: 22px !important;
        height: 16px !important;
        font-size: 0 !important;
        position: relative !important;
    }

    .hbg-line {
        display: block !important;
        width: 100% !important;
        height: 1.5px !important;
        background-color: #1f1b1d !important;
        border-radius: 2px !important;
        transform-origin: center !important;
        transition: transform 0.3s ease, opacity 0.2s ease, top 0.3s ease !important;
        position: relative !important;
    }

    /* Animazione → X quando il menu è aperto */
    .mobile_menu_button.is-open .hbg-line:nth-child(1) {
        transform: translateY(7.25px) rotate(45deg) !important;
    }
    .mobile_menu_button.is-open .hbg-line:nth-child(2) {
        opacity: 0 !important;
        transform: scaleX(0) !important;
    }
    .mobile_menu_button.is-open .hbg-line:nth-child(3) {
        transform: translateY(-7.25px) rotate(-45deg) !important;
    }

    /* Menu mobile: rimossi refusi (frecce destra/giù senza sottomenu) */
    .mobile_menu .mobile_arrow {
        display: none !important;
    }

    /* Voci menu mobile: allineamento sinistra, spaziatura pulita */
    nav.mobile_menu ul {
        margin: 0 !important;
        padding: 0 !important;
    }

    nav.mobile_menu ul li {
        border-bottom: 1px solid #f0f0f0 !important;
        list-style: none !important;
    }

    nav.mobile_menu ul li a {
        display: block !important;
        padding: 14px 20px !important;
        text-align: left !important;
        font-size: 13px !important;
        letter-spacing: 1.5px !important;
        text-transform: uppercase !important;
        color: #1f1b1d !important;
        text-decoration: none !important;
    }

    nav.mobile_menu ul li a:hover,
    nav.mobile_menu ul li.active > a {
        color: #b7b7b7 !important;
    }

    /* --- Parallax: ridotto su tablet --- */
    section.parallax_section_holder {
        height: 350px !important;
        background-attachment: scroll !important;
    }
    section.parallax_section_holder .vc_empty_space {
        height: 250px !important;
    }

    /* Colonne in verticale su tablet/mobile */
    .wpb_column.vc_col-sm-6 {
        width: 100% !important;
        float: none !important;
        padding: 0 20px !important;
        box-sizing: border-box !important;
    }
}

@media only screen and (max-width: 768px) {
    section.parallax_section_holder {
        height: 260px !important;
    }
    section.parallax_section_holder .vc_empty_space {
        height: 170px !important;
    }

    /* Blog post: testo leggibile */
    .blog_holder article .post_title h2,
    .blog_holder article .post_title h3 {
        font-size: 18px !important;
        line-height: 1.4 !important;
    }

    /* Tabelle responsive */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Contact cards stacked */
    .contact_card {
        margin-bottom: 20px;
    }

    /* Logo più piccolo */
    .q_logo img.normal, .logo_wrapper img.normal,
    .q_logo img, .logo_wrapper img {
        height: 46px !important;
        width: auto !important;
    }
}

@media only screen and (max-width: 480px) {
    section.parallax_section_holder {
        height: 200px !important;
    }
    section.parallax_section_holder .vc_empty_space {
        height: 120px !important;
    }

    /* Footer testo centrale su mobile */
    .footer_top .container_inner {
        text-align: center !important;
    }
    .footer_top .container_inner img {
        margin: 0 auto 10px !important;
        display: block !important;
    }

    /* Titoli pagine */
    .title_holder h1 {
        font-size: 22px !important;
        line-height: 1.3 !important;
    }
}
