/* Sentiment colors belong to the data, independently of the UI accent. */
:root {
  --trend-support: #4ade80;
  --trend-neutral: #22c7ff;
  --trend-attack: #fb7185;
  --trend-muted: #a0b0c9;
  --trend-track: #172640;
}
html[data-theme="light"] {
  --trend-support: #087a45;
  --trend-neutral: #007da8;
  --trend-attack: #c42b49;
  --trend-muted: #52647e;
  --trend-track: #e5edf8;
}

#trends-list .trend-item { padding: 14px 0; }
#trends-list .trend-header { align-items: baseline; margin-bottom: 8px; }
#trends-list .trend-name { color: var(--text); font-weight: 700; }
#trends-list .trend-count { color: var(--trend-muted); font-size: 12px; }
#trends-list .trend-bar-track { height: 9px; border-radius: 999px; background: var(--trend-track); }
#trends-list .trend-bar-pos { background: var(--trend-support); }
#trends-list .trend-bar-neu { background: var(--trend-neutral); }
#trends-list .trend-bar-neg { background: var(--trend-attack); }
#trends-list .trend-pct-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px; margin-top: 7px; font-size: 11px; font-variant-numeric: tabular-nums;
}
#trends-list .trend-pct-row > span { width: auto !important; }
#trends-list .pct-pos { color: var(--trend-support); }
#trends-list .pct-neu { color: var(--trend-neutral); text-align: center; }
#trends-list .pct-neg { color: var(--trend-attack); text-align: right; }
.trend-sentiment-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 4px; color: var(--trend-muted); font-size: 12px; }
.trend-sentiment-legend span { display: inline-flex; gap: 6px; align-items: center; }
.trend-sentiment-legend i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.trend-sentiment-legend .support-key { color: var(--trend-support); }
.trend-sentiment-legend .neutral-key { color: var(--trend-neutral); }
.trend-sentiment-legend .attack-key { color: var(--trend-attack); }

/* Both SVG presentation attributes and inline styles resolve these variables
   at paint time, so existing charts change theme without refetching data. */
#vibes-over-time-card, #compare-trends-card {
  --green: var(--trend-support);
  --red: var(--trend-attack);
  --text-light: var(--trend-muted);
}
html[data-theme] .vibe-bar-track { background: var(--trend-track); }
html[data-theme] .chart-tooltip { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
html[data-theme] .chart-hint, html[data-theme] .chart-legend { color: var(--trend-muted); }
html[data-theme] .chart-mode-toggle { background: var(--surface-2); }
html[data-theme] .chart-mode-btn:not(.active), html[data-theme] .view-mode-btn:not(.active) { color: var(--text-sec); }
html[data-theme] .rel-chip:hover { color: var(--text); }
.chart-mode-btn:focus-visible, .view-mode-btn:focus-visible, .toggle-btn:focus-visible { outline: 2px solid var(--trend-neutral); outline-offset: 3px; }
@media (max-width: 480px) {
  #trends-list .trend-header { flex-wrap: wrap; gap: 4px 12px; }
  #trends-list .trend-name { white-space: normal; overflow-wrap: anywhere; }
}
