/*
 * components/charts.css — Sparkline + bar chart components (Session 5: UI Lab).
 *
 * Paired with templates/components/charts.html. Token-driven (D5).
 * The production version (S14) will wrap vendored Chart.js (UX-4/E4);
 * these CSS-only patterns establish the visual baseline.
 */

.sparkline {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.sparkline--accent { color: var(--color-accent); }
.sparkline--success { color: var(--color-success-fg); }
.sparkline--danger { color: var(--color-danger-fg); }
.sparkline--warning { color: var(--color-warn-fg); }

/* A trend sparkline docked under a metric's progress bar (server dashboard,
   WP10): a little top spacing, muted so the bar/number stay primary. */
.metric-spark {
  margin-top: var(--space-2);
  line-height: 0;
  opacity: 0.85;
}

/* Wide variant for CPU/Memory: fills the card width, taller, shows
   per-5-second sampling detail over the last hour (720 points). */
.metric-spark--wide {
  width: 100%;
  height: 40px;
  opacity: 0.9;
}

.metric-spark--wide .metric-spark__svg {
  display: block;
  width: 100%;
  height: 40px;
}

/* Bar chart: CSS-only flex columns */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 8rem;
  padding: var(--space-3) var(--space-4);
  border: var(--border-1);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  margin-bottom: var(--space-4);
  max-width: 30rem;
}

.bar-chart__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
  gap: var(--space-1);
}

.bar-chart__bar {
  width: 100%;
  max-width: 2.5rem;
  background: var(--color-accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: var(--space-1);
  min-height: 2px;
  transition: height var(--dur-base) var(--ease-standard);
}

.bar-chart__value {
  font-size: var(--fs-xs);
  color: var(--color-accent-fg);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

.bar-chart__label {
  font-size: var(--fs-xs);
  color: var(--color-fg-muted);
}

@media (prefers-reduced-motion: reduce) {
  .bar-chart__bar { transition: none; }
}
