/* map.css — вид карты. Закон 4: ни одного hex — только var(--токены) из design/*.md
   (токены впрыскивает движок из карточек тем). Шрифты — камертон Fable: serif. */

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Georgia, 'Literata', 'Times New Roman', serif;
  color: var(--fg); background: var(--bg);
}
#app { height: 100%; display: flex; flex-direction: column; }

/* ── шапка ── */
.topbar {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 20px; letter-spacing: .01em; }
.brand b { font-weight: normal; }
.brand .dot { color: var(--cta); }
.subtitle { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.controls { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.controls label { color: var(--muted); }
select {
  font: inherit; font-size: 13px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 3px 6px;
}
.swatches { display: flex; gap: 6px; }
.swatch {
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); padding: 0; display: inline-block;
}
.swatch.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.audio-btn {
  font: inherit; font-size: 14px; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%;
  color: var(--muted); background: none; border: 1px solid var(--line);
  line-height: 1; padding: 0;
}
.audio-btn:hover { color: var(--fg); border-color: var(--accent); }
.audio-btn.on { color: var(--accent); border-color: var(--accent); }

/* ── сцена ── */
.stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

/* ── панель ── */
.panel {
  position: absolute; z-index: 1000; top: 14px; left: 14px;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 28px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: normal; }
.panel-head .hint { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }

.route-list { list-style: none; margin: 0; padding: 0; }
.route-list button {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: var(--fg); background: none;
  border: 0; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; padding: 10px 14px;
}
.route-list li:last-child button { border-bottom: 0; }
.route-list button:hover { border-left-color: var(--line); }
.route-list button.active { border-left-color: var(--accent); }
.route-list .r-title { font-size: 14px; }
.route-list .r-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.detail { padding: 0 14px 12px; }
.detail .back {
  font: inherit; cursor: pointer; color: var(--muted);
  background: none; border: 0; padding: 10px 0 2px;
}
.detail .back:hover { color: var(--accent); }
.detail h2 { margin: 2px 0 2px; font-size: 17px; font-weight: normal; }
.detail .sub { color: var(--muted); font-size: 12.5px; }
.detail .meta { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.detail .meta .sep { padding: 0 5px; color: var(--line); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.stat b { display: block; font-size: 17px; font-weight: normal; }
.stat span { color: var(--muted); font-size: 10.5px; }

.profile-wrap { margin: 4px 0 10px; }
.profile-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 5px;
}
#profReadout { font-variant-numeric: tabular-nums; }
#profSvg { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }

.btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.btn {
  font: inherit; font-size: 13px; cursor: pointer;
  color: var(--fg); background: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 12px; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--cta); color: var(--cta-fg); border-color: var(--cta); }

.desc { font-size: 13.5px; line-height: 1.55; }
.desc p { margin: 8px 0; }
.fb-note, .offline {
  color: var(--muted); font-size: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 10px; margin: 8px 0;
}
.krest { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; }
.krest a { color: var(--accent); }

/* ── блок настроек: цвета зрителя (localStorage, не в ссылке) ── */
.settings { border-top: 1px solid var(--line); padding: 6px 14px 12px; font-size: 12.5px; }
.settings summary { cursor: pointer; color: var(--muted); padding: 6px 0; list-style-position: inside; }
.settings summary:hover { color: var(--fg); }
.set-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; }
.set-row span { color: var(--muted); }
.set-row input[type=color] {
  width: 38px; height: 24px; padding: 1px 2px; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: var(--radius);
}
.settings .btn { margin-top: 4px; font-size: 12px; padding: 5px 10px; }

/* ── оффлайн-плашка над картой ── */
.offline-bar {
  position: absolute; z-index: 1000; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 12.5px; padding: 7px 12px; max-width: 90%;
}
[hidden] { display: none !important; }

/* ── маркеры на карте (divIcon); капля — приём из демо ChatGPT ── */
.pin {
  width: 20px; height: 20px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid var(--trail-casing); background: var(--trail);
}
.pin.finish { background: var(--trail-casing); border-color: var(--trail); }
.km-chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 10px; font-family: Georgia, serif;
  width: 18px; height: 18px; line-height: 16px; text-align: center;
}
.walker {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--dot, var(--trail)); border: 2px solid var(--trail-casing);
}
.dot-picks-row { display: flex; gap: 9px; align-items: center; margin: 2px 0 10px; }
.dot-pick {
  width: 14px; height: 14px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); padding: 0;
}
.dot-pick.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.leaflet-container { font-family: Georgia, serif; }
/* браузерная рамка фокуса вокруг bbox трека после клика — не нужна */
path.leaflet-interactive:focus, .leaflet-marker-icon:focus { outline: none; }

/* ── точки-POI: яркие, с номером по порядку маршрута (слово владельца) ── */
.poi-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--poi); border: 2px solid var(--trail-casing);
  color: var(--trail-casing);
  font-family: Georgia, serif; font-size: 11px; font-weight: bold;
  line-height: 16px; text-align: center;
  cursor: pointer;
}
.poi-dot:hover { box-shadow: 0 0 0 2px var(--trail-casing); }

/* прогрессия по зуму (слово владельца: дальше — тоньше и меньше,
   как на Google Maps; вблизи — крупнее и подробнее) */
.z-far .poi-dot { transform: scale(0.55); }
.z-mid .poi-dot { transform: scale(0.8); }
.z-far .pin { transform: rotate(-45deg) scale(0.65); }
.z-mid .pin { transform: rotate(-45deg) scale(0.85); }
.z-far .walker { transform: scale(0.7); }

/* всплывающая карточка точки — в тонах темы */
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: none; font-family: Georgia, serif;
}
.leaflet-popup-tip { background: var(--surface); border: 1px solid var(--line); }
.poi-pop { font-size: 13px; line-height: 1.5; }
.poi-pop b { display: block; font-size: 14px; font-weight: normal; margin-bottom: 4px; }
.poi-pop p { margin: 4px 0; }
.poi-pop a { color: var(--accent); }
.poi-pop .poi-photo { max-width: 100%; border-radius: var(--radius); margin-top: 6px; display: block; }

/* ── мобильный: панель снизу ── */
@media (max-width: 700px) {
  .panel { top: auto; bottom: 10px; left: 10px; width: calc(100% - 20px); max-height: 55%; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand { font-size: 17px; }
  .offline-bar { bottom: auto; top: 10px; }
}
