/* ---------- News by District (homepage map) ----------
   The section reuses the portal's own title, row/column and list classes
   (.nf-title-section, .nf-row, .nf-widget, .nf-video-links, .nf-post-tags),
   so this file only covers what is specific to the map. */
.jn-atlas {
  --atlas-l0: #e4e9e6;
  --atlas-l1: #c6e4d2;
  --atlas-l2: #92cba9;
  --atlas-l3: #56a97b;
  --atlas-l4: #2e8f5c;
  --atlas-hover: #f5d999;
  --atlas-selected: #f0b44c;
  --atlas-label: #1c2621;
  --atlas-halo: rgba(255, 255, 255, .85);
  --atlas-label-muted: #66706b;
  margin-bottom: 40px;
  scroll-margin-top: var(--atlas-header-offset, 140px);
}
:root[data-theme="dark"] .jn-atlas {
  --atlas-l0: #2b302d;
  --atlas-l1: #204632;
  --atlas-l2: #26633f;
  --atlas-l3: #2f8752;
  --atlas-l4: #45b373;
  --atlas-hover: #8a7440;
  --atlas-label: #f0f0f0;
  --atlas-halo: rgba(0, 0, 0, .75);
  --atlas-label-muted: #a3a3a3;
}
.jn-atlas [hidden] { display: none !important; }
.jn-atlas button { font: inherit; cursor: pointer; }
.jn-atlas button:focus-visible,
.jn-atlas a:focus-visible,
.jn-atlas select:focus-visible,
.jn-atlas .district-shape:focus-visible { outline: 2px solid var(--nf-green); outline-offset: 2px; }
.jn-atlas .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Title row: section heading with the two filters on the right. */
.jn-atlas .nf-title-section--split { align-items: center; }
.atlas-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.atlas-filters input,
.atlas-filters select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--nf-text);
  background: var(--nf-white);
  border: 1px solid var(--nf-line);
  border-radius: 3px;
  padding: 6px 8px;
  cursor: pointer;
}
.atlas-filters select:hover,
.atlas-filters input:hover,
.atlas-filters input:focus { border-color: var(--nf-green); }
.atlas-filters input { width: 190px; font-weight: 400; cursor: text; }
.atlas-filters input::placeholder { color: var(--nf-muted); }
@media (max-width: 600px) {
  .atlas-filters { width: 100%; }
  .atlas-search { flex-basis: 100%; }
  .atlas-filters input { width: 100%; }
}

.jn-atlas .data-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 16px; padding: 10px 14px;
  font-size: 13.5px; color: var(--nf-text);
  background: var(--nf-red-bg); border: 1px solid var(--nf-red-line); border-left: 4px solid var(--nf-red); border-radius: 3px;
}
.jn-atlas .data-notice button {
  flex-shrink: 0; border: 0; padding: 0; background: none;
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--nf-red);
}

/* ---------- Layout ---------- */
.jn-atlas .atlas-workspace { margin-bottom: 0; }
/* Not stretched to the story column, so its measured height is the map's own.
   The width covers .nf-row's column direction on small screens. */
.jn-atlas .map-panel { position: relative; align-self: flex-start; width: 100%; }

/* ---------- Map ---------- */
.jn-atlas .map-canvas {
  position: relative;
  aspect-ratio: 705 / 566; /* the SVG viewBox, cropped to the state outline */
  overflow: hidden;
  touch-action: pan-y;
}
.jn-atlas .district-svg { display: block; width: 100%; height: 100%; user-select: none; }
.jn-atlas .district-shape {
  fill: var(--atlas-l0);
  stroke: var(--nf-white);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  outline: none;
  transition: fill .2s ease;
}
.jn-atlas .district-shape[data-level="1"] { fill: var(--atlas-l1); }
.jn-atlas .district-shape[data-level="2"] { fill: var(--atlas-l2); }
.jn-atlas .district-shape[data-level="3"] { fill: var(--atlas-l3); }
.jn-atlas .district-shape[data-level="4"] { fill: var(--atlas-l4); }
.jn-atlas .district-shape:hover,
.jn-atlas .district-shape:focus-visible { fill: var(--atlas-hover); }
.jn-atlas .district-shape[aria-pressed="true"] { fill: var(--atlas-selected); }
.jn-atlas .atlas-workspace[aria-busy="true"] .district-shape { cursor: progress; }

.jn-atlas .district-label {
  pointer-events: none;
  text-anchor: middle;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--atlas-label);
  paint-order: stroke;
  stroke: var(--atlas-halo);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.jn-atlas .district-label .district-value { font-size: 15px; font-weight: 700; }
.jn-atlas .district-label.no-news { fill: var(--atlas-label-muted); }
.jn-atlas .district-label.selected { fill: #1c2621; stroke: rgba(255, 255, 255, .7); }

.jn-atlas .map-controls {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  display: flex; flex-direction: column;
  border: 1px solid var(--nf-line); border-radius: 3px; overflow: hidden;
}
.jn-atlas .map-controls button {
  width: 32px; height: 32px; padding: 0;
  font-size: 18px; line-height: 1;
  color: var(--nf-text); background: var(--nf-white);
  border: 0; border-bottom: 1px solid var(--nf-line);
}
.jn-atlas .map-controls button:last-child { border-bottom: 0; font-size: 16px; }
.jn-atlas .map-controls button:hover { color: var(--nf-green); }
.jn-atlas .map-controls button:disabled { opacity: .4; cursor: default; }

.jn-atlas .map-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 140px; max-width: 220px; padding: 8px 12px;
  font-size: 13px; line-height: 1.4; color: var(--nf-body);
  background: var(--nf-white);
  border-left: 3px solid var(--nf-green); border-radius: 3px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
}
.jn-atlas .map-tooltip strong {
  display: block; font-size: 16px; font-weight: 700; text-transform: uppercase; color: var(--nf-text);
}

.jn-atlas .map-source { margin: 6px 0 0; font-size: 11px; color: var(--nf-muted); }
.jn-atlas .map-source a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Stories ---------- */
.jn-atlas .stories-panel { display: flex; flex-direction: column; margin-bottom: 0; min-height: 0; }
.jn-atlas .stories-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: -2px 0 14px;
  font-size: 12px; text-transform: uppercase; color: var(--nf-muted);
}
.jn-atlas .stories-toolbar button {
  flex-shrink: 0; border: 0; padding: 0; background: none;
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--nf-green);
}
.jn-atlas .stories-toolbar button:hover { text-decoration: underline; }
.jn-atlas .back-to-map { display: none; }

.jn-atlas .stories-list {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--nf-dot-border) transparent;
}
.jn-atlas .stories-list > li > a { display: block; overflow: hidden; border-radius: 3px; }
.jn-atlas .stories-list li > div { flex: 1 1 auto; }
.jn-atlas .stories-list h3 {
  font-size: 14px; line-height: 19px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.jn-atlas .stories-list .nf-post-tags { margin-top: 6px; justify-content: flex-start; }

.jn-atlas .loading-state,
.jn-atlas .empty-state { display: block !important; padding: 40px 0 !important; text-align: center; }
.jn-atlas .loader {
  display: block; width: 24px; height: 24px; margin: auto;
  border: 2px solid var(--nf-line); border-top-color: var(--nf-green); border-radius: 50%;
  animation: jn-atlas-spin 1s linear infinite;
}
@keyframes jn-atlas-spin { to { transform: rotate(360deg); } }
.jn-atlas .empty-state h3 { font-size: 16px; font-weight: 700; text-transform: uppercase; margin: 0 0 6px; -webkit-line-clamp: none; }
.jn-atlas .empty-state p { font-size: 14px; color: var(--nf-muted); margin: 0 0 14px; }
.jn-atlas .empty-state button,
.jn-atlas .load-more {
  padding: 8px 16px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--nf-green);
  background: none; border: 1px solid var(--nf-line); border-radius: 3px;
}
.jn-atlas .load-more { margin-top: 12px; width: 100%; }
.jn-atlas .empty-state button:hover,
.jn-atlas .load-more:hover { border-color: var(--nf-green); }
.jn-atlas .stories-panel .nf-more-link { padding-top: 16px; }
.jn-atlas .atlas-workspace[aria-busy="true"] .stories-list { opacity: .55; }

/* Stacked (narrow screens): the story list flows with the page instead of
   scrolling inside a box the height of the map. Set by news-atlas.js. */
.jn-atlas.is-stacked .stories-list { overflow: visible; }
.jn-atlas.is-stacked .back-to-map { display: inline; }
.jn-atlas.is-stacked .stories-panel,
.jn-atlas.is-stacked .map-panel { scroll-margin-top: var(--atlas-header-offset, 140px); }

@media (max-width: 600px) {
  .jn-atlas .district-label { font-size: 19px; stroke-width: 2.5px; }
  .jn-atlas .district-label .district-value { font-size: 21px; }
}

.jn-atlas .noscript { padding: 20px; text-align: center; font-size: 14px; }
.jn-atlas .noscript a { color: var(--nf-green); text-decoration: underline; }

.jn-atlas dialog {
  max-width: 520px; width: calc(100% - 32px); padding: 32px;
  color: var(--nf-text); background: var(--nf-white);
  border: 1px solid var(--nf-line); border-radius: 3px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.jn-atlas dialog::backdrop { background: rgba(0, 0, 0, .55); }
.jn-atlas dialog h2 { font-size: 22px; line-height: 1.3; margin: 0 0 12px; }
.jn-atlas dialog p { font-size: 15px; line-height: 1.6; color: var(--nf-body); }
.jn-atlas .demo-label { font-size: 12px !important; font-weight: 700; text-transform: uppercase; color: var(--nf-green) !important; margin: 0 0 8px; }
.jn-atlas #close-demo { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 26px; color: var(--nf-muted); }
.jn-atlas #close-demo-bottom {
  padding: 8px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: #fff; background: var(--nf-green); border: 0; border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .jn-atlas *, .jn-atlas *::before, .jn-atlas *::after { animation: none !important; transition: none !important; }
}
