/* minimi AI - Benchmark section (data: product/LLMBench/*.json, code: js/benchmark.js)
   Text uses the page font (--font-soft) inherited from body. */

.bench {
	--bench-bar: #2a78d6;        /* accent for focus rings / checkboxes; bars use each vendor's colour (js) */
	--bench-surface: #fff;
	--bench-ink: #333;
	--bench-ink-2: #555;
	--bench-muted: #898781;
	--bench-grid: #e1e0d9;
	--bench-axis: #c3c2b7;
	--bench-line: #777;          /* control borders, matches the side nav */
	--bench-plot-h: 300px;       /* bar area incl. room for the value on the cap */
	--bench-label-h: 140px;      /* rotated model names under the bars: fits 95% of names at 11px, longer ones end in "…" */
	font-size: 0.875rem;
	color: var(--bench-ink-2);
}

.bench a { text-decoration: underline; }

.bench-meta {
	font-size: 12px;
	color: var(--bench-muted);
}
.bench-meta b { color: var(--bench-ink); font-weight: 700; }

/* ---- top row: tabs + update date on the left, filters right-aligned ---- */

.bench-head {
	display: flex;
	flex-wrap: wrap;           /* on narrower screens the filters drop below, still right-aligned */
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem 1.5rem;
	margin-bottom: 1rem;
}

.bench-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 0.5rem 1rem;
	margin-left: auto;
}

.bench-input {
	font: inherit;
	color: var(--bench-ink);
	background: var(--bench-surface);
	border: 2px solid var(--bench-line);
	border-radius: 0;
	padding: 0.2rem 0.5rem;
	height: 2.25rem;           /* same height as the tabs */
}
.bench-input:focus { outline: 2px solid var(--bench-bar); outline-offset: 1px; }
.bench-search { width: 14rem; max-width: 100%; }

.bench-field,
.bench-check {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
	white-space: nowrap;
	cursor: pointer;
}
.bench-check input { width: 1rem; height: 1rem; accent-color: var(--bench-bar); }

.bench-view { display: inline-flex; }
.bench-view button {
	font-size: 12px;
	height: 2.25rem;
	padding: 0 0.75rem;
	color: var(--bench-ink);
	background: var(--bench-surface);
	border: 2px solid var(--bench-line);
	border-radius: 0;
	cursor: pointer;
}
.bench-view button + button { border-left: 0; }
.bench-view button[aria-pressed="true"] { color: #fff; background: var(--bench-line); }

/* ---- benchmark tabs (minimiShortTask / minimiLongTask) ---- */

.bench-tabs {
	display: flex;
	flex-wrap: wrap;
	margin-bottom: 0.25rem; /* the "Updated ..." line sits right under the tabs */
}
.bench-tab {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	height: 2.25rem;
	padding: 0 1rem;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--bench-ink);
	background: var(--bench-surface);
	border: 2px solid var(--bench-line);
	border-radius: 0;
	cursor: pointer;
}
.bench-tab + .bench-tab { margin-left: -2px; } /* borders overlap; still boxed if the tabs wrap */
.bench-tab[aria-selected="true"] { color: #fff; background: var(--bench-line); }
.bench-tab:focus-visible { outline: 2px solid var(--bench-bar); outline-offset: 2px; }
.bench-tab-tag {
	padding: 0 0.3rem;
	font-size: 0.625rem;
	font-weight: 400;
	line-height: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border: 1px solid currentColor;
}

.bench-private {
	margin: 0.75rem 0 0;
	padding: 3rem 1rem;
	text-align: center;
	color: var(--bench-muted);
	border: 1px dashed var(--bench-axis);
}
.bench-private b { color: var(--bench-ink); }

/* ---- vendor filter: tiny badges outlined in the vendor's bar colour (--chip, set in js) ---- */

.bench-vendors {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin-bottom: 1.5rem;
}

.bench-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	height: 1.25rem;
	padding: 0 0.375rem;
	font: inherit;
	font-size: 0.6875rem;
	line-height: 1;
	color: var(--bench-ink-2);
	background: var(--bench-surface);
	border: 1px solid var(--chip, var(--bench-axis));
	border-radius: 0;
	cursor: pointer;
}
.bench-chip:hover { background: color-mix(in srgb, var(--chip, #777) 8%, #fff); }
.bench-chip[aria-pressed="true"] {
	color: var(--bench-ink);
	font-weight: 700;
	background: color-mix(in srgb, var(--chip, #777) 18%, #fff);
	box-shadow: inset 0 0 0 1px var(--chip, #777);  /* 2px outline without moving the layout */
}
.bench-chip .bench-count { color: var(--bench-muted); font-size: 0.625rem; font-weight: 400; }

/* ---- shared bits ---- */

.bench-icon {
	width: 20px;
	height: 20px;
	flex: none;
	object-fit: contain;
}
.bench-chip .bench-icon { width: 12px; height: 12px; }
.bench-chip .bench-badge { font-size: 8px; }

/* vendors without a logo get a pixel letter badge */
.bench-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	background: var(--bench-line);
}

.bench-chart { position: relative; min-height: calc(var(--bench-plot-h) + var(--bench-label-h) + 36px); }
.bench-chart.is-loading { opacity: 0.5; }

.bench-empty {
	padding: 4rem 0;
	text-align: center;
	color: var(--bench-muted);
}

.bench-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.25rem 1rem;
	margin-top: 0.75rem;
	font-size: 0.75rem;
	color: var(--bench-muted);
}
.bench-foot a { color: var(--bench-muted); }

/* ---- column chart (desktop default) ---- */

.bc {
	display: grid;
	grid-template-columns: 2.25rem minmax(0, 1fr);
}

.bc-yaxis {
	position: relative;
	height: var(--bench-plot-h);
}
.bc-yaxis span {
	position: absolute;
	right: 0.5rem;
	transform: translateY(50%);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	color: var(--bench-muted);
}

.bc-scroll {
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 0.25rem;
}

.bc-inner {
	position: relative;
	display: flex;
	min-width: 100%;
	width: max-content;
}

.bc-grid {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: var(--bench-plot-h);
	pointer-events: none;
}
.bc-grid span {
	position: absolute;
	left: 0;
	right: 0;
	height: 1px;
	background: var(--bench-grid);
}
.bc-grid span.is-base { background: var(--bench-axis); }

.bc-item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1 0 40px;
	max-width: 64px;
	cursor: default;
	outline: none;
}

.bc-plot {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: center;
	width: 100%;
	height: var(--bench-plot-h);
}

.bc-val {
	font-size: 12px;
	line-height: 1;
	color: var(--bench-ink);
	margin-bottom: 4px;
	white-space: nowrap;
}

.bc-bar {
	display: block;
	width: 24px;
	min-height: 1px;
	background: var(--bench-bar);
	border-radius: 4px 4px 0 0;
}

.bc-item .bench-icon,
.bc-item .bench-badge { margin-top: 8px; }

/* Model name turned 90° (reads bottom to top, ends at the icon). Rotated with a
   transform rather than writing-mode, which can make Chrome fall back to another font. */
.bc-name {
	position: relative;
	width: 100%;
	height: var(--bench-label-h);
	margin-top: 6px;
}
.bc-name span {
	position: absolute;
	left: calc(50% - 0.675em); /* half the line height: centres the turned text under the bar */
	top: 100%;
	width: var(--bench-label-h);
	transform: rotate(-90deg);
	transform-origin: 0 0;
	text-align: right;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-size: 0.6875rem;  /* 11px, same as the vendor badges */
	line-height: 1.35;     /* room for descenders inside the clipped box */
	color: var(--bench-ink-2);
}

.bc-item:hover .bc-bar,
.bc-item:focus-visible .bc-bar { filter: brightness(0.85) saturate(1.15); }
.bc-item:hover .bc-name span,
.bc-item:focus-visible .bc-name span { color: var(--bench-ink); }
.bc-item:focus-visible { box-shadow: inset 0 0 0 2px var(--bench-bar); }

/* ---- ranked list (mobile default, and the table view on desktop) ---- */

.br { border-top: 1px solid var(--bench-grid); }

.br-row {
	display: grid;
	grid-template-columns: 2.5rem 20px minmax(8rem, 18rem) minmax(0, 1fr);
	grid-template-areas: "rank icon name track";
	align-items: center;
	column-gap: 0.75rem;
	padding: 0.4rem 0.25rem;
	border-bottom: 1px solid var(--bench-grid);
	outline: none;
}
.br-row:hover,
.br-row:focus-visible { background: #f6f6f4; }
.br-row:focus-visible { box-shadow: inset 0 0 0 2px var(--bench-bar); }

.br-rank {
	grid-area: rank;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: right;
	color: var(--bench-muted);
}
.br-row .bench-icon,
.br-row .bench-badge { grid-area: icon; }

.br-name {
	grid-area: name;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--bench-ink);
}
.br-name small { color: var(--bench-muted); margin-left: 0.4rem; font-size: 0.75rem; }

.br-track {
	grid-area: track;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}
.br-bar {
	display: block;
	height: 14px;
	min-width: 1px;
	background: var(--bench-bar);
	border-radius: 0 4px 4px 0;
}
.br-row:hover .br-bar,
.br-row:focus-visible .br-bar { filter: brightness(0.85) saturate(1.15); }
.br-val {
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	color: var(--bench-ink);
}

@media (max-width: 575.98px) {
	.br-row {
		grid-template-columns: 2rem 20px minmax(0, 1fr);
		grid-template-areas:
			"rank icon name"
			".    .    track";
		row-gap: 0.25rem;
	}
	.bench-filters { justify-content: flex-start; margin-left: 0; } /* stacked under the tabs on phones */
	.bench-tab { gap: 0.3125rem; padding: 0 0.4375rem; font-size: 0.8125rem; } /* both tabs on one line at 360px+ */
	.bench-tab-tag { letter-spacing: 0; }
	/* one swipeable row of vendor chips instead of a tall wrapped block */
	.bench-vendors {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-bottom: 0.25rem;
	}
	.bench-chip { flex: none; }
}

/* ---- tooltip ---- */

.bench-tip {
	position: fixed;
	z-index: 1080;
	max-width: 18rem;
	padding: 0.5rem 0.625rem;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--bench-ink-2);
	background: #fff;
	border: 2px solid var(--bench-ink);
	box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.15);
	pointer-events: none;
}
.bench-tip[hidden] { display: none; }
.bench-tip-score {
	font-size: 20px;
	line-height: 1;
	color: var(--bench-ink);
}
.bench-tip-rank { font-size: 12px; color: var(--bench-muted); margin-left: 0.4rem; }
.bench-tip-name { display: block; margin-top: 0.35rem; font-weight: 700; color: var(--bench-ink); }
.bench-tip-id { display: block; color: var(--bench-muted); word-break: break-all; }
