/* =====================================================
   mapa.css  ·  Mapa interactivo del Perú (template-parts/mapa.php)
   Regiones en grafito con líneas blancas; naranja al pasar
   el mouse o al abrir su ficha.
   ===================================================== */

.mapa-peru {
  --grafito:        #34383D;
  --grafito-oscuro: #26292D;
  --grafito-suave:  #5E636A;
  --naranja:        #F26B1D;
  --naranja-hover:  #FF8238;
  --fondo-claro:    #F5F4F2;
  --blanco:         #FFFFFF;
  --flecha: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3 8h10M9 4l4 4-4 4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  display: flex;
  justify-content: center;
  margin-top: 48px;
}
.mapa-peru * { box-sizing: border-box; }

/* ----- Lienzo del mapa ----- */
.mapa-peru .mapa-peru-lienzo {
  width: 100%;
  max-width: 700px;
  height: 620px;
}

/* Leaflet trae su propia letra y fondo gris: se vuelve a la
   tipografía del sitio y a fondo transparente */
.mapa-peru .leaflet-container {
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  outline: none;
}
.mapa-peru .leaflet-container,
.mapa-peru .leaflet-pane,
.mapa-peru .leaflet-tooltip-pane,
.mapa-peru .leaflet-popup-pane { overflow: visible !important; }

/* Sin el recuadro que algunos navegadores dibujan al hacer clic en una región */
.mapa-peru .leaflet-interactive:focus { outline: none; }
.mapa-peru path.leaflet-interactive { cursor: pointer; }

/* =====================================================
   NOMBRE DE LA REGIÓN (al pasar el mouse)
   ===================================================== */
.leaflet-tooltip.nombre-region {
  padding: 6px 12px;
  border: 0;
  border-radius: 4px;
  background: var(--grafito, #34383D);
  box-shadow: 0 8px 20px -8px rgba(38, 41, 45, .5);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.leaflet-tooltip.nombre-region::before { display: none; }

/* =====================================================
   FICHA DE LA REGIÓN (al hacer clic)
   ===================================================== */
.ficha-region .leaflet-popup-content-wrapper {
  overflow: hidden;
  padding: 0;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 24px 48px -16px rgba(38, 41, 45, .45);
}
.ficha-region .leaflet-popup-content {
  width: 250px !important;
  margin: 0;
  line-height: 1.5;
}
.ficha-region .leaflet-popup-tip {
  background: #FFFFFF;
  box-shadow: none;
}

/* Botón cerrar: círculo grafito, naranja al pasar el mouse */
.ficha-region a.leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: rgba(38, 41, 45, .8);
  color: #FFFFFF;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  transition: background .25s;
}
.ficha-region a.leaflet-popup-close-button:hover,
.ficha-region a.leaflet-popup-close-button:focus {
  background: #F26B1D;
  color: #FFFFFF;
}
/* Sin imagen, el botón cerrar va sobre fondo blanco: se ve igual de bien */

.ficha-region .tarjeta-imagen {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #F5F4F2;
}

.ficha-region .tarjeta-contenido { padding: 18px 20px 20px; }
/* Sin imagen, deja espacio arriba para el botón cerrar */
.ficha-region .leaflet-popup-content > .tarjeta-contenido:first-child { padding-top: 22px; padding-right: 48px; }

.ficha-region .tarjeta-titulo {
  display: block;
  margin: 0 0 10px;
  color: #34383D;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}
/* Rayita naranja bajo el nombre */
.ficha-region .tarjeta-titulo::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: #F26B1D;
}

.ficha-region .tarjeta-descripcion {
  display: block;
  margin: 0 0 16px;
  color: #5E636A;
  font-size: 13.5px;
  line-height: 1.6;
}

/* Botón "Ver destino": píldora naranja con flecha */
.ficha-region a.tarjeta-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: #F26B1D;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .25s;
}
.ficha-region a.tarjeta-link::after {
  content: "";
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #34383D url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3 8h10M9 4l4 4-4 4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), background-color .25s;
}
.ficha-region a.tarjeta-link:hover {
  background: #34383D;
  color: #FFFFFF;
}
.ficha-region a.tarjeta-link:hover::after {
  background-color: #F26B1D;
  transform: rotate(-45deg);
}
.ficha-region a:focus-visible {
  outline: 3px solid #FF8238;
  outline-offset: 3px;
}

/* ----- Si el mapa no carga ----- */
.mapa-peru .mapa-peru-lienzo.mapa-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 200px;
  padding: 32px;
  border: 1px dashed #E4E2DF;
  border-radius: 12px;
}
.mapa-peru .mapa-peru-error {
  margin: 0;
  color: #5E636A;
  text-align: center;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .mapa-peru { margin-top: 40px; }
  .mapa-peru .mapa-peru-lienzo { height: 540px; }
}
@media (max-width: 767px) {
  .mapa-peru { margin-top: 32px; }
  .mapa-peru .mapa-peru-lienzo { height: 440px; }
  .ficha-region .leaflet-popup-content { width: 220px !important; }
  .ficha-region .tarjeta-imagen { height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .ficha-region * { transition: none !important; }
}