/* Celaya Maps — Cómo llegar · eleven®  |  Mobile-first */

:root {
  --acento: #0E7C7B;
  --acento-oscuro: #0a5f5e;
  --pie: #0E7C7B;
  --auto: #2563a8;
  --bus: #E8552D;
  --tinta: #2b2b28;
  --tinta-suave: #6b665c;
  --papel: #fff;
  --hueso: #f4f1ea;
  --linea: #e5e0d6;
  --r: 14px;
  --sombra: 0 2px 16px rgba(30,28,24,.14);
  --sombra-alta: 0 -4px 28px rgba(30,28,24,.16);
  --cerrado: 10rem;
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta); background: var(--hueso);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
#mapa { position: fixed; inset: 0; }

/* Barra */
.barra {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: calc(.7rem + var(--sa-t)) 1rem .7rem;
  background: linear-gradient(180deg, rgba(244,241,234,.97), rgba(244,241,234,0));
  pointer-events: none;
}
.marca { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.02em; color: var(--acento); }
.marca span { color: var(--tinta); font-weight: 400; }
.senal {
  font-size: .75rem; font-weight: 600; color: var(--tinta-suave);
  background: rgba(255,255,255,.92); padding: .3rem .6rem;
  border-radius: 999px; box-shadow: var(--sombra); white-space: nowrap;
}
.senal.viva { color: #2f8f4e; } .senal.mala { color: var(--bus); }

/* Botón GPS */
.fab {
  position: fixed; right: 1rem; z-index: 11;
  bottom: calc(var(--cerrado) + var(--sa-b) + .9rem);
  width: 3rem; height: 3rem; display: grid; place-items: center;
  border: none; border-radius: 50%; background: var(--papel);
  box-shadow: var(--sombra); cursor: pointer;
  transition: bottom .28s cubic-bezier(.4,0,.2,1), transform .15s, background .2s;
}
.fab:active { transform: scale(.92); }
.fab svg { width: 1.375rem; height: 1.375rem; fill: var(--tinta-suave); }
.fab.activo { background: var(--acento); } .fab.activo svg { fill: #fff; }
body.abierto .fab { bottom: calc(72vh + .9rem); }
body.media .fab { bottom: calc(40vh + .9rem); }

/* Panel */
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  height: calc(var(--cerrado) + var(--sa-b)); max-height: 72vh;
  background: var(--papel); border-radius: 22px 22px 0 0;
  box-shadow: var(--sombra-alta);
  display: flex; flex-direction: column;
  transition: height .28s cubic-bezier(.4,0,.2,1);
}
.panel.abierto { height: 72vh; }
/* Con una ruta en pantalla el panel se queda a media altura: si ocupa todo,
   el mapa se queda sin espacio y la ruta completa no cabe en el encuadre. */
.panel.media { height: 40vh; }
.asa { flex: 0 0 auto; width: 100%; padding: .7rem 0 .3rem; background: none; border: none; cursor: pointer; display: grid; place-items: center; }
.asa span { display: block; width: 2.5rem; height: 4px; border-radius: 999px; background: var(--linea); }
.hoja { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: .2rem 1rem 0; }

.titulo { font-size: 1.125rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .75rem; }
.subtitulo {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--tinta-suave); margin: 1.25rem 0 .6rem;
}

/* Buscador */
.buscador { position: relative; display: flex; align-items: center; }
.lupa { position: absolute; left: .85rem; width: 1.125rem; height: 1.125rem; fill: var(--tinta-suave); pointer-events: none; }
#q {
  width: 100%; min-height: 3rem; padding: .8rem 2.5rem;
  font-family: inherit; font-size: 1rem; color: var(--tinta);
  background: var(--hueso); border: 1.5px solid transparent; border-radius: var(--r);
  outline: none; -webkit-appearance: none;
}
#q:focus { border-color: var(--acento); background: var(--papel); }
#q::placeholder { color: var(--tinta-suave); }
.limpiar {
  position: absolute; right: .5rem; width: 2rem; height: 2rem;
  display: grid; place-items: center; border: none; background: none;
  font-size: 1.5rem; line-height: 1; color: var(--tinta-suave); cursor: pointer;
}

/* Listas */
.resultados, .destinos { list-style: none; }
.resultados { margin-top: .6rem; }
.resultados li, .destinos li {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .5rem; border-bottom: 1px solid var(--linea);
  cursor: pointer; min-height: 3rem;
}
.resultados li:active, .destinos li:active { background: var(--hueso); }
.destinos li { border-bottom: none; background: var(--hueso); border-radius: var(--r); margin-bottom: .5rem; padding: .8rem; }
.pin {
  flex: 0 0 auto; width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--papel); font-size: 1.125rem; box-shadow: var(--sombra);
}
.destinos .pin { background: var(--papel); }
.resultados .pin { background: var(--hueso); box-shadow: none; }
.txt { flex: 1; min-width: 0; }
.nom { font-size: .9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat { font-size: .75rem; color: var(--tinta-suave); margin-top: .05rem; }
.dist { flex: 0 0 auto; font-size: .8125rem; font-weight: 600; color: var(--tinta-suave); font-variant-numeric: tabular-nums; }

/* Ayuda cuando no hay GPS */
.ayuda-gps {
  margin-top: .9rem; padding: .9rem 1rem;
  background: #fdf4e8; border: 1.5px solid #f0d9b5; border-radius: var(--r);
}
.ayuda-t { font-size: .9375rem; font-weight: 700; margin-bottom: .2rem; }
.ayuda-d { font-size: .8125rem; line-height: 1.45; color: var(--tinta-suave); }
.ayuda-btns { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.btn-chico {
  flex: 1 1 auto; min-height: 2.75rem; padding: .6rem .8rem;
  font-family: inherit; font-size: .875rem; font-weight: 600; color: var(--tinta);
  background: var(--papel); border: 1.5px solid var(--linea); border-radius: 10px; cursor: pointer;
}
.btn-chico.primario { background: var(--acento); color: #fff; border-color: var(--acento); }
.btn-chico:active { transform: scale(.98); }

/* Modo "elige tu punto" */
body.fijando .panel { height: calc(var(--cerrado) + var(--sa-b)); }
.mira {
  position: fixed; left: 50%; top: 42%; z-index: 13;
  transform: translate(-50%,-50%); pointer-events: none;
  width: 2.5rem; height: 2.5rem;
}
.mira::before, .mira::after {
  content:""; position:absolute; background: var(--acento);
}
.mira::before { left:50%; top:0; width:2px; height:100%; margin-left:-1px; }
.mira::after  { top:50%; left:0; height:2px; width:100%; margin-top:-1px; }
.mira span {
  position:absolute; inset:.5rem; border:2.5px solid var(--acento);
  border-radius:50%; background: rgba(255,255,255,.55);
}

/* Viaje */
.volver { background: none; border: none; font-family: inherit; font-size: .875rem; font-weight: 600; color: var(--acento); cursor: pointer; padding: .3rem 0; }
.destino-nombre { font-size: 1.1875rem; font-weight: 700; letter-spacing: -.02em; margin: .4rem 0 .9rem; }

.modos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.modo {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .7rem .3rem; min-height: 4rem;
  font-family: inherit; font-size: .75rem; font-weight: 600; color: var(--tinta-suave);
  background: var(--hueso); border: 2px solid transparent; border-radius: var(--r); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.modo .ico { font-size: 1.25rem; line-height: 1; }
.modo em { font-style: normal; font-size: .9375rem; font-weight: 700; color: var(--tinta); font-variant-numeric: tabular-nums; }
.modo.activo { border-color: var(--acento); color: var(--acento); background: var(--papel); }
.modo:disabled { opacity: .45; cursor: not-allowed; }

.resumen {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
  margin: 1rem 0 .25rem; padding: .85rem 1rem;
  background: var(--hueso); border-radius: var(--r); border-left: 4px solid var(--acento);
}
.resumen .grande { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; }
.resumen .chico { font-size: .875rem; color: var(--tinta-suave); }
.resumen.nada { border-left-color: var(--bus); font-size: .9375rem; }

.pasos { list-style: none; counter-reset: p; margin: 1rem 0 1.5rem; }
.pasos li {
  display: flex; gap: .75rem; padding: .65rem 0;
  border-bottom: 1px solid var(--linea); font-size: .9375rem;
}
.pasos li:last-child { border-bottom: none; }
.flecha { flex: 0 0 1.5rem; font-size: 1.125rem; line-height: 1.3; color: var(--acento); text-align: center; }
.paso-txt { flex: 1; }
.paso-m { color: var(--tinta-suave); font-size: .8125rem; margin-top: .1rem; }

.creditos { flex: 0 0 auto; font-size: .6875rem; color: var(--tinta-suave); text-align: center; padding: .5rem 1rem calc(.7rem + var(--sa-b)); }
.creditos a { color: inherit; }

/* Aviso */
.aviso {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  bottom: calc(var(--cerrado) + var(--sa-b) + 4.5rem);
  max-width: min(22rem, calc(100vw - 2rem));
  padding: .7rem 1.1rem; font-size: .875rem; font-weight: 500; text-align: center;
  color: #fff; background: rgba(43,43,40,.94); border-radius: 999px; box-shadow: var(--sombra);
}
body.abierto .aviso { bottom: calc(72vh + 1rem); }
body.media .aviso { bottom: calc(40vh + 1rem); }

/* Marcadores */
.yo { width: 1.125rem; height: 1.125rem; border-radius: 50%; background: var(--acento); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.3); }
.yo::after { content:""; position:absolute; inset:-.75rem; border-radius:50%; background:var(--acento); opacity:.18; animation: pulso 2.2s ease-out infinite; }
@keyframes pulso { 0%{transform:scale(.6);opacity:.3} 100%{transform:scale(1.5);opacity:0} }
.meta { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50% 50% 50% 6px; transform: rotate(-45deg); background: var(--bus); border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.meta span { transform: rotate(45deg); font-size: .9rem; }

.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { display: none; }

/* Escritorio */
@media (min-width: 768px) {
  .panel { left: 1rem; right: auto; top: 4.5rem; bottom: 1rem; width: 24rem; height: auto; max-height: none; border-radius: 22px; box-shadow: var(--sombra); }
  .panel.abierto, .panel.media { height: auto; }
  .asa { display: none; }
  .hoja { padding: 1.25rem 1.25rem 0; }
  .fab, body.abierto .fab { bottom: 1.5rem; right: 1.5rem; }
  .aviso, body.abierto .aviso { bottom: 1.5rem; left: auto; right: 1.5rem; transform: none; }
  .barra { padding-left: 1.5rem; padding-right: 1.5rem; background: none; }
  .marca { background: rgba(255,255,255,.92); padding: .35rem .8rem; border-radius: 999px; box-shadow: var(--sombra); }
}
