/* =====================================================================
   BRANDING — Identidad visual ATP 2025 (ATP_VisualIdentity.pdf).
   Todo el sitio sale de acá: no hay colores sueltos en el resto del CSS.
   Paleta (pág. 5 del PDF): rojo #b72a20 · naranja #fe9037 · gris #e8e8e8 · negro.
   ===================================================================== */
@font-face {
  font-family: "Bebas Neue"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../assets/fonts/bebas-neue.woff2") format("woff2"); /* SIL OFL, ver assets/fonts/OFL.txt */
}
:root {
  --brand: #b72a20;          /* rojo ATP: barra, botón "Cómo llegar", pines abiertos */
  --brand-ink: #ffffff;
  --brand-soft: #f6e5e4;     /* tinte del rojo (fila seleccionada, hover) */
  --accent: #fe9037;         /* naranja ATP: sello, detalles, "a confirmar" */
  --accent-ink: #000000;
  --bar-bg: var(--brand);
  --bar-ink: #ffffff;
  --pin-sel: #000000;        /* pin seleccionado: negro de la marca */

  --bg: #f4f4f4;             /* gris de la marca aclarado */
  --surface: #ffffff;
  --ink: #000000;
  --ink-2: #4a4a4a;
  --ink-3: #8c8c8c;
  --line: #e8e8e8;           /* gris ATP */

  --open: #1f8a3b;
  --soon: #b35a00;           /* naranja oscurecido para que se lea sobre blanco */
  --closed: #707070;
  --pin-closed: #a3a3a3;
  --pin-unknown: var(--accent);

  --r-lg: 20px;
  --r-md: 14px;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .06);
  --shadow-2: 0 2px 6px rgb(0 0 0 / .06), 0 12px 32px rgb(0 0 0 / .10);
  /* Tipografías de marca: Bebas Neue (títulos) + Helvetica (texto).
     Helvetica es de licencia paga: se usa la del sistema y, si no hay, Arial/Roboto. */
  --font-display: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --font: "Helvetica Neue", Helvetica, Arial, Roboto, system-ui, sans-serif;
  --panel-w: 400px;
  --bar-h: 64px;
  color-scheme: light;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 3000; }
.skip:focus { top: 8px; }

/* ===== Layout ===== */
.panel { display: flex; flex-direction: column; min-height: 100dvh; }
.panel > * { flex-shrink: 0; } /* que la lista no se comprima dentro del panel con alto fijo */
[tabindex="-1"]:focus { outline: none; }

@media (min-width: 900px) {
  .app {
    display: grid; height: 100dvh;
    grid-template-columns: var(--panel-w) 1fr; grid-template-rows: var(--bar-h) minmax(0, 1fr);
  }
  .appbar { grid-column: 1 / -1; }
  .panel { grid-column: 1; grid-row: 2; min-height: 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
  .app > .map-wrap { grid-column: 2; grid-row: 2; padding: 16px; min-height: 0; }
  .map-wrap .map { height: 100%; max-height: none; margin: 0; }
}

/* ===== Barra de marca + intro ===== */
.appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--bar-h); padding: env(safe-area-inset-top) 12px 0 16px;
  background: var(--bar-bg); color: var(--bar-ink);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.logo { width: 46px; height: 46px; flex-shrink: 0; margin-top: -4px; }
.brand-t {
  font-family: var(--font-display); font-size: 1.45rem; line-height: 1; letter-spacing: .03em; white-space: nowrap;
  padding-left: 12px; border-left: 2px solid rgb(255 255 255 / .45); padding-top: 3px;
}
.bar-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; flex-shrink: 0;
  border: 1px solid rgb(255 255 255 / .35); border-radius: 999px; background: rgb(255 255 255 / .12);
  color: inherit; font-family: var(--font-display); font-size: 1.1rem; letter-spacing: .04em; padding-top: 2px;
  cursor: pointer; transition: background .15s;
}
.bar-btn:hover { background: rgb(255 255 255 / .22); }
.bar-btn .ic { width: 18px; height: 18px; }
.appbar :focus-visible { outline-color: #fff; }
@media (max-width: 359px) { .brand-t { display: none; } }

.intro { position: relative; padding: 20px 16px 6px; overflow: hidden; }
/* Grilla de puntos y sello naranja: elementos gráficos de la marca */
.intro::after {
  content: "#1"; position: absolute; top: 18px; right: 16px; width: 58px; height: 58px;
  display: grid; place-items: center; padding-top: 3px;
  font-family: var(--font-display); font-size: 1.6rem; line-height: 1; color: var(--accent-ink);
  background: url("../assets/deco/sello.svg") center / contain no-repeat; transform: rotate(-12deg);
}
.intro::before {
  content: ""; position: absolute; top: 12px; right: 4px; width: 60px; height: 36px; opacity: .9;
  background: radial-gradient(circle, var(--brand) 1.6px, transparent 2px) 0 0 / 10px 10px;
}
.kicker {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display);
  font-size: 1.05rem; letter-spacing: .04em; line-height: 1; color: var(--ink);
}
.spark { width: 13px; height: 13px; fill: var(--brand); flex-shrink: 0; margin-top: -2px; }
.intro h1 {
  position: relative; z-index: 1; margin-top: 6px; font-family: var(--font-display); font-weight: 400;
  font-size: 2.7rem; line-height: .95; letter-spacing: .005em; padding-right: 72px;
}
.intro h1 .hl { color: var(--brand); }
.intro h1::after {
  content: ""; display: block; width: 48px; height: 11px; margin-top: 6px;
  background: url("../assets/deco/onda.svg") left center / contain no-repeat;
}
.intro-p { margin-top: 8px; font-size: .925rem; color: var(--ink-2); max-width: 40ch; }

/* ===== Búsqueda y filtros ===== */
.tools {
  position: sticky; top: 0; z-index: 500; padding: 6px 16px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
@media (min-width: 900px) { .tools { background: color-mix(in srgb, var(--surface) 92%, transparent); } }

.search {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-1);
}
.search:focus-within { border-color: var(--ink); }
.search-ic { color: var(--ink-3); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 1rem; color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn[aria-busy="true"] { animation: pulse 1s infinite; }
.icon-btn.is-on { color: #1a73e8; }
@keyframes pulse { 50% { opacity: .35; } }

.chips { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips-loc { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; flex-shrink: 0;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: .875rem; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-n { color: rgb(255 255 255 / .7); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-open { background: var(--open); }

/* ===== Mapa ===== */
.map-slot .map-wrap { padding: 2px 16px 0; scroll-margin-top: 112px; /* debajo del buscador fijo */ }
.map {
  height: 44vh; min-height: 280px; max-height: 520px;
  border-radius: var(--r-lg); overflow: hidden; background: #ececec;
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
  isolation: isolate; z-index: 0;
}
.map-msg { padding: 16px; color: var(--ink-2); }
/* Tiles OSM desaturados: look moderno y los pines de marca resaltan. Costo cero. */
.leaflet-tile-pane { filter: grayscale(.85) brightness(1.05) contrast(.95); }
.leaflet-container { font: inherit; background: #ececec; }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow-2) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; color: var(--ink) !important; border-color: var(--line) !important; }
@media (max-width: 899px) { .leaflet-control-zoom { display: none; } } /* en móvil: pellizcar */
/* Atribución obligatoria por licencia, en versión discreta */
.leaflet-control-attribution {
  font-size: 10px !important; line-height: 1.4; padding: 1px 6px !important; margin: 0 8px 8px 0 !important;
  border-radius: 6px; background: rgb(255 255 255 / .7) !important; color: var(--ink-3) !important;
}
.leaflet-control-attribution a { color: var(--ink-2) !important; text-decoration: none; }

.pin { background: none; border: 0; transition: opacity .2s; }
.pin svg { width: 100%; height: 100%; display: block; position: relative; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .25)); }
.pin svg path { stroke: #fff; stroke-width: 2.2; }
.pin svg circle { fill: #fff; }
.pin-open path { fill: var(--brand); }
.pin-closed path { fill: var(--pin-closed); }
.pin-unknown path { fill: var(--pin-unknown); }
/* Sin ningún horario cargado: todos "a confirmar" → rojo de marca en vez de naranja. */
.sin-horarios .pin-unknown path { fill: var(--brand); }
.pin:hover, .pin.is-hover { z-index: 3000 !important; }
.pin:hover svg, .pin.is-hover svg { transform: translateY(-3px); transition: transform .15s; }
/* Seleccionado: más grande, oscuro, con onda en la base; el resto se atenúa */
.pin.is-sel svg { filter: drop-shadow(0 6px 8px rgb(0 0 0 / .35)); }
.pin.is-sel path { fill: var(--pin-sel); stroke-width: 2; }
.pin.is-sel circle { fill: var(--accent); }
.pin-pulse {
  position: absolute; left: 50%; bottom: -7px; width: 30px; height: 14px; margin-left: -15px; border-radius: 50%;
  background: rgb(200 14 15 / .35); animation: pin-pulse 1.6s ease-out infinite;
}
@keyframes pin-pulse { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
.has-sel .pin:not(.is-sel) { opacity: .45; }
.has-sel .pin:not(.is-sel):hover, .has-sel .pin.is-hover { opacity: 1; }

/* Tooltip (hover en escritorio) y etiqueta del seleccionado */
.leaflet-tooltip.tt {
  padding: 6px 10px; border: 0; border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-2); font: inherit; font-size: .85rem; line-height: 1.3; white-space: nowrap;
}
.leaflet-tooltip.tt::before { border-top-color: var(--surface); }
.tt-n { display: block; font-family: var(--font-display); font-size: 1.1rem; letter-spacing: .03em; line-height: 1.05; }
.tt .estado { font-size: .78rem; }
.leaflet-tooltip.tt-sel {
  background: var(--pin-sel); color: #fff; font-family: var(--font-display); font-weight: 400;
  font-size: 1.15rem; letter-spacing: .03em; line-height: 1; padding: 7px 11px 5px;
}
.leaflet-tooltip.tt-sel::before { border-top-color: var(--pin-sel); }

/* Leyenda de colores de los pines */
.leyenda {
  display: flex; gap: 10px; padding: 5px 10px; border-radius: 999px; margin: 10px 0 0 10px !important;
  background: rgb(255 255 255 / .92); box-shadow: var(--shadow-1); font-size: .75rem; color: var(--ink-2);
}
.leyenda span { display: inline-flex; align-items: center; gap: 5px; }
.leyenda i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-open { background: var(--brand); }
.lg-closed { background: var(--pin-closed); }
.lg-unknown { background: var(--pin-unknown); }
.leyenda { transition: opacity .2s; }
.has-sel .leyenda { opacity: 0; pointer-events: none; }
.leaflet-container .me { fill: #1a73e8; fill-opacity: 1; stroke: #fff; }
.me-halo { fill: #1a73e8; fill-opacity: .15; stroke: none; }

/* ===== Lista ===== */
.status { padding: 16px 16px 6px; font-family: var(--font-display); font-size: 1.1rem; letter-spacing: .04em; line-height: 1; color: var(--ink-2); }
.lista { margin: 0 16px; background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--line); overflow: hidden; }
@media (min-width: 900px) { .lista { margin: 0; border: 0; border-radius: 0; } }
.lista:empty { display: none; }

.row { display: flex; align-items: center; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
.row.is-sel { background: var(--brand-soft); box-shadow: inset 4px 0 0 var(--brand); }
.row.is-sel::before, .row.is-sel + .row::before { opacity: 0; }

.row-main {
  flex: 1; min-width: 0; display: grid; gap: 2px; padding: 14px 8px 14px 16px;
  text-align: left; background: none; border: 0; cursor: pointer;
}
.row-main:hover .row-name { color: var(--brand); }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-name { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 1.4rem; line-height: 1.05; letter-spacing: .02em; padding-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dist { font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.row-dir { font-size: .875rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.estado { font-size: .875rem; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.estado.is-open { color: var(--open); }
.estado.is-soon { color: var(--soon); }
.estado.is-closed, .estado.is-unknown { color: var(--closed); }

.row-go {
  display: grid; justify-items: center; gap: 1px; margin-right: 12px; padding: 8px 10px; min-width: 52px;
  border: 0; border-radius: 12px; background: none; color: var(--brand); cursor: pointer;
  font-family: var(--font-display); font-size: .95rem; letter-spacing: .05em; line-height: 1;
}
.row-go .ic { width: 26px; height: 26px; }
.row-go:hover { background: var(--brand-soft); }

/* ===== Botones ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px;
  border-radius: 999px; border: 0; font-family: var(--font-display); font-size: 1.3rem; letter-spacing: .04em;
  padding-top: 3px; text-decoration: none; cursor: pointer;
  transition: filter .15s, background .15s;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(.92); }
.btn-soft { background: var(--bg); color: var(--ink); }
.btn-soft:hover { background: var(--line); }
.btn-block { width: 100%; }
.link-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px; font-weight: 600; color: var(--brand); cursor: pointer; }

/* ===== Hojas (dialog): bottom sheet en móvil, panel lateral en escritorio ===== */
.sheet {
  border: 0; padding: 8px 20px max(20px, env(safe-area-inset-bottom)); color: var(--ink); background: var(--surface);
  width: 100%; max-width: 100%; max-height: 88dvh; margin: auto 0 0; border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-2); overflow-y: auto; overscroll-behavior: contain;
}
.sheet[open] { animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: rgb(0 0 0 / .35); animation: fade .2s; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-grip { width: 36px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet-close { position: absolute; top: 14px; right: 12px; background: var(--bg); }

@media (min-width: 900px) {
  .sheet:not(.sheet-nav) {
    position: fixed; z-index: 1500; margin: 0; inset: var(--bar-h) auto 0 0;
    height: calc(100dvh - var(--bar-h)); max-height: none; width: var(--panel-w);
    border-radius: 0; padding: 24px; border-right: 1px solid var(--line);
  }
  .sheet:not(.sheet-nav)::backdrop { background: transparent; }
  .sheet:not(.sheet-nav)[open] { animation: sheet-in .22s cubic-bezier(.2, .8, .2, 1); }
  .sheet-nav { margin: auto; width: 380px; border-radius: 24px; padding: 20px; }
  .sheet-grip { display: none; }
}
@keyframes sheet-in { from { transform: translateX(-24px); opacity: 0; } }

.d-nombre { font-family: var(--font-display); font-weight: 400; font-size: 2.3rem; line-height: .95; letter-spacing: .01em; padding: 4px 44px 0 0; }
.d-estado { margin-top: 6px; }
.d-dir { margin-top: 2px; color: var(--ink-2); }
.d-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 18px 0 22px; }
.d-sub { display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; letter-spacing: .04em; margin-bottom: 6px; }
.d-sub::before { content: ""; width: 12px; height: 12px; background: var(--brand); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.semana li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 12px; border-radius: 10px; font-size: .925rem; }
.semana .dia { color: var(--ink-2); }
.semana .hs { text-align: right; font-variant-numeric: tabular-nums; }
.semana .is-hoy { background: var(--brand-soft); font-weight: 700; }
.semana .is-hoy .dia { color: var(--ink); }
.semana .cerrado { color: var(--ink-3); }
.d-extra { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--bg); color: var(--ink-2); font-size: .875rem; }
.d-extra a { color: var(--brand); font-weight: 600; }

.nav-t { font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; letter-spacing: .02em; line-height: 1; text-align: center; }
.nav-dest { text-align: center; color: var(--ink-2); font-size: .875rem; margin: 2px 0 14px; }
.nav-list { display: grid; gap: 8px; margin-bottom: 10px; }
.nav-opt {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); text-decoration: none; font-weight: 600; transition: background .15s;
}
.nav-opt:hover { background: var(--bg); }
.nav-opt .chev { margin-left: auto; color: var(--ink-3); }
.nav-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 1rem; }
.nav-ic-g { background: #1a73e8; }
.nav-ic-w { background: #33ccff; color: #08303f; }
.nav-ic-a { background: #000; }

/* ===== Pie ===== */
.foot { margin-top: auto; padding: 24px 16px max(24px, env(safe-area-inset-bottom)); text-align: center; display: grid; gap: 10px; justify-items: center; }
.aviso { padding: 6px 12px; border-radius: 999px; background: #fdf0cf; color: #7a4f00; font-size: .78rem; font-weight: 500; }
.fine { font-size: .75rem; color: var(--ink-3); }
.foot-logo { width: 56px; height: auto; transform: rotate(-6deg); margin-bottom: 4px; }
.ig { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: .85rem; text-decoration: none; box-shadow: var(--shadow-1); }
.ig .ic { width: 20px; height: 20px; fill: var(--brand); flex: none; }
.ig b { color: var(--brand); }
.ig:hover { background: var(--brand-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
