/* Villa San Antonio · El vecindario (directorio de lugares cercanos)
   Usa los tokens y piezas de estilos.css (colores, tipos, .wrap, .btn, .wa, footer). */

/* ---------- Escala de letra: seis tamaños, nada por debajo de 12 px ---------- */
.pag-vecindario {
  --t-xs: .75rem;   /* 12 px · créditos, insignias, rótulos del mapa */
  --t-sm: .875rem;  /* 14 px · notas, horarios, filtros */
  --t-md: 1rem;     /* 16 px · texto */
  --t-lg: 1.15rem;  /* 18 px · nombres de lugares, minutos */
  --t-xl: 1.5rem;   /* 24 px · títulos de grupo */
  /* la display (h1, cifras, cierre) va con clamp */

  /* Un color por familia, bien distinto sobre el papel del mapa */
  --c-salud: #B5342A;
  --c-compras: #C98B10;
  --c-comer: #1F7A6C;
  --c-barrio: #2F62A8;
  --c-servicios: #3A2E24;
  background: var(--cream)
}

.c-salud, .c-farmacias, .c-laboratorios { --c: var(--c-salud) }
.c-tiendas, .c-centros, .c-ferreterias { --c: var(--c-compras) }
.c-comer { --c: var(--c-comer) }
.c-educacion, .c-fe, .c-aire { --c: var(--c-barrio) }
.c-servicios, .c-viaje { --c: var(--c-servicios) }

.v-dot {
  display: inline-block;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: var(--c, var(--olive));
  flex-shrink: 0
}

.v-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }

/* ---------- Barra superior ---------- */
.vhdr {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .85rem clamp(1rem, 5vw, 4rem);
  background: var(--cream);
  border-bottom: 1px solid var(--line)
}
.vhdr a { text-decoration: none; color: var(--espresso) }
.vhdr .brand { justify-self: center; font-family: var(--display); font-size: 1.2rem; white-space: nowrap }
.vhdr .brand i { font-style: italic; font-weight: 400 }
.vhdr-volver { justify-self: start; font-size: var(--t-sm); color: var(--ink-soft) !important; padding: .4rem 0 }
.vhdr-wa {
  justify-self: end;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff !important;
  background: var(--olive);
  padding: .7rem 1.15rem;
  border-radius: 100px;
  transition: background .2s ease, transform .16s var(--ease)
}
.vhdr-wa:active { transform: scale(.97) }

/* ---------- Apertura ---------- */
.v-intro { padding-top: clamp(2.5rem, 7vw, 5rem); padding-bottom: clamp(1.8rem, 4vw, 2.8rem) }
.v-intro h1 { font-size: clamp(3rem, 9vw, 6.2rem); line-height: .95; letter-spacing: -.03em; margin: .6rem 0 1.2rem }
.v-lead { font-size: var(--t-lg); color: var(--ink-soft); max-width: 46ch }

.v-vivo { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-top: 1.4rem; font-size: var(--t-md); color: var(--espresso) }
.v-vivo a { color: var(--olive-ink); font-weight: 500; text-decoration: none; white-space: nowrap; padding: .3rem 0 }
.v-vivo-pulso { width: 9px; height: 9px; border-radius: 50%; background: var(--olive); flex-shrink: 0 }

.v-resumen {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 2.5rem);
  margin-top: clamp(2rem, 4vw, 3rem)
}
.v-resumen li { display: flex; flex-direction: column; gap: .3rem }
.v-resumen b { font-family: var(--display); font-weight: 500; font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1; color: var(--espresso) }
.v-resumen b em { font-style: italic; font-weight: 400; font-size: .4em; color: var(--olive-ink); margin-left: .15em }
.v-resumen span { font-size: var(--t-md); color: var(--ink-soft) }

/* ---------- El barrio en fotos: la vista grande, tres lugares al lado ---------- */
.v-fotos { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: clamp(1rem, 2.5vw, 2rem); padding-bottom: clamp(2rem, 5vw, 3.5rem); align-items: start }
.v-foto { margin: 0 }
.v-foto img { width: 100%; height: auto; object-fit: cover; border-radius: var(--radio-foto); transition: transform .5s var(--ease) }
.v-foto-grande img { aspect-ratio: 3 / 2; box-shadow: 0 30px 60px -40px rgba(36, 33, 27, .6) }
.v-foto figcaption { display: flex; flex-direction: column; gap: .15rem; margin-top: .7rem }
.v-foto figcaption b { font-family: var(--display); font-weight: 500; font-size: var(--t-lg) }
.v-foto-grande figcaption b { font-size: var(--t-xl) }
.v-foto figcaption span { font-size: var(--t-sm); color: var(--ink-soft) }
.v-fotos-chicas { display: flex; flex-direction: column; gap: clamp(.9rem, 2vw, 1.3rem) }
.v-fotos-chicas .v-foto { display: grid; grid-template-columns: 44% 1fr; gap: 1rem; align-items: center }
.v-fotos-chicas .v-foto img { aspect-ratio: 4 / 3 }
.v-fotos-chicas figcaption { margin-top: 0 }
.v-cred { font-size: var(--t-xs); color: var(--ink-soft); margin-top: .25rem }
.v-cred a { color: inherit }
/* Entran escalonadas, subiendo, cuando el barrio aparece en pantalla */
.js-vivo .v-foto { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease) }
.js-vivo .v-foto.visto { opacity: 1; transform: none }

/* ---------- Buscador y filtros ---------- */
.v-explora { padding-bottom: clamp(3rem, 8vw, 6rem) }
.v-buscar { position: relative; max-width: 30rem; margin-top: .4rem }
.v-buscar svg { position: absolute; left: 1rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; pointer-events: none }
.v-buscar input {
  width: 100%;
  font: inherit;
  font-size: var(--t-md);
  color: var(--espresso);
  background: #fbf7ee;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: .8rem 1.1rem .8rem 2.8rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease
}
.v-buscar input::placeholder { color: #8f806d }
.v-buscar input:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(176, 96, 58, .18) }

.v-filtros { padding: 1rem 0 1.4rem }
.v-fam, .v-sub { display: flex; flex-wrap: wrap; gap: .5rem }
.v-sub { margin-top: .7rem; padding-left: .2rem }
.v-sub[hidden] { display: none }
.v-sub:not([hidden]) { animation: subir .25s var(--ease) }
@keyframes subir { from { opacity: 0; transform: translateY(-4px) } }

.v-f, .v-s {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 40px;
  font-family: var(--body);
  font-size: var(--t-sm);
  border-radius: 100px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .16s var(--ease)
}
.v-f { color: var(--espresso); background: var(--cream-2); border: none; padding: .5rem 1rem }
.v-f span { color: var(--ink-soft); font-variant-numeric: tabular-nums }
.v-f[aria-pressed="true"] { background: var(--espresso); color: var(--cream) }
.v-f[aria-pressed="true"] span { color: var(--olive-light) }
.v-s { color: var(--ink-soft); background: none; border: 1px solid var(--line); padding: .4rem .9rem }
.v-s span { font-variant-numeric: tabular-nums }
.v-s[aria-pressed="true"] { background: var(--cream-2); border-color: var(--espresso); color: var(--espresso) }
.v-f:active, .v-s:active { transform: scale(.97) }

/* ---------- Mapa + lista ---------- */
.v-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(1.5rem, 3vw, 2.6rem); align-items: start }
.v-mapa-wrap { position: sticky; top: 4.8rem }
.v-mapa {
  height: calc(100vh - 6.6rem);
  min-height: 420px;
  border-radius: var(--radio-foto);
  overflow: hidden;
  background: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center
}
.v-mapa-sin { max-width: 30ch; text-align: center; color: var(--ink-soft); font-size: var(--t-md); padding: 1.5rem }
.v-mapa.leaflet-container { display: block; font-family: var(--body) }

/* Leaflet + la regla global img{max-width:100%} rompen las teselas: se libera aquí */
.leaflet-container img { max-width: none !important; max-height: none !important }

/* Mapa de papel: sin los colores del mapa, para que manden la casa y los pines */
.v-mapa.papel { background: #efe4cc }
.v-mapa.papel .leaflet-tile-pane { filter: grayscale(1) sepia(.5) contrast(1.35) brightness(.97) }
.v-mapa.papel::after { content: ""; position: absolute; inset: 0; z-index: 400; pointer-events: none; box-shadow: inset 0 0 70px rgba(122, 78, 45, .26); border-radius: inherit }
.v-mapa .leaflet-control-attribution { font-size: 10px; background: rgba(243, 236, 217, .85) }
.v-mapa .leaflet-control-zoom a { color: var(--espresso) }

/* Leyenda de colores */
.v-leyenda { background: rgba(251, 247, 238, .94); border-radius: var(--radio-foto); padding: .6rem .8rem; box-shadow: 0 6px 18px -8px rgba(36, 33, 27, .35); font-family: var(--body) }
.v-leyenda ul { list-style: none; display: flex; flex-direction: column; gap: .3rem }
.v-leyenda li { display: flex; align-items: center; gap: .5rem; font-size: var(--t-xs); color: var(--espresso); white-space: nowrap }
.v-leyenda .v-dot { width: .7rem; height: .7rem; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15) }
.v-leyenda .ley-casa { width: .7rem; height: .7rem; border-radius: 3px; background: var(--olive) }

/* Pines: nacen cuando la onda los alcanza */
.pin { background: none; border: none }
.pin i {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: var(--c, var(--olive)); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  transform: scale(0); opacity: 0;
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease
}
.pin.visto i { transform: scale(1); opacity: 1 }
.pin.visto.cerca i { transform: scale(1.5) }
.pin.visto.activo i { transform: scale(1.7); box-shadow: 0 0 0 5px rgba(58, 46, 36, .18), 0 1px 4px rgba(0, 0, 0, .35) }
.anillo-km { font-family: var(--body); font-size: var(--t-xs); font-weight: 500; color: var(--espresso); background: rgba(243, 236, 217, .92); padding: .1rem .45rem; border-radius: 100px; white-space: nowrap; transform: translate(-50%, -50%); width: max-content }
.anillo-etq { opacity: 0; transition: opacity .4s ease }
.anillo-etq.visto { opacity: 1 }

/* La casa, con un latido suave (el único movimiento continuo de la página) */
.pin-casa { background: none; border: none }
.pin-casa div {
  position: relative; display: flex; align-items: center; gap: .35rem;
  background: var(--olive); color: #fff; font-family: var(--display); font-size: var(--t-md); white-space: nowrap;
  padding: .3rem .75rem .3rem .45rem; border-radius: 100px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%); width: max-content
}
.pin-casa svg { width: 18px; height: 18px; fill: #fff }
.pin-casa .latido { position: absolute; left: .6rem; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: rgba(176, 96, 58, .45); animation: latido 2.6s ease-out infinite; z-index: -1 }
@keyframes latido { 0% { transform: scale(.6); opacity: .9 } 80%, 100% { transform: scale(2.6); opacity: 0 } }

/* Camino desde la casa: se dibuja de la casa hacia el lugar */
.ruta { stroke-linecap: round }
.ruta.trazando { stroke-dasharray: 1; stroke-dashoffset: 1; animation: trazo .7s cubic-bezier(.65, 0, .35, 1) forwards }
@keyframes trazo { to { stroke-dashoffset: 0 } }

.v-mapa .leaflet-popup-content-wrapper { border-radius: var(--radio-foto); background: var(--cream); color: var(--espresso) }
.v-mapa .leaflet-popup-tip { background: var(--cream) }
.v-mapa .leaflet-popup-content { margin: .8rem 1rem; font-family: var(--body); font-size: var(--t-sm); line-height: 1.45 }
.v-mapa .leaflet-popup-content b { display: block; font-family: var(--display); font-size: var(--t-lg); font-weight: 500 }
.v-mapa .leaflet-popup-content a { color: var(--olive-ink) }

/* ---------- Lista ---------- */
.v-vacio { font-size: var(--t-md); color: var(--ink-soft); background: var(--cream-2); border-radius: var(--radio-foto); padding: 1.2rem 1.3rem; margin-bottom: 1.5rem }
.v-grupo {
  margin-bottom: 1.1rem;
  background: #fbf7ee;
  border-radius: calc(var(--radio-foto) + 4px);
  padding: 1.1rem 1.2rem .5rem;
  box-shadow: inset 4px 0 0 var(--c), 0 10px 28px -22px rgba(36, 33, 27, .45)
}
.v-grupo[hidden] { display: none }
.v-grupo h2 { display: flex; align-items: center; gap: .6rem; font-size: var(--t-xl); margin-bottom: .3rem; padding-left: .2rem }
.v-grupo h2 .v-cuenta { margin-left: auto; font-family: var(--body); font-size: var(--t-xs); font-weight: 600; color: var(--ink-soft); background: var(--cream-2); padding: .15rem .55rem; border-radius: 100px }
.v-grupo ul { list-style: none }
.lugar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: .3rem 1rem;
  padding: .75rem .6rem;
  margin: 0 -.6rem;
  border-radius: var(--radio-foto);
  transition: background .2s ease
}
.lugar[hidden] { display: none }
.lugar + .lugar { box-shadow: 0 -1px 0 rgba(217, 205, 180, .7) }
.lugar.activo { background: var(--cream-2); box-shadow: none }
.lugar.activo + .lugar { box-shadow: none }
.lg-btn { grid-row: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: left; background: none; border: none; padding: 0; cursor: pointer; color: inherit; font: inherit }
.lg-nom { font-family: var(--display); font-size: var(--t-lg); color: var(--espresso); line-height: 1.25 }
.lg-nota { font-size: var(--t-sm); color: var(--ink-soft) }
.lg-hor { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: var(--t-sm); color: var(--ink-soft); margin-top: .2rem }
.lg-est { font-size: var(--t-xs); font-weight: 600; padding: .12rem .55rem; border-radius: 100px }
.lg-est.abierto { background: #e3ead6; color: #3d5a2b }
.lg-est.pronto { background: #f3e2c4; color: #7a4f0f }
.lg-est.cerrado { background: var(--cream-3); color: var(--ink-soft) }
.lg-tel { grid-column: 1; grid-row: 2; font-size: var(--t-sm); color: var(--olive-ink); text-decoration: none; justify-self: start; padding: .2rem 0 }
.lg-km { grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: .05rem }
.lg-km b { font-family: var(--display); font-weight: 500; font-size: var(--t-lg); color: var(--olive-ink); white-space: nowrap }
.lg-km small { font-size: var(--t-xs); color: var(--ink-soft); white-space: nowrap }
.lg-ir { grid-row: 1 / span 2; display: inline-flex; align-items: center; min-height: 44px; padding: 0 .3rem; font-size: var(--t-sm); color: var(--ink-soft); text-decoration: none; white-space: nowrap }
.v-nota { font-size: var(--t-sm); color: var(--ink-soft); max-width: 52ch; margin-top: .5rem }

/* ---------- Cierre ---------- */
.v-cierre { background: var(--espresso); color: var(--cream); padding: clamp(4rem, 9vw, 7rem) 0; text-align: center }
.v-cierre h2 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); margin-bottom: 1rem; text-wrap: balance }
.v-cierre h2 i.ac { color: var(--olive-light) }
.v-cierre p { color: #d3c8b4; max-width: 46ch; margin: 0 auto 2.2rem; font-size: var(--t-lg) }
.v-cierre-acc { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem }
.v-cierre .wa svg { width: 20px; height: 20px; fill: #fff }
.v-credito { margin-top: 1rem; font-size: var(--t-xs); color: #b8ad99 }

/* ---------- Mouse: hover solo donde hay puntero fino ---------- */
@media (hover: hover) and (pointer: fine) {
  .vhdr-volver:hover { color: var(--olive-ink) !important }
  .vhdr-wa:hover { background: var(--olive-d) }
  .v-f[aria-pressed="false"]:hover { background: var(--cream-3) }
  .v-s[aria-pressed="false"]:hover { border-color: var(--stone); color: var(--espresso) }
  .lugar:hover { background: var(--cream-2) }
  .lg-ir:hover, .v-vivo a:hover, .lg-tel:hover { color: var(--olive-ink); text-decoration: underline }
  .v-foto:hover img { transform: scale(1.02) }
}

/* ---------- Celular: el mapa queda arriba, fijo, y la lista corre debajo ---------- */
@media (max-width: 820px) {
  .vhdr { grid-template-columns: auto 1fr auto }
  .vhdr .brand { font-size: 1.05rem }
  .vhdr-volver span { display: none }
  .vhdr-volver { font-size: 1.3rem; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center }
  .v-resumen { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1.6rem }

  .v-fotos { grid-template-columns: 1fr }
  .v-fotos-chicas .v-foto { grid-template-columns: 38% 1fr }

  .v-buscar { max-width: none }
  .v-filtros { padding: .8rem 0 1.1rem }
  .v-fam, .v-sub { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * clamp(1.4rem, 5vw, 4rem)); padding: 0 clamp(1.4rem, 5vw, 4rem) }
  .v-fam::-webkit-scrollbar, .v-sub::-webkit-scrollbar { display: none }
  .v-f, .v-s { flex-shrink: 0; min-height: 44px }

  .v-grid { grid-template-columns: 1fr }
  .v-mapa-wrap { top: 4.2rem; z-index: 5 }
  .v-mapa { height: 36vh; min-height: 240px }
  .v-mapa .leaflet-bar a { width: 40px; height: 40px; line-height: 40px }
  /* En celular los filtros de arriba ya explican los colores; la leyenda taparía el mapa */
  .v-leyenda { display: none }

  .lugar { grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; padding: .8rem .6rem }
  .lg-btn { grid-row: 1 / span 2 }
  .lg-tel { grid-row: 3 }
  .lg-km { grid-column: 2; grid-row: 1; justify-self: end }
  .lg-ir { grid-column: 2; grid-row: 2 / span 2; justify-self: end; padding: 0 }
}

@media (prefers-reduced-motion: reduce) {
  .pin i { transform: scale(1); opacity: 1; transition: none }
  .pin-casa .latido { display: none }
  .ruta.trazando { animation: none; stroke-dashoffset: 0 }
  .js-vivo .v-foto { opacity: 1; transform: none; transition: none }
  .v-sub:not([hidden]) { animation: none }
  .lugar, .v-f, .v-s, .v-foto img { transition: none }
}
