.wa-chart {
	--wa-chart-font: inherit;
	--wa-chart-heading-size: 1rem;
	--wa-chart-heading-color: inherit;
	--wa-chart-subheading-size: 2.5rem;
	--wa-chart-subheading-color: inherit;
	--wa-chart-legend-columns: 1;
	--wa-chart-gap: 2rem;
	--wa-chart-height: 320px;
	container-type: inline-size;
	margin: 0;
	font-family: var(--wa-chart-font);
}

.wa-chart__inner {
	display: flex;
	gap: var(--wa-chart-gap);
	align-items: center;
}

.wa-chart--layout-right .wa-chart__inner {
	flex-direction: row-reverse;
}

.wa-chart--layout-top .wa-chart__inner {
	flex-direction: column;
	align-items: stretch;
}

.wa-chart__plot {
	display: flex;
	flex: 1 1 60%;
	flex-direction: column;
	gap: 1rem;
	min-width: 0;
}

.wa-chart--legend-right .wa-chart__plot {
	flex-direction: row;
	align-items: center;
}

.wa-chart__canvas {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	height: var(--wa-chart-height);
}

.wa-chart__text {
	display: flex;
	flex: 1 1 40%;
	flex-direction: column;
	gap: 0.25em;
}

.wa-chart__heading {
	font-size: var(--wa-chart-heading-size);
	color: var(--wa-chart-heading-color);
}

.wa-chart__subheading {
	font-size: var(--wa-chart-subheading-size);
	color: var(--wa-chart-subheading-color);
	line-height: 1.1;
}

.wa-chart__legend {
	display: grid;
	grid-template-columns: repeat(var(--wa-chart-legend-columns), minmax(0, 1fr));
	gap: 0.25rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wa-chart__legend[hidden] {
	display: none;
}

.wa-chart--legend-right .wa-chart__legend {
	flex: 0 1 auto;
	max-width: 45%;
}

/* Themes often style every list item (bullets) and every button (colours,
 * padding, hover backgrounds). The legend must look the same everywhere, so
 * reset those properties with enough specificity to win over theme rules. */
.wa-chart .wa-chart__legend .wa-chart__legend-item {
	margin: 0;
	padding: 0;
	list-style: none;
	background: none;
}

.wa-chart .wa-chart__legend .wa-chart__legend-item::before,
.wa-chart .wa-chart__legend .wa-chart__legend-item::after,
.wa-chart .wa-chart__legend .wa-chart__legend-item::marker {
	content: none;
	display: none;
}

.wa-chart .wa-chart__legend .wa-chart__legend-button,
.wa-chart .wa-chart__legend .wa-chart__legend-button:hover,
.wa-chart .wa-chart__legend .wa-chart__legend-button:focus,
.wa-chart .wa-chart__legend .wa-chart__legend-button:active {
	display: inline-flex;
	align-items: center;
	gap: var(--wa-chart-legend-gap, 0.5em);
	width: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-align: start;
	text-decoration: none;
	text-transform: none;
	white-space: normal;
	cursor: pointer;
}

.wa-chart .wa-chart__legend .wa-chart__legend-button:focus-visible {
	outline: 2px solid currentcolor;
	outline-offset: 2px;
}

.wa-chart .wa-chart__legend .wa-chart__legend-button:hover .wa-chart__legend-label {
	text-decoration: underline;
}

.wa-chart .wa-chart__legend .wa-chart__legend-button:disabled {
	cursor: default;
}

.wa-chart .wa-chart__legend .wa-chart__legend-item.is-active .wa-chart__legend-label {
	text-decoration: underline;
}

.wa-chart__legend-item.is-hidden {
	opacity: 0.4;
	text-decoration: line-through;
}

.wa-chart__swatch {
	flex: none;
	width: 0.75em;
	height: 0.75em;
	border-radius: 50%;
}

.wa-chart .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.wa-chart--error .wa-chart__plot {
	display: none;
}

.wa-chart__table {
	border-collapse: collapse;
}

.wa-chart__table th,
.wa-chart__table td {
	padding: 0.25em 0.75em;
	text-align: start;
}

.wa-chart-notice {
	padding: 0.5em 1em;
	border-inline-start: 4px solid #d63638;
	background: #fcf0f1;
}

/* Chart and text stack below 600px; a right-hand legend stays beside the
 * chart down to 400px, then moves under it. */
@container (max-width: 600px) {

	.wa-chart__inner {
		flex-direction: column !important;
		align-items: stretch;
	}
}

@container (max-width: 400px) {

	.wa-chart--legend-right .wa-chart__plot {
		flex-direction: column !important;
		align-items: stretch;
	}

	.wa-chart--legend-right .wa-chart__legend {
		max-width: none;
	}
}

@supports not (container-type: inline-size) {

	@media (max-width: 600px) {

		.wa-chart__inner {
			flex-direction: column !important;
			align-items: stretch;
		}
	}

	@media (max-width: 400px) {

		.wa-chart--legend-right .wa-chart__plot {
			flex-direction: column !important;
			align-items: stretch;
		}

		.wa-chart--legend-right .wa-chart__legend {
			max-width: none;
		}
	}
}
