/* ============================================================
   MAPA DEL DELITO — LA COSTA · v2 (muestra)
   Eje: la tipografía como estructura. Interfaz acromática:
   el único color es la categoría del hecho y el mapa.
   Sin tarjetas, sin sombras, sin esquinas redondeadas.
   ============================================================ */

:root {
  --papel:   #FAF9F6;
  --papel-2: #F2F0EA;
  --papel-3: #EAE7DF;
  --tinta:   #1A1A17;
  --tinta-2: #4A4840;
  --tinta-3: #77756C;
  --tinta-4: #9B9990;
  --linea:   #DDDBD4;
  --linea-suave: #E9E7E0;
  --regla:   #16150F;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --nav-w: 236px;
  --lista-w: 348px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--papel); color: var(--tinta);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; }

/* etiquetas de sección: versalitas finas, no títulos gordos */
.rotulo {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--tinta-4); font-weight: 500;
}

/* ---------------- estructura ---------------- */

.app { display: flex; flex-direction: column; height: 100%; }

.cabecera {
  flex: none;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px 11px;
  border-bottom: 2px solid var(--regla);
}
.marca { display: flex; align-items: baseline; gap: 11px; flex: none; }
.marca h1 {
  font: 400 20px/1 var(--serif); margin: 0; letter-spacing: -.015em;
}
.marca span { font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--tinta-3); }

/* buscador: una línea, no una caja */
.buscador { position: relative; flex: 1; max-width: 330px; }
.buscador input {
  width: 100%; background: none; border: 0;
  border-bottom: 1px solid var(--tinta-3);
  padding: 5px 2px; font-size: 13.5px; outline: none;
}
.buscador input::placeholder { color: var(--tinta-4); }
.buscador input:focus { border-bottom-color: var(--tinta); }
#resultados {
  position: absolute; left: 0; right: 0; top: calc(100% + 1px);
  list-style: none; margin: 0; padding: 0; z-index: 60;
  background: var(--papel); border: 1px solid var(--regla); border-top: 0;
  max-height: 58vh; overflow: auto;
}
#resultados li {
  padding: 9px 11px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--linea-suave);
}
#resultados li:last-child { border-bottom: 0; }
#resultados li:hover { background: var(--papel-3); }
#resultados li.vacio { color: var(--tinta-3); cursor: default; font-size: 12.5px; line-height: 1.45; }
#resultados li.vacio:hover { background: none; }

/* acción principal: texto subrayado, no un botón inflado */
.accion {
  flex: none; font-size: 13.5px;
  border-bottom: 1.5px solid var(--tinta); padding-bottom: 1px;
}
.accion:hover { color: var(--tinta-2); border-bottom-color: var(--tinta-2); }

.aviso-muestra {
  flex: none; background: var(--tinta); color: var(--papel);
  font-size: 11px; letter-spacing: .02em; padding: 5px 20px;
}
.aviso-muestra b { font-weight: 600; }

.cuerpo { flex: 1; min-height: 0; display: flex; }

/* ---------------- navegación: la tira de pueblos ---------------- */

.nav {
  width: var(--nav-w); flex: none; overflow-y: auto;
  border-right: 1px solid var(--linea);
  padding: 15px 0 24px;
}
.nav-bloque { padding: 0 20px; }
.nav-bloque + .nav-bloque { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--linea); }
.nav .rotulo { display: block; margin-bottom: 9px; }

.localidades { display: flex; flex-direction: column; }
.localidad {
  position: relative; text-align: left;
  font-size: 13.5px; line-height: 1.9; color: var(--tinta-3);
}
.localidad:hover { color: var(--tinta); }
.localidad.on { color: var(--tinta); font-weight: 500; }
.localidad.on::before {
  content: ""; position: absolute; left: -12px; top: 13px;
  width: 8px; height: 1.5px; background: var(--tinta);
}

.periodos { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; }
.periodo { color: var(--tinta-3); }
.periodo:hover { color: var(--tinta); }
.periodo.on { color: var(--tinta); border-bottom: 1.5px solid var(--tinta); padding-bottom: 1px; }

.cats { display: flex; flex-direction: column; gap: 2px; }
.cat {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--tinta-3); text-align: left; line-height: 1.75;
}
.cat .tick { width: 7px; height: 7px; flex: none; background: var(--linea); }
.cat.on { color: var(--tinta); }
.cat.off .tick { background: var(--linea) !important; }

/* capas de referencia: ceden contraste */
.capa-grupo { border-top: 1px solid var(--linea-suave); }
.capa-grupo:first-child { border-top: 0; }
.capa-grupo > button {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; text-align: left; font-size: 12.5px; color: var(--tinta-3);
  padding: 7px 0;
}
.capa-grupo > button:hover { color: var(--tinta); }
.capa-grupo > button i { font-style: normal; font-size: 10px; color: var(--tinta-4); }
.capa-lista { padding: 0 0 8px 12px; display: none; }
.capa-grupo.abierto .capa-lista { display: block; }
.capa-item {
  display: block; width: 100%; text-align: left;
  font-size: 12.5px; color: var(--tinta-3); line-height: 1.85;
}
.capa-item:hover { color: var(--tinta); }
.capa-item.on { color: var(--tinta); }
.capa-item.on::after { content: " ·"; }

/* ---------------- lista de hechos ---------------- */

.lista-col {
  width: var(--lista-w); flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--linea); min-height: 0;
}
.lista-cab {
  flex: none; padding: 13px 18px 10px; border-bottom: 1px solid var(--linea);
}
.lista-cab h2 { font: 400 16px/1.2 var(--serif); margin: 0; display: inline; }
.lista-cab span { font-size: 12px; color: var(--tinta-4); margin-left: 7px; }
.lista { flex: 1; overflow-y: auto; }

.hecho {
  display: block; width: 100%; text-align: left;
  padding: 12px 18px 13px; border-bottom: 1px solid var(--linea-suave);
}
.hecho:hover { background: var(--papel-2); }
.hecho.foco { background: var(--papel-3); }
.hecho-cat {
  font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 600; margin-bottom: 4px;
}
.hecho-dir { font: 400 15px/1.3 var(--serif); margin-bottom: 3px; }
.hecho-cuando { font-size: 11.5px; color: var(--tinta-4); }
.hecho-desc { font-size: 12.5px; line-height: 1.5; color: var(--tinta-2); margin-top: 5px; }

.vacio-estado { padding: 26px 18px; color: var(--tinta-3); font-size: 13px; line-height: 1.6; }
.vacio-estado b { display: block; font: 400 16px/1.3 var(--serif); color: var(--tinta); margin-bottom: 5px; }

.pie-lista {
  flex: none; padding: 9px 18px 11px; border-top: 1px solid var(--linea);
  font-size: 10.5px; line-height: 1.45; color: var(--tinta-4);
}

/* ---------------- mapa ---------------- */

.mapa-col { flex: 1; position: relative; min-width: 0; isolation: isolate; }
#mapa { position: absolute; inset: 0; z-index: 0; background: var(--papel-2); }

.pin-hecho span {
  display: block; width: 11px; height: 11px; border-radius: 50%;
  box-shadow: 0 0 0 3px var(--papel);
}
.pin-hecho.grande span { width: 15px; height: 15px; box-shadow: 0 0 0 4px var(--papel); }
.pin-capa span {
  display: block; width: 9px; height: 9px;
  background: var(--tinta); box-shadow: 0 0 0 2.5px var(--papel);
}
.pin-buscado span {
  display: block; width: 13px; height: 13px; border: 2px solid var(--tinta);
  background: var(--papel);
}

/* Leaflet, en clave papel.
   El mapa va desaturado a propósito: así el único color de la pantalla
   es la categoría del hecho. Se logra con un filtro sobre los tiles de
   OpenStreetMap — sin depender de otro proveedor. */
.leaflet-tile-pane { filter: grayscale(1) brightness(1.07) contrast(.9) sepia(.14); }
.leaflet-container { background: var(--papel-2); font: inherit; }
.leaflet-control-zoom { border: 1px solid var(--regla) !important; margin: 14px !important; }
.leaflet-control-zoom a {
  background: var(--papel) !important; color: var(--tinta) !important;
  border-bottom: 1px solid var(--linea) !important; width: 28px !important; height: 28px !important;
  line-height: 28px !important; font-size: 16px !important;
}
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }
.leaflet-control-attribution {
  background: rgba(250, 249, 246, .85) !important; color: var(--tinta-4) !important;
  font-size: 10px !important;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--papel); border-radius: 0; box-shadow: none;
  border: 1px solid var(--regla);
}
.leaflet-popup-tip { border-top: 0; border-left: 0; }
.leaflet-popup-content { margin: 11px 13px; font: inherit; }
.leaflet-popup-content .p-cat {
  font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; font-weight: 600;
}
.leaflet-popup-content .p-dir { font: 400 15px/1.3 var(--serif); margin: 4px 0 2px; }
.leaflet-popup-content .p-meta { font-size: 11.5px; color: var(--tinta-4); }
.leaflet-popup-content .p-desc { font-size: 12.5px; line-height: 1.5; color: var(--tinta-2); margin: 5px 0 0; }
.leaflet-popup-content .p-tel { font-size: 12.5px; margin: 4px 0 0; }
.leaflet-popup-close-button { color: var(--tinta-3) !important; }

/* ---------------- modal de reporte (maqueta) ---------------- */

.modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(26, 26, 23, .35);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-caja {
  background: var(--papel); border: 1px solid var(--regla);
  width: 100%; max-width: 420px; padding: 22px 24px 24px;
}
.modal-caja h2 { font: 400 20px/1.2 var(--serif); margin: 0 0 4px; }
.modal-caja p { font-size: 13px; line-height: 1.6; color: var(--tinta-2); margin: 0 0 14px; }
.modal-caja .rotulo { display: block; margin: 14px 0 6px; }
.modal-cerrar { margin-top: 18px; font-size: 13.5px; border-bottom: 1.5px solid var(--tinta); padding-bottom: 1px; }

/* ---------------- celular ---------------- */

.tira-movil, .movil-solo { display: none; }

@media (max-width: 860px) {
  .cabecera { flex-wrap: wrap; gap: 10px 16px; padding: 10px 14px 9px; }
  .buscador { max-width: none; flex-basis: 100%; order: 3; }
  .accion { order: 2; margin-left: auto; }
  .aviso-muestra { padding: 5px 14px; }

  .cuerpo { flex-direction: column; }

  /* la tira de pueblos pasa a ser horizontal, arriba de todo */
  .tira-movil {
    display: flex; gap: 16px; flex: none;
    padding: 9px 14px; border-bottom: 1px solid var(--linea);
    overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  }
  .tira-movil::-webkit-scrollbar { display: none; }
  .tira-movil .localidad { font-size: 13px; line-height: 1.4; }
  .tira-movil .localidad.on { border-bottom: 1.5px solid var(--tinta); padding-bottom: 2px; }
  .tira-movil .localidad.on::before { display: none; }

  .nav { display: none; }
  .movil-solo { display: block; }

  /* en celular scrollea la página entera: el mapa arriba, la lista abajo */
  html, body { height: auto; }
  .app { height: auto; min-height: 100%; }
  .mapa-col { order: 1; flex: none; height: 42vh; min-height: 230px; border-bottom: 1px solid var(--linea); }
  .lista-col { order: 2; width: 100%; border-right: 0; flex: none; }
  .lista { overflow: visible; }
  .lista-cab { position: sticky; top: 0; z-index: 5; background: var(--papel); }

  /* panel de filtros/capas a pantalla completa */
  .hoja {
    position: fixed; inset: 0; z-index: 900; background: var(--papel);
    display: flex; flex-direction: column;
  }
  .hoja-cab {
    flex: none; display: flex; justify-content: space-between; align-items: baseline;
    padding: 13px 16px 11px; border-bottom: 2px solid var(--regla);
  }
  .hoja-cab h2 { font: 400 18px/1 var(--serif); margin: 0; }
  .hoja-cuerpo { flex: 1; overflow-y: auto; padding: 16px 0 30px; }
  .hoja .nav { display: block; width: 100%; border-right: 0; padding-top: 0; }
}

@media (min-width: 861px) { .hoja { display: none; } }
