/* ========== Mapa interativo do MS ========== */
.ms-map-section {
  padding: 40px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
.ms-map-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
  max-width: 720px;
}
.ms-map-eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
  font-stretch: semi-expanded;
  font-weight: 500;
}
.ms-map-head h2 {
  font-family: 'Geologica', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
  color: var(--fg);
}
.ms-map-head p {
  font-family: 'Inconsolata', monospace;
  font-stretch: semi-expanded;
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-soft);
  margin: 0;
  max-width: 620px;
}

.ms-map-wrap {
  position: relative;
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  overflow: hidden;
}

.ms-map-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 440px;
  user-select: none;
  -webkit-user-select: none;
  /* desktop não tem gestos, mas no mobile precisamos travar o scroll da página */
  touch-action: auto;
  cursor: default;
}

/* Controles de zoom (canto superior direito do mapa) */
.ms-map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 4;
}
.ms-zoom-btn {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.ms-zoom-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}
.ms-zoom-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ms-zoom-reset {
  margin-top: 2px;
  border-top: 1px solid var(--border-strong);
}

/* Fundo do estado: tom muito sutil pra dar área de leitura */
.ms-state-bg {
  fill: var(--bg);
  stroke: none;
}

/* Cada município (célula de Voronoi) */
.ms-cell {
  fill: var(--bg);
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease;
}
.ms-cell.has-news {
  /* azul-secundário a ~10% — distingue municípios com cobertura */
  fill: rgba(59, 75, 255, 0.10);
}
.ms-cell:hover,
.ms-cell.is-hovered {
  fill: var(--primary);
  stroke: var(--primary);
}
/* Hover em município com notícias destaca em azul mais saturado */
.ms-cell.has-news:hover,
.ms-cell.has-news.is-hovered {
  fill: var(--secondary, #3B4BFF);
  stroke: var(--secondary, #3B4BFF);
}

/* Linha de contorno do estado, por cima de todas as células */
.ms-state-outline {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.5;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Pino verde nas cidades destacadas */
.ms-pin {
  fill: var(--primary);
  stroke: var(--bg);
  stroke-width: 1.5;
}

/* Estrela da capital (Campo Grande) */
.ms-pin-capital {
  fill: var(--primary);
  stroke: var(--bg);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

/* Rótulos das cidades destacadas */
.ms-label {
  font-family: 'Geologica', sans-serif;
  font-weight: 700;
  font-size: 11px;
  fill: var(--fg);
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3.5;
  stroke-linejoin: round;
  letter-spacing: 0.02em;
}
.ms-label.is-capital {
  font-weight: 800;
  fill: var(--primary);
  letter-spacing: 0.01em;
}

/* Tooltip flutuante que segue o mouse */
.ms-map-tip {
  position: absolute;
  pointer-events: none;
  background: var(--fg);
  color: var(--bg);
  padding: 8px 12px 9px;
  border-radius: 4px;
  z-index: 5;
  min-width: 160px;
  max-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.ms-map-tip-name {
  font-family: 'Geologica', sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: -0.005em;
}
.ms-map-tip-meta {
  margin-top: 2px;
  font-family: 'Inconsolata', monospace;
  font-stretch: semi-expanded;
  font-weight: 500;
  font-size: 11px;
  opacity: 0.78;
}

/* Legenda abaixo do mapa */
.ms-map-legend {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.ms-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ms-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
}
.ms-legend-swatch.has-news {
  background: rgba(59, 75, 255, 0.18);
  border-color: rgba(59, 75, 255, 0.4);
}
.ms-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}
.ms-legend-star {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--primary);
  /* Estrela de 5 pontas via clip-path */
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}

@media (max-width: 768px) {
  .ms-map-section { padding: 32px 0 4px; margin-top: 24px; }
  .ms-map-head h2 { font-size: 22px; }
  .ms-map-wrap { padding: 14px; }
  .ms-map-svg { max-height: 420px; min-height: 320px; touch-action: none; cursor: grab; }
  .ms-map-svg:active { cursor: grabbing; }
  .ms-label { font-size: 9px; stroke-width: 2.5; }
  .ms-map-legend { gap: 12px; font-size: 10px; }
  .ms-map-controls { top: 10px; right: 10px; gap: 4px; }
  .ms-zoom-btn { width: 40px; height: 40px; }
}
