/* =========================================================
   ENERGY FIRE - Fix responsive mobile
   Data: 29/06/2026
   Scopo: rendere il sito piu' leggibile da smartphone senza rifare HTML.
   Caricare questo file nella root del sito e collegarlo nell'head.
   ========================================================= */

/* Protezione generale: impedisce elementi che allargano la pagina */
html, body{
  max-width:100%;
  overflow-x:hidden;
}

img, video, iframe{
  max-width:100%;
  height:auto;
}

.ef table,
.ef pre,
.ef code{
  max-width:100%;
  overflow-x:auto;
}

/* Migliora il comportamento degli anchor con header sticky */
.ef section,
.ef [id]{
  scroll-margin-top:115px;
}

@media (max-width: 900px){
  /* Header piu' ordinato */
  .ef header{
    position:sticky !important;
    top:0 !important;
    z-index:999 !important;
  }

  .ef .ef-container{
    padding-left:14px !important;
    padding-right:14px !important;
  }

  .ef .ef-nav{
    display:flex !important;
    align-items:center !important;
    gap:8px !important;
    padding-top:8px !important;
    padding-bottom:8px !important;
  }

  .ef .ef-brand{
    flex:1 1 auto !important;
    font-size:18px !important;
    line-height:1.1 !important;
  }

  /* CTA telefono/WhatsApp: non devono rompere la riga */
  .ef .ef-cta{
    width:100% !important;
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    gap:8px !important;
    order:2 !important;
  }

  .ef .ef-cta .ef-btn{
    width:100% !important;
    justify-content:center !important;
    min-height:42px !important;
    padding:8px 9px !important;
    border-radius:12px !important;
    font-size:13px !important;
    white-space:nowrap !important;
  }

  .ef .ef-cta .ef-small{
    display:none !important;
  }

  /* Menu principale: una sola riga scrollabile, non 4 righe accatastate */
  .ef .ef-main-nav{
    order:3 !important;
    width:100% !important;
    flex:0 0 100% !important;
    margin-top:0 !important;
  }

  .ef .ef-menu{
    display:flex !important;
    flex-wrap:nowrap !important;
    gap:8px !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    -webkit-overflow-scrolling:touch !important;
    padding:2px 0 4px !important;
    scrollbar-width:none !important;
  }

  .ef .ef-menu::-webkit-scrollbar{
    display:none !important;
  }

  .ef .ef-menu > a,
  .ef .ef-menu-item > a{
    flex:0 0 auto !important;
    display:inline-flex !important;
    align-items:center !important;
    min-height:34px !important;
    padding:7px 11px !important;
    border:1px solid var(--ef-border, #e0e1e6) !important;
    border-radius:999px !important;
    background:#ffffff !important;
    color:#33333a !important;
    font-size:13px !important;
    white-space:nowrap !important;
  }

  .ef .ef-menu a::after{
    display:none !important;
  }

  .ef .ef-menu-item{
    width:auto !important;
    min-width:auto !important;
    flex:0 0 auto !important;
    display:block !important;
    position:relative !important;
  }

  /* Su telefono non mostriamo tutti i sottolink nel menu alto: appesantiscono troppo.
     Il link 'Servizi' porta alla sezione servizi della home. */
  .ef .ef-submenu{
    display:none !important;
  }

  /* Hero compatto e leggibile */
  .ef .ef-hero{
    padding-top:34px !important;
    padding-bottom:24px !important;
    min-height:auto !important;
  }

  .ef .ef-hero h1{
    font-size:26px !important;
    line-height:1.18 !important;
    margin-bottom:12px !important;
    word-break:normal !important;
  }

  .ef .ef-hero p{
    font-size:15px !important;
    line-height:1.45 !important;
    margin-bottom:14px !important;
  }

  .ef .ef-hero-cta,
  .ef .ef-cta-row{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .ef .ef-hero-cta .ef-btn,
  .ef .ef-cta-row .ef-btn{
    width:100% !important;
    justify-content:center !important;
  }

  /* Sezioni piu' leggere */
  .ef section{
    padding-top:28px !important;
    padding-bottom:28px !important;
  }

  .ef h2{
    font-size:22px !important;
    line-height:1.22 !important;
  }

  .ef h3{
    font-size:18px !important;
    line-height:1.25 !important;
  }

  .ef p,
  .ef li{
    font-size:15px !important;
  }

  /* Card e griglie sempre a una colonna su mobile/tablet piccolo */
  .ef .ef-grid,
  .ef .ef-stats,
  .ef .ef-two-cols,
  .ef .ef-gallery-grid{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:14px !important;
  }

  .ef .ef-card,
  .ef .ef-stat-card,
  .ef .ef-panel{
    grid-column:auto !important;
    padding:16px !important;
    border-radius:14px !important;
  }

  .ef .ef-gallery-item img{
    height:auto !important;
    aspect-ratio:4/3 !important;
    object-fit:cover !important;
  }

  /* Form preventivo leggibile */
  .ef .ef-form,
  .ef .ef-row{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:12px !important;
  }

  .ef input,
  .ef select,
  .ef textarea,
  .ef button{
    max-width:100% !important;
    font-size:16px !important; /* evita zoom automatico su iPhone */
  }

  .ef textarea{
    min-height:120px !important;
  }

  .ef .ef-checks,
  .ef .ef-checkbox-grid{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:8px !important;
  }

  /* Footer ordinato */
  .ef footer{
    padding-bottom:92px !important;
  }

  .ef footer .ef-container{
    display:flex !important;
    flex-direction:column !important;
    align-items:flex-start !important;
    gap:8px !important;
  }
}

@media (max-width: 520px){
  .ef .ef-container{
    padding-left:12px !important;
    padding-right:12px !important;
  }

  .ef .ef-brand{
    font-size:17px !important;
  }

  .ef .ef-cta{
    grid-template-columns:1fr 1fr !important;
  }

  .ef .ef-cta .ef-btn{
    font-size:12px !important;
    padding-left:7px !important;
    padding-right:7px !important;
  }

  .ef .ef-hero h1{
    font-size:23px !important;
  }

  .ef h2{
    font-size:21px !important;
  }

  .ef .ef-badges{
    gap:8px !important;
  }

  .ef .ef-badge{
    font-size:12px !important;
    padding:6px 9px !important;
  }

  /* Pulsante WhatsApp fisso meno invasivo */
  .ef .ef-wa{
    right:10px !important;
    left:10px !important;
    bottom:10px !important;
    z-index:998 !important;
  }

  .ef .ef-wa a{
    width:100% !important;
    justify-content:center !important;
    border-radius:14px !important;
    padding:10px 12px !important;
    font-size:14px !important;
  }

  .ef .ef-cookie{
    left:10px !important;
    right:10px !important;
    bottom:68px !important;
  }
}

@media (max-width: 360px){
  .ef .ef-cta{
    grid-template-columns:1fr !important;
  }

  .ef .ef-hero h1{
    font-size:21px !important;
  }
}
