/* =============================================================
   currency-map.css — Choropleth world map for the CCI
   ============================================================= */

.cci-map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.cci-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.cci-map-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.cci-map-toggle {
  flex-shrink: 0;
}
.cci-map-toggle .cci-toggle {
  padding: 5px 12px;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.cci-map-pillar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cci-map-pillar select.cci-select {
  padding: 6px 26px 6px 10px;
  font-size: 12px;
}
.cci-map-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.15;
}
.cci-map-title strong {
  color: var(--gold-bright);
  font-weight: 800;
  font-style: italic;
  margin-left: 4px;
}
.cci-map-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dimmer);
  letter-spacing: 0.08em;
}
.cci-map-meta strong { color: var(--text-dim); font-weight: 600; }

/* SVG canvas */
.cci-map-svg-wrap {
  position: relative;
  width: 100%;
  background:
    radial-gradient(ellipse at center, rgba(200,146,42,0.04), transparent 70%);
}
.cci-map-svg {
  width: 100%;
  height: auto;
  display: block;
}
.cci-map-country {
  stroke: var(--bg);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: filter 0.12s, stroke 0.12s, stroke-width 0.12s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.cci-map-country:focus,
.cci-map-country:focus-visible,
.cci-map-country:active { outline: none; }
.cci-map-svg,
.cci-map-svg * { -webkit-tap-highlight-color: transparent; }
.cci-map-country.no-data {
  fill: #1a1f26;
  cursor: default;
}
.cci-map-country.no-data:hover {
  filter: none;
  stroke: var(--bg);
  stroke-width: 0.4;
}
.cci-map-country:hover,
.cci-map-country.is-active {
  stroke: var(--gold-bright);
  stroke-width: 1.4;
  filter: brightness(1.2);
}
.cci-map-graticule {
  fill: none;
  stroke: var(--border);
  stroke-width: 0.3;
  stroke-opacity: 0.4;
  pointer-events: none;
}
.cci-map-sphere {
  fill: none;
  stroke: var(--border);
  stroke-width: 0.6;
  pointer-events: none;
}

/* Legend */
.cci-map-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  max-width: 480px;
}
.cci-map-legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dimmer);
}
.cci-map-legend-bar {
  display: flex;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
}
.cci-map-legend-bar > span {
  flex: 1;
}
.cci-map-legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dimmer);
  letter-spacing: 0.08em;
  padding: 0 1px;
}

/* Tier swatches in legend — must match .bt-* in currency.html and TIER_FILL in currency-map.js */
.lg-a { background: #5ea6cf; }
.lg-b { background: #5cc170; }
.lg-c { background: #d4b240; }
.lg-d { background: #b07642; }
.lg-e { background: #d64545; }
.lg-na { background: #1a1f26; border-left: 1px solid var(--border); }

/* Tooltip */
.cci-map-tip {
  position: absolute;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 200px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  z-index: 10;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 0.12s;
}
.cci-map-tip.visible { opacity: 1; }
.cci-map-tip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bg);
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}
.cci-map-tip-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 1px;
}
.cci-map-tip-ccy {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.cci-map-tip-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cci-map-tip-score-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-dimmer);
  text-transform: uppercase;
}
.cci-map-tip-score-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.cci-map-tip-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  margin: 3px 0;
  color: var(--text-dimmer);
  letter-spacing: 0.04em;
}
.cci-map-tip-row .v {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cci-map-tip-rank {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 8px;
}
.cci-map-tip-no {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dimmer);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Loading state */
.cci-map-loading {
  padding: 100px 0;
  text-align: center;
  color: var(--text-dimmer);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Tier color tokens for map fills (kept in sync with currency.html .bt-* tiers) */
:root {
  --map-a: #5ea6cf;
  --map-b: #5cc170;
  --map-c: #d4b240;
  --map-d: #b07642;
  --map-e: #d64545;
  --map-none: #1a1f26;
}

@media (max-width: 768px) {
  .cci-map-card { padding: 14px 12px 12px; }
  .cci-map-header { gap: 8px; margin-bottom: 10px; }
  .cci-map-title { font-size: 10px; }
  .cci-map-meta  { font-size: 9px; }
  .cci-map-tip {
    min-width: 170px;
    padding: 10px 12px;
  }
  .cci-map-tip-score-num { font-size: 22px; }
  .cci-map-legend-bar { min-width: 160px; }
}
