/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --border:     #2a2d3a;
  --text:       #e8eaf0;
  --text-muted: #7c8098;
  --accent:     #4f8ef7;
  --neg:        #e05252;
  --neu:        #6b7280;
  --pos:        #4abe82;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0 1.5rem;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header h1 span {
  color: var(--accent);
}

header p.subtitle {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.meta {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Ads placeholder ──────────────────────────────────────────────────────── */
.ad-banner {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.5rem 0;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
main {
  padding: 2rem 0 4rem;
}

/* ── Government sections ─────────────────────────────────────────────────── */
.gov-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.gov-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}

/* ── Scale axis ───────────────────────────────────────────────────────────── */
.axis-container {
  position: relative;
}

.ranking-block {
  margin-top: 1.25rem;
}

.ranking-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

.ranking-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 520px) {
  .ranking-grid {
    grid-template-columns: 1fr;
  }
}

.ranking-col-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.ranking-pos {
  width: 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.ranking-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.ranking-name {
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-score {
  font-weight: 600;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.axis-container svg {
  width: 100%;
  overflow: visible;
  display: block;
}

/* ── Scale labels ─────────────────────────────────────────────────────────── */
.scale-label {
  font-size: 11px;
  fill: var(--text-muted);
}

/* ── Source circles ───────────────────────────────────────────────────────── */
.source-group {
  cursor: pointer;
}

.source-group:hover .source-ring {
  stroke-width: 2.5;
  opacity: 1;
}

.source-ring {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke-width 0.15s;
}

.source-initial {
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  fill: var(--text);
  pointer-events: none;
}

/* ── Tooltip ──────────────────────────────────────────────────────────────── */
#tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  max-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

#tooltip.visible { opacity: 1; }

#tooltip .tt-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

#tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
}

#tooltip .tt-score {
  font-weight: 600;
}

/* ── Legend ───────────────────────────────────────────────────────────────── */
.legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
}

footer a { color: var(--accent); text-decoration: none; }

/* ── Loading / error states ───────────────────────────────────────────────── */
.loading, .error-msg {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.error-msg { color: var(--neg); }
