/* Global Pulse (/map) — the world as a newsroom wall.
   Design intent: the map stage is ALWAYS deep-space dark (a lit-up world at
   night), framed by the site's normal light/dark chrome, so the brand-red
   heat dots read like signal lamps in both themes. Everything else inherits
   cnn-theme tokens. */

.gp-page { padding: 20px 0 48px; }

/* ── Masthead ─────────────────────────────────────────────────────────── */
.gp-masthead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin: 6px 0 18px;
}
.gp-masthead h1 {
  font-family: var(--serif); font-size: var(--fs-masthead);
  color: var(--ink); margin: 0; letter-spacing: -0.01em;
}
.gp-tagline { color: var(--muted); margin: 6px 0 0; font-size: 0.95rem; }
.gp-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.gp-stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 16px;
  box-shadow: var(--shadow-1); min-width: 118px;
}
.gp-stat-num {
  display: block; font-weight: 800; font-size: 1.25rem; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}
.gp-stat-label {
  display: block; color: var(--faint); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px;
}

/* ── Stage layout ─────────────────────────────────────────────────────── */
.gp-stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px; align-items: stretch;
}
@media (max-width: 900px) { .gp-stage { grid-template-columns: 1fr; } }

/* ── Map frame: always night-mode Earth ───────────────────────────────── */
.gp-map-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #16202e 0%, #0c121c 55%, #080d14 100%);
  border: 1px solid rgba(120, 140, 170, 0.18);
  box-shadow: var(--shadow-2), inset 0 0 80px rgba(0, 0, 0, 0.45);
  padding: clamp(8px, 2vw, 22px);
}
.gp-map { display: block; width: 100%; height: auto; }

.gp-countries path {
  fill: #223045; stroke: #31415c; stroke-width: 0.5;
  transition: fill 0.18s ease;
  outline: none;
}
.gp-countries path:hover,
.gp-countries path:focus-visible { fill: #2e415e; }
.gp-countries path.gp-active { fill: #3a5178; }
.gp-countries path:focus-visible { stroke: #7fa3d8; stroke-width: 1.2; }

/* Heat dots — radius set inline by map.js (sqrt scale). */
.gp-dots circle {
  fill: var(--brand); fill-opacity: 0.85;
  stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.7;
  cursor: pointer;
  transition: fill-opacity 0.15s ease, r 0.15s ease;
}
.gp-dots circle:hover { fill-opacity: 1; }
.gp-dots circle.gp-halo {
  fill: none; stroke: var(--brand); stroke-width: 1.2;
  pointer-events: none; animation: gp-pulse 2.6s ease-out infinite;
  transform-origin: center; transform-box: fill-box;
}
@keyframes gp-pulse {
  0%   { opacity: 0.9; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(2.1); }
  100% { opacity: 0;   transform: scale(2.1); }
}
@media (prefers-reduced-motion: reduce) {
  .gp-dots circle.gp-halo { animation: none; opacity: 0.35; }
}

.gp-hint {
  position: absolute; left: 16px; bottom: 10px; margin: 0;
  color: rgba(190, 205, 228, 0.55); font-size: 0.72rem;
  letter-spacing: 0.05em; text-transform: uppercase;
}

/* Tooltip — glassy, follows pointer (positioned by map.js). */
.gp-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: rgba(10, 14, 21, 0.92);
  border: 1px solid rgba(140, 165, 200, 0.35);
  color: #eef2f8; border-radius: 8px; padding: 7px 11px;
  font-size: 0.8rem; line-height: 1.35; max-width: 240px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.gp-tooltip.gp-show { opacity: 1; transform: translateY(0); }
.gp-tooltip strong { color: #fff; }
.gp-tooltip .gp-tip-count { color: #ff8c8c; font-weight: 700; }

/* ── Side panel ───────────────────────────────────────────────────────── */
.gp-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: 16px; min-height: 320px; overflow: auto; max-height: 560px;
}
/* Country view: header stays put, only the story list scrolls. */
.gp-panel-country { display: flex; flex-direction: column; max-height: 500px; }
.gp-panel-country[hidden] { display: none; }
.gp-panel-kicker, .gp-section-title {
  font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint); margin: 2px 0 12px; font-weight: 700;
}
.gp-rank { list-style: none; margin: 0; padding: 0; counter-reset: gp; }
.gp-rank li { counter-increment: gp; }
.gp-rank-row {
  display: grid; grid-template-columns: minmax(90px, 1fr) 90px 44px;
  align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; padding: 8px 6px; border-radius: var(--radius-xs);
  cursor: pointer; text-align: left; font: inherit; color: var(--text);
}
.gp-rank-row::before {
  content: counter(gp, decimal-leading-zero);
  position: absolute; margin-left: -4px; opacity: 0; /* numeral kept for AT via order */
}
.gp-rank-row:hover, .gp-rank-row:focus-visible { background: var(--surface-2); }
.gp-rank-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-rank-bar { height: 6px; border-radius: 3px; background: var(--brand-soft); overflow: hidden; }
.gp-rank-bar span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.gp-rank-count { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.85rem; color: var(--muted); text-align: right; }

.gp-panel-close {
  background: none; border: 0; color: var(--link); font: inherit;
  font-size: 0.85rem; cursor: pointer; padding: 2px 0 10px;
}
.gp-panel-close:hover { text-decoration: underline; }
.gp-panel-title { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); margin: 0 0 2px; }
.gp-panel-sub { color: var(--muted); font-size: 0.82rem; margin: 0 0 12px; }
.gp-headlines {
  list-style: none; margin: 0; padding: 0 6px 0 0;
  overflow-y: auto; min-height: 0; flex: 1 1 auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.gp-headlines::-webkit-scrollbar { width: 6px; }
.gp-headlines::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.gp-headlines::-webkit-scrollbar-track { background: transparent; }
.gp-headlines li { padding: 10px 0; border-top: 1px solid var(--line); }
.gp-headlines li:first-child { border-top: 0; }
.gp-headlines a {
  color: var(--text); text-decoration: none; font-weight: 600;
  font-size: 0.92rem; line-height: 1.4; display: block;
}
.gp-headlines a:hover { color: var(--brand-ink); }
.gp-headlines .gp-card-meta { margin-top: 3px; }

/* ── Crawlable top-5 cards ────────────────────────────────────────────── */
.gp-top-section { margin-top: 28px; }
.gp-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.gp-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-1);
}
.gp-card-title {
  font-family: var(--serif); font-size: 1.05rem; color: var(--ink);
  margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; justify-content: space-between;
}
.gp-card-count { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; color: var(--brand-ink); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.gp-card-list { list-style: none; margin: 0; padding: 0; }
.gp-card-list li { padding: 7px 0; border-top: 1px solid var(--line); }
.gp-card-list li:first-child { border-top: 0; padding-top: 0; }
.gp-card-list a { color: var(--text); text-decoration: none; font-size: 0.88rem; font-weight: 600; line-height: 1.35; display: block; }
.gp-card-list a:hover { color: var(--brand-ink); }
.gp-card-meta { display: block; color: var(--faint); font-size: 0.74rem; margin-top: 2px; }
.gp-updated { color: var(--faint); font-size: 0.78rem; margin-top: 16px; }

/* Dark chrome: lift panel/card surfaces slightly against the page. */
body.dark-mode .gp-map-frame { border-color: rgba(140, 165, 200, 0.22); }
body.dark-mode .gp-countries path { fill: #1d2837; stroke: #2c3a50; }
body.dark-mode .gp-countries path:hover,
body.dark-mode .gp-countries path:focus-visible { fill: #293952; }
body.dark-mode .gp-countries path.gp-active { fill: #35496b; }
