:root {
  --bg: #f5f5f2;
  --ink: #1c1c1c;
  --muted: #5c5c5c;
  --line: #d8d8d2;
  --accent: #c1121f;
  --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  /* Colores por tipo de evento (marcadores, filtros). */
  --color-camp: #c1121f;
  --color-march: #0e56ca;
  --color-assembly: #7209b7;
  --color-sit_in: #f77f00;
  --color-default: #c1121f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- Página de mapa ---------- */

.map-page {
  position: fixed;
  inset: 0;
}

#map {
  position: absolute;
  inset: 0;
}

.filters {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #fff;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.filters-sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0.2rem 0;
}

.layers-toggle {
  display: none;
}

.filter-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  display: inline-block;
}

.repo-link {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1001;
  background: #fff;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

.repo-link:hover {
  color: var(--ink);
}

/* ---------- Marcadores con icono SVG propio ---------- */

/* El SVG usa fill: currentColor: el color se configura aquí por tipo. */
.type-marker {
  background: transparent;
  border: none;
  color: var(--accent);
}

.type-marker--camp {
  color: var(--color-camp);
}

.type-marker--march {
  color: var(--color-march);
}

.type-marker--assembly {
  color: var(--color-assembly);
}

/* ---------- Popups (Leaflet y MapLibre) ---------- */

.leaflet-popup-content,
.maplibregl-popup-content {
  max-width: 300px;
  font-family: inherit;
}

.leaflet-popup-content {
  margin: 0.75rem 1rem;
}

.popup-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  line-height: 1.3;
}

.popup-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.popup-city {
  font-weight: 600;
  color: var(--ink);
}

.popup-photo {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin-bottom: 0.5rem;
}

.popup-photo-link {
  display: block;
  text-decoration: none;
}

.popup-photo-link .popup-photo {
  cursor: zoom-in;
  margin-bottom: 0;
}

.popup-desc {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 0.5rem;
}

.popup-links {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.popup-links li {
  margin: 0.15rem 0;
}

.popup-registered {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}

.popup-error {
  padding: 1rem;
  color: var(--accent);
}

/* ---------- Responsive (móvil) ---------- */

@media (max-width: 600px) {
  .layers-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1002;
    width: 42px;
    height: 42px;
    background: #fff;
    color: var(--ink);
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    cursor: pointer;
  }

  .filters {
    display: none;
    top: 64px;
    max-width: calc(100vw - 24px);
  }

  .filters.open {
    display: flex;
  }

  .repo-link {
    bottom: 8px;
    left: 8px;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 6px;
  }
}
