/* NOCTRA · Página de sucursales con mapa interactivo. Solo consume tokens de 01-base.css. */

.bx-hero { padding: clamp(32px, 6vw, 72px) 0 clamp(20px, 3vw, 32px); }
.bx-hero .nv-crumbs { margin-bottom: 18px; }
.bx-title {
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.4vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.04;
}
.bx-title em { font-style: italic; color: var(--gold); }
.bx-lead { max-width: 56ch; color: var(--muted); font-size: var(--fs-lg); }
.bx-stats { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 28px 0 0; }
.bx-stats div { display: flex; flex-direction: column-reverse; }
.bx-stats dt { color: var(--muted); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; }
.bx-stats dd { margin: 0; font-family: var(--font-display); font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ---------- Distribución ---------- */
.bx-app {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-bottom: clamp(40px, 6vw, 72px);
}
.bx-panel {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - var(--header-h) - 32px);
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.bx-search { position: relative; }
.bx-search .ico { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.bx-search input, .bx-filters select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--text);
  font-size: 16px; /* evita el zoom automático en iOS */
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.bx-search input[type="search"] { padding: 0 14px 0 40px; }
.bx-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bx-filters select { padding: 0 10px; font-size: var(--fs-sm); }
.bx-search input:focus, .bx-filters select:focus { outline: none; border-color: var(--violet-2); box-shadow: var(--ring); }
.bx-count { margin: 4px 2px 0; color: var(--muted); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; }
.bx-list { list-style: none; margin: 0 -6px; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.bx-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-md);
  transition: background-color .2s var(--ease);
}
.bx-item:hover { background: var(--surface-2); }
.bx-item[aria-current="true"] { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-violet); }
.bx-item-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); grid-row: span 2; }
.bx-item-dot.is-open { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.bx-item-dot.is-closed { background: var(--red); }
.bx-item-main { display: flex; flex-direction: column; min-width: 0; }
.bx-item-main strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-item-main small, .bx-item-meta { color: var(--muted); font-size: var(--fs-xs); }
.bx-item-meta { grid-column: 2; }
.bx-empty { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Mapa ---------- */
.bx-stage { display: grid; gap: 20px; min-width: 0; }
.bx-map {
  position: relative;
  aspect-ratio: 298 / 190;
  min-height: 300px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background:
    radial-gradient(80% 90% at 50% 40%, var(--glow-a), transparent 70%),
    var(--bg-2);
  overflow: hidden;
  isolation: isolate;
}
.bx-map svg { width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.bx-map.is-dragging svg { cursor: grabbing; }
.mx-state {
  fill: var(--surface-2);
  stroke: var(--line-strong);
  stroke-width: 1px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill .25s var(--ease), opacity .25s var(--ease);
}
.mx-state:hover { fill: var(--surface-3); }
.mx-state.has-branch { fill: color-mix(in srgb, var(--violet) 34%, var(--surface-2)); cursor: pointer; }
.mx-state.has-branch:hover { fill: color-mix(in srgb, var(--violet) 48%, var(--surface-2)); }
.mx-state.is-selected { fill: color-mix(in srgb, var(--violet) 58%, var(--surface-2)); stroke: var(--gold); }
.mx-state.is-dimmed { opacity: .45; }

.bx-marker { cursor: pointer; outline: none; }
.bx-marker-core { fill: var(--gold); stroke: var(--bg); stroke-width: .8; }
.bx-marker-halo { fill: var(--gold); opacity: .22; transform-box: fill-box; transform-origin: center; }
.bx-marker.is-selected .bx-marker-halo { opacity: .35; animation: bx-pulse 2.2s var(--ease-out) infinite; }
.bx-marker:focus-visible .bx-marker-core { stroke: var(--text); stroke-width: 1.2; }
.bx-marker.is-filtered, .bx-marker.is-clustered { display: none; }
@keyframes bx-pulse { 0% { transform: scale(.7); opacity: .45; } 100% { transform: scale(2.1); opacity: 0; } }

.bx-cluster { cursor: pointer; }
.bx-cluster circle { fill: var(--violet); stroke: var(--gold); stroke-width: .8; }
.bx-cluster text { fill: #fff; font: 700 6.5px var(--font-sans); pointer-events: none; }

.bx-zoom {
  position: absolute;
  right: 14px;
  top: 14px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  overflow: hidden;
}
.bx-zoom-btn { display: grid; place-items: center; width: 40px; height: 40px; color: var(--text); font-size: 1.25rem; line-height: 1; transition: background-color .15s var(--ease); }
.bx-zoom-btn + .bx-zoom-btn { border-top: 1px solid var(--line-soft); }
.bx-zoom-btn:hover { background: var(--surface-3); }
.bx-zoom-btn:active { transform: scale(.94); }
.bx-zoom-btn .ico { width: 18px; height: 18px; }

.bx-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--glass-strong);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.bx-legend {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.bx-legend li { display: flex; align-items: center; gap: 6px; }
.bx-legend i { width: 10px; height: 10px; border-radius: 3px; }
.bx-legend-state { background: color-mix(in srgb, var(--violet) 40%, var(--surface-2)); }
.bx-legend-pin { border-radius: 50% !important; background: var(--gold); }

/* ---------- Ficha de sucursal ---------- */
.bx-details { display: grid; gap: 16px; }
.bx-app.is-enhanced .bx-detail:not(.is-active) { display: none; }
.bx-detail {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.bx-app.is-enhanced .bx-detail.is-active { animation: bx-in .45s var(--ease-out); }
@keyframes bx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bx-detail:focus { outline: none; }
.bx-detail-media { margin: calc(clamp(18px, 3vw, 28px) * -1) calc(clamp(18px, 3vw, 28px) * -1) 0; aspect-ratio: 21 / 8; overflow: hidden; border-radius: var(--r-xl) var(--r-xl) 0 0; }
.bx-detail-media img { width: 100%; height: 100%; object-fit: cover; }
.bx-detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.bx-detail-place { color: var(--gold); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.bx-detail-head h2 { margin-top: 4px; font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 500; letter-spacing: -.02em; }
.bx-detail-copy { color: var(--text-soft); max-width: 64ch; }
.bx-facts { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 24px; }
.bx-facts li { display: flex; gap: 10px; color: var(--text-soft); font-size: var(--fs-sm); }
.bx-facts .ico { color: var(--gold); margin-top: 2px; }
.bx-facts a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.bx-facts span { display: flex; flex-direction: column; gap: 4px; }
.bx-note { color: var(--amber); font-size: var(--fs-xs); }
.bx-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.bx-chips li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); font-size: var(--fs-xs); font-weight: 600; }
.bx-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.bx-stock { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.bx-stock-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
.bx-stock-head h3 { font-size: var(--fs-base); font-weight: 700; }
.bx-stock-head span, .bx-muted { color: var(--muted); font-size: var(--fs-sm); }
.bx-stock-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.bx-stock-list a {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.bx-stock-list a:hover { background: var(--surface-3); }
.bx-stock-list a:active { transform: scale(.985); }
.bx-stock-thumb { display: grid; place-items: center; width: 44px; height: 56px; border-radius: 6px; background: var(--bg-3); color: var(--muted); overflow: hidden; }
.bx-stock-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bx-stock-name { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-sm); font-weight: 600; }
.bx-stock-name small { color: var(--muted); font-weight: 500; }
.bx-stock-price { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Servicios ---------- */
.bx-services { padding-top: 0; }
.bx-service-grid { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bx-service-grid a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.bx-service-grid a:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.bx-service-grid .ico { width: 22px; height: 22px; color: var(--gold); margin-bottom: 6px; }
.bx-service-grid small { color: var(--muted); }

/* ---------- Adaptación ---------- */
@media (max-width: 900px) {
  .bx-app { grid-template-columns: 1fr; }
  .bx-panel { position: static; max-height: none; order: 2; }
  .bx-list { max-height: 320px; }
  .bx-stage { order: 1; }
  .bx-map { aspect-ratio: 4 / 3; border-radius: var(--r-lg); }
  .bx-service-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .bx-map { aspect-ratio: 1 / 1; }
  .bx-legend { left: 10px; right: 64px; bottom: 10px; }
  .bx-service-grid { grid-template-columns: 1fr; }
  .bx-stock-list { grid-template-columns: 1fr; }
}
@media (hover: none) { .bx-zoom-btn { width: 44px; height: 44px; } }
@media (prefers-reduced-motion: reduce) {
  .bx-marker.is-selected .bx-marker-halo { animation: none; }
  .bx-app.is-enhanced .bx-detail.is-active { animation: none; }
}
.bx-leader { stroke: var(--gold); stroke-opacity: .55; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.bx-clusters { pointer-events: auto; }
.bx-cluster.is-active circle { stroke-width: 1.6; fill: color-mix(in srgb, var(--violet) 70%, var(--gold)); }
