/* =====================================================================
   PROPUESTA v2 · 100 Rutas GRVL · se carga DESPUÉS de style.css
   <link rel="stylesheet" href="css/proposal.css">
   Parche por capas: style.css no se toca; quitar la línea = diseño actual.
   Sin tema oscuro. Escritorio y móvil con tamaños de marcador distintos.
   ===================================================================== */

/* ---------- 1 · tokens y contraste ---------- */
:root {
  --bg: #f6f3ec;
  --surface: #fffdf9;
  --surface-raised: #ffffff;
  --ink: #1f1c17;
  --muted: #5f594f;
  --line: #ddd6c8;
  --border-strong: #857d70;
  --circ: #b8481a;
  --lin: #17627e;
  --race: #7b3f9e;
  --sr: #2a7147;
  --on-route: #ffffff;
  --focus: #17627e;
  --lvl1-fg: #1f6b2a; --lvl1-bg: #e4f1e1;
  --lvl2-fg: #7d5600; --lvl2-bg: #fbf0cc;
  --lvl3-fg: #a8301f; --lvl3-bg: #f8ddd7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 28, 23, .10), 0 8px 24px rgba(31, 28, 23, .16);
  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* niveles de dificultad: contraste ≥ 5:1 */
.stat.lvl-1 { background: var(--lvl1-bg); } .stat.lvl-1 .stat-v { color: var(--lvl1-fg); }
.stat.lvl-2 { background: var(--lvl2-bg); } .stat.lvl-2 .stat-v { color: var(--lvl2-fg); }
.stat.lvl-3 { background: var(--lvl3-bg); } .stat.lvl-3 .stat-v { color: var(--lvl3-fg); }
.f-dot.lvl-1 { background: var(--lvl1-fg); } .f-dot.lvl-2 { background: var(--lvl2-fg); } .f-dot.lvl-3 { background: var(--lvl3-fg); }
.stat { border-radius: 12px; padding: 12px 14px; }
.stat-l { letter-spacing: .2px; }

/* texto de la interfaz: mínimo 12px (los números de marcador son la única excepción) */
.chip, .f-group h3, .p-section h3, .stat-l, .filter-count, .route-tip .tt-hint,
.legend, .pinned-ctl, .btn-sm, .f-opt, .f-foot, .f-clear, .muted { font-size: 12px; }
.kv, .highlights, .links, .pin-switch, .version .v-name, .notice { font-size: 14px; }
.about { font-size: 15px; line-height: 1.6; }
.kv { grid-template-columns: 96px 1fr; gap: 8px 12px; }

/* controles con borde visible y foco visible */
.search input, .filter-btn, .f-opt, .btn.ghost, .pinned-ctl, .legend-btn { border-color: var(--border-strong); }
.search input, .filter-btn { border-radius: 12px; background: var(--surface-raised); }
.f-opt { padding: 6px 12px; font-weight: 500; }
button:focus-visible, a:focus-visible, input:focus-visible, .f-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.search input:focus { outline: 2px solid var(--focus); background: var(--surface-raised); }
.chip.surface, .chip.race, .chip.sr, .v-name .chip, .filter-count { color: var(--on-route); }
.btn { border-radius: 12px; padding: 11px 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- 2 · identidad de la cabecera ---------- */
.brand h1 { text-transform: none; font-size: 22px; letter-spacing: 0; }
#route-total {
  display: inline-block; margin-right: 6px; padding: 1px 9px 2px;
  border-radius: 999px; background: var(--circ); color: var(--on-route);
}
.p-title { text-transform: none; }

/* ---------- 3 · controles del mapa (zoom y capas de Leaflet) ---------- */
.leaflet-bar, .leaflet-control-layers {
  border: none !important; border-radius: 12px !important;
  box-shadow: var(--shadow) !important; overflow: hidden;
}
.leaflet-bar a { width: 36px; height: 36px; line-height: 36px; color: var(--ink); background: var(--surface); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--bg); }
.leaflet-control-layers { background: var(--surface); }
.leaflet-control-layers-toggle { width: 36px; height: 36px; }
.leaflet-control-scale-line { border-color: var(--muted); color: var(--muted); font-size: 12px; }

/* mi ubicación: botón (gris apagado, azul hueco encendido y suelto, azul relleno siguiéndote) y punto azul */
.locate-ctl a { display: flex; align-items: center; justify-content: center; }
.locate-ctl svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.locate-ctl svg circle:first-child { fill: none; }
.locate-ctl.is-on a { color: #1a73e8; }
.locate-ctl.is-following svg circle:first-child { fill: currentColor; }
.locate-ctl.is-searching svg { animation: locate-blink 1s ease-in-out infinite; }
@keyframes locate-blink { 50% { opacity: .3; } }
path.my-dot { fill: #1a73e8; fill-opacity: 1; stroke: #fff; stroke-width: 3; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
path.my-acc { fill: #1a73e8; fill-opacity: .12; stroke: #1a73e8; stroke-opacity: .35; stroke-width: 1; }

/* ---------- 4 · marcadores: ESCRITORIO (ratón y pantalla ancha) ---------- */
/* app.js fija iconSize 20: el margen negativo mantiene el centro exacto */
@media (pointer: fine) and (min-width: 761px) {
  .rm { width: 22px; height: 22px; margin: -1px; font-size: 10px; letter-spacing: -.2px; border-width: 2px; border-color: var(--surface); }
  .rm.n3 { width: 24px; height: 24px; margin: -2px; font-size: 9px; letter-spacing: -.4px; }
  .rm.race { width: 18px; height: 18px; margin: 1px; border-radius: 3px; font-size: 9px; }
  .rm.race.n3 { font-size: 8.5px; }
  .rm.camino { width: 26px; height: 26px; margin: -3px; font-size: 10px; }
  .rm.sr { width: 28px; height: 28px; margin: -4px; font-size: 9.5px; }
  .leaflet-tooltip.cap-label { font-size: 12px; }
}

/* ---------- 4b · marcadores: MÓVIL (mismo tamaño que hoy: con 134 puntos no caben más grandes) ---------- */
@media (pointer: coarse), (max-width: 760px) {
  .rm { font-size: 10px; border-color: var(--surface); }        /* antes 9px */
  .rm.n3 { font-size: 9px; letter-spacing: -.5px; }               /* antes 7,5px */
  .rm.race { font-size: 9px; } .rm.race.n3, .rm.sr.n3 { font-size: 8px; }
  .rm.sr, .rm.camino { font-size: 9px; }
  .rm::after { content: ''; position: absolute; inset: -4px; }    /* área táctil +4px sin agrandar el dibujo */
  .filter-btn, .search input, .legend-btn, .panel-close { min-height: 44px; }
  .panel-close { min-width: 44px; }
  .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
}
.rm { position: relative; }
.rm.notrack { background: var(--surface); color: var(--c); }
.rm.is-selected { color: var(--surface); }

/* ---------- 5 · barra y ficha flotantes ---------- */
@media (min-width: 761px) {
  :root { --topbar-h: 0px; }
  .topbar {
    position: absolute; top: 12px; left: 12px; right: 12px; height: 56px; padding: 0 16px;
    border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  }
  .leaflet-top.leaflet-left { top: 72px; }
  .filters { top: 80px; right: 12px; border-radius: 16px; }
  .panel {
    top: 80px; right: 12px; bottom: 12px; width: var(--panel-w);
    border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
    transform: translateX(calc(100% + 24px)); overflow: hidden;
  }
  body.panel-open .filters, body.panel-open .legend { right: calc(var(--panel-w) + 24px); }
  .p-num { font-size: 48px; }
  .p-title { font-size: 30px; }
  .stat-v { font-size: 28px; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 0px; }
  .topbar {
    position: absolute; top: 8px; left: 8px; right: 8px; height: 52px;
    border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  }
  .brand h1 { font-size: 16px; line-height: 1.05; }
  #route-total { padding: 0 7px 1px; }
  .leaflet-top.leaflet-left { top: 68px; }
  .filters { top: 68px; }
  .panel { border-radius: 24px 24px 0 0; }
  .p-title { font-size: 26px; }
}
.leaflet-tooltip.route-tip, .legend, .pinned-ctl { border-radius: 12px; }
.legend, .legend-btn { background: var(--surface); }
