:root {
  --fondo: #EEE9DF;
  --superficie: #FFFDF9;
  --superficie-2: #F4EFE6;
  --superficie-3: #EAE4D8;
  --tinta: #1C1A17;
  --tinta-2: #5B544A;
  --tinta-3: #857D71;
  --linea: rgba(28, 26, 23, .09);
  --boton: #1C1A17;
  --boton-texto: #FFFDF9;
  --sombra: 0 18px 40px rgba(46, 34, 14, .16), 0 3px 10px rgba(46, 34, 14, .08);
  --sombra-chica: 0 6px 16px rgba(46, 34, 14, .14), 0 1px 3px rgba(46, 34, 14, .10);
  --urgencia: #D92D2D;
  --resorte: cubic-bezier(.22, 1, .36, 1);
  --ancho-panel: 404px;
  --f: "Poppins", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 400 15px/1.45 var(--f);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.ico { width: 1em; height: 1em; fill: currentColor; flex: none; display: block; }

.mapa { position: fixed; inset: 0; }
.maplibregl-canvas:focus { outline: none; }
.maplibregl-ctrl-attrib { font: 400 12px/1.4 var(--f) !important; }
.maplibregl-ctrl-bottom-right { bottom: var(--alto-visible, 200px); transition: bottom .5s var(--resorte); }

/* ---------- cabecera ---------- */
.cabecera {
  position: fixed;
  z-index: 5;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 0 10px;
  pointer-events: none;
}
.cabecera > * { pointer-events: auto; }
.cabecera-fila {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 8px;
  background: color-mix(in srgb, var(--superficie) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-radius: 20px;
  box-shadow: var(--sombra-chica);
}
.btn-casa {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--boton);
  color: var(--boton-texto);
  font-size: 24px;
  transition: transform .2s var(--resorte);
}
.btn-casa:active { transform: scale(.94); }
.titulo {
  flex: 1;
  min-width: 0;
  font: 700 21px/1 var(--f);
  letter-spacing: .12em;
  padding-left: 4px;
}
.btn-icono {
  height: 44px; min-width: 44px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 22px;
  color: var(--tinta-2);
  background: var(--superficie-2);
  transition: transform .2s var(--resorte), background .2s;
}
.btn-icono:active { transform: scale(.94); }
.btn-idioma { padding: 0 10px 0 9px; color: var(--tinta); }
.btn-idioma-cod { font: 600 12px/1 var(--f); letter-spacing: .04em; }

.menu-idioma {
  position: absolute;
  right: 12px;
  top: calc(env(safe-area-inset-top) + 66px);
  z-index: 8;
  min-width: 200px;
  padding: 8px;
  border-radius: 18px;
  background: var(--superficie);
  box-shadow: var(--sombra);
  display: grid;
  gap: 2px;
  animation: entrar .3s var(--resorte);
}
.menu-titulo { font: 600 12px/1.2 var(--f); letter-spacing: .07em; text-transform: uppercase; color: var(--tinta-3); padding: 6px 10px 6px; }
.menu-opcion {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 44px; padding: 0 12px;
  border-radius: 12px;
  font: 500 15px/1 var(--f);
  text-align: left;
}
.menu-opcion:hover { background: var(--superficie-2); }
.menu-opcion[aria-checked="true"] { background: var(--superficie-2); font-weight: 600; }
.menu-opcion .ico { font-size: 20px; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px 4px;
  scrollbar-width: none;
  scroll-padding: 12px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  background: var(--superficie);
  box-shadow: var(--sombra-chica);
  font: 500 14px/1 var(--f);
  color: var(--tinta);
  white-space: nowrap;
  transition: background .25s, color .25s, transform .2s var(--resorte);
}
.chip .ico { font-size: 19px; color: var(--c, var(--tinta-2)); transition: color .25s; }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--c, var(--tinta)); color: var(--ct, #fff); }
.chip[aria-pressed="true"] .ico { color: var(--ct, #fff); }
.chip-todo[aria-pressed="true"] { background: var(--boton); color: var(--boton-texto); }
.chip-todo[aria-pressed="true"] .ico { color: var(--boton-texto); }
.chip-urgencia { color: var(--urgencia); font-weight: 600; }

/* ---------- controles del mapa ---------- */
.controles {
  position: fixed;
  z-index: 4;
  right: 12px;
  bottom: calc(var(--alto-visible, 200px) + 12px);
  transition: bottom .5s var(--resorte), opacity .3s;
}
body.hoja-llena .controles { opacity: 0; pointer-events: none; }
.btn-flotante {
  width: 48px; height: 48px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: var(--superficie);
  color: var(--tinta);
  box-shadow: var(--sombra-chica);
  font-size: 22px;
}
.btn-flotante.activo { color: #1A73E8; }

/* ---------- hoja inferior ---------- */
.hoja {
  position: fixed;
  z-index: 6;
  left: 0; right: 0; bottom: 0;
  height: var(--alto-hoja, 80vh);
  display: flex;
  flex-direction: column;
  background: var(--superficie);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 40px rgba(46, 34, 14, .14), 0 -1px 0 var(--linea);
  transform: translate3d(0, var(--hoja-y, 60vh), 0);
  transition: transform .55s var(--resorte);
  will-change: transform;
  touch-action: none;
}
.hoja.arrastrando { transition: none; }
.hoja-agarre { flex: none; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.hoja-agarre span { width: 40px; height: 5px; border-radius: 3px; background: var(--superficie-3); }
.hoja-cuerpo {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.hoja[data-estado="full"] .hoja-cuerpo { overflow-y: auto; touch-action: pan-y; }
.vista { padding: 2px 16px 28px; }
.vista.entrando { animation: entrar .42s var(--resorte); }
@keyframes entrar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* saludo y destacados */
.saludo { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 12px; row-gap: 2px; padding: 4px 2px 12px; }
.saludo h2 { font: 600 23px/1.15 var(--f); letter-spacing: -.01em; white-space: nowrap; }
.saludo p { font-size: 13px; color: var(--tinta-3); text-align: right; margin-left: auto; }
.destacados {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 0 16px 6px;
  touch-action: pan-x;
  scroll-snap-type: x mandatory;
  scroll-padding: 16px;
  scrollbar-width: none;
}
.destacados::-webkit-scrollbar { display: none; }
.destacado {
  flex: none;
  width: 236px;
  height: 104px;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 12px 14px;
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  text-align: left;
  isolation: isolate;
  transition: transform .25s var(--resorte);
}
.destacado:active { transform: scale(.97); }
.destacado-fondo { position: absolute; inset: 0; z-index: -1; }
.destacado-fondo img, .destacado-fondo svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.destacado-fondo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 20%, rgba(0,0,0,.55)); }
.destacado-texto { display: grid; gap: 2px; }
.destacado-titulo { font: 600 16px/1.15 var(--f); }
.destacado-sub { font: 400 13px/1.25 var(--f); opacity: .92; }
.destacado .ico-grande { position: absolute; right: 10px; top: 8px; font-size: 56px; opacity: .28; }
.destacado-cat { background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 50%, #08140a)); }

/* secciones */
.seccion { margin-top: 22px; }
.seccion-titulo {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: 600 12px/1.3 var(--f);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--tinta-3);
  margin: 0 2px 8px;
}
.cat-cabeza { display: flex; align-items: center; gap: 12px; margin: 6px 2px 12px; }
.cat-cabeza .bala { width: 44px; height: 44px; font-size: 24px; }
.cat-cabeza h2 { font: 600 22px/1.15 var(--f); letter-spacing: -.01em; }
.cat-cabeza p { font-size: 13px; color: var(--tinta-3); }
.nota {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--superficie-2);
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--tinta-2);
}
.nota .ico { font-size: 22px; color: var(--cx, var(--c, var(--tinta-2))); }
.nota a { font-weight: 600; color: var(--tinta); text-decoration: underline; text-underline-offset: 3px; }
.nota strong { font-weight: 600; color: var(--tinta); }

/* emergencias */
.seccion-urgencia { margin-top: 18px; }
.seccion-urgencia .seccion-titulo { color: var(--urgencia); }
.tel-fila { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tel-chico {
  display: grid; justify-items: start; gap: 2px;
  padding: 10px 12px 11px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--c) 10%, var(--superficie));
  text-decoration: none;
  color: var(--tinta);
  transition: transform .2s var(--resorte);
}
.tel-chico:active { transform: scale(.97); }
.tel-chico .ico { font-size: 24px; color: var(--c); margin-bottom: 2px; }
.tel-chico strong { font: 700 20px/1 var(--f); }
.tel-chico span { font-size: 12px; color: var(--tinta-2); }
.enlace-urgencia {
  margin-top: 8px;
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--superficie-2);
  font: 500 14px/1.2 var(--f);
  text-align: left;
}
.enlace-urgencia > span { flex: 1; }
.enlace-urgencia .ico:first-child { font-size: 22px; color: var(--urgencia); }
.enlace-urgencia .ico:last-child { font-size: 20px; color: var(--tinta-3); }
.telefonos { display: grid; gap: 8px; }
.telefono {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--superficie-2);
  text-decoration: none;
}
.telefono .bala { width: 44px; height: 44px; font-size: 24px; }
.telefono-num { font: 700 26px/1 var(--f); margin-left: auto; }
.telefono-texto { display: grid; gap: 2px; }
.telefono-texto strong { font: 600 16px/1.2 var(--f); }
.telefono-texto span { font-size: 13px; color: var(--tinta-3); }

/* filas de lugares */
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fila {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  margin: 0 -8px;
  width: calc(100% + 16px);
  border-radius: 16px;
  text-align: left;
  transition: background .2s;
}
.fila:hover { background: var(--superficie-2); }
.fila:active { background: var(--superficie-3); }
.bala {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c);
  color: var(--ct, #fff);
  font-size: 20px;
  flex: none;
}
.fila-texto { flex: 1; min-width: 0; display: grid; gap: 1px; }
.fila-nombre { font: 600 15px/1.3 var(--f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-meta { font-size: 13px; color: var(--tinta-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-min { flex: none; display: grid; justify-items: end; font: 600 15px/1.1 var(--f); color: var(--tinta); }
.fila-min small { font: 400 12px/1.2 var(--f); color: var(--tinta-3); }

/* ficha */
.ficha-barra { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px 10px; }
.btn-texto {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px 0 8px;
  border-radius: 12px;
  font: 500 14px/1 var(--f);
  color: var(--tinta-2);
}
.btn-texto .ico { font-size: 22px; }
.btn-texto:hover { background: var(--superficie-2); }
.ficha-foto { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--superficie-2); }
.ficha-foto img { width: 100%; height: 100%; object-fit: cover; display: block; animation: aparecer .6s var(--resorte); }
@keyframes aparecer { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }
.credito { font-size: 12px; line-height: 1.35; color: var(--tinta-3); margin-top: 6px; }
.credito a { color: var(--tinta-3); }
.ficha-postal {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  min-height: 132px;
  padding: 18px;
  display: flex;
  align-items: flex-end;
  background: color-mix(in srgb, var(--c) 16%, var(--superficie));
  color: var(--cx, var(--c));
}
.ficha-postal .ico-fondo { position: absolute; right: -14px; top: -18px; font-size: 150px; opacity: .18; }
.ficha-postal-min { display: grid; gap: 2px; }
.ficha-postal-min strong { font: 700 38px/1 var(--f); letter-spacing: -.02em; color: var(--cx, var(--c)); }
.ficha-postal-min span { font-size: 14px; color: var(--tinta-2); }
.ficha-cabeza { margin-top: 16px; display: grid; gap: 8px; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; }
.etiqueta {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  border-radius: 999px;
  background: var(--superficie-2);
  font: 500 13px/1 var(--f);
  color: var(--tinta-2);
}
.etiqueta .ico { font-size: 16px; }
.etiqueta-cat { background: var(--c); color: var(--ct, #fff); }
.ficha-nombre { font: 700 27px/1.12 var(--f); letter-spacing: -.015em; }
.ficha-datos { display: grid; gap: 8px; margin-top: 14px; }
.dato { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--tinta-2); }
.dato .ico { font-size: 20px; margin-top: 1px; color: var(--tinta-3); }
.dato strong { color: var(--tinta); font-weight: 600; }
.ficha-desc { margin-top: 14px; font-size: 15.5px; line-height: 1.55; color: var(--tinta); }
.botones { display: grid; gap: 8px; margin-top: 18px; }
.boton {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px;
  border-radius: 16px;
  font: 600 15px/1 var(--f);
  text-decoration: none;
  transition: transform .2s var(--resorte), filter .2s;
}
.boton .ico { font-size: 22px; }
.boton:active { transform: scale(.98); }
.boton-principal { background: var(--boton); color: var(--boton-texto); }
.boton-secundario { background: var(--superficie-2); color: var(--tinta); }
.boton-urgencia { background: var(--urgencia); color: #fff; }

/* zona */
.zona-arte { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 9; }
.zona-arte svg, .zona-arte img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* pie */
.pie { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--linea); font-size: 12px; line-height: 1.5; color: var(--tinta-3); display: grid; gap: 6px; }
.pie a { color: var(--tinta-3); }

/* marcadores HTML */
.marca-casa { position: relative; display: grid; justify-items: center; pointer-events: auto; cursor: pointer; }
.marca-casa-pin {
  width: 34px; height: 34px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--boton);
  color: var(--boton-texto);
  font-size: 20px;
  box-shadow: 0 0 0 2.5px var(--superficie), 0 6px 16px rgba(0, 0, 0, .3);
}
.marca-casa-texto {
  position: absolute;
  top: 38px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--boton);
  color: var(--boton-texto);
  font: 600 12px/1.3 var(--f);
  white-space: nowrap;
  box-shadow: 0 0 0 2px var(--superficie);
}
.marca-casa::before {
  content: "";
  position: absolute;
  top: 17px; left: 50%;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 13px;
  background: var(--boton);
  opacity: .25;
  animation: latido 2.6s ease-out infinite;
}
@keyframes latido { 0% { transform: scale(1); opacity: .35; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
.anillo-sel { width: 56px; height: 56px; border-radius: 50%; pointer-events: none; }
.anillo-sel::before, .anillo-sel::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--c);
  animation: onda 2.2s cubic-bezier(.2, .7, .3, 1) infinite;
}
.anillo-sel::after { animation-delay: 1.1s; }
@keyframes onda { 0% { transform: scale(.95); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }
.punto-yo { width: 20px; height: 20px; border-radius: 50%; background: #1A73E8; box-shadow: 0 0 0 4px #fff, 0 2px 10px rgba(0,0,0,.35); }

/* aviso */
.aviso {
  position: fixed; z-index: 20; left: 50%; top: calc(env(safe-area-inset-top) + 130px);
  transform: translate(-50%, -10px); opacity: 0;
  padding: 10px 16px; border-radius: 14px;
  background: var(--boton); color: var(--boton-texto);
  font: 500 14px/1.3 var(--f);
  box-shadow: var(--sombra-chica);
  pointer-events: none;
  transition: opacity .3s, transform .4s var(--resorte);
  max-width: calc(100% - 32px);
  text-align: center;
}
.aviso.visible { opacity: 1; transform: translate(-50%, 0); }
.sin-js { position: fixed; inset: auto 16px 16px; padding: 16px; border-radius: 16px; background: var(--superficie); }

/* ---------- escritorio: panel lateral ---------- */
@media (min-width: 900px) {
  .cabecera { right: auto; width: var(--ancho-panel); left: 16px; top: 16px; padding: 0; }
  .cabecera-fila { margin: 0; }
  .menu-idioma { right: 0; top: 66px; }
  .chips { padding: 10px 0 4px; flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .hoja {
    left: 16px; right: auto; bottom: 16px;
    top: calc(16px + var(--alto-cabecera, 150px) + 10px);
    width: var(--ancho-panel);
    height: auto;
    border-radius: 24px;
    transform: none !important;
    box-shadow: var(--sombra);
  }
  .hoja-agarre { display: none; }
  .hoja .hoja-cuerpo { overflow-y: auto; touch-action: auto; padding-top: 10px; }
  .controles { bottom: 28px; right: 16px; }
  .maplibregl-ctrl-bottom-right { bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
