/* ===== Slide 4: sfondo e ancoraggio del footer ===== */
.slide:nth-child(4){
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
.slide:nth-child(4) footer{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
}

/* ===== Barra footer (overlay) ===== */
.footer-top{
  background: rgba(0,34,68,.55);  /* blu scuro semitrasp. */
  color: #fff;
  padding: 24px 6%;
}

/* ===== Layout desktop: logo | indirizzo | social+partner ===== */
.footer-container{
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  align-items: center;
  gap: 32px;
}

/* Colonna sinistra: logo */
.footer-left{ display:flex; align-items:center; gap:20px; }
.footer-logo{ width:220px; height:auto; display:block; }
.footer-left-divider{ width:2px; height:120px; background:rgba(255,255,255,.35); }

/* Colonna centrale: indirizzo */
.footer-address{ display:flex; flex-direction:column; gap:6px; }
.footer-address h3{ margin:0 0 6px; font-weight:800; letter-spacing:.5px; color:#fff; }
.footer-address p, .footer-address a{
  margin:0;
  color:#e7f6ff;
  white-space: nowrap;   /* evita a capo su desktop */
}
#footerPhone{ background:none; border:0; color:#e7f6ff; text-decoration:underline; cursor:pointer; }

/* Colonna destra: social + partner */
.footer-right{
  display:flex;
  flex-direction:column;
  gap:28px;
  align-items:flex-end;
  margin-left:auto;   /* spinge la colonna a destra */
}

.social-section,
.partner-section{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  width:100%;
}

/* Titoli con riga blu a destra (desktop) */
.social-section h3, .partner-section h3{
  position:relative; margin:0 0 10px; font-weight:800; color:#fff;
}
.social-section h3::after, .partner-section h3::after{
  content:""; position:absolute; right:0; left:110%; top:50%;
  height:3px; background:#009fe3; transform:translateY(-50%);
}

/* Social */
.social-logos{
  display:flex;
  gap:12px;
  justify-content:flex-end; /* icone a destra (desktop) */
  width:100%;
}
.social-logos a{
  width:44px; height:44px; border-radius:50%;
  border:1px solid rgba(255,255,255,.6);
  display:inline-flex; align-items:center; justify-content:center;
  transition:background .25s ease, transform .25s ease;
}
.social-logos a:hover{ background:#009fe3; transform:scale(1.05); }
.social-logos img{ height:22px; width:auto; }

/* Partner */
.partner-logos{
  display:flex;
  gap:16px;
  justify-content:flex-end; /* loghi a destra (desktop) */
  width:100%;
  align-items:center;
}
.partner-logos img{ height:38px; width:auto; display:block; }

/* Footer bottom (policy) – opzionale nascosto */
.footer-bottom{ display:none; }

/* ===== Mobile generico (≤900px): colonna singola e centrata ===== */
@media (max-width: 900px){
  .footer-container{
    grid-template-columns: 1fr;
    gap: 20px;
    text-align:center;
  }
  .footer-left{ justify-content:center; }
  .footer-left-divider{ display:none; }
  .footer-right{ align-items:center; margin-left:0; }
  .social-section h3::after,
  .partner-section h3::after{ display:none; }
  .footer-logo{ width:180px; }
  .social-logos a{ width:40px; height:40px; }
  .social-logos img{ height:20px; }
  .partner-logos img{ height:34px; }
}

/* ===== Layout pagina con footer sticky (fuori dalla slide 4, se serve) ===== */
html, body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
footer { margin-top: auto; }

/* =========================================================
   iPhone 16 – portrait (390–430): LOGO SOPRA, pila sotto centrata
   ========================================================= */
@supports (-webkit-touch-callout:none){
  @media screen and (orientation:portrait) and (min-width:390px) and (max-width:430px){
    .slide:nth-child(4) .footer-container{
      display:flex !important;
      flex-direction:column !important;
      align-items:center !important;
      justify-content:center;
      gap:18px !important;
      text-align:center !important;
    }
    .slide:nth-child(4) .footer-left{
      display:flex !important;
      flex-direction:column !important;      /* <— forza stack verticale */
      align-items:center !important;
      justify-content:center !important;
      gap:12px !important;
      width:100% !important;
    }
    .slide:nth-child(4) .footer-logo{ width:170px; height:auto; margin:0 auto; }
    .slide:nth-child(4) .footer-left-divider{ display:none !important; }
    .slide:nth-child(4) .footer-address{
      align-items:center !important;
      gap:6px;
      width:100%;
    }
    /* consenti a capo naturale nei contatti su mobile */
    .slide:nth-child(4) .footer-address p,
    .slide:nth-child(4) .footer-address a{ white-space:normal !important; }

    .slide:nth-child(4) .footer-right{
      align-items:center !important; gap:20px; margin-left:0 !important; width:100%;
    }
    .slide:nth-child(4) .social-section,
    .slide:nth-child(4) .partner-section{ align-items:center !important; text-align:center !important; width:100%; }
    .slide:nth-child(4) .social-section h3,
    .slide:nth-child(4) .partner-section h3{ margin:0 0 8px; text-align:center !important; }
    .slide:nth-child(4) .social-section h3::after,
    .slide:nth-child(4) .partner-section h3::after{ display:none !important; }
    .slide:nth-child(4) .social-logos,
    .slide:nth-child(4) .partner-logos{ justify-content:center !important; width:100%; }
  }
}

/* =========================================================
   iPhone 16 Pro Max – portrait (435–747): LOGO SOPRA, pila sotto
   ========================================================= */
@supports (-webkit-touch-callout:none){
  @media screen and (orientation:portrait) and (min-width:435px) and (max-width:747px){
    .slide:nth-child(4) .footer-container{
      display:flex !important; flex-direction:column !important;
      align-items:center !important; justify-content:center;
      gap:20px !important; text-align:center !important;
    }
    .slide:nth-child(4) .footer-left{
      display:flex !important;
      flex-direction:column !important;      /* <— stack verticale */
      align-items:center !important;
      justify-content:center !important;
      gap:14px !important;
      width:100% !important;
    }
    .slide:nth-child(4) .footer-logo{ width:190px; height:auto; margin:0 auto; }
    .slide:nth-child(4) .footer-left-divider{ display:none !important; }
    .slide:nth-child(4) .footer-address{
      align-items:center !important; gap:6px; width:100% !important;
    }
    .slide:nth-child(4) .footer-address p,
    .slide:nth-child(4) .footer-address a{ white-space:normal !important; }

    .slide:nth-child(4) .footer-right{
      align-items:center !important; gap:22px; margin-left:0 !important; width:100% !important;
    }
    .slide:nth-child(4) .social-section,
    .slide:nth-child(4) .partner-section{ align-items:center !important; text-align:center !important; width:100%; }
    .slide:nth-child(4) .social-section h3,
    .slide:nth-child(4) .partner-section h3{ margin:0 0 10px; text-align:center !important; }
    .slide:nth-child(4) .social-section h3::after,
    .slide:nth-child(4) .partner-section h3::after{ display:none !important; }
    .slide:nth-child(4) .social-logos,
    .slide:nth-child(4) .partner-logos{ justify-content:center !important; width:100%; }
  }
}

/* =========================================================
   iPad 11"/12.9" – 901–1375: LOGO SOPRA, pila sotto centrata
   ========================================================= */
@media screen and (min-width:901px) and (max-width:1375px){
  .slide:nth-child(4) .footer-container{
    display:flex !important; flex-direction:column !important;
    align-items:center !important; justify-content:center;
    gap:22px !important; text-align:center !important;
  }
  .slide:nth-child(4) .footer-left{
    display:flex !important;
    flex-direction:column !important;        /* <— stack verticale */
    align-items:center !important;
    justify-content:center !important;
    gap:16px !important;
    width:100% !important;
  }
  .slide:nth-child(4) .footer-logo{ width:220px; height:auto; margin:0 auto; }
  .slide:nth-child(4) .footer-left-divider{ display:none !important; }

  .slide:nth-child(4) .footer-address{
    align-items:center !important; gap:8px; width:100% !important;
  }
  .slide:nth-child(4) .footer-address p,
  .slide:nth-child(4) .footer-address a{ white-space:normal !important; }

  .slide:nth-child(4) .footer-right{
    align-items:center !important; gap:24px; margin-left:0 !important; width:100% !important;
  }

  .slide:nth-child(4) .social-section,
  .slide:nth-child(4) .partner-section{ align-items:center !important; text-align:center !important; width:100%; }
  .slide:nth-child(4) .social-section h3,
  .slide:nth-child(4) .partner-section h3{ margin:0 0 10px; text-align:center !important; }
  .slide:nth-child(4) .social-section h3::after,
  .slide:nth-child(4) .partner-section h3::after{ display:none !important; }

  .slide:nth-child(4) .social-logos,
  .slide:nth-child(4) .partner-logos{ justify-content:center !important; width:100%; }
}

/* Mobile (≤900px): testi e logo un po' più piccoli */
@media (max-width: 900px){
  .slide:nth-child(4) .footer-logo{ width:150px; } /* solo il logo */

  /* titoli */
  .slide:nth-child(4) .footer-address h3,
  .slide:nth-child(4) .social-section h3,
  .slide:nth-child(4) .partner-section h3{
    font-size: clamp(.95rem, 2.8vw, 1.05rem);
    letter-spacing:.4px;
  }
  /* testo indirizzo/contatti */
  .slide:nth-child(4) .footer-address p,
  .slide:nth-child(4) .footer-address a{
    font-size: clamp(.88rem, 2.6vw, .98rem);
  }
  /* NON tocco .social-logos / .partner-logos */
}

/* iPhone 16 (390–430): leggermente più piccoli */
@supports (-webkit-touch-callout:none){
  @media screen and (orientation:portrait) and (min-width:390px) and (max-width:430px){
    .slide:nth-child(4) .footer-logo{ width:145px; }
    .slide:nth-child(4) .footer-address h3,
    .slide:nth-child(4) .social-section h3,
    .slide:nth-child(4) .partner-section h3{ font-size: .95rem; }
    .slide:nth-child(4) .footer-address p,
    .slide:nth-child(4) .footer-address a{ font-size: .88rem; }
    .footer-right{
	  display:flex;
	  flex-direction:column;
	  gap:28px;
	  align-items:center;   /* contenuti centrati */
	  text-align:center;    /* testi centrati */
	  justify-self:center;  /* se è item di CSS Grid */
	  margin:0 auto;        /* se NON è in grid, centra il blocco */
	}
	.social-logos, .partner-logos{  justify-content:center;}
	.social-section h3,
	.partner-section h3{
	  right:30% !important;            /* centra il titolo */
	}
	footer{margin-top:1%;}
	.footer-top{height:100vh;}
  }
}

/* iPhone 16 Pro Max (435–747): via di mezzo */
@supports (-webkit-touch-callout:none){
  @media screen and (orientation:portrait) and (min-width:435px) and (max-width:747px){
    .slide:nth-child(4) .footer-logo{ width:155px; }
    .slide:nth-child(4) .social-section h3,
    .slide:nth-child(4) .partner-section h3{ font-size: 1rem;}
    .slide:nth-child(4) .footer-address p,
    .slide:nth-child(4) .footer-address a{ font-size: .92rem; }
    .footer-right{
	  display:flex;
	  flex-direction:column;
	  gap:28px;
	  align-items:center;   /* contenuti centrati */
	  text-align:center;    /* testi centrati */
	  justify-self:center;  /* se è item di CSS Grid */
	  margin:0 auto;        /* se NON è in grid, centra il blocco */
	}
	.social-logos, .partner-logos{  justify-content:center;}
	.social-section h3,
	.partner-section h3{
	  right:30% !important;            /* centra il titolo */
	}
	footer{margin-top:1%;}
	.footer-top{height:100vh;}
  }
}
