/* =====================================================
   World Map — mapa del mundo interactivo (componente reutilizable)
   Personalizar sobrescribiendo las variables --wmap-* en .wmap
   (o en un selector más específico del sitio que lo use).
   ===================================================== */
.wmap {
  --wmap-land:        #DCE3EC;   /* países sin presencia */
  --wmap-border:      #FFFFFF;   /* líneas entre países */
  --wmap-active:      #9CC1F4;   /* países con presencia (color claro) */
  --wmap-hover:       #1548BE;   /* país al pasar el mouse (color oscuro) */
  --wmap-marker:      #1548BE;   /* punto sobre cada país */
  --wmap-tip-bg:      #0D1B3E;
  --wmap-tip-fg:      #FFFFFF;
  --wmap-chip-bg:     #FFFFFF;
  --wmap-chip-border: #E2E8F0;
  --wmap-chip-fg:     #1F365C;
  --wmap-max-width:   980px;
  --wmap-font:        inherit;

  max-width: var(--wmap-max-width);
  margin: 0 auto;
  font-family: var(--wmap-font);
}

/* Modo oscuro: automático con [data-theme="dark"] en <html>, o forzado con .wmap--dark */
[data-theme="dark"] .wmap,
.wmap--dark {
  --wmap-land:        #1E2A42;
  --wmap-border:      #0B1220;   /* = fondo de la sección */
  --wmap-active:      #4A7FD0;
  --wmap-hover:       #1548BE;
  --wmap-marker:      #9CC1F4;
  --wmap-tip-bg:      #E8EDF6;
  --wmap-tip-fg:      #0B1220;
  --wmap-chip-bg:     #131C30;
  --wmap-chip-border: #253148;
  --wmap-chip-fg:     #DDE7FB;
}

/* ---- Mapa ---- */
.wmap__stage {
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .7s ease, transform .7s ease;
}
.wmap.is-visible .wmap__stage { opacity: 1; transform: none; }

.wmap__svg { display: block; width: 100%; height: auto; overflow: visible; }

.wmap__svg path {
  fill: var(--wmap-land);
  stroke: var(--wmap-border);
  stroke-width: .6;
  stroke-linejoin: round;
}
.wmap__svg path.is-active {
  fill: var(--wmap-active);
  cursor: pointer;
  transition: fill .2s ease;
}
.wmap__svg path.is-active.is-hover { fill: var(--wmap-hover); }
.wmap.is-visible .wmap__svg path.is-active {
  animation: wmap-fill-in .9s ease backwards;
  animation-delay: calc(var(--i, 0) * .15s + .3s);
}
@keyframes wmap-fill-in { from { fill: var(--wmap-land); } }

/* Marcadores (ayudan a ubicar países pequeños) */
.wmap__markers { pointer-events: none; }
.wmap__pin {
  fill: var(--wmap-marker);
  stroke: #fff;
  stroke-width: 1.5;
  transition: fill .2s ease;
}
.wmap__marker.is-hover .wmap__pin { fill: #fff; stroke: var(--wmap-marker); }
.wmap__pulse {
  fill: var(--wmap-marker);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.wmap.is-visible .wmap__pulse {
  animation: wmap-pulse 2.4s ease-out infinite;
  animation-delay: calc(var(--i, 0) * .4s + 1s);
}
@keyframes wmap-pulse {
  0%   { opacity: .45; transform: scale(1); }
  80%, 100% { opacity: 0; transform: scale(3.2); }
}

/* Tooltip */
.wmap__tip {
  position: absolute;
  left: 0; top: 0;
  z-index: 2;
  padding: .4rem .75rem;
  border-radius: 6px;
  background: var(--wmap-tip-bg);
  color: var(--wmap-tip-fg);
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(13, 27, 62, .25);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 6px));
  transition: opacity .15s ease;
}
.wmap__tip::after {
  content: "";
  position: absolute;
  left: 50%; top: 100%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--wmap-tip-bg);
}
.wmap__tip.is-visible { opacity: 1; }

/* ---- Leyenda (también es el contenido accesible y el respaldo sin JS) ---- */
.wmap__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.wmap__chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .95rem;
  border: 1px solid var(--wmap-chip-border);
  border-radius: 999px;
  background: var(--wmap-chip-bg);
  color: var(--wmap-chip-fg);
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.wmap__chip img { width: 22px; height: auto; border-radius: 2px; flex-shrink: 0; }
.wmap__chip.is-hover,
.wmap__chip:focus-visible {
  border-color: var(--wmap-hover);
  background: var(--wmap-hover);
  color: #fff;
  box-shadow: 0 4px 14px rgba(21, 72, 190, .25);
  outline: none;
}

@media (max-width: 600px) {
  .wmap__svg path { stroke-width: .9; }
  .wmap__pin, .wmap__pulse { r: 8px; }
  .wmap__chip { font-size: .82rem; padding: .4rem .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .wmap__stage { transition: none; transform: none; }
  .wmap.is-visible .wmap__svg path.is-active,
  .wmap.is-visible .wmap__pulse { animation: none; }
}
