/*
Theme Name: Family Water
Theme URI: https://familywater.it
Author: Family Water
Description: Tema ufficiale Family Water — impianti di depurazione domestica. "La salute inizia da qui." Versione Elementor-First: tutto il contenuto è editabile visivamente con Elementor.
Version: 2.0.0
License: GNU General Public License v2 or later
Text Domain: familywater
Tags: elementor, water, depurazione, minimal, moderno, italiano
*/

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand palette */
  --fw-navy:       #1E3A8A;
  --fw-navy-dark:  #152B6B;
  --fw-blue:       #4DA6D4;
  --fw-blue-light: #7CC4E4;
  --fw-teal:       #2A9D8F;
  --fw-green:      #5CB85C;
  --fw-green-dark: #4A9B4A;
  --fw-light:      #EEF7FB;
  --fw-lighter:    #F5FBFF;
  --fw-white:      #FFFFFF;
  --fw-dark:       #1A2B3C;
  --fw-gray:       #5A6B7D;
  --fw-border:     #D0E8F5;

  --font-main:  'Poppins', 'Segoe UI', sans-serif;
  --radius:     14px;
  --shadow:     0 6px 28px rgba(30,58,138,0.10);
  --shadow-lg:  0 16px 48px rgba(30,58,138,0.16);
  --transition: 0.3s ease;
  --max-width:  1200px;

  /* Elementor Global Colors — brand palette */
  --e-global-color-primary:   #1E3A8A;
  --e-global-color-secondary: #4DA6D4;
  --e-global-color-text:      #1A2B3C;
  --e-global-color-accent:    #5CB85C;
  --e-global-typography-primary-font-family:   'Poppins';
  --e-global-typography-secondary-font-family: 'Poppins';
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-main);
  color: var(--fw-dark);
  background: var(--fw-white);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--fw-navy); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--fw-blue); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

/* ===== TYPOGRAPHY ===== */
h1,h2,h3,h4 { font-weight: 700; line-height: 1.2; color: var(--fw-dark); }
h1 { font-size: clamp(2rem,5vw,3.2rem); }
h2 { font-size: clamp(1.6rem,3.5vw,2.4rem); }
h3 { font-size: clamp(1.1rem,2.2vw,1.45rem); }
p  { color: var(--fw-gray); margin-bottom: 1rem; }

/* ===== ELEMENTOR FULL COMPATIBILITY ===== */
/* Rimuove padding forzato SOLO sull'area contenuto, non su header/footer */
.elementor-page .entry-content,
.elementor-page .post-content,
.elementor-page #fw-page-main > .container {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

/* L'area main non aggiunge spaziatura extra */
.elementor-page #fw-page-main {
  padding: 0 !important;
}

/* Elementor sezioni e colonne — nessun override forzato */
.elementor-section { width: 100%; }
.elementor-widget-wrap > .elementor-element { width: 100%; }

/* Rimozione margin-top automatico su pagine Elementor */
.elementor-page .wp-site-blocks > * + * { margin-top: 0; }

/* ===== HEADER ===== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--fw-border);
  box-shadow: 0 2px 20px rgba(30,58,138,0.08);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 20px;
}

.site-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.logo-symbol {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
}
.logo-brand {
  height: 32px;
  width: auto;
  object-fit: contain;
}

#fw-menu {
  display: flex;
  list-style: none;
  gap: 6px;
  align-items: center;
}
#fw-menu li a {
  color: var(--fw-dark);
  font-weight: 500;
  font-size: 0.93rem;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all var(--transition);
}
#fw-menu li a:hover { color: var(--fw-navy); background: var(--fw-light); }
#fw-menu .nav-cta a {
  background: var(--fw-navy);
  color: white !important;
  padding: 10px 22px;
  border-radius: 50px;
  font-weight: 700;
}
#fw-menu .nav-cta a:hover { background: var(--fw-navy-dark); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--fw-dark);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── Header CTA button ──────────────────────────────────────────────────────── */
.header-cta-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.93rem;
  font-family: var(--font-main);
  background: var(--fw-navy);
  color: #fff !important;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.header-cta-btn:hover { background: var(--fw-navy-dark); color: #fff; }

/* ── Logo testo (fallback) ───────────────────────────────────────────────────── */
.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--fw-navy);
  letter-spacing: -0.5px;
}

/* ── wp_nav_menu compatibility ────────────────────────────────────────────────
   WordPress aggiunge classi come .menu-item, .current-menu-item ecc.
   Le normalizziamo con lo stile esistente. */
#fw-menu .menu-item a { color: var(--fw-dark); font-weight: 500; font-size: 0.93rem; padding: 8px 14px; border-radius: 8px; transition: all var(--transition); display: block; }
#fw-menu .menu-item a:hover { color: var(--fw-navy); background: var(--fw-light); }
#fw-menu .current-menu-item > a,
#fw-menu .current-page-ancestor > a { color: var(--fw-navy); font-weight: 600; }
#fw-menu .nav-cta > a,
#fw-menu .menu-item.nav-cta > a { background: var(--fw-navy); color: white !important; padding: 10px 22px; border-radius: 50px; font-weight: 700; }
#fw-menu .nav-cta > a:hover,
#fw-menu .menu-item.nav-cta > a:hover { background: var(--fw-navy-dark); }
.btn, .fw-btn {
  display: inline-block;
  padding: 14px 34px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-family: var(--font-main);
}
.btn-navy, .fw-btn-navy {
  background: var(--fw-navy);
  color: var(--fw-white);
  box-shadow: 0 4px 18px rgba(30,58,138,0.28);
}
.btn-navy:hover, .fw-btn-navy:hover { background: var(--fw-navy-dark); color: #fff; }
.btn-outline-navy {
  background: transparent;
  color: var(--fw-navy);
  border: 2px solid var(--fw-navy);
}
.btn-outline-navy:hover { background: var(--fw-navy); color: white; }
.btn-white-outline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.7);
}
.btn-white-outline:hover { background: rgba(255,255,255,0.15); color: white; }

/* ===== FOOTER ===== */
#site-footer {
  background: var(--fw-dark);
  color: rgba(255,255,255,0.8);
  padding: 64px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
.footer-brand p { color: rgba(255,255,255,0.65); font-size: 0.93rem; line-height: 1.7; }
.footer-logo-symbol { border-radius: 8px; filter: brightness(0.9); }
.footer-col h4 { color: white; font-weight: 700; margin-bottom: 20px; font-size: 1rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: rgba(255,255,255,0.65); font-size: 0.92rem; transition: color var(--transition); }
.footer-col ul li a:hover { color: var(--fw-blue); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.45);
}
.footer-bottom a { color: rgba(255,255,255,0.6); }
.footer-bottom a:hover { color: var(--fw-blue); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  #fw-menu { display: none; flex-direction: column; position: absolute; top: 72px; left: 0; right: 0; background: white; padding: 20px; box-shadow: 0 8px 24px rgba(30,58,138,0.12); z-index: 1000; }
  #fw-menu.is-open { display: flex; }
  .hamburger { display: flex; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ===== MOBILE — FIX SCROLL ORIZZONTALE ===== */
/*
  I widget Text Editor di Elementor usano display:grid inline.
  Su mobile queste griglie fisse traboccano dallo schermo causando
  lo scroll orizzontale. Le sovrascriviamo a colonna singola.
*/
@media (max-width: 767px) {

  /* Tutti i div con grid inline dentro i widget Elementor → 1 colonna */
  .elementor-widget-text-editor div[style*="display:grid"],
  .elementor-widget-text-editor div[style*="display: grid"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Flex row con gap → va a capo */
  .elementor-widget-text-editor div[style*="display:flex"],
  .elementor-widget-text-editor div[style*="display: flex"] {
    flex-wrap: wrap !important;
  }

  /* Hero: stats row si centra */
  .elementor-widget-text-editor div[style*="gap:32px"],
  .elementor-widget-text-editor div[style*="gap: 32px"] {
    justify-content: center !important;
  }

  /* Colonne Elementor su mobile → full width */
  .elementor-column {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Padding sezioni ridotto su mobile */
  .elementor-section > .elementor-container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Nessun elemento può uscire dallo schermo */
  .elementor-widget-wrap,
  .elementor-widget-container {
    overflow: hidden;
    max-width: 100%;
  }

  /* Titoli hero più piccoli */
  .elementor-widget-heading h1 { font-size: 2rem !important; }
  .elementor-widget-heading h2 { font-size: 1.5rem !important; }
}
