#mymap {
	width: 100%;
	height: 320px;
}

.descmap {
    height: 33px;
    color: white;
    text-align: right;
    font-size: 12px;
    padding-right: 8px;
	font-weight: 500;
    display: flex;
    align-items: center;     /* ← centratura verticale */
    justify-content: flex-end; /* ← allinea a destra */
}

.descmap a {
	color: #fffaaa;
	text-decoration: none;
	font-weight: 700;
}

#mapattribution {
	font-size: 12px;
	text-align: right;
	margin-top: 8px;
	font-weight: 600;
}

.homemap {
	height: 500px !important;
}


.com-content-article #mymap {
	height: calc(80vh - 33px);
	border-top-left-radius: 0.375rem;
	border-top-right-radius: 0.375rem;
}

/* il wrapper mobile è nascosto su desktop */
#mylegend-mobile-wrapper { display: none; }

/* quando siamo sotto breakpoint, mostra il wrapper */
@media (max-width: 1199.98px) {
	
  .com-content-article #mymap {
	height: 70vh;
	border-top-left-radius: 0.375rem;
	border-top-right-radius: 0.375rem;
}
	
  #mylegend-mobile-wrapper { display: block; position: relative; }

/* opzionale: migliora layout legenda quando è nel wrapper */
  #mylegend-mobile-wrapper > #mylegend {
    position: static; /* lascia che il plugin gestisca la legenda */
    width: 100%;
    box-sizing: border-box;
  }
}

#mylegend {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;      /* <--- SENZA QUESTO NON SCROLLA */
    overflow: hidden !important;
	border: 1px solid #3c7259;
	    border-radius: 0.375rem;
	background: none !important;
	background-color: #FAFEFD !important;
	  
  }

#mylegend .maplibregl-ctrl {
  background-color: #FAFEFD !important;
  background: #FAFEFD !important;
}


@media (min-width:1200px) {
	
	#mylegend,
#mylegend * {
  scrollbar-width: thin;
}

@supports selector(::-webkit-scrollbar) {

  #mylegend ::-webkit-scrollbar {
    width: 6px;
  }

  #mylegend ::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,.35);
    border-radius: 6px;
  }
}

	
	.mappa-estesa .slideshow { height: calc(80vh + 65.6px) !important; align-items: stretch !important; }
	.mappa-estesa .rightsliderbox { height: 100% !important; flex: 1 1 auto !important; }
	#mylegend { flex-grow: 1; }

  /* Livello 1 — il contenitore finale deve potersi comprimere */
  

  /* Livello 2 — contenitore generato dal plugin */
  #mylegend > .maplibregl-ctrl.maplibregl-ctrl-group {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;       /* <--- fondamentale */
    width: 100% !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Livello 3 — la lista deve prendere tutto lo spazio rimanente */
  #mylegend .maplibregl-legend-list {
    flex: 1 1 auto !important;      /* <-- LO SCROLL SOLO COSÌ FUNZIONA */
    min-height: 0 !important;       /* <-- permette la compressione */
    overflow-y: auto !important;
    overflow-x: hidden !important;

    height: auto !important;
    max-height: none !important;    /* <-- toglie il vincolo che la taglia */
    padding: 6px 4px 12px 4px !important;
  }

  /* Style inline del plugin da annullare */
  #mylegend .maplibregl-legend-list[style] {
    height: auto !important;
    max-height: none !important;
  }
}

@media (max-width: 1200px) {

  /* wrapper della legenda in versione mobile */
  #mylegend-mobile-wrapper {
      position: static !important;   /* Importantissimo: rientra nel flusso normale */
      height: auto;                  /* Lascia che cresca liberamente */
      max-height: none;
      overflow: visible;
  }

  /* legenda stessa */
  #mylegend-mobile-wrapper #mylegend {
      height: auto;
      max-height: none;
      overflow: visible;             /* Nessuno scroll interno */
  }

  /* lista degli elementi della legenda */
  #mylegend-mobile-wrapper .maplibregl-legend-list {
      height: auto;
      max-height: none;
      overflow: visible;
  }

  /* se avevi sticky elements, vanno disattivati */
  #mylegend-mobile-wrapper .maplibregl-legend-title-label,
  #mylegend-mobile-wrapper .maplibregl-legend-close-button {
      position: static;
  }
}


#mylegend .maplibregl-legend-onlyRendered-checkbox,
#mylegend .maplibregl-legend-onlyRendered-label {
  display: none !important;
}

#mylegend .maplibregl-legend-close-button,
#mylegend .maplibregl-legend-switcher {
  display: none !important;
}

.legend-icon { width: 20px; height: 20px; display:inline-block; vertical-align:middle; }
#mylegend .legend-table-td { white-space: nowrap; }

/* rende il svg centrato nella cella e rimuove line-height strani */
.legend-table-td svg {
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
}
.legend-table-td { /* opzionale: centra anche il contenuto della cella */
  vertical-align: middle;
}

.maplibregl-legend-onlyRendered-checkbox,
.maplibregl-legend-onlyRendered-label,
.maplibregl-legend-title-label + br {
    display: none !important;
}


#mylegend .legend-table {
    margin: 0;          /* elimina il centramento */
    margin-left: 0 !important;
}

#mylegend td.legend-table-td {
	 background-clip: content-box;
	 padding-bottom: 4px !important;
}

.maplibregl-legend-title-label {
	font-size: 18px !important;
	font-weight: 600 !important;
    color: #3c7259 !important;	
}

#hidden-cai-symbol {
  width: 28px;
  height: auto;
  vertical-align: middle;
}


#mymap,
#mymap canvas {
  background-color: #f3fcfa; /* lo stesso colore del body */
}

#mylegend, .maplibregl-legend-list {
	
}
/* ---- tooltip al passaggio (usava già .caimap) ---- */
.maplibregl-popup.caimap {
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
.maplibregl-popup.caimap .maplibregl-popup-tip {
  display: none;
}
.maplibregl-popup.caimap .maplibregl-popup-content {
  /* il tuo stile originale CAI (copiato) */
  background-color: #FFFFFF;
  background-clip: content-box;
  box-shadow: inset 11px 0 0 0 #D52B3B, inset -11px 0 0 0 #D52B3B;
  font-weight: bold;
  border: 1px solid #000000;
  padding: 0px 10px 0px 10px;
  min-width: 46px;
  text-align: center;
  border-radius: 0 !important;
  pointer-events: none;
}

/* variante tooltip Valle Avellana */
.maplibregl-popup.caimap.caimap-valleavellana .maplibregl-popup-content {
  background: linear-gradient(
    225deg,
    #ffffff 0%,
    #ffffff 50%,
    #E8E800 50%,
    #E8E800 100%
  );

  box-shadow: none;              /* niente bande rosse */
  border: 1.5px solid #59120E;   /* bordo marrone/rosso scuro */
  padding: 0px 0px;
  min-width: 22px;               /* quadrata */
  pointer-events: none;
}


/* ---- Popup di click (scheda sentiero) ---- */
.maplibregl-popup.sentiero-popup {
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
}

/* --- Punta automatica (centrata e adattiva) --- */

/* Punta in basso (popup sopra al punto) */
.maplibregl-popup.sentiero-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -10px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #fff;
}

/* Punta in alto (popup sotto al punto) */
.maplibregl-popup.sentiero-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -10px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #fff;
}

/* Punta a destra (popup a sinistra del punto) */
.maplibregl-popup.sentiero-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: -10px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid #fff;
}

/* Punta a sinistra (popup a destra del punto) */
.maplibregl-popup.sentiero-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: -10px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid #fff;
}


.maplibregl-popup.sentiero-popup .maplibregl-popup-content {
	position: relative;
  background-color: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  min-width: 160px;
   position: relative;
  z-index: 1;
}

/* --- stile interno della scheda, identico al vecchio --- */
.fa {
  font-size: 18px !important;
  padding-top: 5px !important;
}

.scheda {
  margin-top: 5px;
}

.scheda a {
  color: #ffffff !important;
  text-shadow: 0 1px 0 #555555;
  background-color: #57a480;
  border-radius: 5px;
  padding: 8px 5px 5px 5px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  font-size: 14px;
  vertical-align: middle;
   text-decoration: none;
}

.scheda a:hover {
  background-color: #3c7259;
  text-decoration: none;
}

a.icon-scheda:before {
  content: "\f0f6";
}

.nomesent {
  font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif;
  font-size: 13.2px;
  font-weight: bold;
  color: #12834E;
}

.numerosent {
  font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif;
  font-weight: bold;
  color: #D52B3B;
}

/* SOLO simboli poligonali della legenda */ 
#mylegend td.legend-table-td[style*="background-color"] { 
	display: inline-block; width: 100%; 
	height: 30px; /* <<< QUESTA È LA CHIAVE */ 
	margin: 3px 0 !important; 
	padding: 0 !important; line-height: 30px; /* evita schiacciamenti */ 
	box-sizing: border-box; 
}

#mylegend tr > td:nth-child(2) {
    padding-left: 6px !important;   /* o quello che vuoi */
}

@media (min-width: 1400px) and (max-width: 1599.98px) {
	
	#mylegend tr > td:first-child {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}
	
	#mylegend tr > td:nth-child(2) {
    padding-left: 6px !important;   /* o quello che vuoi */
	letter-spacing: -0.3px;
	    word-spacing: -0.3px;
}
	
	td.legend-table-td>label {
		
	}
	
	.maplibregl-legend-list {
		margin: 4px !important;
	}
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
	
	#mylegend tr > td:first-child {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
}

	
	#mylegend tr > td:nth-child(2) {
    padding-left: 2px !important;   /* o quello che vuoi */
	letter-spacing: -0.4px;
	    word-spacing: -0.8px;
	font-size: 14px;
}
	
	td.legend-table-td>label {
		letter-spacing: -0.3px;
	    word-spacing: -1.0px;
	}
	
	#mylegend .maplibregl-legend-list {
		margin: 0px !important;
		 padding: 1px 1px 1px 1px !important;
	}
}

@media (min-width: 1200px) {
	#mymap {
		height: calc(100vh - 400px);
	}
}

@media (max-width: 479.98px) {
	.descmap {
		font-size: 11px;
	}
#mapattribution {
	font-size: 11px;
}
}

@media (max-width: 359.98px) {
	.descmap {
		letter-spacing: -0.5px;
		word-spacing: -0.5px;
	}
#mapattribution {
	letter-spacing: -0.5px;
	word-spacing: -0.5px;
}
}

@media (min-width: 768px) and (max-width: 991.98px) {
	.descmap {
		
	}
#mapattribution {
	font-size: 11px;
	letter-spacing: -0.4px;
		word-spacing: -0.3px;
}
}





