/*
 * design-system/components/map.css
 * Editorial Calm — Map. ТЗ §6.5.
 *
 * Тайлы — монохромные на тёплой бумажной подложке (--map-base).
 * Точки городов — кружки 6-20px, диаметр по плотности данных.
 * Hover на точке — мини-превью CityCard.
 *
 * Зависимость: MapLibre GL JS подключается через CDN.
 */

[data-theme="editorial"] .ed-map {
  position: relative;
  width: 100%;
  min-height: 480px;
  background: var(--map-base);
  border: 1px solid var(--rule);
}

[data-theme="editorial"] .ed-map__container {
  width: 100%;
  height: 100%;
  min-height: 480px;
}

/* Mini-preview popup (CityCard adapt for hover) */
[data-theme="editorial"] .ed-map-popup {
  font-family: var(--font-sans);
  pointer-events: none;
}
[data-theme="editorial"] .ed-map-popup .maplibregl-popup-content {
  padding: var(--s-3) var(--s-4);
  background: var(--paper-edge);
  border: 1px solid var(--ink);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-2);
  font-family: var(--font-sans);
  min-width: 200px;
}
[data-theme="editorial"] .ed-map-popup .maplibregl-popup-tip { display: none; }

[data-theme="editorial"] .ed-map-popup__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}
[data-theme="editorial"] .ed-map-popup__meta {
  font-size: 12px;
  color: var(--ink-3);
  font-feature-settings: "tnum";
}

/* MapLibre overrides — приглушаем default UI под Editorial */
[data-theme="editorial"] .maplibregl-ctrl-group {
  background: var(--paper-edge);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  box-shadow: none;
}
[data-theme="editorial"] .maplibregl-ctrl-group button {
  background: var(--paper-edge);
  border: 0;
}
[data-theme="editorial"] .maplibregl-ctrl-group button:hover {
  background: var(--paper-2);
}
[data-theme="editorial"] .maplibregl-ctrl-attrib {
  background: rgba(251, 250, 247, 0.85);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-3);
}

/* Loading-state */
[data-theme="editorial"] .ed-map[data-state="loading"]::after {
  content: "Загружаем карту…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--map-base);
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 14px;
  z-index: 1;
}

/* Error-state */
[data-theme="editorial"] .ed-map[data-state="error"] .ed-map__container { display: none; }
[data-theme="editorial"] .ed-map[data-state="error"]::after {
  content: "Не удалось загрузить тайлы. Попробовать снова?";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bad);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: var(--s-5);
  text-align: center;
}
