/* The markup is app/views/shared/_bar_chart.html.erb, which server-renders every part of the
   chart and writes exactly one inline style, the height of a bar, because that is the datum. */

.c-barchart {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin: 0;
}

.c-barchart__caption {
  color: var(--text-bright);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.c-barchart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-dim);
  font-size: var(--text-xs);
}

.c-barchart__legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}

.c-barchart__swatch {
  inline-size: 0.75rem;
  block-size: 0.75rem;
  background: var(--surface-hi);
}

/* The suffix is the series' one-based index, as the partial numbers them. Only the first two are
   given a colour; a third keeps the neutral tone above rather than earning a hue, which this
   palette reserves for state. */
.c-barchart__swatch--1,
.c-barchart__bar--1 {
  background: var(--accent);
}

.c-barchart__swatch--2,
.c-barchart__bar--2 {
  background: var(--good);
}

.c-barchart__plot {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3xs);
  block-size: 12rem;
  padding-block-start: var(--space-xs);
  border-bottom: var(--bw) solid var(--line-strong);
}

.c-barchart__bucket {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-3xs);
  min-inline-size: 0;
  block-size: 100%;
}

.c-barchart__bars {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  block-size: 100%;
}

.c-barchart__bar {
  flex: 1 1 0;
  min-block-size: 1px;
  background: var(--surface-hi);
}

.c-barchart__label {
  color: var(--text-muted);
  font-size: var(--text-xs);
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}
