/* The bar chart (includes/components/bar-chart.php): one series, a bar
   each, on one fixed scale (--max). Geometry here; the bars' color is the
   chart's poster role's accent, so every look repaints them. */
.bar-chart {
	--bar-chart-height: 8rem;

	margin: 0;
	/* The chart is a picture: its numbers and year labels are part of the
	   drawing, not text to select (a screen reader still reads them). */
	user-select: none;

	ol {
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: minmax(0, 1fr);
		margin: 0;
		padding: 0;
	}

	/* The bar (its number riding on top of it), then its label, each bar
	   its own column. */
	li {
		display: grid;
		grid-template-rows: var(--bar-chart-height) auto;
		gap: 0.25rem;
		justify-items: center;
		min-width: 0;
	}

	/* Each bar's slot, its bottom edge the axis: the columns touch, so the
	   edges join into one line, and the bars stand narrower inside them. */
	.bar-track {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-end;
		gap: 0.25rem;
		width: 100%;
		border-bottom: 1px solid var(--stroke-primary);
	}

	/* Its share of the track, less the number's line above it, so the
	   tallest bar and its number just fill the chart. */
	.bar {
		flex-shrink: 0;
		width: 70%;
		height: calc(var(--value) / var(--max) * (100% - 1.5rem));
		border-radius: var(--corners, 0) var(--corners, 0) 0 0;
		background: var(--poster-accent);
		/* Moving the range is a gesture at the chart, so the bars move with
		   it (the motion policy: requested motion isn't gated). */
		transition: height 150ms ease-out;
	}

	.bar-value,
	.bar-label {
		color: var(--ink-secondary);
	}
}
