/*
 * Shared by every widget. Each widget adds its own stylesheet on top.
 *
 * Tokens are hardcoded rather than read from theme globals, whose meaning changes per site. The
 * three brand tokens are overridden inline from Settings, OSHA Injury Data; a theme can also
 * override any --oid-* token on .oid.
 *
 * The default primary green is only 3.1:1 on white, so it is kept for bars, rules and large
 * numbers. Text and filled buttons use the darker --oid-primary-strong (5.4:1).
 */
.oid {
	--oid-primary: #789e4b;
	--oid-primary-strong: #557334;
	--oid-accent: #6e6259;
	--oid-text: #222831;
	--oid-muted: #5d6474;
	--oid-border: #dddcd7;
	--oid-panel: #f7f7f4;
	--oid-track: #ecece8;
	--oid-card: #fff;
	--oid-warn-bg: #fff9ed;
	--oid-warn-border: #d8c7a5;
	--oid-radius: 16px;

	container-type: inline-size;
	margin-block: 2rem;
	color: var(--oid-text);
	font-size: 1rem;
	line-height: 1.5;
}

.oid *,
.oid *::before,
.oid *::after {
	box-sizing: border-box;
}

.oid p,
.oid h2,
.oid h3,
.oid ol,
.oid ul {
	margin: 0;
	padding: 0;
}

.oid-top {
	display: grid;
	gap: 1rem;
	align-items: start;
}

.oid .oid-kicker {
	color: var(--oid-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.oid .oid-heading {
	margin-top: 0.35rem;
	color: var(--oid-text);
	font-size: clamp(1.75rem, 1.2rem + 2.2cqi, 2.5rem);
	line-height: 1.1;
}

.oid-rule {
	display: block;
	width: 9rem;
	height: 4px;
	margin-top: 1rem;
	border-radius: 999px;
	background: var(--oid-primary);
}

.oid .oid-lede {
	margin-top: 0.85rem;
	color: var(--oid-muted);
}

.oid-stat {
	display: flex;
	flex-direction: column;
	padding: 1rem 1.15rem;
	border: 1px solid var(--oid-border);
	border-radius: var(--oid-radius);
	background: var(--oid-panel);
}

.oid-stat-number {
	color: var(--oid-primary-strong);
	font-size: 2.6rem;
	font-weight: 800;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.oid-stat-label {
	font-weight: 700;
}

.oid-stat-scope {
	color: var(--oid-muted);
	font-size: 0.875rem;
}

.oid-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.oid-control {
	display: flex;
	flex: 1 1 12rem;
	flex-direction: column;
	gap: 0.35rem;
	font-size: 0.8125rem;
	font-weight: 700;
}

.oid .oid-control select,
.oid input.oid-search {
	width: 100%;
	min-height: 2.75rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--oid-border);
	border-radius: 12px;
	background-color: var(--oid-card);
	color: var(--oid-text);
	font: inherit;
	font-size: 1rem;
	font-weight: 400;
}

.oid .oid-control select:focus-visible,
.oid input.oid-search:focus-visible {
	outline: 3px solid var(--oid-primary);
	outline-offset: 2px;
}

.oid-card {
	padding: 1.15rem;
	border: 1px solid var(--oid-border);
	border-radius: var(--oid-radius);
	background: var(--oid-card);
}

.oid .oid-title {
	font-size: 1.375rem;
	line-height: 1.25;
}

.oid .oid-subtitle {
	margin-top: 0.3rem;
	color: var(--oid-muted);
	font-size: 0.875rem;
}

.oid .oid-rows {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-top: 1.1rem;
	list-style: none;
}

.oid-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.25rem 0.75rem;
	align-items: center;
	margin: 0;
}

.oid-label {
	grid-column: 1 / -1;
	font-size: 0.9375rem;
}

.oid-track {
	display: block;
	height: 0.875rem;
	overflow: hidden;
	border-radius: 999px;
	background: var(--oid-track);
}

.oid-bar {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--oid-primary);
	transition: width 0.3s ease;
}

.oid-value {
	min-width: 2.5rem;
	color: var(--oid-accent);
	font-weight: 800;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.oid .oid-warning {
	grid-column: 1 / -1;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--oid-warn-border);
	border-radius: 12px;
	background: var(--oid-warn-bg);
	color: var(--oid-accent);
	font-size: 0.8125rem;
}

/*
 * Twenty Twenty-One styles buttons with button:not(:hover):not(:active):not(.has-background),
 * specificity 0,3,1. Doubled classes on plugin buttons are there to beat that, not by accident.
 */
.oid button.oid-link.oid-link {
	margin: 0;
	padding: 0.25rem 0;
	border: 0;
	background: none;
	color: var(--oid-primary-strong);
	font: inherit;
	font-weight: 700;
	text-decoration: underline;
	cursor: pointer;
}

.oid button.oid-link.oid-link:focus-visible {
	outline: 3px solid var(--oid-primary);
	outline-offset: 2px;
}

.oid .oid-source {
	margin-top: 1rem;
	padding-top: 0.85rem;
	border-top: 1px solid var(--oid-border);
	color: var(--oid-muted);
	font-size: 0.8125rem;
}

.oid .oid-source a {
	color: inherit;
	text-decoration: underline;
}

/* Sized off the widget, not the viewport, because the theme's content column is narrow. */
@container (min-width: 36rem) {
	.oid-row {
		grid-template-columns: minmax(9rem, 13rem) 1fr auto;
	}

	.oid-label {
		grid-column: auto;
	}
}

@container (min-width: 44rem) {
	.oid-top {
		grid-template-columns: 1fr 15rem;
	}
}

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