/* Benchmarks page (benchmarks.html): page head extras, the device card (device-card.js), the download strip
   (loads.js), the corpus waterfall (waterfall.js), the frame-time scene (frames.js) and the published numbers.
   Colours come from the site.css tokens only, so both themes work. Scripts set only custom properties (--l, --w,
   --step, --c) through the CSSOM. */

.page-benchmarks .section { padding-block: clamp(56px, 8vw, 104px); }
.page-benchmarks .section-head { margin-bottom: clamp(28px, 4vw, 44px); }
.page-benchmarks .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.page-benchmarks .chip.off { border-style: dashed; border-color: var(--line-2); color: var(--text-3); }
.page-benchmarks td.r,
.page-benchmarks th.r { text-align: right; }

/* placeholder text inside the script-filled containers (replaced on boot; stays when WebGPU is missing) */
.bm-wait {
	margin: 0;
	padding: 18px 0;
	color: var(--text-3);
	font-size: 14px;
}

/* --- page head ------------------------------------------------------------------------------------------------- */

.page-benchmarks .page-head .lead { max-width: 62ch; }

.bm-head-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 24px;
	margin-top: 4px;
}

.bm-local { margin: 0; }

.bm-jump {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}

.bm-jump a {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 0 12px;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	color: var(--text-2);
	font-size: 13.5px;
	font-weight: 500;
	text-decoration: none;
	transition: color 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.bm-jump a:hover { border-color: color-mix(in oklab, var(--text) 30%, transparent); background: var(--surface-2); color: var(--text); }

.bm-jump-n {
	margin-right: 8px;
	color: var(--text-3);
	font: 500 11px/1 var(--font-mono);
	letter-spacing: 0.04em;
}

.bm-kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin-top: 22px;
	margin-bottom: 10px;
}

.bm-kpi {
	display: grid;
	gap: 6px;
	align-content: start;
	padding: 18px 20px;
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	background: var(--surface);
}

.bm-kpi-badge {
	display: inline-flex;
	align-self: start;
	justify-self: start;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	font: 600 11px/1.4 var(--font-mono);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.bm-kpi-num {
	color: var(--text);
	font-size: clamp(1.85rem, 1.45rem + 1.4vw, 2.55rem);
	font-weight: 700;
	letter-spacing: -0.04em;
	line-height: 1.05;
	font-variant-numeric: tabular-nums;
}

.bm-kpi-unit {
	margin-left: 6px;
	color: var(--text-3);
	font-size: 0.45em;
	font-weight: 500;
	letter-spacing: -0.01em;
	white-space: nowrap;
}

.bm-kpi-desc {
	color: var(--text-2);
	font-size: 13px;
	line-height: 1.45;
}

.bm-kpi-desc strong { color: var(--text); font-weight: 600; }
.bm-kpi-desc em { font-style: normal; color: var(--text); }

.bm-kpi-note { max-width: 90ch; margin: 0 0 4px; font-size: 12.5px; line-height: 1.5; }

/* --- this device (device-card.js) ------------------------------------------------------------------------------ */

.dc-main {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: clamp(32px, 5vw, 72px);
	align-items: start;
}

.dc-gpu { display: grid; gap: 18px; align-content: start; }

.dc-label {
	color: var(--text-3);
	font: 500 12px/1.4 var(--font-mono);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.dc-adapter-head { display: grid; gap: 4px; margin-top: -10px; }

.dc-adapter {
	margin: 0;
	color: var(--text);
	font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem);
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.dc-adapter-detail {
	margin: 0;
	color: var(--text-3);
	font: 400 12.5px/1.4 var(--font-mono);
	overflow-wrap: anywhere;
}

.dc-specs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin: 0;
	border-block: 1px solid var(--line);
}

.dc-specs > div { padding: 12px 12px 12px 0; }
.dc-specs > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.dc-specs dt { color: var(--text-3); font-size: 12.5px; }
.dc-specs dd { margin: 2px 0 0; color: var(--text); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }

.dc-families { display: grid; margin: 0; padding: 0; list-style: none; }

.dc-family {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 14px;
	padding: 14px 0;
	border-bottom: 1px solid var(--line);
}

/* the 4×4 texel block: the unit every one of these formats stores */
.dc-block {
	width: 21px;
	height: 21px;
	border-radius: 2px;
	color: var(--line-2);
	background-image:
		linear-gradient(to right, currentColor 1px, transparent 1px),
		linear-gradient(to bottom, currentColor 1px, transparent 1px);
	background-size: 5px 5px;
}

.dc-family.on .dc-block { color: color-mix(in oklab, var(--accent) 70%, transparent); background-color: var(--accent-soft); }

.dc-family-text { display: grid; gap: 2px; min-width: 0; }
.dc-family-name { color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.dc-family-formats { color: var(--text-3); font-size: 13px; }

.dc-family-state {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--text-3);
	font-size: 13px;
	white-space: nowrap;
}

.dc-family-state::before {
	content: '';
	width: 6px;
	height: 6px;
	border: 1px solid var(--text-3);
	border-radius: 50%;
}

.dc-family.on .dc-family-state { color: var(--text); }
.dc-family.on .dc-family-state::before { border-color: var(--ok); background: var(--ok); }
.dc-family.off .dc-family-name { color: var(--text-2); }

.dc-device-head { display: grid; gap: 6px; margin-bottom: 8px; }
.dc-device-name { margin: 0; color: var(--text-3); font-size: 13.5px; }
.dc-device-name strong { color: var(--text-2); font-weight: 600; }

.dc-table th { white-space: nowrap; }
.dc-table td { vertical-align: middle; }

.dc-kind { display: grid; gap: 1px; color: var(--text); }
.dc-sem { color: var(--text-3); font: 400 11.5px/1.3 var(--font-mono); white-space: nowrap; }
.dc-device-note { margin: 0; }
.dc-device-note code { font-size: 0.86em; }

code.dc-format {
	padding: 0;
	border: 0;
	background: none;
	color: var(--text);
	font-size: 13px;
}

code.dc-format.f-raw { color: var(--text-3); }

.dc-more { margin-top: 32px; border-top: 1px solid var(--line); }

details.dc-other { border-bottom: 1px solid var(--line); }

details.dc-other > summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 16px;
	padding: 14px 28px 14px 0;
	position: relative;
	color: var(--text-2);
	font-size: 14px;
	cursor: pointer;
	list-style: none;
}

details.dc-other > summary::-webkit-details-marker { display: none; }

details.dc-other > summary::after {
	content: '';
	position: absolute;
	right: 4px;
	top: 50%;
	width: 7px;
	height: 7px;
	margin-top: -6px;
	border-right: 1.5px solid var(--text-3);
	border-bottom: 1.5px solid var(--text-3);
	transform: rotate(45deg);
	transition: transform 0.2s var(--ease);
}

details.dc-other[open] > summary::after { margin-top: -2px; transform: rotate(-135deg); }
details.dc-other > summary:hover { color: var(--text); }
.dc-other-name strong { color: var(--text); font-weight: 600; }
.dc-other-state { color: var(--text-3); font-size: 13px; }
details.dc-other .table-scroll { padding-bottom: 16px; }

.dc-foot { max-width: 80ch; margin-top: 24px; }

/* --- what this page downloaded (loads.js) ---------------------------------------------------------------------- */

.ld-grid { display: grid; gap: clamp(36px, 5vw, 56px); }

/* #loads-bars: the headline figures on the left, the comparison bars on the right */
.ld-bars,
.ld-list {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: 24px clamp(32px, 5vw, 72px);
	align-items: start;
}

.ld-list { padding-top: clamp(28px, 4vw, 40px); border-top: 1px solid var(--line); }

.ld-summary { display: grid; gap: 0; align-content: start; }

.big { display: grid; gap: 8px; align-content: start; }

.big-num,
.zero b {
	color: var(--text);
	font-size: clamp(2.5rem, 1.9rem + 2.2vw, 3.5rem);
	font-weight: 650;
	letter-spacing: -0.04em;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.big-label { max-width: 34ch; color: var(--text-3); font-size: 14px; line-height: 1.45; }
.ld-figure { padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.ld-figure-note { color: var(--text-2); font-size: 14px; line-height: 1.45; }

/* "0 WASM · 0 .wasm fetched · 0 WebAssembly calls" (the exact text e2e reads; the separator is hidden) */
.zero {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 26px 0 0;
}

.zero-sep { display: none; }

.zero-detail {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--text-2);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.zero-detail::before {
	content: '';
	flex: none;
	width: 9px;
	height: 4.5px;
	margin: -3px 1px 0;
	border-bottom: 1.75px solid var(--ok);
	border-left: 1.75px solid var(--ok);
	transform: rotate(-45deg);
}

.zero.bad b { color: var(--err); }
.zero.bad .zero-detail::before { width: 8px; height: 8px; margin: 0; border: 0; border-radius: 50%; background: var(--err); transform: none; }

.ld-csp { margin-top: 10px; }
.ld-csp code { font-size: 0.82em; }

.ld-rows { display: grid; }
.ld-rows-note { margin-top: 12px; }

.ld-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ld-row:first-child { padding-top: 4px; }

.ld-row-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
}

.ld-row-label { display: grid; gap: 1px; min-width: 0; color: var(--text-2); font-size: 14.5px; }
.ld-row-note { color: var(--text-3); font-size: 12.5px; font-weight: 400; }

.ld-row-value {
	flex: none;
	color: var(--text-2);
	font: 500 13px/1 var(--font-mono);
	font-variant-numeric: tabular-nums;
}

.ld-row.ours .ld-row-label,
.ld-row.ours .ld-row-value { color: var(--text); font-weight: 600; }
.ld-row.ours .ld-row-note { font-weight: 400; }

.ld-track {
	display: block;
	position: relative;
	height: 6px;
	margin-top: 10px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--surface-2);
}

.ld-fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: var(--w, 0%);
	min-width: 3px;
	border-radius: inherit;
	background: var(--them);
	transition: width 0.6s var(--ease);
}

.ld-row.ours .ld-fill { background: var(--ours); }

.ld-chunks { display: grid; gap: 8px; align-content: start; }
.ld-families { margin-top: 6px; }
.ld-chip-state { color: var(--text-3); font-weight: 400; }
.chip.on .ld-chip-state { color: color-mix(in oklab, var(--accent) 70%, var(--text-3)); }

details.ld-modules { border-block: 1px solid var(--line); }

details.ld-modules > summary {
	position: relative;
	padding: 14px 28px 14px 0;
	color: var(--text);
	font-size: 14.5px;
	font-weight: 500;
	cursor: pointer;
	list-style: none;
}

details.ld-modules > summary::-webkit-details-marker { display: none; }
details.ld-modules > summary .subtle { font-weight: 400; }

details.ld-modules > summary::after {
	content: '';
	position: absolute;
	right: 4px;
	top: 50%;
	width: 7px;
	height: 7px;
	margin-top: -6px;
	border-right: 1.5px solid var(--text-3);
	border-bottom: 1.5px solid var(--text-3);
	transform: rotate(45deg);
	transition: transform 0.2s var(--ease);
}

details.ld-modules[open] > summary::after { margin-top: -2px; transform: rotate(-135deg); }
details.ld-modules > .table-scroll { max-height: 420px; overflow-y: auto; }
details.ld-modules > p { margin: 12px 0; }
.ld-table code { padding: 0; border: 0; background: none; font-size: 12.5px; }
.ld-table td:not(:first-child),
.ld-table th:not(:first-child) { text-align: right; white-space: nowrap; }

/* --- the corpus waterfall (waterfall.js) ----------------------------------------------------------------------- */

.wf-panel {
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	background: var(--surface);
}

/* buttons left, options right; when both do not fit on one line the options wrap under the buttons as a whole
   (the buttons never wrap one by one) */
.wf-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 24px;
	padding: clamp(18px, 2.4vw, 24px);
	border-bottom: 1px solid var(--line);
}

.wf-buttons,
.wf-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.wf-buttons { flex: none; max-width: 100%; }
.wf-options { flex: 0 1 auto; min-width: 0; }
.wf-options select { min-height: 32px; font-size: 13.5px; }
.wf-corpus { flex: 1 0 100%; margin: 0; }

button.wf-run { min-height: 42px; padding: 0 20px; border-radius: 10px; font-size: 15px; }
button.wf-run .arrow { transition: transform 0.2s var(--ease); }
button.wf-run:hover .arrow { transform: translateX(3px); }

.wf-totals {
	padding: clamp(18px, 2.4vw, 24px);
	border-bottom: 1px solid var(--line);
}

.wf-totals:empty { display: none; }
.wf-totals .bm-wait { padding: 0; }
.wf-totals > .note { min-height: 24px; }

.wf-empty { margin: 0; color: var(--text-2); font-size: 15px; }
.wf-empty strong { color: var(--text); font-weight: 600; }
.wf-empty b { color: var(--text); font-weight: 600; }

.wf-stats {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr));
}

.wf-stat { display: grid; gap: 6px; align-content: start; padding: 2px 20px; }
.wf-stat:first-child { padding-left: 0; }
.wf-stat + .wf-stat { border-left: 1px solid var(--line); }

.wf-stat-num {
	color: var(--text);
	font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.85rem);
	font-weight: 650;
	letter-spacing: -0.03em;
	line-height: 1.05;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.wf-stat.main .wf-stat-num { font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.6rem); }
.wf-stat-label { color: var(--text-3); font-size: 13px; line-height: 1.4; }

.wf-pills {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
	margin: 18px 0 0;
}

.wf-history { margin-left: 6px; }

.wf-rows { padding: 8px clamp(18px, 2.4vw, 24px) 14px; }

.wf-row {
	display: grid;
	grid-template-columns: minmax(0, 210px) minmax(0, 1fr) 76px;
	grid-template-areas:
		'name track time'
		'meta track time';
	column-gap: 20px;
	border-radius: 6px;
	transition: opacity 0.2s var(--ease);
}

.wf-row:not(.wf-axis):hover .wf-name { color: var(--accent); }

.wf-name {
	grid-area: name;
	overflow: hidden;
	padding-top: 9px;
	color: var(--text);
	font-size: 14px;
	font-weight: 500;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: color 0.15s var(--ease);
}

.wf-meta {
	grid-area: meta;
	overflow: hidden;
	padding-bottom: 9px;
	color: var(--text-3);
	font: 400 11.5px/1.5 var(--font-mono);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wf-row.error .wf-meta { color: var(--err); }
.wf-row.error .wf-name { color: var(--err); }

/* the track spans both lines of the row, so its vertical grid lines join from row to row */
.wf-track {
	grid-area: track;
	position: relative;
	min-height: 24px;
	background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
	background-size: var(--step, 25%) 100%;
	background-repeat: repeat-x;
}

.wf-track::before {
	content: '';
	position: absolute;
	inset: 50% 0 auto;
	height: 1px;
	background: var(--line);
}

.wf-time {
	grid-area: time;
	align-self: center;
	color: var(--text-2);
	font: 500 12.5px/1 var(--font-mono);
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.wf-track .seg {
	position: absolute;
	top: 50%;
	left: var(--l, 0%);
	width: var(--w, 0%);
	min-width: 1px;
	height: 7px;
	margin-top: -4px;
	border-radius: 1.5px;
	background: var(--text-3);
}

.wf-track .seg.gpu { height: 2px; margin-top: 6px; border-radius: 1px; }

.seg.fetch { background: var(--fetch); }
.seg.decode { background: var(--decode); }
.seg.upload { background: var(--upload); }
.seg.wait { background: var(--wait); }
.seg.queue { background: var(--queue); }
.seg.sample { background: var(--sample); }
.seg.gpu { background: var(--gpu); }

/* "wait" is near the background colour: give it an outline so it stays visible in both themes */
.wf-track .seg.wait { box-shadow: inset 0 0 0 1px var(--line-2); }

.wf-axis {
	grid-template-areas: 'name track time';
	align-items: center;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--line);
	border-radius: 0;
}

.wf-axis .wf-name,
.wf-axis .wf-time {
	padding: 12px 0;
	color: var(--text-3);
	font: 500 11px/1.4 var(--font-mono);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.wf-axis .wf-track { align-self: stretch; min-height: 0; background: none; }
.wf-axis .wf-track::before { content: none; }

.wf-tick {
	position: absolute;
	top: 50%;
	margin-top: -5px;
	left: var(--l, 0%);
	color: var(--text-3);
	font: 400 11px/1 var(--font-mono);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	transform: translateX(-50%);
}

.wf-tick:first-child { transform: none; }
.wf-tick.end { transform: translateX(-100%); }

.wf-row.pending .wf-name { color: var(--text-2); }
.wf-row.pending .wf-track { background: none; }
.wf-row.pending .wf-time { color: var(--text-3); }

.wf-rows.is-running .wf-row:not(.wf-axis):not(.pending) { opacity: 0.4; }

.wf-rows.is-running .wf-row.pending .wf-track::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 0;
	width: 30%;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--accent), transparent);
	animation: wf-scan 1.4s var(--ease) infinite;
}

@keyframes wf-scan {
	from { transform: translateX(-100%); }
	to { transform: translateX(340%); }
}

.wf-key { margin-top: 32px; }

.wf-key-title {
	margin-bottom: 14px;
	color: var(--text-3);
	font: 500 12px/1.4 var(--font-mono);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.wf-legend {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	gap: 14px 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wf-legend li { display: grid; gap: 2px; align-content: start; }

.wf-legend .seg {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	background: none;
	color: var(--text);
	font-size: 14px;
	font-weight: 500;
}

.wf-legend .seg::before {
	content: '';
	flex: none;
	width: 18px;
	height: 7px;
	border-radius: 1.5px;
}

.wf-legend .seg.gpu::before { height: 2px; }
.wf-legend .seg.wait::before { box-shadow: inset 0 0 0 1px var(--line-2); }
.wf-legend .seg.fetch::before { background: var(--fetch); }
.wf-legend .seg.decode::before { background: var(--decode); }
.wf-legend .seg.upload::before { background: var(--upload); }
.wf-legend .seg.wait::before { background: var(--wait); }
.wf-legend .seg.queue::before { background: var(--queue); }
.wf-legend .seg.sample::before { background: var(--sample); }
.wf-legend .seg.gpu::before { background: var(--gpu); }

.wf-legend-desc { padding-left: 27px; color: var(--text-3); font-size: 13.5px; line-height: 1.45; }

/* --- frame time (frames.js) ------------------------------------------------------------------------------------ */

.fr-controls { margin-bottom: 20px; }

.fr-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
}

.fr-figure { display: grid; gap: 10px; align-content: start; margin: 0; }
.fr-figure figcaption { max-width: 60ch; }

.fr-stage,
.fr-plot {
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
}

/* a neutral dark stage in both themes (the scene's own background, after tone mapping) */
.fr-stage { background: #19191d; }
.fr-stage canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; }

.fr-plot { background: var(--surface); }
.fr-plot canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; }

.fr-stats { margin-top: 24px; }
.fr-stats > p { margin-top: 10px; }
.fr-table td:not(:first-child),
.fr-table th:not(:first-child) { text-align: right; white-space: nowrap; }
.fr-table td:first-child { color: var(--text); white-space: nowrap; }

.swatch {
	display: inline-block;
	width: 14px;
	height: 3px;
	margin-right: 10px;
	border-radius: 2px;
	background: var(--c, var(--text-3));
	vertical-align: middle;
}

/* --- published numbers ----------------------------------------------------------------------------------------- */

.pub-context {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 0;
	margin-top: 4px;
	color: var(--text-2);
	font: 500 12.5px/1.4 var(--font-mono);
	letter-spacing: 0.02em;
}

/* the one gold accent of the page: a tiny dot next to the test machine */
.pub-context::before {
	content: '';
	width: 6px;
	height: 6px;
	margin-right: 10px;
	border-radius: 50%;
	background: var(--bolt);
}

.pub-context strong { color: var(--text); font-weight: 600; }

/* keeps a figure such as "1.4–2.5 ms" on one line in a heading */
.bm-nowrap { white-space: nowrap; }

.pub-figures {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	border-block: 1px solid var(--line);
}

.pub-figure { display: grid; gap: 10px; align-content: start; padding: 28px 28px 28px 0; }
.pub-figure + .pub-figure { padding-left: 28px; border-left: 1px solid var(--line); }
.pub-figure .subtle { max-width: 34ch; font-size: 14px; line-height: 1.5; }

.pub-num {
	color: var(--text);
	font-size: clamp(2.4rem, 1.9rem + 2vw, 3.4rem);
	font-weight: 650;
	letter-spacing: -0.04em;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.pub-unit {
	margin-left: 4px;
	color: var(--text-3);
	font-size: 0.42em;
	font-weight: 500;
	letter-spacing: 0;
}

.pub-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(32px, 5vw, 64px);
	margin-top: clamp(40px, 6vw, 64px);
}

.pub-block { display: grid; gap: 14px; align-content: start; min-width: 0; }
.pub-block > p { max-width: 60ch; }
.pub-wide { margin-top: clamp(32px, 5vw, 48px); margin-bottom: clamp(32px, 5vw, 48px); }
.pub-wide > p { max-width: 82ch; }
.bm-comp-table th,
.bm-comp-table td { white-space: nowrap; }
.bm-comp-table td:first-child { white-space: normal; }
.bm-row-ours { background: color-mix(in oklab, var(--accent-soft) 50%, transparent); }
.bm-row-ours td:first-child { color: var(--text); }
.bm-row-ours td.r strong { color: var(--accent); }

/* "4.0×": how much faster than the Basis UASTC .ktx2 row, after the time */
.bm-x {
	display: inline-block;
	min-width: 3.4em;
	margin-left: 8px;
	color: var(--text-3);
	font: 500 11.5px/1 var(--font-mono);
	text-align: right;
}

.bm-row-ours .bm-x { color: color-mix(in oklab, var(--accent) 75%, var(--text-3)); }

/* CSS-only interactive benchmark scenario tabs (.bm-tabs) */
.bm-tabs > input[type='radio'] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.bm-tab-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
}

.bm-tab-bar {
	display: inline-flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	max-inline-size: 100%;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: 9px;
	background: var(--surface-2);
	scrollbar-width: none;
}

.bm-tab-bar::-webkit-scrollbar { display: none; }

.bm-tab-bar label {
	position: relative;
	flex: none;
	padding: 6px 12px;
	border-radius: 6px;
	color: var(--text-2);
	font-size: 12.5px;
	font-weight: 550;
	white-space: nowrap;
	cursor: pointer;
	transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.bm-tab-bar label:hover { color: var(--text); }

#bmtab-pbr:checked ~ .bm-tab-head label[for='bmtab-pbr'],
#bmtab-warm:checked ~ .bm-tab-head label[for='bmtab-warm'],
#bmtab-cold:checked ~ .bm-tab-head label[for='bmtab-cold'],
#bmtab-net:checked ~ .bm-tab-head label[for='bmtab-net'],
#bmtab-high:checked ~ .bm-tab-head label[for='bmtab-high'] {
	background: var(--bg);
	color: var(--text);
	box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / 0.12);
}

#bmtab-pbr:checked ~ .bm-tab-head label[for='bmtab-pbr']::after,
#bmtab-warm:checked ~ .bm-tab-head label[for='bmtab-warm']::after,
#bmtab-cold:checked ~ .bm-tab-head label[for='bmtab-cold']::after,
#bmtab-net:checked ~ .bm-tab-head label[for='bmtab-net']::after,
#bmtab-high:checked ~ .bm-tab-head label[for='bmtab-high']::after {
	content: '';
	position: absolute;
	inset-inline: 10px;
	inset-block-end: 0;
	border-block-end: 2px solid var(--accent);
}

#bmtab-pbr:focus-visible ~ .bm-tab-head label[for='bmtab-pbr'],
#bmtab-warm:focus-visible ~ .bm-tab-head label[for='bmtab-warm'],
#bmtab-cold:focus-visible ~ .bm-tab-head label[for='bmtab-cold'],
#bmtab-net:focus-visible ~ .bm-tab-head label[for='bmtab-net'],
#bmtab-high:focus-visible ~ .bm-tab-head label[for='bmtab-high'] {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.bm-panel { display: none; }
#bmtab-pbr:checked ~ .bm-panel[data-bmtab='pbr'],
#bmtab-warm:checked ~ .bm-panel[data-bmtab='warm'],
#bmtab-cold:checked ~ .bm-panel[data-bmtab='cold'],
#bmtab-net:checked ~ .bm-panel[data-bmtab='net'],
#bmtab-high:checked ~ .bm-panel[data-bmtab='high'] { display: block; }

/* head to head with spark.js: the better value of each row is the bold one */
.bm-vs-table td:first-child { color: var(--text-2); }
/* two value columns of equal width that may wrap, so spark.js stays on screen next to ours on a phone */
.bm-vs-table th:not(:first-child),
.bm-vs-table td:not(:first-child) { width: 22%; white-space: normal; }
.bm-vs-table td.bm-win strong { color: var(--accent); }
.bm-vs-table td a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.bm-vs-table td a:hover { color: var(--text); }

.page-benchmarks .section-head .lead .pill { margin-right: 4px; vertical-align: 2px; }
.pub-wide > .pub-context { margin-top: -4px; }
.pub-context-ref { margin-bottom: 14px; }

.pub-quality {
	grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
	grid-template-rows: auto 1fr;
	grid-template-areas:
		'title table'
		'desc table';
	column-gap: clamp(32px, 5vw, 64px);
	margin-top: clamp(40px, 6vw, 64px);
	padding-top: clamp(32px, 4vw, 48px);
	border-top: 1px solid var(--line);
}

.pub-quality > h3 { grid-area: title; }
.pub-quality > p { grid-area: desc; align-self: start; }
.pub-quality > .table-scroll { grid-area: table; }
.pub-quality-table code { padding: 0; border: 0; background: none; color: var(--text); font-size: 12.5px; }
.pub-quality-table td.r { white-space: nowrap; }
.pub-quality-table td.r.wrap { white-space: normal; }

.pub-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	margin-top: clamp(32px, 5vw, 48px);
	margin-left: -14px;
}

/* the closing call to action is the shared .page-next of site.css */

/* --- responsive ------------------------------------------------------------------------------------------------ */

@media (max-width: 960px) {
	.bm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.dc-main,
	.ld-bars,
	.ld-list { grid-template-columns: minmax(0, 1fr); }
	.wf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
	.wf-stat:nth-child(3) { padding-left: 0; border-left: 0; }
	.pub-quality { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'title' 'desc' 'table'; }
}

@media (max-width: 560px) {
	.bm-kpis { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
	.fr-grid,
	.pub-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
	.wf-row {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			'name time'
			'meta meta'
			'track track';
		column-gap: 12px;
		padding-bottom: 10px;
	}

	.wf-name { padding-top: 10px; }
	.wf-time { align-self: end; }
	.wf-meta { padding-bottom: 4px; }
	.wf-track { min-height: 16px; }
	.wf-axis { grid-template-areas: 'name time' 'track track'; padding-bottom: 0; }
	.wf-axis .wf-name,
	.wf-axis .wf-time { padding: 10px 0 4px; }
	.wf-axis .wf-track { min-height: 22px; }

	.pub-figures { grid-template-columns: minmax(0, 1fr); }
	.pub-figure,
	.pub-figure + .pub-figure { padding: 22px 0; border-left: 0; }
	.pub-figure + .pub-figure { border-top: 1px solid var(--line); }
}

@media (max-width: 560px) {
	.dc-specs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.dc-specs > div:nth-child(3) { grid-column: 1 / -1; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
	.wf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
	.wf-stat,
	.wf-stat + .wf-stat { padding: 0; border-left: 0; }
	.wf-stat.main,
	.wf-stat:last-child { grid-column: 1 / -1; }
	.fr-plot canvas { aspect-ratio: 4 / 3; }
	.dc-family { gap: 12px; }
	.wf-row.pending .wf-track { display: none; }
	.wf-row.pending { padding-bottom: 0; }
}

/* the narrowest phones: the four-column format table fits without sideways scrolling */
@media (max-width: 400px) {
	.dc-table th,
	.dc-table td { padding-inline: 6px; }
	.dc-table th:first-child,
	.dc-table td:first-child { padding-left: 0; }
	.dc-table th:last-child,
	.dc-table td:last-child { padding-right: 0; }
	code.dc-format { font-size: 12px; }
	.dc-sem { font-size: 11px; }
}
