/*
  Homepage (TEMPLATE CMS FILASTROCCHE 2026)
  - CSS dedicato, caricato SOLO in homepage tramite controllers/homepage.php
  - Scope: body.page-home .home-*
  - Nessun JS: tabs/accordion/carousel resi statici (stack / details / grid)
*/

body.page-home{
  /* fallback variabili: riuso palette progetto quando possibile */
  --home-primary: var(--primary, #2c7eb7);
  --home-primary-dark: var(--primary-dark, #006c45);
  --home-text: var(--text, #023428);
  --home-muted: var(--muted, #2c2c2c);
  --home-border: var(--border, #d6e2da);
  --home-soft: var(--bg-soft, #f5f7f6);
  --home-soft2: #eef5f1;
  --home-lime: var(--accent, #A1C63B);
  --home-deep: #2c7eb7;
  --home-shadow: 0 10px 26px rgba(0,0,0,0.07);

  /* evitare overflow orizzontali dovuti a full-width backgrounds */
  overflow-x: hidden;
}

body.page-home .home-main{
  color: var(--home-text);
}

body.page-home .home-main img{ max-width:100%; height:auto; display:block; }

body.page-home .home-container{
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

body.page-home .home-section{
  padding: 44px 0;
}

/* Full-width backgrounds senza toccare layout globale */
body.page-home .home-soft,
body.page-home .home-soft2,
body.page-home .home-dark{
  position: relative;
}

body.page-home .home-soft::before,
body.page-home .home-soft2::before,
body.page-home .home-dark::before{
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 100vw;
  transform: translateX(-50%);
  z-index: -1;
}

body.page-home .home-soft::before{
  background: var(--home-soft);
  border-top: 1px solid var(--home-border);
  border-bottom: 1px solid var(--home-border);
}

body.page-home .home-soft2::before{
  background: var(--home-soft2);
  border-top: 1px solid var(--home-border);
  border-bottom: 1px solid var(--home-border);
}

body.page-home .home-dark{
  color: #fff;
}
body.page-home .home-dark::before{
  background:#e96f14;
}

body.page-home h1,
body.page-home h2,
body.page-home h3{
  line-height: 1.2;
  margin: 0 0 10px;
}

/* Assicura H1 bianco in HERO (sezione dark) */
body.page-home .home-dark h1{ color:#fff; }

body.page-home h1{ font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
body.page-home h2{ font-size: clamp(1.35rem, 2.2vw, 1.9rem); }
body.page-home h3{ font-size: 1.06rem; }

body.page-home .home-subtext{
  color: var(--home-muted);
  margin: 0;
  max-width: 80ch;
}

body.page-home .home-dark-title{ color: #fff; }
body.page-home .home-dark-subtext{ color: rgba(255,255,255,0.90); margin:0; max-width:80ch; }

/* Eyebrow */
body.page-home .home-eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* Hero */
body.page-home .home-hero-grid{
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 26px;
  align-items: center;
}

body.page-home .home-hero-grid--cta{
  grid-template-columns: 1fr;
  padding: 34px 0;
}

body.page-home .home-lead{
  font-size: 1.03rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.92);
  margin: 12px 0 0;
  max-width: 70ch;
}

body.page-home .home-hero-media{
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--home-shadow);
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}

body.page-home .home-hero-media picture,
body.page-home .home-panel-media picture{
  display:block;
  max-width:100%;
}

body.page-home .home-hero-media img{
  width: 100%;
  height: auto;
  display: block;
}

body.page-home .home-hero-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

body.page-home .home-btn-pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 850;
  border: 1px solid rgba(0,0,0,0.06);
  text-decoration: none;
  white-space: nowrap;
}

body.page-home .home-btn-pill:hover{ text-decoration:none; filter: brightness(0.98); }
body.page-home .home-btn-pill:active{ transform: translateY(1px); }

body.page-home .home-btn-primary{
  background: var(--home-lime);
  color: #fff;
  border-color: rgba(0,0,0,0.10);
}

body.page-home .home-btn-secondary{
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.28);
}

/* Cards / grids */
body.page-home .home-grid{
  display: grid;
  gap: 14px;
}

body.page-home .home-grid-4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.page-home .home-grid-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.page-home .home-grid-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }

body.page-home .home-card{
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 16px;
  box-shadow: var(--home-shadow);
  padding: 16px;
}

body.page-home .home-card p{ color: var(--home-muted); margin: 0 0 10px; }

body.page-home .home-pill{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  /*border: 1px solid var(--home-border);*/
  background: #006db7;
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 10px;
  height: 23px;
}

body.page-home .home-link{
  color: var(--home-primary);
  font-weight: 800;
  text-decoration: none;
}
body.page-home .home-link:hover{ text-decoration: underline; }

/* Soluzioni stack */
body.page-home .home-stack{ display: grid; gap: 14px; }

body.page-home .home-panel{
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 18px;
  box-shadow: var(--home-shadow);
  overflow: hidden;
}

body.page-home .home-panel-grid{
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
}

body.page-home .home-panel-box{
  padding: 16px;
}

body.page-home .home-panel-box p{ color: var(--home-muted); margin: 0 0 10px; }
body.page-home .home-panel-box ul{ margin: 10px 0 0 18px; color: var(--home-muted); }
body.page-home .home-panel-box li{ margin: 6px 0; }

body.page-home .home-panel-media{
  background: #f3f7f5;
  border-left: 1px solid var(--home-border);
  display: flex;
  flex-direction: column;
}

body.page-home .home-panel-media img{
  width: 100%;
  height: auto;
  display: block;
}

body.page-home .home-caption{
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--home-muted);
  border-top: 1px solid var(--home-border);
}

body.page-home .home-strong-link{ margin: 12px 0 0; }
body.page-home .home-strong-link a{ color: var(--home-primary-dark); text-decoration:none; }
body.page-home .home-strong-link a:hover{ text-decoration: underline; }

/* Steps */
body.page-home .home-steps{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

body.page-home .home-step{
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 16px;
  box-shadow: var(--home-shadow);
  padding: 14px;
}

body.page-home .home-num{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  color: #fff;
  background: var(--home-primary-dark);
  margin-bottom: 10px;
}

body.page-home .home-step p{ color: var(--home-muted); margin: 0; }

/* Case study */
body.page-home .home-quote-card{
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(0,0,0,0.22);
  padding: 16px;
}

body.page-home .home-metric{
  font-size: 0.95rem;
  color: rgba(255,255,255,0.95);
}
body.page-home .home-metric b{ font-size: 1.35rem; margin-right: 6px; }

body.page-home .home-quote{ margin: 10px 0 0; color: rgba(255,255,255,0.95); font-size: 1.02rem; line-height: 1.55; }
body.page-home .home-quote-meta{ margin-top: 10px; color: rgba(255,255,255,0.75); font-size: 0.92rem; }

/* FAQ (details) */
body.page-home .home-faq{ margin-top: 14px; display: grid; gap: 10px; }

body.page-home .home-faq-item{
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 14px;
  box-shadow: var(--home-shadow);
  overflow: hidden;
}

body.page-home .home-faq-item summary{
  cursor: pointer;
  padding: 14px 14px;
  font-weight: 850;
  list-style: none;
}

body.page-home .home-faq-item summary::-webkit-details-marker{ display:none; }

body.page-home .home-faq-item[open] summary{
  border-bottom: 1px solid var(--home-border);
}

body.page-home .home-faq-a{
  padding: 12px 14px 14px;
  color: var(--home-muted);
}


/* Responsive (ispirato al layout del template home.html) */
@media (max-width: 980px){
  /* Stack colonne come nel riferimento */
  body.page-home .home-hero-grid,
  body.page-home .home-panel-grid{ grid-template-columns: minmax(0,1fr); }

  body.page-home .home-panel-media{ border-left: 0; border-top: 1px solid var(--home-border); }

  /* 4-card e 3-card: 2 colonne su tablet */
  body.page-home .home-grid-4{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.page-home .home-grid-3{ grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* 2-card resta 2 colonne finché c'è spazio */
  body.page-home .home-grid-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Step: 2 colonne su tablet */
  body.page-home .home-steps{ grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Evita overflow pill su schermi medi */
  body.page-home .home-btn-pill{ max-width: 100%; white-space: normal; }
}

@media (max-width: 520px){
  body.page-home h1{ font-size: clamp(1.65rem, 6.5vw, 2.15rem); }
  body.page-home .home-lead{ font-size: 1.0rem; }
  body.page-home .home-eyebrow{ font-size: 0.74rem; }
  body.page-home .home-container{ padding: 0 14px; }
  body.page-home .home-section{ padding: 34px 0; }
  body.page-home .home-hero-grid{ gap: 16px; }

  /* 1 colonna su mobile */
  body.page-home .home-grid-4,
  body.page-home .home-grid-3,
  body.page-home .home-grid-2{ grid-template-columns: minmax(0,1fr); }

  body.page-home .home-steps{ grid-template-columns: minmax(0,1fr); }

  /* CTA: bottoni full-width (tap target) */
  body.page-home .home-hero-actions{ flex-direction: column; align-items: stretch; }
  body.page-home .home-btn-pill{
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Riduci padding card per compattare */
  body.page-home .home-card{ padding: 14px; }
  body.page-home .home-panel-box{ padding: 14px; }
  body.page-home .home-step{ padding: 13px; }
}


/* =========================================================
   FIX DEFINITIVO OVERFLOW (V5)
   - Conflitto con cms-template.css su body.layout-full:
     su mobile la main-layout può restare con colonna fissa (es. 1040px)
     causando overflow in TUTTO il contenuto.
   - Override SOLO in homepage e SOLO sotto 900px.
   ========================================================= */
@media (max-width: 900px){
  body.page-home.layout-full .main-layout{
    grid-template-columns: minmax(0, 1fr) !important;
    justify-content: stretch !important;
  }
  /* ulteriore safety: evita min-content overflow */
  body.page-home.layout-full .main-layout > *{
    min-width: 0;
  }
}

/* Safety per pseudo full-bleed: riduce rounding/scrollbar issues su mobile */
body.page-home .home-soft::before,
body.page-home .home-soft2::before,
body.page-home .home-dark::before{
  width: calc(100vw - 1px);
}

@supports (width: 100dvw){
  body.page-home .home-soft::before,
  body.page-home .home-soft2::before,
  body.page-home .home-dark::before{
    width: 100dvw;
  }
}

