/* Shared look of the v2 maps (districts page, landing heatmap, CPI map).
   Colours come from the base.html tokens; every rule has a light and a dark form. */

.nm-map { position: relative; --nm-radius: clamp(10px, .8vw, 16px); }

/* lift the map off the card */
.nm-map .highcharts-series-group {
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, .16));
}
html[data-mode="dark"] .nm-map .highcharts-series-group {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .45));
}

/* smooth hover / selection changes — only once the map has finished its first
   draw (.nm-ready, set by NarxMap), otherwise the transition runs on top of
   Highcharts' own initial render and the shapes flash with thick outlines */
.nm-map.nm-ready path.highcharts-point {
  transition: fill .3s ease, opacity .3s ease, stroke .3s ease, stroke-width .3s ease;
}
.nm-map path.highcharts-point.nm-dim { opacity: .55; }
.nm-map path.highcharts-point.nm-dim:hover { opacity: .9; }

/* tooltip card */
.nm-tip {
  min-width: 150px;
  padding: 10px 12px;
  border-radius: var(--nm-radius, 12px);
  background: var(--glass-surface-strong, #fff);
  border: 1px solid var(--glass-border, #E2E8F0);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.12));
  color: var(--ink, #0F172A);
  font-family: var(--font-family-sans-serif, "Overpass", sans-serif);
  line-height: 1.25;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nm-tip {
    background: var(--glass-surface, rgba(255,255,255,.84));
    -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) saturate(var(--glass-saturate, 125%));
    backdrop-filter: blur(var(--glass-blur, 12px)) saturate(var(--glass-saturate, 125%));
  }
}
html[data-mode="dark"] .nm-tip {
  background: rgba(30, 30, 30, .94);
  border-color: rgba(255, 255, 255, .12);
  color: #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.nm-tip-name { font-weight: 700; font-size: 13px; }
.nm-tip-note { font-size: 11px; color: var(--muted, #64748B); font-style: italic; }
.nm-tip-value { font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.nm-tip-unit { font-size: 12px; font-weight: 500; color: var(--muted, #64748B); margin-left: 3px; }
.nm-tip-delta { font-size: 12px; font-weight: 600; margin-top: 2px; }
.nm-tip-delta.up   { color: #dc2626; }
.nm-tip-delta.down { color: #16a34a; }
.nm-tip-delta.flat { color: #626B7A; }
html[data-mode="dark"] .nm-tip-delta.up   { color: #f87171; }
html[data-mode="dark"] .nm-tip-delta.down { color: #4ade80; }
html[data-mode="dark"] .nm-tip-delta.flat { color: #9aa3b2; }
.nm-tip-date { font-size: 11px; color: var(--muted, #64748B); margin-top: 4px; }
html[data-mode="dark"] .nm-tip-note,
html[data-mode="dark"] .nm-tip-unit,
html[data-mode="dark"] .nm-tip-date { color: #9aa3b2; }

/* ⓘ attribution control: the OSM credit shows only on hover or keyboard focus
   (:focus-visible), never sticks after a click (map-v2.js attachAttribution) */
.nm-attr {
  /* top-left: the one corner no map uses for its legend or back button */
  position: absolute; left: 6px; top: 6px; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-family-sans-serif, "Overpass", sans-serif);
}
.nm-attr-btn {
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; cursor: pointer;
  color: var(--B6, #2D4F8A);
  background: rgba(255, 255, 255, .85);
  border: 1px solid var(--line, #E2E8F0);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.nm-attr-btn:hover, .nm-attr-btn:focus-visible {
  background: var(--B0, #EAF0FA); border-color: var(--B5, #3D6CB8); outline: none;
}
.nm-attr-btn:focus-visible { box-shadow: 0 0 0 2px var(--B5, #3D6CB8); }
html[data-mode="dark"] .nm-attr-btn {
  color: #cbd5e1; background: rgba(30, 30, 30, .85); border-color: rgba(255, 255, 255, .18);
}
html[data-mode="dark"] .nm-attr-btn:hover,
html[data-mode="dark"] .nm-attr-btn:focus-visible {
  color: #4caf50; border-color: #4caf50; background: rgba(76, 175, 80, .15);
}
.nm-attr-pop {
  display: none; white-space: nowrap; font-size: 11px; padding: 3px 8px; border-radius: 6px;
  color: var(--muted, #64748B); background: rgba(255, 255, 255, .92); border: 1px solid var(--line, #E2E8F0);
}
.nm-attr-pop a { color: var(--B6, #2D4F8A); text-decoration: underline; }
html[data-mode="dark"] .nm-attr-pop { color: #cbd5e1; background: rgba(30, 30, 30, .92); border-color: rgba(255, 255, 255, .18); }
html[data-mode="dark"] .nm-attr-pop a { color: #4caf50; }
/* focus-within: keyboard focus only — a mouse press never focuses the button
   (mousedown is cancelled in map-v2.js), so a click cannot leave it open */
.nm-attr:hover .nm-attr-pop,
.nm-attr:focus-within .nm-attr-pop { display: inline-block; }
/* touch screens have no hover: a tap shows the text the way a hover does and
   the next tap elsewhere hides it (the ODbL credit stays reachable on phones) */


/* Highcharts breadcrumb / back button: small rounded control like the site's icon buttons */
.nm-map .highcharts-breadcrumbs-button { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .nm-map path.highcharts-point, .nm-attr-btn { transition: none; }
}

/* Drill-down path pill (NarxMap.attachCrumb) — same design as the mobile app:
   top-right, back arrow, "Respublika › Region". Replaces Highcharts breadcrumbs. */
.nm-has-crumb .highcharts-breadcrumbs-group { display: none !important; }
.nm-crumb {
  position: absolute; top: 8px; right: 8px; z-index: 6;
  display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 64px);
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--line, #E2E8F0);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .08);
  color: var(--B6, #2D4F8A);
  font: 600 13px/1.2 var(--font-family-sans-serif, "Overpass", sans-serif);
  white-space: nowrap; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease, opacity .2s ease;
}
.nm-crumb[hidden] { display: none; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nm-crumb {
    background: var(--glass-surface, rgba(255, 255, 255, .84));
    -webkit-backdrop-filter: blur(var(--glass-blur, 12px)) saturate(var(--glass-saturate, 125%));
    backdrop-filter: blur(var(--glass-blur, 12px)) saturate(var(--glass-saturate, 125%));
  }
}
.nm-crumb-ico {
  flex: none; width: 22px; height: 22px; padding: 4px;
  border-radius: 50%;
  background: var(--B0, #EAF0FA); color: var(--B6, #2D4F8A);
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.nm-crumb-root { color: var(--muted, #64748B); font-weight: 500; }
.nm-crumb-sep { color: var(--muted, #64748B); opacity: .7; }
.nm-crumb-cur { color: var(--B9, #1A2B4B); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.nm-crumb:hover { border-color: var(--B5, #3D6CB8); box-shadow: 0 2px 4px rgba(15, 23, 42, .08), 0 8px 20px rgba(37, 99, 235, .12); }
.nm-crumb:hover .nm-crumb-ico { background: var(--B6, #2D4F8A); color: #fff; transform: translateX(-1px); }
.nm-crumb:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--B5, #3D6CB8); }
.nm-crumb:active { transform: scale(.98); }

html[data-mode="dark"] .nm-crumb {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(30, 30, 30, .82);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  color: #cbd5e1;
}
html[data-mode="dark"] .nm-crumb-ico { background: rgba(255, 255, 255, .08); color: #e5e7eb; }
html[data-mode="dark"] .nm-crumb-root,
html[data-mode="dark"] .nm-crumb-sep { color: #94a3b8; }
html[data-mode="dark"] .nm-crumb-cur { color: #f1f5f9; }
html[data-mode="dark"] .nm-crumb:hover { border-color: #4caf50; }
html[data-mode="dark"] .nm-crumb:hover .nm-crumb-ico { background: #4caf50; color: #fff; }
html[data-mode="dark"] .nm-crumb:focus-visible { box-shadow: 0 0 0 2px #4caf50; }

@media (max-width: 576px) {
  .nm-crumb { font-size: 12px; padding: 4px 10px 4px 5px; gap: 5px; }
  .nm-crumb-ico { width: 20px; height: 20px; }
}
@media (min-width: 1920px) {
  .nm-crumb { font-size: 15px; top: 12px; right: 12px; }
  .nm-crumb-ico { width: 26px; height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .nm-crumb, .nm-crumb-ico { transition: none; }
}
