/* ════════════════════════════════════════════════════════════════════
   ╔════════════════════════════════════════════════════════════════╗
   ║   ELM MOBILE NAV - HEADER + OVERLAY MENU FULLSCREEN            ║
   ║   ───────────────────────────────────────────────────────────  ║
   ║   File CSS COMPLETAMENTE INDIPENDENTE dal resto del sito.      ║
   ║   Caricato come ULTIMO link <link rel=stylesheet> in MasterPage║
   ║   per vincere sempre la cascade vs tema GoodLayers/hotale.     ║
   ║                                                                ║
   ║   Tutti i nomi classe sono prefissati "elm-" per garantire     ║
   ║   zero collisione con tema. Non eredita variabili custom dal   ║
   ║   resto del sito ma definisce le proprie inline dove serve.   ║
   ║                                                                ║
   ║   COMPONENTI gestiti qui:                                      ║
   ║   - Logo standalone fixed top-left (.elm-mobile-brand)         ║
   ║   - Header bar sticky (.elm-mobile-header)                     ║
   ║   - Hamburger toggle (.elm-mh-toggle)                          ║
   ║   - Backdrop overlay (.elm-mm-backdrop)                        ║
   ║   - Overlay menu fullscreen bordeaux (.elm-mobile-menu)        ║
   ║   - Lista macro con icone (.elm-mm-item)                       ║
   ║   - Language selector con bandiere (.elm-mm-lang)              ║
   ║   - Social (.elm-mm-social)                                    ║
   ║                                                                ║
   ║   STATI body (gestiti via JS):                                 ║
   ║   - body.elm-has-hero      = pagina con hero scuro full-bleed  ║
   ║   - body.elm-scrolled      = utente ha scrollato > 4px         ║
   ║   - body.elm-mm-locked     = overlay aperto -> scroll lock     ║
   ║                                                                ║
   ║   STATI element:                                               ║
   ║   - .elm-mobile-header.is-scrolled  = sopra al 4px scroll      ║
   ║   - .elm-mobile-menu.is-open        = overlay visibile         ║
   ║   - .elm-mm-backdrop.is-open        = backdrop visibile        ║
   ║   - .elm-mm-lang-link.is-active     = lingua corrente          ║
   ║                                                                ║
   ║   Markup: vedi MasterPage.master sezione "MOBILE HEADER".      ║
   ║   JS: vedi MasterPage.master sezione "MOBILE MENU JS".         ║
   ╚════════════════════════════════════════════════════════════════╝
   ════════════════════════════════════════════════════════════════════ */


/* ════════════════════════════════════════════════════════════════════
   1) HEADER BAR MOBILE — sticky in cima, full-width
   ════════════════════════════════════════════════════════════════════ */

/* SELETTORE NUCLEARE: html body header.elm-mobile-header (specificita' 0,2,3)
   per vincere su qualsiasi regola del tema anche con !important. */
html body header.elm-mobile-header,
.elm-mobile-header {
    display: none !important;            /* default desktop: nascosto */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
    /* DEFAULT UNIVERSALE: header solido bianco (safe per qualsiasi pagina). */
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: background .35s ease, border-color .25s ease, box-shadow .25s ease;
}

/* PATTERN TRASPARENTE (opt-in via body.elm-has-hero): solo home + DormireList
   + altre pagine con hero scuro full-bleed in cima. */
body.elm-has-hero .elm-mobile-header {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
}
/* Scrolled (>4px): SEMPRE solido bianco indipendentemente dal pattern. */
.elm-mobile-header.is-scrolled,
body.elm-has-hero .elm-mobile-header.is-scrolled {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom-color: rgba(0,0,0,0.06) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
}
/* QUANDO OVERLAY APERTO: nascondi page header bar (sennò appare bianco sopra
   l'overlay essendo z-index 9999 > 1200 -> doppio close button visibile,
   confonde l'utente). Il logo standalone (z 99999) resta visibile, il close
   action e' solo il .elm-mm-close round dentro l'overlay. Transition fluida. */
body.elm-mm-locked .elm-mobile-header {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity .25s ease, visibility 0s linear .25s !important;
    pointer-events: none !important;
}

.elm-mh-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 1.2rem;
    max-width: 100%;
}

.elm-mh-spacer,
.elm-mm-spacer {
    display: inline-block;
    width: 215px;     /* riserva spazio del logo standalone (70h * 3 ratio) */
    height: 1px;
}

.elm-mh-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* ════════════════════════════════════════════════════════════════════
   2) LOGO STANDALONE — fixed top-left, sopra tutto
   ════════════════════════════════════════════════════════════════════ */

.elm-mobile-brand {
    display: none !important;            /* default desktop: nascosto */
    position: fixed !important;
    top: 10px !important;
    left: 14px !important;
    z-index: 99999 !important;           /* sopra TUTTO incluso overlay */
    line-height: 0;
    height: 70px;
}
.elm-brand-img {
    height: 70px;
    width: auto;
    display: block;
    transition: opacity .35s ease;
}
/* Colorata default (header solido), bianca quando hero/overlay. */
.elm-brand-color {
    opacity: 1;
    position: relative;
}
.elm-brand-white {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
}
body.elm-has-hero:not(.elm-scrolled) .elm-brand-color { opacity: 0; }
body.elm-has-hero:not(.elm-scrolled) .elm-brand-white { opacity: 1; }
body.elm-mm-locked .elm-brand-color { opacity: 0; }
body.elm-mm-locked .elm-brand-white { opacity: 1; }


/* ════════════════════════════════════════════════════════════════════
   3) HAMBURGER TOGGLE — 3 stanghette, morph in X
   ════════════════════════════════════════════════════════════════════ */

.elm-mh-toggle {
    width: 38px;
    height: 38px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.elm-mh-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    /* Default: NERO (header bianco solido) */
    background: #18140f;
    border-radius: 2px;
    box-shadow: none;
    transition: background .25s ease, box-shadow .25s ease,
                transform .3s ease, opacity .25s ease;
}
/* Su hero trasparente (NON scrolled): BIANCO con shadow per leggibilita' */
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-toggle span {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
/* Morph in X quando aperto */
.elm-mh-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.elm-mh-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.elm-mh-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


/* ════════════════════════════════════════════════════════════════════
   4) BACKDROP — fondo scuro dietro overlay
   ════════════════════════════════════════════════════════════════════ */

.elm-mm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1199;
    opacity: 0;
    visibility: hidden;
    transition: opacity .4s ease, visibility 0s linear .4s;
}
.elm-mm-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .4s ease, visibility 0s linear 0s;
}


/* ════════════════════════════════════════════════════════════════════
   5) OVERLAY MENU FULLSCREEN — bordeaux/porpora premium
   ════════════════════════════════════════════════════════════════════ */

.elm-mobile-menu {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(100%, 420px);
    z-index: 1200;
    background: linear-gradient(160deg, #3a1422 0%, #4a1a2e 55%, #5a1825 100%);
    color: #f8eee8;
    overflow-y: auto;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .45s cubic-bezier(.22,1,.36,1),
                visibility 0s linear .45s;
    box-shadow: -16px 0 40px rgba(0,0,0,0.35);
    -webkit-overflow-scrolling: touch;
}
.elm-mobile-menu.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .45s cubic-bezier(.22,1,.36,1),
                visibility 0s linear 0s;
}

/* HEADER overlay: spacer per logo standalone + close button a destra.
   Padding 7px verticale (stesso della .elm-mh-inner della page header)
   cosi' il close button cade ESATTAMENTE alla stessa altezza dove era
   l'hamburger -> apertura/chiusura senza salti verticali. */
.elm-mm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 1.2rem;
    min-height: 52px;       /* match altezza bar header (52px) */
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.elm-mm-close {
    width: 38px;            /* stesso size dell'hamburger toggle */
    height: 38px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
    color: #f8eee8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .25s ease, border-color .2s ease;
}
.elm-mm-close:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* Body scroll lock */
body.elm-mm-locked {
    overflow: hidden;
}


/* ════════════════════════════════════════════════════════════════════
   6) LISTA MACRO — icone tonde + label + subtext categorie + chevron
   ════════════════════════════════════════════════════════════════════ */

.elm-mm-list {
    list-style: none;
    margin: 0;
    padding: 50px 0 12px 0;
}
.elm-mm-item {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    /* Stagger animation: invisibili e shiftati di 20px a destra by default */
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .4s ease, transform .45s cubic-bezier(.22,1,.36,1);
}
.elm-mm-item:last-child {
    border-bottom: 0;
}
.elm-mobile-menu.is-open .elm-mm-item {
    opacity: 1;
    transform: translateX(0);
}
/* Stagger delays */
.elm-mobile-menu.is-open .elm-mm-item:nth-child(1) { transition-delay: .12s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(2) { transition-delay: .17s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(3) { transition-delay: .22s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(4) { transition-delay: .27s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(5) { transition-delay: .32s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(6) { transition-delay: .37s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(7) { transition-delay: .42s; }
.elm-mobile-menu.is-open .elm-mm-item:nth-child(8) { transition-delay: .47s; }

.elm-mm-item > a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 22px;
    text-decoration: none;
    color: #f8eee8;
    font-family: 'Lora', serif;
    transition: background .18s ease, color .18s ease;
}
.elm-mm-item > a:hover,
.elm-mm-item > a:focus-visible,
.elm-mm-item > a:active {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.elm-mm-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #f8d8d8;
    flex-shrink: 0;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.elm-mm-item > a:hover .elm-mm-icon {
    background: #e66a31;
    border-color: #e66a31;
    color: #fff;
}
.elm-mm-textwrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    gap: 3px;
}
.elm-mm-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: #fff;
}
.elm-mm-subtext {
    font-family: 'Jost', sans-serif;
    font-size: 0.75rem; /* era .72rem: minimo 12px, richiesta di Andrea 24/09/2026 */
    color: rgba(248,238,232,0.55);
    font-weight: 400;
    letter-spacing: 0.01em;
}
.elm-mm-arrow {
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
    transition: transform .2s ease, color .2s ease;
}
.elm-mm-item > a:hover .elm-mm-arrow {
    color: #fff;
    transform: translateX(3px);
}

/* CTA item (richiedi preventivo) — pulsante arancio brand */
.elm-mm-item-cta {
    border-bottom: 0;
}
.elm-mm-item-cta > a {
    background: #e66a31;
    color: #fff;
    margin: 14px 18px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(230,106,49,0.35);
}
.elm-mm-item-cta > a:hover,
.elm-mm-item-cta > a:focus-visible {
    background: #d65a26;
    color: #fff;
}
.elm-mm-item-cta .elm-mm-icon {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}
.elm-mm-item-cta > a:hover .elm-mm-icon {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.4);
}
.elm-mm-item-cta .elm-mm-text { color: #fff; }
.elm-mm-item-cta .elm-mm-arrow { color: rgba(255,255,255,0.7); }


/* ════════════════════════════════════════════════════════════════════
   7) FOOTER OVERLAY — language selector + social
   ════════════════════════════════════════════════════════════════════ */

.elm-mm-footer {
    padding: 22px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .4s ease .35s, transform .45s cubic-bezier(.22,1,.36,1) .35s;
}
.elm-mobile-menu.is-open .elm-mm-footer {
    opacity: 1;
    transform: translateY(0);
}

.elm-mm-lang {
    margin-bottom: 18px;
}
.elm-mm-lang-label {
    display: block;
    font-size: 0.75rem; /* era .68rem: minimo 12px, richiesta di Andrea 24/09/2026 */
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(248,238,232,0.6);
    margin-bottom: 10px;
}
.elm-mm-lang-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.elm-mm-lang-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease,
                opacity .2s ease, transform .2s ease;
    opacity: 0.55;
}
.elm-mm-lang-link img {
    display: block;
    width: 36px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.elm-mm-lang-link:hover,
.elm-mm-lang-link:focus-visible {
    opacity: 0.95;
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}
.elm-mm-lang-link.is-active {
    opacity: 1;
    background: rgba(230,106,49,0.18);
    border-color: #e66a31;
    cursor: default;
    transform: scale(1.05);
    pointer-events: none;
}
.elm-mm-lang-link.is-active img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.elm-mm-social {
    display: flex;
    gap: 12px;
}
.elm-mm-social a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f8eee8;
    font-size: 1.1rem;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}
.elm-mm-social a:hover {
    background: #e66a31;
    border-color: #e66a31;
    color: #fff;
}


/* ════════════════════════════════════════════════════════════════════
   8) ATTIVAZIONE MOBILE + RESET CONTAINING BLOCK (<= 991px)
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 991.98px) {

    /* Mostra header e logo standalone (default desktop: display none) */
    html body header.elm-mobile-header,
    .elm-mobile-header { display: block !important; }
    html body a.elm-mobile-brand,
    .elm-mobile-brand { display: inline-block !important; }

    /* ─── RESET CONTAINING BLOCK ───
       Il tema hotale/GoodLayers applica transform/will-change/filter/perspective
       su html, body, wrappers per ottimizzazione scroll. Questo CREA un
       containing block per i nostri position:fixed -> diventano relativi
       all'ancestor trasformato invece del viewport -> SCROLLANO con la pagina.
       Force-reset di TUTTE le proprieta' che possono creare containing block. */
    html, body,
    .hotale-body, .hotale-body-front, .hotale-body-outer-wrapper,
    .hotale-body-wrapper, .hotale-header-boxed-wrap,
    .hotale-page-wrapper {
        transform: none !important;
        -webkit-transform: none !important;
        filter: none !important;
        -webkit-filter: none !important;
        perspective: none !important;
        -webkit-perspective: none !important;
        will-change: auto !important;
        contain: none !important;
    }

    /* Nascondi vecchio header desktop + top bar + placeholder hotale */
    .hotale-top-bar,
    .hotale-header-wrap,
    .hotale-mobile-header-wrap {
        display: none !important;
    }

    /* Body padding-top per compensare header fisso. Pagine con hero (elm-has-hero)
       lo azzerano -> hero filtra sotto l'header trasparente. */
    body { padding-top: 0px; }
    body.elm-has-hero { padding-top: 0; }

    /* Bar piu' bassa cosi' il logo 70px sborda visibilmente sotto */
    .elm-mh-inner { padding: 7px 1.2rem; }

    /* Effetto shadow opzionale quando scrollato */
    .elm-mobile-header.is-scrolled {
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    }
}


/* ════════════════════════════════════════════════════════════════════
   9) LENTE DELLA RICERCA (13/10/2026)
   UNICA aggiunta all'header congelato, su OK esplicito di Andrea
   ("lente nell'header"): un link accanto all'hamburger, stessa misura
   (38x38) e stessi colori delle stanghette (nero su header bianco,
   bianco con ombra sull'hero trasparente). Il resto dell'header non
   cambia. Il pannello che apre e' in elm-ricerca.css / elm-ricerca.js.
   ════════════════════════════════════════════════════════════════════ */
.elm-mh-search {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: #18140f;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    transition: color .25s ease, background-color .2s ease;
}
.elm-mh-search i { line-height: 1; }
.elm-mh-search:hover,
.elm-mh-search:focus { color: #18140f; text-decoration: none; }
.elm-mh-search:focus-visible { outline: 2px solid #c9a96b; outline-offset: 1px; }
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-search,
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-search:hover,
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-search:focus {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}


/* ════════════════════════════════════════════════════════════════════
   10) CUORE "IL MIO VIAGGIO" (14/10/2026)
   Seconda aggiunta all'header congelato, su OK esplicito di Andrea
   ("cuore + contatore nell'header, accanto alla lente"). Stessa misura
   e stessi colori della lente (sez. 9). Il numerino dei salvati sta
   nell'angolo in alto a destra e sparisce con 0 (attributo hidden,
   lo gestisce App_Script/elm-mio-viaggio.js).
   ════════════════════════════════════════════════════════════════════ */
.elm-mh-viaggio {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: #18140f;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    transition: color .25s ease, background-color .2s ease;
}
.elm-mh-viaggio i { line-height: 1; }
.elm-mh-viaggio:hover,
.elm-mh-viaggio:focus { color: #18140f; text-decoration: none; }
.elm-mh-viaggio:focus-visible { outline: 2px solid #c9a96b; outline-offset: 1px; }
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-viaggio,
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-viaggio:hover,
body.elm-has-hero .elm-mobile-header:not(.is-scrolled) .elm-mh-viaggio:focus {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.elm-mh-viaggio-n {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #c9a96b;
    color: #18140f;
    font-family: 'Jost', system-ui, -apple-system, sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
    text-shadow: none;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}
.elm-mh-viaggio-n[hidden] { display: none; }
