/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --bg: #f9f7f4;
  --card-bg: #ffffff;
  --border: #e8e5e0;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --black: #000000;
  --radius: 8px;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

main { min-height: 100vh; }

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  background: var(--black);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.logo-text { font-size: 16px; font-weight: 600; }

/* ─── Nav links ──────────────────────────────────────────────── */
.nav-link-custom {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-link-custom:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero-section {
  padding: 4rem 1rem 2.5rem;
  text-align: center;
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
}

/* brand-mark: three pulsing dots */
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--black);
  animation: brand-breathe 2.4s ease-in-out infinite;
}
.brand-dot.d1 { animation-delay: 0s; }
.brand-dot.d2 { animation-delay: 0.4s; width: 14px; height: 14px; }
.brand-dot.d3 { animation-delay: 0.8s; }

@keyframes brand-breathe {
  0%, 100% { transform: scale(0.7); opacity: 0.35; }
  50%       { transform: scale(1.2); opacity: 1; }
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto 28px;
}

/* ─── Search form ────────────────────────────────────────────── */
.search-form { width: 100%; }

.search-row {
  display: flex;
  gap: 8px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-row:focus-within {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.07);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.search-input::placeholder { color: var(--text-muted); }

.btn-search {
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 22px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-search:hover  { background: #222; }
.btn-search:disabled { background: #888; cursor: not-allowed; }

/* ─── Content area ───────────────────────────────────────────── */
.content-area {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ─── Error banner ───────────────────────────────────────────── */
.error-banner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 24px;
}

/* ─── Sonar loading animation ────────────────────────────────── */
.loading-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 0 40px;
}

.sonar-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.sonar-core {
  width: 14px;
  height: 14px;
  background: var(--black);
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

.sonar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--black);
  animation: sonar-expand 2.4s ease-out infinite;
  opacity: 0;
}

.sonar-ring.r1 { animation-delay: 0s; }
.sonar-ring.r2 { animation-delay: 0.8s; }
.sonar-ring.r3 { animation-delay: 1.6s; }

@keyframes sonar-expand {
  0%   { transform: scale(0.15); opacity: 0.9; }
  100% { transform: scale(1);    opacity: 0; }
}

.stage-text {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin: 0;
  min-height: 22px;
  animation: stage-fade 0.4s ease;
}

@keyframes stage-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Back button ────────────────────────────────────────────── */
.back-row { margin-bottom: 20px; }

.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.back-btn:hover { border-color: var(--black); color: var(--text); }

/* ─── Answer section ─────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.card-body { padding: 16px; }

.card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.position-card.india { border-left: 3px solid #e05a00; }
.position-card.china { border-left: 3px solid #cc0000; }

.badge { font-size: 11px; font-weight: 600; border-radius: 4px; padding: 2px 6px; }
.tier-1 { background: #16a34a; color: #fff; }
.tier-2 { background: #d97706; color: #fff; }
.tier-3 { background: #6b7280; color: #fff; }
.bg-success  { background: #16a34a !important; }
.bg-secondary { background: #6b7280 !important; }

.evidence-item { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.evidence-item:last-child { border-bottom: none; padding-bottom: 0; }
.evidence-num {
  flex-shrink: 0;
  width: 20px; height: 20px;
  background: var(--black);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.legend-item { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.legend-dot  { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

/* ─── Topics section ─────────────────────────────────────────── */
.topics-header { margin-bottom: 20px; }

.topics-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.topics-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 48px;
}

.topic-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-card:hover {
  border-color: var(--black);
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.topic-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.topic-card-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.conf-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.conf-high   { background: #dcfce7; color: #166534; }
.conf-medium { background: #fef9c3; color: #713f12; }
.conf-low    { background: #f3f4f6; color: #374151; }

.topic-card-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topic-card-meta .meta-chip {
  display: flex;
  align-items: center;
  gap: 3px;
}

.topic-card-arrow {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ─── Vision / Coming soon ────────────────────────────────────── */
.vision-section { border-top: 1px solid var(--border); padding-top: 32px; }

.vision-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.vision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.vision-card {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  opacity: 0.65;
}

.vision-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.vision-label { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.vision-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ─── Map ────────────────────────────────────────────────────── */
#map { height: 360px; border-radius: 8px; box-shadow: 0 2px 16px rgba(0,0,0,0.13); border: 1px solid #e5e7eb; }
#generalMap { border-radius: 8px; box-shadow: 0 2px 16px rgba(0,0,0,0.13); border: 1px solid #e5e7eb; }

/* ─── Map title overlay ──────────────────────────────────────── */
.map-title-overlay {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 800;
  background: rgba(17,24,39,0.78);
  backdrop-filter: blur(6px);
  color: #f9fafb;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 5px;
  pointer-events: none;
}

/* ─── Coordinate readout ─────────────────────────────────────── */
.map-coord-readout {
  position: absolute;
  bottom: 26px; right: 6px;
  z-index: 800;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(4px);
  color: #374151;
  font-size: 10px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  padding: 3px 8px; border-radius: 4px;
  pointer-events: none;
  min-width: 148px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ─── Political map coord readout (fixed over SVG) ───────────── */
#pol-coords {
  position: fixed;
  bottom: 28px; right: 80px;
  z-index: 250;
}

/* ─── Map layer toggles ──────────────────────────────────────── */
.map-layer-btn {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  padding: 3px 10px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.map-layer-btn.active {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}
.map-layer-btn:hover:not(.active) {
  border-color: var(--black);
  color: var(--text);
}

/* ─── Year slider ────────────────────────────────────────────── */
.year-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
.year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--black);
  border-radius: 50%;
  cursor: pointer;
}
.year-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--black);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ─── Chart ──────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 300px;
  margin-top: 8px;
}

/* ─── Basemap toggle buttons ─────────────────────────────────── */
.map-base-btn {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  padding: 3px 10px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.map-base-btn.active {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}
.map-base-btn:hover:not(.active) {
  border-color: var(--black);
  color: var(--text);
}

.map-divider {
  color: var(--border);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
}

/* ─── Geo map place labels ───────────────────────────────────── */
.geo-place-label {
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  white-space: nowrap;
  pointer-events: none;
}

.geo-place-label-dark {
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 4px #000, 0 0 4px #000, 0 0 3px #000;
  white-space: nowrap;
  pointer-events: none;
}

/* ─── History section ────────────────────────────────────────── */
.history-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.history-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.history-card:hover {
  border-color: var(--black);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.history-q {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-ago {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
