/* ===== EV Atlas — components layered on top of the cloned Evergreen base =====
   Tab navigation, the museum timeline spine, and world callouts. Kept separate
   from the cloned base/components so the shared theme stays a clean drop-in. */

/* ---------- always-visible top bar (holds the tab nav) ---------- */
.eva-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 9px 18px;
  background: var(--topbar-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.eva-topbar .topbar-brand {
  font-family: var(--font-display); font-weight: 600; font-size: 21px;
  letter-spacing: 0.01em; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.eva-topbar .tabnav { margin: 0 auto; }              /* center the tabs */
.eva-topbar #theme-toggle {                           /* dock the toggle into the bar */
  position: static; top: auto; right: auto; box-shadow: none;
  width: 34px; height: 34px; flex-shrink: 0;
}

/* ---------- tab navigation (in the sticky topbar) ---------- */
.tabnav { display: flex; gap: 4px; }
.tab-btn {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--ink-soft);
  background: none; border: 0; border-radius: 9px;
  padding: 6px 14px; cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}
.tab-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tab-btn.active { color: var(--on-accent); background: var(--accent); }

/* Each tab is a full view; only one is shown at a time. */
.tab-view { display: none; }
.tab-view.active { display: block; animation: tab-fade 0.4s ease; }
@keyframes tab-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- the museum timeline ---------- */
.timeline-wrap { position: relative; max-width: 1000px; margin: 0 auto; padding: 20px 24px 120px; }

/* sticky "you are here in time" ticker */
.tl-ticker {
  position: sticky; top: 64px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: max-content; margin: 0 auto 10px; padding: 8px 22px;
  background: var(--topbar-bg); backdrop-filter: blur(10px);
  border: 1px solid var(--rule); border-radius: 999px;
  box-shadow: var(--shadow);
}
.tl-ticker .tk-year { font-family: var(--font-mono); font-weight: 600; font-size: 20px; color: var(--era, var(--accent)); }
.tl-ticker .tk-era { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }

.tl-track { position: relative; }

/* the center line */
.tl-spine {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg,
    #C9A24B 0%, #C77B43 16%, #6E7B86 38%, #5BA8DC 62%, #2FE3D0 84%, #48EFE0 100%);
  border-radius: 3px; opacity: 0.55;
}

/* era band headings */
.tl-era {
  position: relative; z-index: 2; text-align: center; margin: 56px 0 30px;
  opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease;
}
.tl-era.in-view { opacity: 1; transform: none; }
.tl-era .tl-era-hint { display: block; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-soft); }
.tl-era .tl-era-label {
  display: inline-block; margin-top: 4px; padding: 4px 18px;
  font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 38px); font-weight: 600;
  color: var(--era); border-bottom: 2px solid var(--era);
}

/* nodes alternate sides */
.tl-node { position: relative; width: 50%; padding: 18px 44px; box-sizing: border-box; }
.tl-node.left { left: 0; text-align: right; }
.tl-node.right { left: 50%; text-align: left; }

.tl-node .tl-dot {
  position: absolute; top: 30px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--era); border: 3px solid var(--paper);
  box-shadow: 0 0 0 2px var(--era), 0 0 18px color-mix(in srgb, var(--era) 60%, transparent);
  z-index: 3;
}
.tl-node.left .tl-dot { right: -8px; }
.tl-node.right .tl-dot { left: -8px; }

.tl-card {
  display: inline-block; text-align: left; max-width: 380px;
  background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--era);
  border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow);
}
.tl-year { font-family: var(--font-mono); font-weight: 600; font-size: 15px; color: var(--era); letter-spacing: 0.04em; }
.tl-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.05; margin: 3px 0 7px; }
.tl-body { font-size: 16px; line-height: 1.5; color: var(--ink-soft); margin: 0; }
.tl-stat {
  margin-top: 10px; font-family: var(--font-mono); font-weight: 600; font-size: 15px;
  color: var(--ink); background: color-mix(in srgb, var(--era) 14%, transparent);
  border-radius: 8px; padding: 6px 10px; display: inline-block;
}
.tl-src { margin-top: 8px; font-size: 12px; color: var(--ink-soft); opacity: 0.7; }

/* slide-in animation, direction depends on side */
.tl-node { opacity: 0; transition: opacity 0.6s ease, transform 0.6s ease; }
.tl-node.left { transform: translateX(36px); }
.tl-node.right { transform: translateX(-36px); }
.tl-node.in-view { opacity: 1; transform: none; }

/* era color tokens */
.tl-node[data-era="dawn"], .tl-era[data-era="dawn"] { --era: #C9A24B; }
.tl-node[data-era="gas"], .tl-era[data-era="gas"] { --era: #C77B43; }
.tl-node[data-era="darkage"], .tl-era[data-era="darkage"] { --era: #828F9A; }
.tl-node[data-era="revival"], .tl-era[data-era="revival"] { --era: #5BA8DC; }
.tl-node[data-era="tesla"], .tl-era[data-era="tesla"] { --era: #2FE3D0; }
.tl-node[data-era="mainstream"], .tl-era[data-era="mainstream"] { --era: #48EFE0; }
.tl-ticker[data-era="dawn"] { --era: #C9A24B; } .tl-ticker[data-era="gas"] { --era: #C77B43; }
.tl-ticker[data-era="darkage"] { --era: #828F9A; } .tl-ticker[data-era="revival"] { --era: #5BA8DC; }
.tl-ticker[data-era="tesla"] { --era: #2FE3D0; } .tl-ticker[data-era="mainstream"] { --era: #48EFE0; }

/* mobile: spine slides left, every node on the right */
@media (max-width: 720px) {
  .tl-spine { left: 20px; }
  .tl-node, .tl-node.left, .tl-node.right { width: 100%; left: 0; text-align: left; padding: 14px 8px 14px 44px; transform: translateX(-24px); }
  .tl-node.in-view { transform: none; }
  .tl-node.left .tl-dot, .tl-node.right .tl-dot { left: 12px; right: auto; }
  .tl-card { max-width: none; }
  .tl-era { text-align: left; padding-left: 44px; }
}

/* ---------- world callout cards (China / Norway / Global South) ---------- */
.callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; max-width: 1140px; margin: 28px auto 0; padding: 0 24px; }
.callout { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.callout .co-flag { font-size: 30px; }
.callout h3 { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 6px 0 6px; }
.callout p { font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); margin: 0; }
.callout .co-stat { font-family: var(--font-mono); font-weight: 600; color: var(--accent); font-size: 17px; margin-top: 10px; }

/* ---------- misc shell pieces ---------- */
.scroll-hint {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-soft); margin-top: 22px;
  animation: hint-bob 1.8s ease-in-out infinite;
}
@keyframes hint-bob { 0%,100% { transform: translateY(0); opacity: 0.7; } 50% { transform: translateY(5px); opacity: 1; } }

/* state-jump chip row (reuses .chip-mini look from components.css) */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; max-width: 1000px; margin: 0 auto; }

/* battery-price chart card + cheapest-EV strip (world tab) */
.chart-card {
  max-width: 860px; margin: 18px auto 0; padding: 20px 22px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 16px;
  box-shadow: var(--shadow); position: relative;
}
.cheapest-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px;
  max-width: 1000px; margin: 22px auto 0; padding: 0 24px;
}
.cheap-card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  padding: 14px 16px; text-align: center; box-shadow: var(--shadow);
}
.cheap-card .cc-price { font-family: var(--font-mono); font-weight: 600; font-size: 24px; color: var(--accent); }
.cheap-card .cc-model { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-top: 2px; }
.cheap-card .cc-where { font-size: 13px; color: var(--ink-soft); }

/* ---------- trend chart text ---------- */
.tc-axis { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-soft); }
.tc-annot { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }

/* ---------- region/country detail panel ----------
   Cards are flex columns with a uniform gap so every card shares the same
   vertical rhythm: heading → big number → pill → detail list line up across the row. */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin-top: 4px; align-items: stretch; }
.ev-grid .card { display: flex; flex-direction: column; gap: 12px; }
.ev-grid .card > h3 { margin: 0; }
.ev-grid .card.wide { grid-column: 1 / -1; }

.big-stat { display: flex; align-items: baseline; gap: 10px; margin: 0; min-height: 52px; }
.big-stat .num {
  font-family: var(--font-mono); font-weight: 600; line-height: 1;
  font-size: clamp(38px, 4.6vw, 56px); letter-spacing: -0.02em; color: var(--accent);
  text-shadow: var(--num-glow);
}
.big-stat .unit { font-family: var(--font-ui); font-size: 13.5px; color: var(--ink-soft); line-height: 1.3; }
.rank-pill {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 10px;
  align-self: flex-start;
}
.kv-list { display: flex; flex-direction: column; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 15px; }
.kv .k { color: var(--ink-soft); }
.kv .v { font-family: var(--font-mono); font-weight: 600; }
.card .card-lead { font-size: 15.5px; color: var(--ink-soft); margin: 0; }
.charge-compare { display: flex; gap: 12px; }
.charge-compare .cc { flex: 1; text-align: center; background: var(--paper-deep); border-radius: 10px; padding: 12px 10px; }
.charge-compare .cc .amt { font-family: var(--font-mono); font-weight: 600; font-size: 24px; }
.charge-compare .cc.ev .amt { color: var(--accent); }
.charge-compare .cc.gas .amt { color: var(--gold); }
.charge-compare .cc .lbl { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.est-flag { font-size: 12px; color: var(--ink-soft); opacity: 0.8; font-style: italic; }

/* ---------- choropleth maps (borders must STROKE not fill — else black wedges) ---------- */
.choropleth-svg { display: block; }
.geo { cursor: pointer; stroke: none; transition: opacity 0.15s ease; }
.geo:hover { opacity: 0.82; }
.geo.selected { stroke: var(--ink); stroke-width: 1.5; }
.geo-borders { fill: none; stroke: var(--paper); stroke-width: 0.7; pointer-events: none; }
.geo.flash { animation: geo-flash 1s ease-out; }
@keyframes geo-flash {
  0%, 25% { filter: drop-shadow(0 0 9px rgba(120, 240, 230, 0.65)); }
  100% { filter: drop-shadow(0 0 0 rgba(120, 240, 230, 0)); }
}
