/* Universal map widget — embeddable block */
.mapa-widget {
  --mapa-bg: #f6f3ee;
  --mapa-surface: #ffffff;
  --mapa-ink: #1c1917;
  --mapa-muted: #57534e;
  --mapa-line: #e7e5e4;
  --mapa-accent: #0f766e;
  --mapa-accent-soft: #ccfbf1;
  --mapa-feira: #0f766e;
  --mapa-organica: #4d7c0f;
  --mapa-veshevaya: #b45309;
  --mapa-smeshannaya: #7c3aed;
  --mapa-peredvizhnaya: #0369a1;
  --mapa-night: #1e3a5f;
  --mapa-map-h: min(52vh, 420px);
  --mapa-map-h-mobile: min(42vh, 320px);
  --mapa-radius: 12px;
  --mapa-font: "Segoe UI", system-ui, -apple-system, sans-serif;

  box-sizing: border-box;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0;
  color: var(--mapa-ink);
  font-family: var(--mapa-font);
  background: var(--mapa-bg);
  border: 1px solid var(--mapa-line);
  border-radius: var(--mapa-radius);
  overflow: hidden;
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.mapa-widget *,
.mapa-widget *::before,
.mapa-widget *::after {
  box-sizing: border-box;
}

.mapa-widget__header {
  padding: 1rem 1.1rem 0.75rem;
  background: var(--mapa-surface);
  border-bottom: 1px solid var(--mapa-line);
}

.mapa-widget__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 700;
}

.mapa-widget__lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--mapa-muted);
}

.mapa-widget__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  background: var(--mapa-surface);
  border-bottom: 1px solid var(--mapa-line);
}

.mapa-widget__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--mapa-line);
  border-radius: 8px;
  background: var(--mapa-surface);
  color: var(--mapa-ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.mapa-widget__btn:hover,
.mapa-widget__btn:focus-visible {
  border-color: var(--mapa-accent);
  color: var(--mapa-accent);
  outline: none;
}

.mapa-widget__btn[hidden],
.mapa-widget [hidden] {
  display: none !important;
}

.mapa-widget__btn--accent {
  background: var(--mapa-accent);
  border-color: var(--mapa-accent);
  color: #fff;
}

.mapa-widget__btn--accent:hover,
.mapa-widget__btn--accent:focus-visible {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}

.mapa-widget__btn--ghost {
  background: transparent;
}

.mapa-widget__collection {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.mapa-widget__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  background: var(--mapa-surface);
  border-bottom: 1px solid var(--mapa-line);
}

.mapa-widget__chip {
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--mapa-line);
  border-radius: 999px;
  background: #fafaf9;
  color: var(--mapa-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.mapa-widget__chip:hover,
.mapa-widget__chip:focus-visible {
  border-color: var(--mapa-accent);
  color: var(--mapa-accent);
  outline: none;
}

.mapa-widget__chip.is-active {
  background: var(--mapa-accent-soft);
  border-color: var(--mapa-accent);
  color: var(--mapa-accent);
}

.mapa-widget__map-shell {
  position: relative;
  z-index: 0;
  width: 100%;
  height: var(--mapa-map-h);
  background:
    linear-gradient(160deg, #e7e5e4 0%, #d6d3d1 40%, #e7e5e4 100%);
}

.mapa-widget__map {
  width: 100%;
  height: 100%;
}

.mapa-widget .leaflet-tile,
.mapa-widget .leaflet-marker-icon,
.mapa-widget .leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.mapa-widget__map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: var(--mapa-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.mapa-widget.is-map-ready .mapa-widget__map-placeholder {
  display: none;
}

.mapa-widget__status {
  min-height: 1.25rem;
  padding: 0.35rem 1.1rem;
  font-size: 0.8rem;
  color: var(--mapa-muted);
  background: var(--mapa-surface);
  border-bottom: 1px solid var(--mapa-line);
}

.mapa-widget__status[hidden] {
  display: none;
}

.mapa-widget__list {
  list-style: none;
  margin: 0;
  padding: 0.65rem;
  background: var(--mapa-bg);
  max-height: none;
}

.mapa-widget .mapa-widget__list {
  list-style: none !important;
  padding-left: 0.65rem;
}

.mapa-widget__item {
  list-style: none !important;
  margin: 0 0 0.55rem;
  padding-left: 0;
}

.mapa-widget__item::marker,
.mapa-widget__item::before {
  content: none !important;
  display: none !important;
}

.mapa-widget__item:last-child {
  margin-bottom: 0;
}

.mapa-widget__card {
  display: block;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--mapa-line);
  border-radius: 10px;
  background: var(--mapa-surface);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.mapa-widget__card:hover,
.mapa-widget__card:focus-visible {
  border-color: var(--mapa-accent);
  outline: none;
}

.mapa-widget__card.is-active {
  border-color: var(--mapa-accent);
  box-shadow: 0 0 0 2px var(--mapa-accent-soft);
  background: #fff;
}

.mapa-widget__card[hidden] {
  display: none;
}

.mapa-widget__card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  margin-bottom: 0.35rem;
}

.mapa-widget__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.mapa-widget__district {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mapa-muted);
}

.mapa-widget__meta {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--mapa-muted);
}

.mapa-widget__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.55rem;
}

.mapa-widget__tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  background: #f5f5f4;
  color: var(--mapa-muted);
}

.mapa-widget__tag[data-cat="Уличный рынок"] {
  background: #ccfbf1;
  color: var(--mapa-feira);
}

.mapa-widget__tag[data-cat="Фермерская"] {
  background: #ecfccb;
  color: var(--mapa-organica);
}

.mapa-widget__tag[data-cat="Вещевая"],
.mapa-widget__tag[data-cat="Ночная вещевая"] {
  background: #ffedd5;
  color: var(--mapa-veshevaya);
}

.mapa-widget__tag[data-cat="Смешанная"] {
  background: #ede9fe;
  color: var(--mapa-smeshannaya);
}

.mapa-widget__tag[data-cat="Передвижная"] {
  background: #e0f2fe;
  color: var(--mapa-peredvizhnaya);
}

.mapa-widget__tag[data-cat="Концертная площадка"] {
  background: #dbeafe;
  color: var(--mapa-night);
}

.mapa-widget__tag[data-cat="По дням недели"] {
  background: #ccfbf1;
  color: var(--mapa-feira);
}

.mapa-widget__tag[data-cat="По афише"] {
  background: #ede9fe;
  color: var(--mapa-smeshannaya);
}

.mapa-widget__tag[data-cat="Босса-нова"] {
  background: #ffedd5;
  color: var(--mapa-veshevaya);
}

.mapa-widget__tag[data-cat="Шоро"] {
  background: #ccfbf1;
  color: var(--mapa-feira);
}

.mapa-widget__tag[data-cat="MPB"] {
  background: #ede9fe;
  color: var(--mapa-smeshannaya);
}

.mapa-widget__tag[data-cat="Сильная roda"] {
  background: #dbeafe;
  color: var(--mapa-night);
}

.mapa-widget__tag[data-cat="Главные самба-вечера"] {
  background: #dbeafe;
  color: var(--mapa-night);
}

.mapa-widget__tag[data-cat="Камерная"] {
  background: #ccfbf1;
  color: var(--mapa-feira);
}

.mapa-widget__tag[data-cat="Дневное событие"] {
  background: #ffedd5;
  color: var(--mapa-veshevaya);
}

.mapa-widget__tag[data-cat="Большая вечеринка"] {
  background: #ede9fe;
  color: var(--mapa-smeshannaya);
}

.mapa-widget__tag[data-cat="Уличная площадка"] {
  background: #e0f2fe;
  color: var(--mapa-peredvizhnaya);
}

.mapa-widget__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mapa-widget__link {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--mapa-line);
  border-radius: 7px;
  background: #fafaf9;
  color: var(--mapa-ink);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.mapa-widget__link:hover,
.mapa-widget__link:focus-visible {
  border-color: var(--mapa-accent);
  color: var(--mapa-accent);
  outline: none;
}

/* Custom markers */
.mapa-marker-wrap {
  background: transparent !important;
  border: none !important;
}

.mapa-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.28);
  background: var(--mapa-feira);
  transition: transform 0.15s, box-shadow 0.15s;
}

.mapa-marker__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: rotate(45deg);
}

.mapa-marker.is-active {
  transform: rotate(-45deg) scale(1.18);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.4);
  z-index: 500 !important;
}

.mapa-marker[data-cat="Уличный рынок"] { background: var(--mapa-feira); }
.mapa-marker[data-cat="Фермерская"] { background: var(--mapa-organica); }
.mapa-marker[data-cat="Вещевая"] { background: var(--mapa-veshevaya); }
.mapa-marker[data-cat="Ночная вещевая"] { background: var(--mapa-night); }
.mapa-marker[data-cat="Смешанная"] { background: var(--mapa-smeshannaya); }
.mapa-marker[data-cat="Передвижная"] { background: var(--mapa-peredvizhnaya); }
.mapa-marker[data-cat="Концертная площадка"] { background: var(--mapa-night); }
.mapa-marker[data-cat="По дням недели"] { background: var(--mapa-feira); }
.mapa-marker[data-cat="По афише"] { background: var(--mapa-smeshannaya); }
.mapa-marker[data-cat="Босса-нова"] { background: var(--mapa-veshevaya); }
.mapa-marker[data-cat="Шоро"] { background: var(--mapa-feira); }
.mapa-marker[data-cat="MPB"] { background: var(--mapa-smeshannaya); }
.mapa-marker[data-cat="Сильная roda"] { background: var(--mapa-night); }
.mapa-marker[data-cat="Главные самба-вечера"] { background: var(--mapa-night); }
.mapa-marker[data-cat="Камерная"] { background: var(--mapa-feira); }
.mapa-marker[data-cat="Дневное событие"] { background: var(--mapa-veshevaya); }
.mapa-marker[data-cat="Большая вечеринка"] { background: var(--mapa-smeshannaya); }
.mapa-marker[data-cat="Уличная площадка"] { background: var(--mapa-peredvizhnaya); }

.mapa-popup-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.mapa-popup-meta {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  color: var(--mapa-muted);
}

.mapa-popup-note {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.mapa-popup-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mapa-popup-links a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mapa-accent);
}

.leaflet-popup-content-wrapper {
  border-radius: 10px;
}

.leaflet-popup-content {
  margin: 10px 12px;
  line-height: 1.4;
}

.mapa-widget--embed-demo {
  margin: 1.5rem auto;
}

.mapa-page {
  margin: 0;
  padding: 1.25rem 1rem 2.5rem;
  background: #ebe7e1;
  color: #1c1917;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.mapa-page__intro {
  max-width: 920px;
  margin: 0 auto 1.25rem;
}

.mapa-page__intro h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  line-height: 1.25;
}

.mapa-page__intro p {
  margin: 0;
  max-width: 62ch;
  line-height: 1.5;
  color: #57534e;
}

@media (max-width: 720px) {
  .mapa-widget {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .mapa-widget__map-shell {
    height: var(--mapa-map-h-mobile);
  }

  .mapa-widget__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .mapa-widget__collection {
    margin-left: 0;
  }

  .mapa-widget__btn,
  .mapa-widget__collection .mapa-widget__btn {
    width: 100%;
  }

  /* List follows page scroll — no nested panel scroll on phones */
  .mapa-widget__list {
    max-height: none;
    overflow: visible;
  }
}

@media (min-width: 721px) {
  /* Optional: keep long lists usable without stretching the article forever */
  .mapa-widget[data-list-scroll="true"] .mapa-widget__list {
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
