/* ==========================================================
   COEM MENDIOLAZA — MAPA DE RIESGO HÍDRICO
   Sistema de diseño: consola operativa de gestión de riesgo.
   Paleta inspirada en cartografía topográfica + señalética
   de protección civil. Sin adornos decorativos: cada color
   y cada línea codifican información.
   ========================================================== */

:root{
  /* --- color --- */
  --ink:        #101B22;   /* texto principal / header */
  --ink-soft:   #3B4B52;
  --paper:      #EAEEEC;   /* fondo general, papel topográfico frío */
  --paper-deep: #DCE3DF;
  --panel:      #FFFFFF;
  --line:       #C7D0CC;

  --brand:      #1B3A4B;   /* azul institucional profundo */
  --brand-deep: #0F1B2D;
  --water:      #2E7DA6;   /* accent principal: agua */
  --alert:      #C0392B;   /* amenazas / puntos críticos */
  --warn:       #E8A33D;   /* anegamiento */
  --ok:         #1B7A3D;   /* recursos / disponibilidad */

  /* --- tipografía --- */
  --f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-body:    "Public Sans", "Segoe UI", sans-serif;

  --radius: 3px;
  --shadow-panel: 0 1px 0 rgba(16,27,34,.06), 0 8px 24px -16px rgba(16,27,34,.35);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img{ max-width:100%; display:block; }
a{ color: inherit; }
.wrap{
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}
h1,h2,h3{
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.05;
  margin: 0 0 .4em;
  letter-spacing: .2px;
}
code{
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--paper-deep);
  padding: .1em .4em;
  border-radius: 2px;
  font-size: .9em;
}
:focus-visible{
  outline: 3px solid var(--water);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html{ scroll-behavior: auto; }
}

/* ---------- barra de estado ---------- */
.status-bar{
  background: var(--brand-deep);
  color: #C9D6DC;
  font-size: 12.5px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  padding: 6px 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.status-bar__item{ display:flex; align-items:center; gap:8px; }
.status-dot{
  width:7px; height:7px; border-radius:50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(232,163,61,.25);
  flex: none;
}
.status-bar__version{ opacity:.75; display:flex; align-items:center; gap:10px; }

.status-bar__install{
  background: var(--water); color:#fff; border:none; border-radius:20px;
  padding: 3px 12px; font-size:11.5px; font-weight:700; cursor:pointer; opacity:1;
}
.status-bar__install:hover{ background:#3690b8; }

.ios-install-hint{
  background: var(--brand); color:#fff; font-size:13px; padding:10px 24px;
  display:flex; align-items:center; justify-content:center; gap:14px; text-align:center;
}
.ios-install-hint[hidden]{ display:none; }
.ios-install-hint button{
  background:transparent; border:1px solid rgba(255,255,255,.5); color:#fff;
  width:26px; height:26px; border-radius:50%; font-size:16px; cursor:pointer; flex:none;
}

/* ---------- header ---------- */
.site-header{
  position: sticky; top:0; z-index: 50;
  background: var(--brand);
  color: #fff;
  border-bottom: 3px solid var(--water);
}
.site-header__inner{
  display:flex; align-items:center; justify-content: space-between;
  padding: 12px 24px;
  gap: 16px;
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand__mark{ color: #fff; display:flex; }
.brand__text{ display:flex; flex-direction:column; line-height:1.15; }
.brand__text strong{ font-family: var(--f-display); font-size: 19px; letter-spacing: .5px; }
.brand__text span{ font-size: 12px; color: #B9CBD3; }

.main-nav{ display:flex; align-items:center; gap: 22px; font-size: 14.5px; }
.main-nav a{ text-decoration:none; color: #DCE7EA; padding: 4px 2px; border-bottom: 2px solid transparent; }
.main-nav a:hover{ color:#fff; border-color: rgba(255,255,255,.4); }
.main-nav a.nav-cta{
  background: var(--water); color:#fff; padding: 7px 14px; border-radius: var(--radius);
  border-bottom: none;
}
.main-nav a.nav-cta:hover{ background:#3690b8; }

.nav-toggle{
  display:none; flex-direction:column; justify-content:center; gap:5px;
  width: 38px; height: 34px; background:transparent; border:1px solid rgba(255,255,255,.35);
  border-radius: var(--radius); cursor:pointer;
}
.nav-toggle span{ width:18px; height:2px; background:#fff; margin:0 auto; }

/* ---------- hero ---------- */
.hero{
  background:
    linear-gradient(180deg, var(--brand-deep) 0%, var(--brand) 100%);
  color: #EAF1F3;
  padding: 64px 0 72px;
  position: relative;
  overflow:hidden;
}
.hero::after{
  content:"";
  position:absolute; inset:0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 42px);
  pointer-events:none;
}
.hero__grid{
  position:relative;
  display:grid;
  grid-template-columns: 1.3fr .9fr;
  gap: 48px;
  align-items:start;
}
.eyebrow{
  font-size: 13px; font-weight: 600; letter-spacing: .06em;
  color: #8FC3D6; margin: 0 0 10px;
}
.hero h1{
  font-size: clamp(34px, 4.2vw, 54px);
  color:#fff;
  max-width: 14ch;
}
.hero__lead{
  font-size: 17px; max-width: 52ch; color:#CBDBDF;
}
.hero__actions{ display:flex; gap:12px; margin-top:26px; flex-wrap:wrap; }

.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding: 11px 20px; border-radius: var(--radius);
  font-weight:600; font-size: 14.5px; text-decoration:none;
  border: 1px solid transparent;
}
.btn--primary{ background: var(--water); color:#fff; }
.btn--primary:hover{ background:#3690b8; }
/* background: transparent es obligatorio acá: en un <button> el
   navegador aplica su propio fondo gris/blanco por defecto, y como el
   texto de este botón es blanco quedaba ilegible (blanco sobre blanco).
   En un <a> no se notaba porque los links no tienen fondo propio.
   font/cursor tampoco se heredan en <button>, por eso se fuerzan. */
.btn--ghost{
  border-color: rgba(255,255,255,.4); color:#fff;
  background: transparent; font-family: var(--f-body); cursor:pointer;
}
.btn--ghost:hover{ background: rgba(255,255,255,.08); }
.btn--ghost:disabled{ opacity:.55; cursor:default; }

.hero__panel{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  backdrop-filter: blur(2px);
}
.hero__panel h3, .hero__panel h2{ color:#fff; font-size: 17px; margin-bottom: 14px; }
.hero__stats{ list-style:none; margin:0 0 14px; padding:0; display:flex; flex-direction:column; gap:9px; }
.hero__stats li{
  display:flex; justify-content:space-between; align-items:center;
  font-size: 14px; border-bottom: 1px dashed rgba(255,255,255,.16); padding-bottom:9px;
}
.hero__stats .tag{
  font-family: var(--f-display); font-weight:600; font-size: 16px;
  background: rgba(255,255,255,.12); padding: 2px 10px; border-radius: 20px;
}
.hero__note{ font-size: 12.5px; color:#9FB6BC; margin:0; }

/* ---------- secciones genéricas ---------- */
.section{ padding: 68px 0; }
.section--alt{ background: var(--paper-deep); }
.section__head{ max-width: 680px; margin-bottom: 34px; }
.section__head h2{ font-size: clamp(26px, 3vw, 36px); color: var(--brand-deep); }
.section__lead{ color: var(--ink-soft); font-size: 15.5px; max-width: 60ch; }

/* ---------- mapa ---------- */
.section--map{ padding-bottom: 0; }
.map-shell{ position:relative; width:100%; height: 620px; border-top: 1px solid var(--line); overflow:hidden; }
#map{ width:100%; height:100%; background: #DDE6E2; }
/* Leaflet a veces hereda box-sizing global; se fuerza a llenar el
   contenedor para que nunca se desborde ni se desproporcione. */
.leaflet-container{ width:100% !important; height:100% !important; font-family: var(--f-body); }

.map-scroll-hint{
  position:absolute; left:50%; bottom:18px; transform: translateX(-50%);
  z-index: 500; background: rgba(16,27,34,.85); color:#fff;
  font-size: 12.5px; padding: 7px 14px; border-radius: 20px;
  pointer-events:none; transition: opacity .2s ease;
}
.map-scroll-hint.is-hidden{ opacity:0; }

.map-baselayer{
  position:absolute; bottom:18px; left:16px; z-index: 400;
  display:flex; background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow-panel); border: 1px solid var(--line); overflow:hidden;
}
.map-baselayer button{
  border:none; background:transparent; padding: 9px 16px; font-size: 13px;
  font-weight:600; color: var(--ink-soft); cursor:pointer; font-family: var(--f-body);
}
.map-baselayer button.is-active{ background: var(--brand); color:#fff; }
.map-baselayer button + button{ border-left: 1px solid var(--line); }
.map-baselayer__sim.is-active{ background: var(--water); color:#fff; }

/* ---------- animación "Simular" ----------
   Sin la clase .is-simulating en .map-shell, todo se ve exactamente
   igual que antes (líneas quietas). Con la clase puesta:
   - .ruta-flow (rutas de evacuación): los guiones del trazado
     "caminan" en la dirección del recorrido, como flechas de sentido.
   - .cauce-flow (cauces/escorrentías): se le agrega un patrón de
     guiones que corre en loop, simulando agua fluyendo.
   El :not(.leaflet-interactive) evita que el efecto se aplique por
   error a algo que no sea la línea en sí. */
/* Velocidades: el cauce del arroyo conserva su ritmo original (1.1 s por ciclo);
   las escorrentías y las rutas de evacuación van más lentas para que la
   simulación se lea con calma y el arroyo siga siendo lo que "manda". */
.map-shell.is-simulating .ruta-flow{
  animation: coem-flow 1.8s linear infinite;
}
.map-shell.is-simulating .cauce-flow{
  stroke-dasharray: 7 9;
  animation: coem-flow-agua 1.1s linear infinite;
}
.map-shell.is-simulating .cauce-flow.capa-escorrentias{
  animation-duration: 2s;
}

/* ---------- "área crítica" (polígonos con relleno de rayas — ver poligonoEsCritico) ---------- */
.area-critica{ stroke-dasharray: 6 4; }
@keyframes coem-flow{ to{ stroke-dashoffset: -36; } }
@keyframes coem-flow-agua{ to{ stroke-dashoffset: -32; } }

/* ---------- radar de sirenas (Alerta Temprana) — permanente ----------
   El span .risk-badge ya trae `color: <color de la capa>` inline (se
   ve en iconEspecialHtml), así que acá se usa currentColor: el anillo
   sale del mismo color naranja de la capa sin tener que repetirlo. Dos
   anillos con delay para que el radar se vea continuo, no a los saltos. */
.risk-badge{ position:relative; }
.risk-badge--pulse::before,
.risk-badge--pulse::after{
  content:""; position:absolute; inset:-2px; border-radius:50%;
  border:2px solid currentColor; opacity:0; pointer-events:none;
  animation: coem-radar 2.2s ease-out infinite;
}
.risk-badge--pulse::after{ animation-delay: 1.1s; }
@keyframes coem-radar{
  0%{ transform:scale(1); opacity:.6; }
  100%{ transform:scale(2.7); opacity:0; }
}

/* ---------- parpadeo de puntos en estado "crítico" — permanente ----------
   Se aplica sobre el contenedor que arma Leaflet para el marcador
   (className del divIcon), no sobre el ícono en sí, así funciona igual
   con o sin ícono especial. */
.risk-marker--critico{ animation: coem-critico-blink 1.8s ease-in-out infinite; }
@keyframes coem-critico-blink{ 0%, 100%{ opacity:1; } 50%{ opacity:.4; } }

/* ---------- zonas de anegamiento "respirando" — sólo durante Simular ---------- */
.map-shell.is-simulating .zona-flow{
  animation: coem-respirar 4s ease-in-out infinite;
}
@keyframes coem-respirar{
  0%, 100%{ fill-opacity:.14; }
  50%{ fill-opacity:.36; }
}

@media (prefers-reduced-motion: reduce){
  .risk-badge--pulse::before, .risk-badge--pulse::after{ animation:none; opacity:0; }
  .risk-marker--critico{ animation:none; }
  .map-shell.is-simulating .zona-flow{ animation:none; }
}
@media (prefers-reduced-motion: reduce){
  .map-shell.is-simulating .ruta-flow,
  .map-shell.is-simulating .cauce-flow{ animation: none; }
}

/* ---------- botones de acción dentro del popup ---------- */
.map-popup__actions{ display:flex; gap:8px; margin-top:10px; }
.map-popup__action{
  width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background: var(--paper-deep); border:1px solid var(--line); flex:none;
}
.map-popup__action svg{ width:17px; height:17px; fill: var(--brand); }
.map-popup__action--whatsapp{ background:#E5F6EC; border-color:#BFE6CE; }
.map-popup__action--whatsapp svg{ fill:#1B7A3D; }
.map-popup__action:hover{ filter:brightness(.96); }

.map-legend{
  position:absolute; top:16px; right:16px; z-index: 400;
  width: 258px; max-width: calc(100vw - 32px);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  border: 1px solid var(--line);
  overflow:hidden;
}
.map-legend__head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 14px; background: var(--brand); color:#fff;
}
.map-legend__head h3{ margin:0; font-size:15px; }
.map-legend__min{
  width:22px; height:22px; border-radius:50%; border:1px solid rgba(255,255,255,.5);
  background:transparent; color:#fff; cursor:pointer; line-height:1; font-size:16px;
}
.map-legend__body{ padding: 10px 14px 14px; max-height: 420px; overflow-y:auto; }
.legend-row{
  display:flex; align-items:center; gap:9px; padding:7px 0; font-size: 13.5px;
  border-bottom: 1px solid #EEF1EF; cursor:pointer; user-select:none;
}
.legend-row:last-child{ border-bottom:none; }
.legend-swatch{ width:13px; height:13px; border-radius:3px; flex:none; }
.legend-row input{ accent-color: var(--water); }
.legend-count{ margin-left:auto; font-size:11.5px; color:#6C7A80; font-variant-numeric: tabular-nums; }

/* ---------- grupos desplegables de la leyenda (Barrios, Rutas de evacuación) ---------- */
.legend-row--group{ cursor:default; }
.legend-group__toggle{
  flex:1; min-width:0; display:flex; align-items:center; gap:9px; padding:0;
  border:none; background:none; font:inherit; color:inherit; text-align:left; cursor:pointer;
}
.legend-group__name{ flex:1; min-width:0; }
.legend-chevron{
  width:7px; height:7px; flex:none; margin:0 2px 2px 4px;
  border-right:2px solid #6C7A80; border-bottom:2px solid #6C7A80;
  transform: rotate(45deg); transition: transform .18s ease;
}
.legend-group.is-open .legend-chevron{ transform: rotate(-135deg); margin-bottom:-2px; }
.legend-sub{ margin: 0 0 6px 8px; padding-left:12px; border-left:2px solid #E3E9E6; }
.legend-sub[hidden]{ display:none; }
.legend-row--sub{ padding:5px 0; font-size:13px; }
.legend-swatch--sub{ width:11px; height:11px; }
.legend-sub__empty{ margin:6px 0 8px; font-size:12.5px; line-height:1.4; color:#6C7A80; }
.legend-group__toggle:focus-visible,
.legend-row input:focus-visible{ outline:2px solid var(--water); outline-offset:2px; border-radius:3px; }
@media (prefers-reduced-motion: reduce){
  .legend-chevron{ transition:none; }
}

/* ---------- barrios: nombre sobre el polígono + chip de color en popups ---------- */
.barrio-label{
  background: rgba(255,255,255,.85); border:1px solid rgba(0,0,0,.2); border-radius:4px;
  padding:2px 7px; box-shadow:none; white-space:nowrap;
  font: 600 12px/1.3 var(--f-body); color: var(--brand-deep);
}
.ocultar-etiquetas-barrio .barrio-label{ display:none; }
.map-popup__color{
  display:inline-block; width:11px; height:11px; margin-right:7px; border-radius:3px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}

/* popup leaflet */
.leaflet-popup-content-wrapper{ border-radius: var(--radius); }
/* Leaflet arma el nodo .leaflet-popup de cero cada vez que se abre un
   popup (no lo reutiliza), así que esta animación se dispara sola en
   cada apertura sin necesitar ningún JS extra enganchado a "popupopen". */
.leaflet-popup{
  animation: coem-popup-pop .22s cubic-bezier(.34, 1.56, .64, 1);
  transform-origin: bottom center;
}
@keyframes coem-popup-pop{
  from{ opacity:0; transform: scale(.86) translateY(6px); }
  to{ opacity:1; transform: scale(1) translateY(0); }
}
@media (prefers-reduced-motion: reduce){
  .leaflet-popup{ animation:none; }
}
.map-popup h4{ margin:0 0 4px; font-family: var(--f-display); font-size:16px; color: var(--brand-deep); }
.map-popup .estado{
  display:inline-block; font-size:11px; font-weight:600; padding:2px 8px; border-radius:20px;
  margin-bottom:6px; background:#EEE; color:#555;
}
.map-popup .estado.critico{ background:#FBE4E1; color:var(--alert); }
.map-popup .estado.relevado{ background:#E1F0E5; color:var(--ok); }
.map-popup p{ margin:0; font-size:13px; color:var(--ink-soft); }

/* ---------- tarjetas de capas ---------- */
.layer-cards{
  display:grid; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); gap:16px;
}
.layer-card{
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; border-top: 4px solid var(--brand);
}
.layer-card h3{ font-size:18px; margin-bottom:6px; color: var(--brand-deep); }
.layer-card p{ font-size:13.5px; color: var(--ink-soft); margin:0 0 12px; }
.layer-card__count{ font-size:12.5px; color:#6C7A80; border-top:1px dashed var(--line); padding-top:10px; }
.layer-card__count strong{ color:var(--ink); font-family: var(--f-display); font-size:15px; }

/* ---------- galería ---------- */
.gallery-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 22px; }
.gallery-tabs button{
  padding: 8px 16px; border-radius: 20px; border:1px solid var(--line);
  background: var(--panel); font-size: 13.5px; font-weight:600; color: var(--ink-soft); cursor:pointer;
}
.gallery-tabs button.is-active{ background: var(--brand); color:#fff; border-color: var(--brand); }

/* Grilla real (no "masonry" por columnas CSS): se llena de izquierda a
   derecha y recién después baja de fila, sin dejar huecos sueltos ni
   reacomodar tarjetas al azar. Todas las tarjetas miden lo mismo —
   rectangulares, 4:3 — con la foto recortada al centro (object-fit:
   cover) para que la fila quede prolija; si una foto puntual necesita
   verse completa sin recorte, se puede sumar la clase "is-contain" al
   objeto en GALLERY (ver js/gallery.js) para esa tarjeta en particular. */
.gallery-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 20px;
}
.gallery-card{
  background: var(--panel); border:1px solid var(--line); border-radius: 10px; overflow:hidden;
  box-shadow: 0 1px 2px rgba(16,27,34,.04);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.gallery-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 16px 28px -18px rgba(16,27,34,.45);
  border-color: var(--water);
}
.gallery-card__img{
  position:relative; overflow:hidden;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  color:#8FA0A6; font-size:12.5px; text-align:center;
  display:flex; align-items:center; justify-content:center;
}
.gallery-card__img img{
  width:100%; height:100%; display:block; object-fit: cover;
  transition: transform .45s ease;
}
.gallery-card:hover .gallery-card__img img{ transform: scale(1.06); }
.gallery-card__img.is-contain img{ object-fit: contain; }
.gallery-card__body{ padding: 12px 14px 14px; }
.gallery-card__body h4{ margin:0 0 4px; font-size:15px; font-family: var(--f-display); }
.gallery-card__body p{ margin:0; font-size:12.5px; color: var(--ink-soft); }
.gallery-empty{
  grid-column: 1/-1; text-align:center; padding: 40px 20px; color:#6C7A80;
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px;
}

/* "Cargar más": evita que una categoría con muchas fotos se vuelva un
   scroll interminable (sobre todo en celular) sin sacrificar que se
   puedan ver todas si la persona realmente quiere. */
.gallery-loadmore{ display:flex; justify-content:center; margin-top: 22px; }
.gallery-loadmore button{
  padding: 10px 22px; border-radius: 20px; border:1px solid var(--line);
  background: var(--panel); font-size:13.5px; font-weight:600; color: var(--brand-deep); cursor:pointer;
  transition: background .18s ease, border-color .18s ease;
}
.gallery-loadmore button:hover{ background: var(--paper-deep); border-color: var(--water); }

/* ---------- equipo ---------- */
.team-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap:18px; }
.team-card{
  position:relative; overflow:hidden;
  background: var(--panel); border:1px solid var(--line); border-radius: 10px; padding: 22px 18px 18px;
  box-shadow: 0 1px 2px rgba(16,27,34,.04);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, opacity .5s ease;
  /* arrancan "apagadas" y js/main.js las enciende con .is-visible al entrar en pantalla */
  opacity: 0; transform: translateY(16px);
}
.team-card.is-visible{ opacity:1; transform:none; }
.team-card::before{
  content:""; position:absolute; top:0; left:0; right:0; height:4px;
  background: linear-gradient(90deg, var(--water), var(--brand));
}
.team-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 16px 28px -18px rgba(16,27,34,.45);
  border-color: var(--water);
}
.team-card__logo{
  width:44px; height:44px; border-radius:50%; object-fit:contain; background: var(--paper-deep);
  padding:7px; margin-bottom:12px; display:block;
}
.team-card__badge{
  width:44px; height:44px; border-radius:50%; margin-bottom:12px;
  display:flex; align-items:center; justify-content:center;
  background: var(--brand); color:#fff; font-family: var(--f-display); font-size:18px; font-weight:700;
}
.team-card h3{ font-size:17px; color: var(--brand-deep); margin-bottom:6px; }
.team-card p{ font-size:13.5px; color: var(--ink-soft); margin:0; }

/* ---------- hoja de ruta ---------- */
.roadmap{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:0; max-width: 720px; }
.roadmap li{
  display:grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items:center;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.roadmap li:first-child{ border-top: 1px solid var(--line); }
.roadmap .fecha{ font-family: var(--f-display); font-weight:600; color: var(--brand); font-size:15px; }
.roadmap .hito{ font-size:14.5px; color: var(--ink); }
.roadmap .estado{
  font-size:11.5px; font-weight:600; padding:3px 10px; border-radius:20px; white-space:nowrap;
  background:#EEE; color:#666;
}
.roadmap .estado.en-curso{ background:#FCEFD9; color:#9A6A16; }
.roadmap .estado.pendiente{ background:#E7ECEA; color:#5C6B67; }
.roadmap .estado.finalizado{ background:#E1F0E5; color:#1B7A3D; }
.roadmap .estado.finalizada{ background:#E1F0E5; color:#1B7A3D; }
.roadmap .estado.completado{ background:#E1F0E5; color:#1B7A3D; }

/* ---------- clima ---------- */
.section--weather{ background: var(--brand-deep); color:#E7EEF0; }
.section--weather .section__head h2{ color:#fff; }
.section--weather .section__lead{ color:#AFC3C9; }
.weather-strip{
  display:grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
}
.weather-day{
  background: rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.15);
  border-radius: var(--radius); padding: 16px 10px; text-align:center;
}
.weather-day .dow{ font-family: var(--f-display); font-size:15px; letter-spacing:.4px; margin-bottom:6px; }
.weather-day .ic{ font-size:26px; margin:6px 0; }
.weather-day .temps{ font-size:14px; font-weight:600; }
.weather-day .temps .min{ color:#9FB6BC; font-weight:400; }
.weather-day .rain{ font-size:12px; color:#8FC3D6; margin-top:4px; }
.weather-status{ text-align:center; color:#AFC3C9; padding: 20px 0; }

/* ---------- tabla operativa de clima (lluvia + viento + humedad + riesgo) ---------- */
.weather-table-wrap{ margin-top: 28px; }
.weather-table-scroll{ overflow-x:auto; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.14); }
.weather-table{ width:100%; border-collapse:collapse; min-width: 520px; background: rgba(255,255,255,.03); }
.weather-table th{
  text-align:left; font-family: var(--f-display); font-weight:600; letter-spacing:.3px;
  font-size: 13px; color:#AFC3C9; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.14);
}
.weather-table td{ padding: 12px 14px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,.08); white-space:nowrap; }
.weather-table tr:last-child td{ border-bottom:none; }
.wt-dia{ font-family: var(--f-display); font-weight:600; font-size:15px; }
.wt-dow{ display:block; font-family: var(--f-body); font-weight:400; font-size:11.5px; color:#8FA6AC; text-transform:capitalize; }
.wt-sub{ display:block; font-size:11px; color:#8FA6AC; }
.wt-badge{
  display:inline-flex; align-items:center; gap:5px; padding: 4px 10px; border-radius:20px;
  font-size:12px; font-weight:700; letter-spacing:.3px;
}
.wt-badge--normal{ background: rgba(27,122,61,.22); color:#5FD98A; }
.wt-badge--moderado{ background: rgba(232,163,61,.22); color:#F0B85C; }
.wt-badge--alto{ background: rgba(192,57,43,.25); color:#F08477; }
.weather-table-note{ font-size:12px; color:#7C939A; margin: 10px 2px 0; }

.weather-actions{
  display:flex; align-items:center; justify-content:center; gap:16px; flex-wrap:wrap; margin-top:22px;
}
.btn--sm{ padding: 8px 16px; font-size: 13px; }
.weather-updated{ text-align:center; font-size:12px; color:#7C939A; margin:0; }
.weather-satellite-link{ text-align:center; font-size:13px; color:#AFC3C9; margin-top:16px; }
.weather-satellite-link a{ color:#8FC3D6; text-decoration:underline; text-underline-offset:2px; }

/* ---------- hora a hora de HOY ---------- */
.weather-hourly{ margin-top: 22px; }
.weather-hourly h3{
  font-family: var(--f-display); font-size:16px; color:#fff; margin: 0 0 10px; font-weight:600;
}
.weather-hourly-strip{
  display:flex; gap:10px; overflow-x:auto; padding-bottom:6px; scroll-snap-type: x proximity;
}
.weather-hour{
  flex: 0 0 68px; scroll-snap-align:start; text-align:center;
  background: rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.15);
  border-radius: var(--radius); padding: 10px 6px;
}
.weather-hour .hh{ font-size:12px; color:#AFC3C9; margin-bottom:4px; }
.weather-hour .ic{ font-size:20px; }
.weather-hour .temp{ font-size:13px; font-weight:600; margin-top:2px; }
.weather-hour .rain{ font-size:10.5px; color:#8FC3D6; margin-top:2px; }

/* ---------- fuente / confiabilidad de los datos ---------- */
.weather-source{
  font-size:12px; color:#8FA6AC; text-align:center; max-width:64ch; margin: 18px auto 0; line-height:1.6;
}
.weather-source a{ color:#8FC3D6; text-decoration:underline; text-underline-offset:2px; }
.weather-source strong{ color:#F0B85C; }

@media (max-width:600px){
  .weather-table{ min-width: 460px; }
}

/* Debajo de ~560px, la tabla de scroll horizontal se reemplaza por
   tarjetas apiladas: cada <tr> pasa a ser un bloque, y cada <td> se
   etiqueta con su columna (usando el atributo data-th que pone
   weather.js). Es el patrón estándar para "tablas responsivas" y
   evita depender de que alguien note que puede scrollear al costado. */
@media (max-width:560px){
  .weather-table-scroll{ overflow-x:visible; border:none; }
  .weather-table{ min-width:0; display:block; background:transparent; }
  .weather-table thead{ display:none; }
  .weather-table tbody{ display:flex; flex-direction:column; gap:10px; }
  .weather-table tr{
    display:grid; grid-template-columns: 1fr 1fr; gap:6px 10px;
    background: rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.15);
    border-radius: var(--radius); padding:12px 14px;
  }
  .weather-table td{ border:none; padding:0; white-space:normal; }
  .weather-table td.wt-dia{ grid-column: 1/-1; padding-bottom:4px; border-bottom:1px solid rgba(255,255,255,.12); margin-bottom:4px; }
  .weather-table td[data-th]::before{
    content: attr(data-th); display:block; font-size:10.5px; color:#8FA6AC; margin-bottom:2px;
  }
}

/* ---------- foto dentro del popup del mapa ---------- */
.map-popup__foto{
  margin-top:8px; cursor:pointer; border-radius: var(--radius); overflow:hidden; position:relative;
}
.map-popup__foto img{ width:100%; max-height:110px; object-fit:cover; display:block; }
.map-popup__foto-hint{
  position:absolute; right:6px; bottom:6px; background:rgba(16,27,34,.75); color:#fff;
  font-size:10.5px; padding:2px 7px; border-radius:20px;
}

/* ---------- lightbox de foto ampliada (mapa) ---------- */
.coem-lightbox{
  position:fixed; inset:0; z-index:2000; background:rgba(10,16,20,.92);
  display:flex; align-items:center; justify-content:center; padding: 40px 16px;
  opacity:0; pointer-events:none; transition: opacity .15s ease;
}
.coem-lightbox.is-open{ opacity:1; pointer-events:auto; }
.coem-lightbox__figure{ margin:0; max-width:min(92vw,900px); text-align:center; }
.coem-lightbox__img{ max-width:100%; max-height:78vh; border-radius: var(--radius); display:block; margin:0 auto; }
.coem-lightbox__caption{ color:#E7EEF0; font-size:13.5px; margin-top:12px; }
.coem-lightbox__close{
  position:absolute; top:16px; right:16px; width:44px; height:44px; border-radius:50%;
  background:rgba(255,255,255,.12); color:#fff; border:1px solid rgba(255,255,255,.3);
  font-size:26px; line-height:1; cursor:pointer;
}
.coem-lightbox__close:hover{ background:rgba(255,255,255,.22); }

/* ---------- footer ---------- */
.site-footer{ background: var(--brand-deep); color:#8FA6AC; padding: 22px 0; border-top: 1px solid rgba(255,255,255,.08); }
.site-footer__inner{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; font-size:12.5px; }
.site-footer__inner strong{ color:#fff; font-family: var(--f-display); font-size:15px; }
.site-footer__inner p{ margin:2px 0 0; }
.site-footer__meta{ display:flex; flex-direction:column; align-items:flex-end; gap:4px; text-align:right; }

.footer-credit{
  display:flex; align-items:center; flex-wrap:wrap; gap:8px; text-decoration:none;
  color:#8FA6AC; font-size:12.5px; padding-top: 4px; max-width: 100%;
}
.footer-credit img{ width:20px; height:20px; border-radius:4px; flex:none; }
.footer-credit strong{ color:#6FD8C9; font-family: var(--f-display); letter-spacing:.3px; }
.footer-credit:hover strong{ text-decoration: underline; }

/* columna central del footer: logo del municipio + redes sociales */
.footer-social{ display:flex; flex-direction:column; align-items:center; gap:12px; }
.footer-social__logo{ height:38px; width:auto; display:block; }
.footer-social__icons{ display:flex; align-items:center; gap:16px; }
.footer-social__icons a{
  color:#fff; opacity:.82; display:flex; line-height:0;
  transition: opacity .2s ease, transform .2s ease;
}
.footer-social__icons a:hover{ opacity:1; transform: translateY(-2px); }
.footer-social__icons svg{ width:20px; height:20px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px){
  .hero__grid{ grid-template-columns: 1fr; }
  .weather-strip{ grid-template-columns: repeat(3, 1fr); }
  .roadmap li{ grid-template-columns: 90px 1fr; }
  .roadmap .estado{ grid-column: 2/3; justify-self:start; }
}
@media (max-width: 680px){
  .site-footer__inner{ flex-direction:column; align-items:center; text-align:center; gap:22px; }
  .site-footer__meta{ align-items:center; text-align:center; }
  .footer-credit{ justify-content:center; }
}
@media (max-width: 760px){
  .nav-toggle{ display:flex; }
  .main-nav{
    position:absolute; top:100%; left:0; right:0;
    background: var(--brand); flex-direction:column; align-items:flex-start;
    padding: 14px 24px 20px; gap: 14px;
    display:none;
    border-bottom: 3px solid var(--water);
  }
  .main-nav.is-open{ display:flex; }
  .main-nav a.nav-cta{ margin-top:4px; }
  .map-shell{ height: 480px; }
  .map-legend{ width: calc(100vw - 32px); }
  .weather-strip{ grid-template-columns: repeat(2, 1fr); }
}

/* ---------- información de contacto (dentro del hero) ---------- */
.hero__contact{ position:relative; margin-top: 44px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.16); }
.hero__contact-title{ color:#fff; font-size: 20px; margin: 0 0 16px; }
.contact-grid{ display:grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.contact-card{
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.18);
  border-top: 3px solid var(--water); border-radius: var(--radius);
  padding: 16px 14px 14px; display:flex; flex-direction:column; align-items:center; gap: 10px;
  text-align:center; backdrop-filter: blur(2px);
}
.contact-card__media{
  width: 84px; height: 72px; flex:none;
  display:flex; align-items:center; justify-content:center;
}
.contact-card__logo{ width: 100%; height: 100%; object-fit: contain; display:block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.contact-card__emoji{ font-size: 30px; line-height:1; }
.contact-card h3{ color:#fff; font-size: 15.5px; line-height:1.2; margin:0; min-height: 2.4em; display:flex; align-items:center; }
.contact-card__actions{ display:flex; gap: 10px; margin-top:auto; }
.contact-btn{
  width: 42px; height: 42px; border-radius: 50%; display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  transition: background .2s ease, transform .2s ease;
}
.contact-btn svg{ width: 20px; height: 20px; fill:#fff; }
.contact-btn:hover{ background: rgba(255,255,255,.26); transform: translateY(-2px); }
.contact-btn--wa{ background:#1F9D55; border-color:#2FBF6C; }
.contact-btn--wa:hover{ background:#25B565; }
.contact-btn:focus-visible{ outline: 2px solid #8FC3D6; outline-offset: 2px; }
@media (max-width: 1000px){ .contact-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 560px){ .contact-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } .hero{ padding-bottom: 56px; } }

/* ---------- aviso de versión nueva (PWA) ---------- */
.update-banner{
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 5000;
  max-width: 520px; margin: 0 auto; background: var(--brand-deep); color:#fff;
  border: 1px solid var(--water); border-radius: var(--radius); padding: 12px 14px;
  display:flex; align-items:center; gap: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.update-banner button{
  margin-left:auto; background: var(--water); color:#fff; border:0; border-radius: var(--radius);
  padding: 8px 14px; font-weight:600; font-family: var(--f-body); cursor:pointer;
}

/* ---------- interruptor maestro de capas ---------- */
.map-legend__tools{ display:flex; align-items:center; gap:12px; }
.legend-master{ display:flex; align-items:center; gap:7px; cursor:pointer; user-select:none; }
.legend-master__label{ font-size:12px; font-weight:600; color:#DCE9EE; }
.legend-master input{ position:absolute; opacity:0; width:0; height:0; }
.legend-master__track{
  position:relative; width:34px; height:20px; border-radius:20px; flex:none;
  background: rgba(255,255,255,.28); border:1px solid rgba(255,255,255,.5);
  transition: background .2s ease;
}
.legend-master__track::after{
  content:""; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%;
  background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.35); transition: transform .2s ease;
}
.legend-master input:checked + .legend-master__track{ background:#2FBF6C; border-color:#2FBF6C; }
.legend-master input:checked + .legend-master__track::after{ transform: translateX(14px); }
.legend-master input:focus-visible + .legend-master__track{ outline:2px solid #8FC3D6; outline-offset:2px; }
@media (prefers-reduced-motion: reduce){
  .legend-master__track, .legend-master__track::after{ transition:none; }
}

/* ==========================================================================
   v2 — REDISEÑO (mismo sistema visual que el mapa de videovigilancia)
   Se apoya en lo de arriba y lo refuerza: tipografías con más peso y contraste,
   panel de estado, referencias, mapa (agrupación, pantalla completa, leyenda),
   registro fotográfico con visor, equipo y pie de página.
   ========================================================================== */
:root{
  --ink: #0B151B;
  --ink-soft: #26353C;          /* antes #3B4B52: texto secundario con más contraste */
  --acc: #5CC8F0;               /* acento brillante (sobre fondos oscuros) */
  --acc2: #6FD8C9;              /* verde agua del crédito bootcode */
  --water-dark: #1D6E96;
  --f-head: var(--f-display);
  --radius-lg: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body{ font-size: 16px; font-weight: 500; }
h1,h2,h3{ font-weight: 700; }
.no-scroll{ overflow: hidden; }

/* ---------- tipografía y encabezados de sección ---------- */
.eyebrow{
  display:inline-flex; align-items:center; gap:10px; margin:0 0 12px;
  font: 700 12.5px var(--f-body); letter-spacing:.14em; text-transform:uppercase; color: var(--water-dark);
}
.eyebrow::before{ content:""; width:34px; height:3px; border-radius:2px; background: currentColor; }
.hero .eyebrow{ color: #7FD3F2; }
.section__head{ max-width: 760px; margin-bottom: 36px; }
.section__head h2{ font-size: clamp(32px, 4vw, 46px); font-weight:700; color: var(--brand-deep); letter-spacing:.2px; }
.section__lead{ font-size: 17.5px; font-weight: 500; color: var(--ink-soft); max-width: 62ch; }
.brand__text strong{ font-size: 21px; font-weight:700; }
.brand__text span{ color:#DCE9EE; font-weight:500; }
.main-nav a{ color:#fff; font-weight: 600; }
.status-bar{ font-weight: 500; }

/* ---------- botones ---------- */
.btn{ font-weight: 700; border-radius: 10px; }
.btn--primary{ background: linear-gradient(180deg, #3A9FD0, #2C7CA8); box-shadow: 0 8px 18px -10px rgba(46,125,166,.9); }
.btn--primary:hover{ background: linear-gradient(180deg, #4AB0E2, #338BB9); }
.btn--sm{ padding: 8px 15px; font-size: 13.5px; }
.btn--outline{ background:#fff; border:1.5px solid var(--brand); color: var(--brand-deep); cursor:pointer; font-family: var(--f-body); }
.btn--outline:hover{ background: var(--brand); color:#fff; }
.btn-mini{
  display:inline-flex; align-items:center; gap:6px; padding: 7px 13px; border:0; border-radius: 999px;
  background: var(--brand); color:#fff; font: 700 12.5px var(--f-body); cursor:pointer; text-decoration:none;
}
.btn-mini:hover{ background: var(--water-dark); }
.btn-mini svg{ width:15px; height:15px; }

/* ---------- hero ---------- */
.hero{
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(92,200,240,.22), transparent 60%),
    radial-gradient(700px 360px at 0% 110%, rgba(46,125,166,.30), transparent 60%),
    linear-gradient(180deg, var(--brand-deep) 0%, var(--brand) 100%);
}
.hero h1{ font-size: clamp(40px, 5.4vw, 68px); font-weight: 700; max-width: 15ch; }
.hero__lead{ font-size: 18.5px; font-weight: 500; color:#E3EEF2; max-width: 54ch; }

/* ---------- panel "Estado del relevamiento" ---------- */
.hero__panel{
  background: linear-gradient(160deg, rgba(255,255,255,.15), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.28); border-top: 4px solid var(--acc);
  border-radius: var(--radius-lg); padding: 24px 26px 20px; backdrop-filter: blur(6px);
  box-shadow: 0 28px 60px -32px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.25);
}
.hero__panel h2{ font-size: 20px; letter-spacing:.3px; margin-bottom: 14px; }
.rel-total{ display:flex; justify-content:space-between; align-items:flex-end; gap:14px; margin: 4px 0 16px; }
.rel-total__big{ font: 700 78px/.9 var(--f-display); color:#fff; display:block; text-shadow: 0 4px 24px rgba(92,200,240,.35); }
.rel-total__cap{ color:#D9E8ED; font-size: 14.5px; font-weight: 600; }
.rel-total__pct{
  display:grid; justify-items:center; gap:2px; padding: 8px 14px; border-radius: 12px;
  background: rgba(52,210,123,.16); border: 1px solid rgba(52,210,123,.55);
  color:#C3F7DA; font: 700 11.5px var(--f-body); letter-spacing:.07em; text-transform:uppercase;
}
.rel-total__pct b{ font: 700 30px/1 var(--f-display); color:#fff; letter-spacing:0; }
.seg-bar{ display:flex; gap:3px; height:14px; border-radius:8px; overflow:hidden; background: rgba(255,255,255,.14); margin-bottom: 12px; }
.seg{ display:block; min-width:6px; }
.rel-list{ list-style:none; margin:0 0 14px; padding:0; }
.rel-list li{ display:grid; grid-template-columns: 14px 1fr auto 44px; gap:10px; align-items:center; padding: 10px 0; border-top: 1px solid rgba(255,255,255,.16); }
.rel-list li:first-child{ border-top:0; }
.rel-list .dot{ width:12px; height:12px; border-radius:4px; }
.rel-list .lbl{ font-size: 15px; font-weight: 600; color:#fff; }
.rel-list .num{ font: 700 28px/1 var(--f-display); color:#fff; }
.rel-list .pct{ color:#CFE0E5; font-size: 13px; font-weight:600; text-align:right; }
.rel-mini{ display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; margin-bottom: 14px; }
.rel-mini__item{
  display:grid; justify-items:start; gap:2px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  font-size: 12px; font-weight:600; color:#D9E8ED; line-height:1.25;
}
.rel-mini__ic svg{ width:18px; height:18px; color: var(--acc); }
.rel-mini__item b{ font: 700 28px/1 var(--f-display); color:#fff; }
.hero__note{ color:#C4D6DC; font-size: 12.5px; }

/* ---------- referencias del mapa ---------- */
.refs{ display:grid; grid-template-columns: minmax(290px, 380px) 1fr; gap: 30px; align-items:start; }
.refs-info{
  position: sticky; top: 92px; color:#fff; border-radius: var(--radius-lg); padding: 24px 24px 22px;
  background: linear-gradient(160deg, var(--brand-deep), var(--brand)); border-top: 5px solid var(--c, var(--water));
  box-shadow: 0 24px 50px -30px rgba(16,27,34,.8);
}
.refs-info__head{ display:flex; align-items:center; gap:14px; margin-bottom: 12px; }
.refs-info__sym{ flex:none; display:grid; place-items:center; width:48px; height:48px; }
.refs-info h3{ font-size: 29px; color:#fff; margin:0; line-height:1.05; }
.refs-info__desc{ font-size: 16px; color:#E6F0F3; margin: 0 0 16px; }
.refs-info__bar{ height:8px; border-radius:6px; background: rgba(255,255,255,.2); overflow:hidden; margin-bottom: 8px; }
.refs-info__bar span{ display:block; height:100%; border-radius:6px; }
.refs-info__stat{ font-size: 14px; color:#D3E3E8; margin: 0 0 16px; }
.refs-info__stat b{ font: 700 21px var(--f-display); color:#fff; }
.refs-info__stat b.is-crit{ color:#FF8C82; }
.refs-groups{ display:grid; gap: 24px; }
.ref-group h3{ font: 700 13px var(--f-body); letter-spacing:.14em; text-transform:uppercase; color: var(--water-dark); margin: 0 0 11px; }
.ref-chips{ display:flex; flex-wrap:wrap; gap: 9px; }
.ref-chip{
  display:inline-flex; align-items:center; gap:9px; padding: 6px 8px 6px 7px; border-radius: 999px;
  border: 1.5px solid var(--line); background:#fff; color: var(--ink); cursor:pointer;
  font: 600 14.5px var(--f-body); transition: transform .15s, border-color .15s, box-shadow .15s, background .15s;
}
.ref-chip:hover{ border-color: var(--water); transform: translateY(-1px); box-shadow: 0 8px 16px -12px rgba(16,27,34,.6); }
.ref-chip__sym{ display:grid; place-items:center; width:28px; height:28px; flex:none; }
.ref-chip__n{ font: 700 13px var(--f-display); min-width: 26px; text-align:center; padding: 2px 8px; border-radius:99px; background: var(--paper-deep); color: var(--ink-soft); }
.ref-chip[aria-pressed="true"]{ background: var(--brand-deep); border-color: var(--brand-deep); color:#fff; box-shadow: 0 10px 20px -12px rgba(16,27,34,.9); }
.ref-chip[aria-pressed="true"] .ref-chip__n{ background: rgba(255,255,255,.2); color:#fff; }
.ref-line{ display:block; width: 26px; height:0; border-top: 4px solid var(--c); border-radius:2px; }
.refs-info__sym .ref-line{ width: 44px; border-top-width: 6px; }
.ref-line.is-dashed{ border-top-style: dashed; }
.ref-zone{ display:block; width:22px; height:22px; border-radius:6px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 38%, transparent); }
.refs-info__sym .ref-zone{ width:40px; height:40px; border-radius:9px; }
.ref-zone.is-outline{ background: transparent; border-style: dashed; }

/* ---------- mapa ---------- */
.map-shell{ border-bottom: 4px solid var(--brand-deep); }
.map-shell.is-fullscreen{ position:fixed; inset:0; z-index:4000; height:auto; border:0; }
.map-shell.is-fullscreen #map{ height:100%; }
.map-fs{
  position:absolute; z-index:1000; left:10px; top:96px; width:34px; height:34px; display:grid; place-items:center;
  border-radius:4px; border:2px solid rgba(0,0,0,.2); background:#fff; color:#333; padding:0; cursor:pointer; background-clip: padding-box;
}
.map-fs:hover{ background:#f4f4f4; }
.map-fs svg{ width:18px; height:18px; }
.map-baselayer{ border-radius: 10px; bottom: calc(18px + var(--safe-bottom)); }
.map-baselayer button{ padding: 10px 17px; font-weight:700; color: var(--ink); }
.map-legend{ width: 292px; border-radius: 12px; box-shadow: 0 16px 36px -18px rgba(16,27,34,.6); }
.map-legend__head{ background: linear-gradient(180deg, var(--brand), var(--brand-deep)); padding: 11px 14px; }
.map-legend__head h3{ font-size: 17px; letter-spacing:.3px; }
.map-legend__body{ max-height: min(430px, 56vh); }
.legend-row{ font-size: 14px; font-weight: 600; color: var(--ink); }
.legend-count{ font: 700 12.5px var(--f-display); background: var(--paper-deep); color: var(--ink-soft); padding: 1px 8px; border-radius: 99px; }
.legend-icon{ display:grid; place-items:center; flex:none; width:22px; height:22px; }
.legend-line{ flex:none; display:block; width: 22px; height:0; border-top: 4px solid var(--c); border-radius:2px; }
.legend-line.is-dashed{ border-top-style: dashed; }
.legend-swatch{ width:16px; height:16px; margin: 0 3px; border-radius:5px; box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.18); }
.legend-swatch.is-outline{ background: transparent !important; box-shadow:none; border: 2px dashed var(--c); }
.map-popup__foto img{ max-height: 150px; }
.map-popup__foto-hint{ display:inline-flex; align-items:center; gap:5px; font: 700 11.5px var(--f-body); padding: 4px 9px; }
.map-popup__foto-hint svg{ width:13px; height:13px; }
.map-popup__foto:focus-visible{ outline: 3px solid var(--water); outline-offset: 2px; }
.leaflet-popup-content-wrapper{ border-radius: 12px; box-shadow: 0 18px 40px -16px rgba(16,27,34,.55); }
.map-popup h4{ font-size: 19px; font-weight:700; }
.map-popup p{ font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.map-popup .estado{ font-size: 11.5px; font-weight: 700; }
/* grupos de pines (se agrupan sólo cuando se pisan) */
.coem-cluster-wrap{ background:none; border:0; }
.coem-cluster{
  display:grid; place-items:center; width:40px; height:40px; border-radius:50%; background: var(--c); color:#fff;
  border: 3px solid #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent), 0 4px 10px rgba(0,0,0,.4);
}
.coem-cluster b{ font: 700 16px var(--f-display); text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---------- registro fotográfico ---------- */
.gallery-tools{ display:grid; gap: 14px; margin-bottom: 26px; }
.gallery-search{ position:relative; max-width: 420px; }
.gallery-search svg{ position:absolute; left:13px; top:50%; transform: translateY(-50%); width:19px; height:19px; color: var(--ink-soft); pointer-events:none; }
.gallery-search input{
  width:100%; padding: 12px 14px 12px 42px; border:1.5px solid var(--line); border-radius: 12px; background:#fff;
  font: 500 15px var(--f-body); color: var(--ink);
}
.gallery-search input:focus{ outline:0; border-color: var(--water); box-shadow: 0 0 0 4px rgba(46,125,166,.18); }
.gallery-tabs{ display:flex; flex-wrap:wrap; gap:8px; margin:0; }
.gallery-tabs button{
  display:inline-flex; align-items:center; gap:8px; padding: 8px 8px 8px 15px; border-radius: 999px; border:1.5px solid var(--line);
  background:#fff; color: var(--ink); font: 600 14px var(--f-body); cursor:pointer; transition: border-color .15s, background .15s;
}
.gallery-tabs button span{ font: 700 13px var(--f-display); min-width:24px; text-align:center; padding: 1px 7px; border-radius:99px; background: var(--paper-deep); color: var(--ink-soft); }
.gallery-tabs button:hover{ border-color: var(--water); }
.gallery-tabs button.is-active{ background: var(--brand-deep); border-color: var(--brand-deep); color:#fff; }
.gallery-tabs button.is-active span{ background: var(--acc); color: var(--brand-deep); }
.gallery-summary{ margin:0; font-size: 14px; font-weight:600; color: var(--ink-soft); }
.gallery-grid{ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.gallery-card{ border-radius: 14px; display:flex; flex-direction:column; }
.gallery-card__img{
  position:relative; display:block; width:100%; padding:0; border:0; cursor: zoom-in; overflow:hidden;
  aspect-ratio: 4 / 3; background: var(--paper-deep);
}
.gallery-card__img img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; transition: transform .35s ease; }
.gallery-card__img:hover img{ transform: scale(1.05); }
.gallery-card__img.is-contain img{ object-fit: contain; background:#0E1A22; }
.gallery-card__img.is-missing img{ display:none; }
.gallery-card__placeholder{ position:absolute; inset:0; display:none; place-content:center; justify-items:center; gap:6px; color:#8A9AA1; font: 600 13px var(--f-body); }
.gallery-card__img.is-missing .gallery-card__placeholder{ display:grid; }
.gallery-card__placeholder svg{ width:38px; height:38px; }
.gallery-card__cat{
  position:absolute; left:10px; top:10px; max-width: calc(100% - 20px); padding: 5px 11px; border-radius:999px;
  background: rgba(11,21,27,.78); color:#fff; font: 700 11.5px var(--f-body); letter-spacing:.03em; backdrop-filter: blur(4px);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.gallery-card__count, .gallery-card__zoom{
  position:absolute; right:10px; bottom:10px; padding: 5px 11px; border-radius:999px;
  background: rgba(11,21,27,.78); color:#fff; font: 700 12px var(--f-body);
}
.gallery-card__zoom{ display:grid; place-items:center; width:32px; height:32px; padding:0; opacity:0; transition: opacity .2s; }
.gallery-card__zoom svg{ width:16px; height:16px; }
.gallery-card__img:hover .gallery-card__zoom, .gallery-card__img:focus-visible .gallery-card__zoom{ opacity:1; }
.gallery-card__thumbs{ display:grid; grid-template-columns: repeat(3, 1fr); gap:3px; background: var(--line); border-bottom:1px solid var(--line); }
.gallery-card__thumb{ position:relative; display:block; padding:0; border:0; aspect-ratio: 4 / 3; overflow:hidden; cursor:zoom-in; background:#CDD5DE; }
.gallery-card__thumb img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; transition: transform .3s; }
.gallery-card__thumb:hover img{ transform: scale(1.07); }
.gallery-card__thumb:focus-visible{ outline: 2px solid var(--water); outline-offset:-2px; }
.gallery-card__thumb-more{ position:absolute; inset:0; display:grid; place-items:center; background: rgba(11,21,27,.62); color:#fff; font: 700 20px var(--f-display); }
.gallery-card__body{ padding: 14px 16px 16px; display:flex; flex-direction:column; gap: 8px; flex:1; }
.gallery-card__body h4{ margin:0; font: 700 22px/1.1 var(--f-display); color: var(--brand-deep); }
.gallery-card__body p{ margin:0; font-size: 14px; color: var(--ink-soft); font-weight:500; }
.gallery-card__foot{ margin-top:auto; padding-top: 6px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.gallery-card__date{ font-size: 12.5px; font-weight: 600; color:#4A5B63; }
.gallery-empty{ grid-column: 1/-1; padding: 40px 20px; text-align:center; color: var(--ink-soft); background:#fff; border:2px dashed var(--line); border-radius: 14px; font-weight:600; }

/* ---------- articulación institucional ---------- */
#equipo{ background: radial-gradient(rgba(27,58,75,.10) 1.2px, transparent 1.3px) 0 0 / 22px 22px, var(--paper); }
.team-grid{ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.team-card{
  padding: 26px 22px 22px; border-radius: 16px; display:flex; flex-direction:column; gap: 4px;
  box-shadow: 0 1px 2px rgba(16,27,34,.05), 0 18px 34px -26px rgba(16,27,34,.45);
}
.team-card::before{ height: 5px; background: linear-gradient(90deg, var(--acc), var(--water), var(--brand)); }
.team-card__n{ position:absolute; right:16px; top:12px; font: 700 54px/1 var(--f-display); color: rgba(27,58,75,.09); }
.team-card__media{ width:72px; height:72px; margin-bottom: 14px; display:grid; place-items:center; border-radius:50%; background:#fff; border: 2px solid var(--line); box-shadow: 0 8px 18px -10px rgba(16,27,34,.5); }
.team-card__logo{ width:100%; height:100%; margin:0; padding:10px; border-radius:50%; background:#fff; object-fit:contain; }
.team-card__badge{ width:100%; height:100%; margin:0; font-size: 28px; }
.team-card h3{ font-size: 25px; font-weight:700; color: var(--brand-deep); margin: 0 0 8px; }
.team-card__tasks{ list-style:none; margin:0; padding:0; display:grid; gap: 9px; }
.team-card__tasks li{ position:relative; padding-left: 24px; font-size: 14.5px; font-weight:500; color: var(--ink-soft); line-height:1.45; }
.team-card__tasks li::before{
  content:""; position:absolute; left:0; top:3px; width:15px; height:15px; border-radius:50%;
  background: var(--water) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 11px no-repeat;
}

/* ---------- visor de fotos ---------- */
.lightbox { position: fixed; inset: 0; z-index: 6000; background: rgba(6, 14, 22, .94); display: none; align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 64px calc(24px + var(--safe-bottom)); }
.lightbox.is-open { display: flex; animation: lb-in .18s ease-out; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox__figure { margin: 0; max-width: min(1100px, 100%); width: 100%; display: grid; gap: 12px; }
.lightbox__stage { display: grid; place-items: center; min-height: 40vh; }
.lightbox__img { max-width: 100%; max-height: 74vh; border-radius: 10px; box-shadow: 0 10px 50px rgba(0, 0, 0, .6); }
.lightbox__missing { color: #D6E6EB; padding: 60px 30px; border: 2px dashed rgba(255, 255, 255, .3); border-radius: 12px; font-weight: 600; }
.lightbox__img[hidden], .lightbox__missing[hidden] { display: none; }
.lightbox__caption { color: #fff; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; justify-content: center; text-align: center; }
.lightbox__caption strong { font: 600 24px var(--f-display); }
.lightbox__caption span { color: #D6E6EB; font-size: 14px; }
.lightbox__count { color: var(--acc); font-style: normal; font-weight: 700; font-size: 13px; }
.lightbox__close, .lightbox__nav { position: absolute; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(255, 255, 255, .26); }
.lightbox__close { top: calc(16px + var(--safe-top)); right: 16px; width: 46px; height: 46px; }
.lightbox__nav { top: 50%; width: 46px; height: 46px; transform: translateY(-50%); }
.lightbox__nav--prev { left: 12px; } .lightbox__nav--next { right: 12px; }
.lightbox__nav[hidden] { display: none; }
.lightbox svg { width: 24px; height: 24px; }

/* ---------- pie de página (igual al del monitoreo de cámaras) ---------- */
.site-footer{
  background: linear-gradient(180deg, var(--brand-deep), #08121F); color:#CBDADF;
  border-top: 4px solid var(--acc); padding: 38px 0 calc(30px + var(--safe-bottom));
}
.site-footer__inner{ align-items:center; gap: 28px 40px; font-size: 14px; }
.site-footer__id{ display:flex; align-items:center; gap:18px; }
.site-footer__id img{ width:72px; height:72px; object-fit:contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.45)); }
.site-footer__id strong{ display:block; font: 700 24px var(--f-display); color:#fff; }
.site-footer__id p{ margin: 2px 0 10px; font-size: 14px; color:#D6E6EB; }
.site-footer__id .footer-social__icons{ justify-content:flex-start; }
.site-footer__meta{ display:grid; justify-items:end; gap:10px; font-size: 13.5px; }
.footer-link{ color: var(--acc); font-weight:600; text-decoration:none; }
.footer-link:hover{ text-decoration: underline; }
.footer-credit{
  display:inline-flex; align-items:center; gap:10px; color:#fff; text-decoration:none; padding: 7px 14px 7px 8px;
  border-radius:999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); transition: background .15s, border-color .15s;
}
.footer-credit:hover{ background: rgba(255,255,255,.15); border-color: var(--acc2); }
.footer-credit img{ width:auto; height:30px; border-radius:6px; }
.footer-credit strong{ color: var(--acc2); font-family: var(--f-body); letter-spacing:0; }

/* ---------- responsive v2 ---------- */
@media (max-width: 960px){
  .refs{ grid-template-columns: 1fr; }
  .refs-info{ position: static; }
}
@media (max-width: 680px){
  .site-footer__inner{ flex-direction:column; text-align:center; }
  .site-footer__id{ flex-direction:column; }
  .site-footer__id .footer-social__icons{ justify-content:center; }
  .site-footer__meta{ justify-items:center; }
  .rel-total__big{ font-size: 64px; }
  .rel-mini{ grid-template-columns: repeat(3, 1fr); }
  .map-fs{ top: 90px; }
}
@media (max-width: 420px){
  .rel-mini__item{ padding: 9px 9px; font-size: 11px; }
  .gallery-grid{ grid-template-columns: 1fr; }
}


/* ==========================================================================
   v2.1 — rutas con flechitas, "ver sólo esta capa", logos del equipo
   ========================================================================== */
/* Rutas de evacuación: flechitas que parpadean despacio, una detrás de otra en el sentido
   del recorrido (el desfasaje --d sale de js/map.js). Con "Simular" parpadean más rápido. */
.ruta-flecha-wrap{ background:none; border:0; }
.ruta-flecha{
  display:block; width:100%; height:100%; cursor:pointer;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  animation: coem-parpadeo 2.6s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.ruta-flecha__rot{ display:block; width:100%; height:100%; }
.ruta-flecha__rot svg{ display:block; width:100%; height:100%; }
@keyframes coem-parpadeo{ 0%, 100%{ opacity:.2; } 50%{ opacity:1; } }
.map-shell.is-simulating .ruta-flecha{ animation-duration: 1.3s; }
@media (prefers-reduced-motion: reduce){ .ruta-flecha{ animation:none; opacity:1; } }
.legend-arrow, .ref-arrow{ flex:none; display:grid; place-items:center; width:22px; height:22px; }
.refs-info__sym .ref-arrow{ width:44px; height:44px; }
.ref-chip__sym .ref-arrow{ width:28px; height:28px; }

/* Cartel "Mostrando solo ..." */
.map-solo{
  position:absolute; z-index:1100; left:50%; top:12px; transform: translateX(-50%);
  display:flex; align-items:center; gap:12px; max-width: calc(100% - 140px);
  padding: 8px 8px 8px 16px; border-radius: 999px; color:#fff; font: 600 14px var(--f-body);
  background: rgba(15,27,45,.94); border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 12px 28px -12px rgba(0,0,0,.7); backdrop-filter: blur(6px);
}
.map-solo[hidden]{ display:none; }
.map-solo b{ color: var(--acc); font-weight:700; }
.map-solo button{
  flex:none; border:0; border-radius:999px; padding: 7px 14px; cursor:pointer;
  background: var(--acc); color: var(--brand-deep); font: 700 13px var(--f-body);
}
.map-solo button:hover{ background:#fff; }
@media (max-width: 680px){
  .map-solo{ top: auto; bottom: 70px; max-width: calc(100% - 24px); flex-wrap:wrap; justify-content:center; border-radius: 16px; padding: 10px 12px; }
}

/* Articulación institucional: el logo va en un recuadro redondeado (en el círculo se
   cortaban las puntas de los escudos) y se ve completo. */
.team-card__media{ width:84px; height:84px; border-radius:18px; padding:8px; background:#fff; border:2px solid var(--line); }
.team-card__logo{ width:100%; height:100%; padding:0; border-radius:0; object-fit:contain; background:transparent; }
.team-card__badge{ border-radius:12px; }
