/* STAGEO - MOBILE GLOBAL FIX TUTTE LE PAGINE 20260523
   Da caricare su tutte le pagine, dopo gli altri CSS.
   Obiettivo: evitare tagli brutti, overflow laterale, testi fuori schermo, immagini deformate.
*/

html,body{
  width:100%;
  max-width:100%;
  overflow-x:hidden!important;
}

img,video,canvas,svg{
  max-width:100%;
}

section,main,header,footer,div{
  box-sizing:border-box;
}

/* Evita che titoli enormi escano dallo schermo */
@media(max-width:768px){
  h1{
    font-size:clamp(42px,13vw,72px)!important;
    line-height:.9!important;
    max-width:100%!important;
    overflow-wrap:normal!important;
  }
  h2{
    font-size:clamp(32px,10vw,52px)!important;
    line-height:.95!important;
    max-width:100%!important;
  }
  h3{
    font-size:clamp(24px,7vw,36px)!important;
    line-height:1!important;
  }
  p,li{
    font-size:16px!important;
    line-height:1.55!important;
  }
}

/* HEADER/MENU mobile valido per home e pagine interne */
@media(max-width:900px){
  .site-header,
  #stageoHeaderUnified,
  .stageo-main-header{
    position:sticky!important;
    top:0!important;
    z-index:9998!important;
    width:100%!important;
    min-height:auto!important;
    padding:10px 14px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:10px!important;
    flex-wrap:wrap!important;
    background:#fff!important;
    box-shadow:0 8px 24px rgba(0,0,0,.12)!important;
  }

  .site-header .logo,
  .stageo-logo{
    display:flex!important;
    align-items:center!important;
    max-width:185px!important;
    flex:0 0 auto!important;
  }

  .site-header .logo img,
  .stageo-logo img,
  header img{
    max-width:180px!important;
    width:auto!important;
    height:auto!important;
    max-height:58px!important;
    object-fit:contain!important;
  }

  .menu-toggle,
  .stageo-menu{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:44px!important;
    height:44px!important;
    border:0!important;
    border-radius:8px!important;
    background:#f26a00!important;
    color:#fff!important;
    font-size:24px!important;
    font-weight:900!important;
    margin-left:auto!important;
  }

  .main-nav,
  .stageo-nav{
    display:none!important;
    flex:0 0 100%!important;
    width:100%!important;
    order:10!important;
    background:#071014!important;
    padding:10px!important;
    margin:6px 0 0!important;
    grid-template-columns:1fr!important;
    gap:6px!important;
  }

  .main-nav.open,
  .main-nav.is-open,
  .stageo-nav.open,
  .stageo-nav.is-open{
    display:grid!important;
  }

  .main-nav a,
  .stageo-nav a{
    display:flex!important;
    min-height:42px!important;
    align-items:center!important;
    justify-content:center!important;
    padding:9px 10px!important;
    background:rgba(255,255,255,.06)!important;
    color:#fff!important;
    font-size:15px!important;
    line-height:1.1!important;
    text-align:center!important;
    text-decoration:none!important;
    font-weight:900!important;
  }

  .quote,
  .stageo-quote{
    order:11!important;
    flex:0 0 100%!important;
    width:100%!important;
    min-height:48px!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    margin:0!important;
    padding:0 12px!important;
    font-size:15px!important;
    background:#f26a00!important;
    color:#fff!important;
    text-align:center!important;
    text-decoration:none!important;
  }
}

/* HERO generiche pagine */
@media(max-width:768px){
  .hero,
  .page-hero,
  .catasto-hero,
  .why-hero,
  .work-hero,
  .services-hero,
  .tech-hero{
    min-height:auto!important;
    height:auto!important;
    padding:96px 18px 48px!important;
    overflow:hidden!important;
  }

  .hero-content,
  .page-hero-inner,
  .catasto-hero-inner,
  .why-hero-inner,
  .work-hero-inner,
  .services-hero-inner,
  .tech-hero-inner{
    position:relative!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;
    transform:none!important;
    width:100%!important;
    max-width:100%!important;
    padding:0!important;
    z-index:3!important;
  }
}

/* Griglie responsive generali */
@media(max-width:900px){
  .grid,
  .cards,
  .impact-grid,
  .services-grid,
  .service-grid,
  .work-grid,
  .works-grid,
  .portfolio-grid,
  .why-cards,
  .steps,
  .certs,
  .footer,
  .private-inner,
  .about-preview,
  .split,
  .why-split,
  .why-statement,
  .why-cta,
  .local-grid,
  .faq-grid,
  .deliverables-grid,
  .process-grid{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:18px!important;
  }

  section,
  .section,
  .dark-section,
  .light-section,
  .content-section{
    padding-left:18px!important;
    padding-right:18px!important;
  }
}

/* Servizi home */
@media(max-width:768px){
  .services-strip{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:1px!important;
    overflow:visible!important;
  }
  .services-strip a{
    min-width:0!important;
    width:100%!important;
    padding:16px 10px!important;
    min-height:112px!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
    text-align:center!important;
  }
}
@media(max-width:480px){
  .services-strip{grid-template-columns:1fr!important;}
}

/* Immagini: evita deformazioni e tagli brutti */
@media(max-width:768px){
  .blade-gallery,
  .gallery,
  .image-grid,
  .work-gallery,
  .works-gallery,
  .portfolio-gallery{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:12px!important;
    height:auto!important;
  }

  .blade-gallery .blade,
  .gallery figure,
  .image-card,
  .work-card,
  .portfolio-card,
  .media-card{
    width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:auto!important;
    overflow:hidden!important;
  }

  .blade-gallery img,
  .gallery img,
  .image-grid img,
  .work-gallery img,
  .works-gallery img,
  .portfolio-gallery img,
  .work-card img,
  .portfolio-card img,
  .media-card img{
    width:100%!important;
    height:auto!important;
    max-height:none!important;
    object-fit:contain!important;
    object-position:center!important;
    display:block!important;
  }

  /* Per hero/slider è normale un leggero crop, ma non deve tagliare strumenti importanti */
  .slide img,
  .hero img,
  .page-hero img{
    width:100%!important;
    height:100%!important;
    object-fit:cover!important;
    object-position:center center!important;
  }
}

/* Tabelle/listati non devono uscire dallo schermo */
@media(max-width:768px){
  table{
    display:block!important;
    width:100%!important;
    overflow-x:auto!important;
  }
  pre,code{
    white-space:pre-wrap!important;
    word-break:break-word!important;
  }
}

/* CTA e pulsanti */
@media(max-width:768px){
  .btn,
  .button,
  .cta,
  .private-cta,
  .small-btn,
  .btn-primary,
  .btn-secondary,
  .btn-ghost{
    width:100%!important;
    max-width:100%!important;
    min-height:48px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    text-align:center!important;
    padding:12px 14px!important;
  }
}

/* Chat globale mobile */
.stageo-chat-widget{
  z-index:2147483000!important;
}
@media(max-width:768px){
  .stageo-chat-widget{
    position:fixed!important;
    right:10px!important;
    bottom:10px!important;
    left:auto!important;
    top:auto!important;
    z-index:2147483000!important;
  }
  .stageo-chat-button{
    min-width:128px!important;
    width:128px!important;
    min-height:72px!important;
    border-radius:999px!important;
    padding:10px 12px!important;
    text-align:center!important;
  }
  .stageo-chat-button strong{font-size:17px!important;}
  .stageo-chat-button span{font-size:10px!important;}
  .stageo-chat-button em{font-size:10px!important;}

  .stageo-chat-panel{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    top:8px!important;
    bottom:8px!important;
    width:auto!important;
    height:auto!important;
    max-width:none!important;
    max-height:none!important;
    border-radius:18px!important;
    display:none!important;
    grid-template-rows:auto 1fr auto auto auto!important;
    overflow:hidden!important;
  }
  .stageo-chat-panel.is-open,
  .stageo-chat-panel.open,
  .stageo-chat-panel.active{
    display:grid!important;
  }
  .stageo-chat-messages{
    min-height:0!important;
    overflow:auto!important;
    padding:14px!important;
    -webkit-overflow-scrolling:touch!important;
  }
  .stageo-msg{
    max-width:94%!important;
    font-size:14px!important;
  }
  .stageo-chat-nudge{display:none!important;}
  .stageo-chat-form input{
    font-size:16px!important;
    min-height:48px!important;
  }
}

/* Reset elegante */
.stageo-chat-actions{
  display:flex!important;
  justify-content:flex-end!important;
  align-items:center!important;
  padding:7px 12px 0!important;
  background:#101820!important;
  border-top:1px solid rgba(255,255,255,.05)!important;
}
.stageo-chat-actions .stageo-chat-reset{
  border:0!important;
  background:transparent!important;
  color:#ffb16e!important;
  font-size:11px!important;
  font-weight:900!important;
  cursor:pointer!important;
  padding:2px 0!important;
  text-transform:uppercase!important;
  letter-spacing:.03em!important;
}
