/* flagmap — картата пълни екрана, целият интерфейс плува над нея. */

:root {
  --bg: #ffffff;
  --fg: #101418;
  --muted: #5b6672;
  --line: rgba(16, 20, 24, .12);
  --card: rgba(255, 255, 255, .92);
  --accent: #0f6fd6;
  --accent-fg: #ffffff;
  --shadow: 0 6px 28px rgba(16, 20, 24, .16);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --fg: #eef2f6;
    --muted: #9aa6b2;
    --line: rgba(238, 242, 246, .16);
    --card: rgba(18, 23, 28, .9);
    --accent: #4da3ff;
    --accent-fg: #06121f;
    --shadow: 0 6px 28px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}

#map { position: absolute; inset: 0; }

/* ── Меню ─────────────────────────────────────────────────────────────────── */

.panel {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 10;
  width: min(320px, calc(100vw - 24px));
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 12px 14px;
}

.panel__title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  flex: 1;
}

.panel__dot { color: var(--muted); margin: 0 6px; }
.panel__city { font-weight: 450; color: var(--muted); }

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 16px; line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { color: var(--fg); }

.panel__body { padding: 0 14px 14px; }
.panel[data-collapsed="true"] .panel__body { display: none; }

.panel__lede {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.field { margin-bottom: 14px; }

.field__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.field__hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.segmented--3 { grid-template-columns: repeat(3, 1fr); }

.segmented button {
  appearance: none;
  border: 0;
  border-radius: 7px;
  padding: 7px 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.panel__stat { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.panel__stat strong { color: var(--fg); font-size: 15px; }

.panel__foot {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}
.panel__foot a { color: inherit; }

/* ── Лента за състояние ───────────────────────────────────────────────────── */

.status {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  transition: opacity .25s;
}
.status[hidden] { display: none; }
.status--error { color: #d33; }

/* ── Popup ────────────────────────────────────────────────────────────────── */

.maplibregl-popup-content {
  padding: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button {
  color: var(--muted);
  font-size: 20px;
  padding: 2px 8px;
}

.pop { width: 268px; padding: 14px; }

.pop__street {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Паметникът се различава от улицата още от заглавния ред на popup-а. */
.pop__street--mon { color: var(--accent); }

.pop__who { display: flex; gap: 10px; align-items: center; }

.pop__flag {
  width: 40px; height: 27px;
  border-radius: 4px;
  border: 1px solid var(--line);
  object-fit: cover;
  flex: none;
  background: var(--line);
}

.pop__flag--round { width: 32px; height: 32px; border-radius: 50%; }

.pop__name { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.25; }
.pop__years { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.pop__row { margin: 10px 0 0; font-size: 13px; }
.pop__row span { color: var(--muted); }

.pop__links { margin-top: 12px; display: flex; gap: 10px; font-size: 13px; }
.pop__links a { color: var(--accent); text-decoration: none; }
.pop__links a:hover { text-decoration: underline; }

.pop__note {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
}

/* Атрибуцията на MapLibre не бива да спори с менюто. */
.maplibregl-ctrl-bottom-right { z-index: 5; }

@media (max-width: 560px) {
  .panel { width: calc(100vw - 24px); }
  .pop { width: min(268px, 72vw); }
}
