/* =========================================================
   HOME MAP V6 — rifinitura fascia "Dove siamo"
   Intervento isolato: non modifica header, agenda, numeri, in evidenza o immagini.
   Obiettivo: mappa più istituzionale, card sede più ordinata, mobile più pulito.
   ========================================================= */

html body.path-frontpage .caritas-public-band--map,
html body.path-frontpage .caritas-home-section--map {
  padding-top: clamp(44px, 4.8vw, 76px) !important;
  padding-bottom: clamp(58px, 5.8vw, 92px) !important;
  background:
    radial-gradient(circle at 96% 22%, rgba(123, 5, 0, 0.035) 0%, rgba(123, 5, 0, 0) 34%),
    linear-gradient(180deg, #ffffff 0%, #fffefe 100%) !important;
}

html body.path-frontpage .caritas-map-strip {
  margin-bottom: 22px !important;
}

html body.path-frontpage .caritas-map-panel {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr) !important;
  border-radius: 26px !important;
  border: 1px solid rgba(123, 5, 0, 0.14) !important;
  background:
    radial-gradient(circle at 100% 0%, rgba(123, 5, 0, 0.06) 0%, rgba(123, 5, 0, 0) 34%),
    linear-gradient(135deg, #ffffff 0%, #fffaf8 100%) !important;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.10) !important;
}

html body.path-frontpage .caritas-map-panel::before {
  width: 6px !important;
  border-radius: 26px 0 0 26px !important;
  background: linear-gradient(180deg, #7b0500 0%, #9d0b04 100%) !important;
}

html body.path-frontpage .caritas-map-panel__map,
html body.path-frontpage .caritas-map-panel__canvas {
  min-height: clamp(360px, 34vw, 440px) !important;
}

html body.path-frontpage .caritas-map-panel__map {
  background:
    linear-gradient(135deg, rgba(123, 5, 0, 0.07), rgba(15, 139, 141, 0.055)),
    #f8fafc !important;
}

html body.path-frontpage .caritas-map-panel__info {
  justify-content: center !important;
  gap: 20px !important;
  padding: clamp(30px, 3vw, 44px) !important;
  background:
    radial-gradient(circle at 100% 4%, rgba(123, 5, 0, 0.07) 0%, rgba(123, 5, 0, 0) 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 252, 251, 0.97) 100%) !important;
}

html body.path-frontpage .caritas-map-panel__eyebrow,
html body.path-frontpage .caritas-map-panel__label {
  color: #7b0500 !important;
  font-size: 0.74rem !important;
  letter-spacing: 0.09em !important;
}

html body.path-frontpage .caritas-map-panel__info h3 {
  max-width: 420px !important;
  margin-top: 0.58rem !important;
  margin-bottom: 0.72rem !important;
  color: #111827 !important;
  font-size: clamp(1.55rem, 2.05vw, 2.08rem) !important;
  line-height: 1.08 !important;
}

html body.path-frontpage .caritas-map-panel__info-head p {
  max-width: 440px !important;
  color: #4b5563 !important;
  font-size: 0.97rem !important;
  line-height: 1.58 !important;
}

html body.path-frontpage .caritas-map-panel__details {
  gap: 11px !important;
}

html body.path-frontpage .caritas-map-panel__details p {
  padding: 13px 15px !important;
  border-radius: 17px !important;
  border-color: rgba(123, 5, 0, 0.115) !important;
  background: rgba(255, 255, 255, 0.82) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035) !important;
}

html body.path-frontpage .caritas-map-panel__value {
  margin-top: 7px !important;
  color: #111827 !important;
  font-size: 0.93rem !important;
  line-height: 1.38 !important;
  font-weight: 850 !important;
}

html body.path-frontpage .caritas-map-panel__details a[href^="mailto:"] .caritas-map-panel__value {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  font-size: 0.86rem !important;
}

html body.path-frontpage .caritas-map-panel__actions {
  gap: 11px !important;
}

html body.path-frontpage .caritas-map-panel__button {
  min-height: 41px !important;
  padding: 0 17px !important;
  border-radius: 999px !important;
  font-size: 0.88rem !important;
  box-shadow: none !important;
}

html body.path-frontpage .caritas-map-panel__button--primary {
  background: #7b0500 !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(123, 5, 0, 0.18) !important;
}

html body.path-frontpage .caritas-map-panel__button--secondary {
  background: rgba(123, 5, 0, 0.07) !important;
  color: #7b0500 !important;
  border-color: rgba(123, 5, 0, 0.14) !important;
}

/* Anteprima lazy della mappa: evita effetto "mappa vecchia" prima del caricamento. */
html body.path-frontpage .caritas-map-lazy-preview {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3 !important;
  display: flex !important;
  align-items: flex-end !important;
  padding: clamp(20px, 2.4vw, 30px) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, rgba(255, 255, 255, 0.24) 44%, rgba(255, 255, 255, 0.92) 100%),
    radial-gradient(circle at 20% 22%, rgba(123, 5, 0, 0.11) 0%, rgba(123, 5, 0, 0) 28%),
    radial-gradient(circle at 82% 26%, rgba(15, 139, 141, 0.12) 0%, rgba(15, 139, 141, 0) 30%),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.045) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.035) 0 1px, transparent 1px 54px),
    #f7f4ef !important;
}

html body.path-frontpage .caritas-map-panel--loaded .caritas-map-lazy-preview {
  display: none !important;
}

html body.path-frontpage .caritas-map-lazy-preview__content {
  width: min(420px, 100%) !important;
  padding: 18px 20px !important;
  border: 1px solid rgba(123, 5, 0, 0.12) !important;
  border-radius: 22px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.13) !important;
  backdrop-filter: blur(10px) !important;
}

html body.path-frontpage .caritas-map-lazy-preview__eyebrow {
  display: block !important;
  margin-bottom: 7px !important;
  color: #7b0500 !important;
  font-size: 0.72rem !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
}

html body.path-frontpage .caritas-map-lazy-preview__title {
  display: block !important;
  color: #111827 !important;
  font-size: clamp(1.2rem, 1.45vw, 1.48rem) !important;
  line-height: 1.08 !important;
  font-weight: 950 !important;
  letter-spacing: -0.035em !important;
}

html body.path-frontpage .caritas-map-lazy-preview__address {
  display: block !important;
  margin-top: 7px !important;
  color: #4b5563 !important;
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
  font-weight: 750 !important;
}

html body.path-frontpage .caritas-map-lazy-preview__actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 9px !important;
  margin-top: 14px !important;
}

html body.path-frontpage .caritas-map-lazy-preview__button,
html body.path-frontpage .caritas-map-lazy-preview__link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 38px !important;
  padding: 0 14px !important;
  border-radius: 999px !important;
  font-size: 0.82rem !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

html body.path-frontpage .caritas-map-lazy-preview__button {
  border: 0 !important;
  background: #7b0500 !important;
  color: #ffffff !important;
}

html body.path-frontpage .caritas-map-lazy-preview__link {
  border: 1px solid rgba(123, 5, 0, 0.14) !important;
  background: rgba(123, 5, 0, 0.07) !important;
  color: #7b0500 !important;
}

html body.path-frontpage .caritas-map-lazy-preview__button:hover,
html body.path-frontpage .caritas-map-lazy-preview__button:focus {
  background: #5f0300 !important;
}

html body.path-frontpage .caritas-map-lazy-preview__link:hover,
html body.path-frontpage .caritas-map-lazy-preview__link:focus {
  background: rgba(123, 5, 0, 0.12) !important;
  color: #5f0300 !important;
}

html body.path-frontpage .caritas-map-marker {
  width: 46px !important;
  height: 46px !important;
  border-width: 5px !important;
  box-shadow:
    0 16px 30px rgba(123, 5, 0, 0.30),
    0 0 0 10px rgba(123, 5, 0, 0.12) !important;
}

html body.path-frontpage .maplibregl-ctrl-top-right {
  top: 13px !important;
  right: 13px !important;
}

html body.path-frontpage .maplibregl-ctrl-group {
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14) !important;
}

@media (max-width: 1100px) {
  html body.path-frontpage .caritas-map-panel {
    grid-template-columns: 1fr !important;
  }

  html body.path-frontpage .caritas-map-panel__info {
    border-left: 0 !important;
    border-top: 1px solid rgba(123, 5, 0, 0.10) !important;
  }
}

@media (max-width: 760px) {
  html body.path-frontpage .caritas-public-band--map,
  html body.path-frontpage .caritas-home-section--map {
    padding-top: 38px !important;
    padding-bottom: 56px !important;
  }

  html body.path-frontpage .caritas-map-strip {
    margin-bottom: 18px !important;
  }

  html body.path-frontpage .caritas-map-panel {
    border-radius: 24px !important;
  }

  html body.path-frontpage .caritas-map-panel::before {
    width: 5px !important;
    border-radius: 24px 0 0 24px !important;
  }

  html body.path-frontpage .caritas-map-panel__map,
  html body.path-frontpage .caritas-map-panel__canvas {
    min-height: 315px !important;
  }

  html body.path-frontpage .caritas-map-panel__info {
    gap: 17px !important;
    padding: 24px 22px 26px !important;
  }

  html body.path-frontpage .caritas-map-panel__info h3 {
    max-width: 100% !important;
    font-size: clamp(1.42rem, 6vw, 1.86rem) !important;
  }

  html body.path-frontpage .caritas-map-panel__info-head p {
    font-size: 0.92rem !important;
  }

  html body.path-frontpage .caritas-map-panel__details p {
    padding: 12px 14px !important;
  }

  html body.path-frontpage .caritas-map-panel__actions,
  html body.path-frontpage .caritas-map-lazy-preview__actions {
    flex-direction: row !important;
  }

  html body.path-frontpage .caritas-map-panel__button,
  html body.path-frontpage .caritas-map-lazy-preview__button,
  html body.path-frontpage .caritas-map-lazy-preview__link {
    width: auto !important;
    flex: 1 1 auto !important;
    min-width: 138px !important;
  }

  html body.path-frontpage .caritas-map-lazy-preview {
    padding: 17px !important;
  }

  html body.path-frontpage .caritas-map-lazy-preview__content {
    padding: 16px !important;
    border-radius: 20px !important;
  }
}

@media (max-width: 430px) {
  html body.path-frontpage .caritas-map-panel__map,
  html body.path-frontpage .caritas-map-panel__canvas {
    min-height: 285px !important;
  }

  html body.path-frontpage .caritas-map-panel__info {
    padding: 22px 18px 24px !important;
  }

  html body.path-frontpage .caritas-map-panel__actions,
  html body.path-frontpage .caritas-map-lazy-preview__actions {
    flex-direction: column !important;
  }

  html body.path-frontpage .caritas-map-panel__button,
  html body.path-frontpage .caritas-map-lazy-preview__button,
  html body.path-frontpage .caritas-map-lazy-preview__link {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.path-frontpage .caritas-map-lazy-preview__button,
  html body.path-frontpage .caritas-map-lazy-preview__link,
  html body.path-frontpage .caritas-map-panel__button {
    transition: none !important;
  }
}

/* =========================================================
   HOME MAP V6B — mobile: pulsanti su una riga + mappa statica
   - Apri indicazioni / Chiama restano affiancati anche su smartphone.
   - La mappa su mobile non cattura più il trascinamento: così lo scroll pagina resta fluido.
   ========================================================= */

@media (max-width: 760px) {
  html body.path-frontpage .caritas-map-panel__actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  html body.path-frontpage .caritas-map-panel__button {
    width: auto !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 0 12px !important;
    white-space: nowrap !important;
    font-size: 0.86rem !important;
  }

  html body.path-frontpage .caritas-map-panel__button--primary {
    flex: 1 1 66% !important;
  }

  html body.path-frontpage .caritas-map-panel__button--secondary {
    flex: 0 1 34% !important;
  }

  /*
   * Su mobile la mappa resta una preview visiva: non deve rubare lo scroll.
   * Per navigare davvero ci sono i pulsanti Google Maps / indicazioni.
   */
  html body.path-frontpage .caritas-map-panel__canvas,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-canvas-container,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-canvas,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-control-container,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-marker,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-popup {
    pointer-events: none !important;
  }

  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-ctrl-top-right,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-ctrl-bottom-left,
  html body.path-frontpage .caritas-map-panel__canvas .maplibregl-ctrl-bottom-right {
    display: none !important;
  }

  html body.path-frontpage .caritas-map-panel__fallback {
    pointer-events: auto !important;
  }
}

@media (max-width: 430px) {
  html body.path-frontpage .caritas-map-panel__actions,
  html body.path-frontpage .caritas-map-lazy-preview__actions {
    flex-direction: row !important;
  }

  html body.path-frontpage .caritas-map-panel__button {
    width: auto !important;
    min-width: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 0.84rem !important;
  }
}

@media (max-width: 360px) {
  html body.path-frontpage .caritas-map-panel__actions {
    gap: 8px !important;
  }

  html body.path-frontpage .caritas-map-panel__button {
    min-height: 42px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    font-size: 0.78rem !important;
    letter-spacing: -0.01em !important;
  }
}

/* =========================================================
   HOME MAP V6C — fix pulsanti azioni mobile
   - Corregge V6B: il pulsante "Apri indicazioni" non deve occupare quasi tutta la riga.
   - "Chiama" resta visibile accanto, senza uscire fuori dalla card.
   ========================================================= */

@media (max-width: 760px) {
  html body.path-frontpage .caritas-map-panel__actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
    align-items: center !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  html body.path-frontpage .caritas-map-panel__actions .caritas-map-panel__button,
  html body.path-frontpage .caritas-map-panel__button--primary,
  html body.path-frontpage .caritas-map-panel__button--secondary {
    display: inline-flex !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    box-sizing: border-box !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.84rem !important;
    line-height: 1 !important;
  }

  html body.path-frontpage .caritas-map-panel__button--secondary {
    justify-self: stretch !important;
  }
}

@media (max-width: 390px) {
  html body.path-frontpage .caritas-map-panel__actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.62fr) !important;
    gap: 8px !important;
  }

  html body.path-frontpage .caritas-map-panel__actions .caritas-map-panel__button,
  html body.path-frontpage .caritas-map-panel__button--primary,
  html body.path-frontpage .caritas-map-panel__button--secondary {
    min-height: 40px !important;
    height: 40px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    font-size: 0.78rem !important;
  }
}
