/*
  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:#006db7;
}

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-card-has-media{
  overflow: hidden;
}

body.page-home .home-card-media{
  display:block;
  margin: -16px -16px 12px;
  aspect-ratio: 45 / 38;
  background:#f3f4f6;
  overflow:hidden;
  border-bottom: 1px solid var(--home-border);
}
body.page-home .home-card-media a,
body.page-home .home-card-media picture,
body.page-home .home-card-media img{
  display:block;
  width:100%;
  height:100%;
}
body.page-home .home-card-media img{
  object-fit:cover;
}
body.page-home .home-card h3 a{
  color: inherit;
  text-decoration: none;
}
body.page-home .home-card h3 a:hover{
  text-decoration: underline;
}

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);
}



/* Ultimi prodotti homepage */
body.page-home .home-latest-products .product-grid{
  margin-top: 14px;
}
body.page-home .home-latest-products .home-subtext{
  margin-bottom: 0;
}



/* Categorie menu in evidenza homepage */
body.page-home .home-menu-tax-nav .home-subtext{
  margin-bottom: 0;
}
body.page-home .home-menu-tax-strip{
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  margin-top: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
body.page-home .home-menu-tax-card{
  flex: 0 0 236px;
  width: 236px;
  max-width: 236px;
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 16px;
  box-shadow: var(--home-shadow);
  overflow: hidden;
  scroll-snap-align: start;
  min-height: 100%;
}
body.page-home .home-menu-tax-media{
  display: block;
  text-decoration: none;
}
body.page-home .home-menu-tax-media img{
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
body.page-home .home-menu-tax-body{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}
body.page-home .home-menu-tax-pill{
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: #006db7;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
body.page-home .home-menu-tax-card h3{
  margin: 0;
  font-size: 1.02rem;
}
body.page-home .home-menu-tax-card h3 a{
  color: var(--home-text);
  text-decoration: none;
}
body.page-home .home-menu-tax-card h3 a:hover,
body.page-home .home-menu-tax-link:hover{
  text-decoration: underline;
}
body.page-home .home-menu-tax-card p{
  margin: 0;
  color: var(--home-muted);
  font-size: 0.94rem;
  line-height: 1.45;
}
body.page-home .home-menu-tax-link{
  margin-top: auto;
  color: var(--home-primary-dark);
  font-weight: 800;
  text-decoration: none;
}
body.page-home .home-menu-tax-strip::-webkit-scrollbar{
  height: 8px;
}
body.page-home .home-menu-tax-strip::-webkit-scrollbar-thumb{
  background: rgba(0, 0, 0, .18);
  border-radius: 999px;
}
body.page-home .home-menu-tax-strip::-webkit-scrollbar-track{
  background: transparent;
}
@media (max-width: 640px){
  body.page-home .home-menu-tax-strip{
    gap: 10px;
    padding-bottom: 8px;
  }
  body.page-home .home-menu-tax-card{
    flex-basis: 206px;
    width: 206px;
    max-width: 206px;
  }
}



/* Brand principali homepage */
body.page-home .home-visually-hidden{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
body.page-home .home-brand-nav .home-subtext{
  margin-bottom: 0;
}
body.page-home .home-brand-nav-grid{
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
body.page-home .home-brand-nav-card{
  min-width: 0;
}
body.page-home .home-brand-nav-linkbox{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 136px;
  padding: 18px 14px;
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 18px;
  box-shadow: var(--home-shadow);
  text-decoration: none;
}
body.page-home .home-brand-nav-linkbox:hover{
  text-decoration: none;
}
body.page-home .home-brand-nav-logo{
  display: block;
  max-width: 100%;
  max-height: 62px;
  width: auto;
  height: auto;
  object-fit: contain;
}
body.page-home .home-brand-nav-fallback{
  display: block;
  text-align: center;
  font-weight: 900;
  line-height: 1.2;
  color: var(--home-text);
}

/* Hub principali homepage */
body.page-home .home-hub-nav .home-subtext{
  margin-bottom: 0;
}
body.page-home .home-hub-nav-grid{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
body.page-home .home-hub-nav-card{
  background: #fff;
  border: 1px solid var(--home-border);
  border-radius: 16px;
  box-shadow: var(--home-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
body.page-home .home-hub-nav-card h3{
  margin: 0 0 8px;
  font-size: 1.02rem;
}
body.page-home .home-hub-nav-card h3 a{
  color: var(--home-text);
  text-decoration: none;
}
body.page-home .home-hub-nav-card h3 a:hover{
  text-decoration: underline;
}
body.page-home .home-hub-nav-card p{
  margin: 0;
  color: var(--home-muted);
  font-size: 0.95rem;
}
body.page-home .home-hub-nav-link{
  margin-top: auto;
  padding-top: 12px;
  color: var(--home-primary-dark);
  font-weight: 800;
  text-decoration: none;
}
body.page-home .home-hub-nav-link:hover{
  text-decoration: underline;
}

/* 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)); }
  body.page-home .home-brand-nav-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.page-home .home-hub-nav-grid{ 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: 760px){
  body.page-home .home-brand-nav-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@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); }
  body.page-home .home-brand-nav-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body.page-home .home-brand-nav-linkbox{ min-height: 112px; padding: 16px 12px; }
  body.page-home .home-brand-nav-logo{ max-height: 52px; }
  body.page-home .home-hub-nav-grid{ 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;
  }
}



/* Naviga per età homepage: una riga orizzontale a scorrimento, solo homepage */
body.page-home .home-age-directory .home-subtext{
  margin-bottom: 0;
}
body.page-home .home-age-directory .subcat-grid{
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  grid-template-columns: none;
}
body.page-home .home-age-directory .subcat-card{
  flex: 0 0 182px;
  width: 182px;
  max-width: 182px;
  min-height: 0;
  scroll-snap-align: start;
}
body.page-home .home-age-directory .subcat-card img{
  display: block;
  max-width: 64px;
  width: 100%;
  height: auto;
  margin: 0 auto 4px;
}
body.page-home .home-age-directory .subcat-card h3 a,
body.page-home .home-age-directory .subcat-link{
  text-decoration: none;
}
body.page-home .home-age-directory .subcat-card h3 a:hover,
body.page-home .home-age-directory .subcat-link:hover{
  text-decoration: underline;
}
body.page-home .home-age-directory .subcat-grid::-webkit-scrollbar{
  height: 8px;
}
body.page-home .home-age-directory .subcat-grid::-webkit-scrollbar-thumb{
  background: rgba(0, 0, 0, .18);
  border-radius: 999px;
}
body.page-home .home-age-directory .subcat-grid::-webkit-scrollbar-track{
  background: transparent;
}
@media (max-width: 640px){
  body.page-home .home-age-directory .subcat-grid{
    gap: 8px;
    padding-bottom: 8px;
  }
  body.page-home .home-age-directory .subcat-card{
    flex-basis: 164px;
    width: 164px;
    max-width: 164px;
  }
}
