/*
	Report design — the shared look of every generated report and tool page: the release notes,
	the Oxygen test report, the Sodium reports and the migration review. The rules are in the
	Aluminium guide team/guides/report-design.md.

	This file is the source. Reports that open from disk take a copy when they are generated,
	because they cannot load it; after changing it, regenerate them.

	Tokens come from the SPA's client theme (src/theme/client in Oxygen-SPA), default branding.
*/

/* ── Tokens ────────────────────────────────────────────────────────────── */

:root {
	--report-page: #f9fafb;
	--report-paper: #ffffff;
	--report-line: #e2e8f0;
	--report-text: #4b5563;
	--report-muted: #6c737f;
	--report-title: #0d3d6e;
	--report-accent: #e17000;
	--report-accent-glow: rgba(225, 112, 0, 0.5);
	--report-chip: #f3f4f6;
	--report-hover: rgba(17, 25, 39, 0.04);
	--report-shadow: 0 5px 22px rgba(0, 0, 0, 0.04), 0 0 0 0.5px rgba(0, 0, 0, 0.03);
	--report-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
	--report-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;

	/* -- Tones: a solid colour, a soft background and readable text on that background. */
	--report-success: #10b981;
	--report-success-soft: #ecfdf3;
	--report-success-text: #087443;
	--report-error: #f04438;
	--report-error-soft: #fef3f2;
	--report-error-text: #b42318;
	--report-warning: #f79009;
	--report-warning-soft: #fffaeb;
	--report-warning-text: #b54708;
	--report-info: #2970ff;
	--report-info-soft: #ebefff;
	--report-info-text: #004eeb;
	--report-purple: #9e77ed;
	--report-purple-soft: #f4ebff;
	--report-purple-text: #6941c6;
	--report-neutral: #9da4ae;
	--report-neutral-soft: #f3f4f6;
	--report-neutral-text: #4d5761;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--report-page: #1a222c;
		--report-paper: #24303f;
		--report-line: #2d3748;
		--report-text: #aeb7c0;
		--report-muted: #a0aec0;
		--report-title: #9cc0e6;
		--report-chip: #2e3a47;
		--report-hover: rgba(243, 244, 246, 0.06);
		--report-shadow: 0 5px 22px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
		--report-success-soft: rgba(16, 185, 129, 0.16);
		--report-success-text: #3fc79a;
		--report-error-soft: rgba(240, 68, 56, 0.16);
		--report-error-text: #f97066;
		--report-warning-soft: rgba(247, 144, 9, 0.16);
		--report-warning-text: #fdb022;
		--report-info-soft: rgba(41, 112, 255, 0.16);
		--report-info-text: #8eb1ff;
		--report-purple-soft: rgba(158, 119, 237, 0.16);
		--report-purple-text: #cbb5f7;
		--report-neutral-soft: #2e3a47;
		--report-neutral-text: #d2d6db;
	}
}

:root[data-theme="dark"] {
	--report-page: #1a222c;
	--report-paper: #24303f;
	--report-line: #2d3748;
	--report-text: #aeb7c0;
	--report-muted: #a0aec0;
	--report-title: #9cc0e6;
	--report-chip: #2e3a47;
	--report-hover: rgba(243, 244, 246, 0.06);
	--report-shadow: 0 5px 22px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
	--report-success-soft: rgba(16, 185, 129, 0.16);
	--report-success-text: #3fc79a;
	--report-error-soft: rgba(240, 68, 56, 0.16);
	--report-error-text: #f97066;
	--report-warning-soft: rgba(247, 144, 9, 0.16);
	--report-warning-text: #fdb022;
	--report-info-soft: rgba(41, 112, 255, 0.16);
	--report-info-text: #8eb1ff;
	--report-purple-soft: rgba(158, 119, 237, 0.16);
	--report-purple-text: #cbb5f7;
	--report-neutral-soft: #2e3a47;
	--report-neutral-text: #d2d6db;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

* {
	box-sizing: border-box;
}

/* -- Filtering hides with [hidden]; component display rules would otherwise show it again. */
[hidden],
.report-hidden {
	display: none !important;
}

body.report {
	margin: 0;
	background: var(--report-page);
	color: var(--report-text);
	font-family: var(--report-font);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.6;
	text-align: left;
	-webkit-font-smoothing: antialiased;
}

.report a {
	color: var(--report-accent);
	text-decoration: none;
}

.report a:hover {
	text-decoration: underline;
}

.report code,
.report pre {
	font-family: var(--report-mono);
	font-size: 0.875em;
}

.report code {
	padding: 0.15em 0.4em;
	background: var(--report-chip);
	border-radius: 5px;
}

.report pre code {
	padding: 0;
	background: none;
}

.report-page {
	max-width: 72rem;
	margin: 0 auto;
	padding: 48px 24px 64px;
}

/* ── Header ────────────────────────────────────────────────────────────── */

.report-header {
	margin: 0 0 32px;
}

.report-title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
}

.report-title h1 {
	margin: 0;
	color: var(--report-title);
	font-size: 2em;
	font-weight: 700;
	line-height: 1.25;
}

.report-subtitle {
	margin: 4px 0 0;
	color: var(--report-muted);
}

.report-intro {
	max-width: 72ch;
	margin: 16px 0 0;
}

.report-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 12px 24px;
	margin: 24px 0 0;
}

.report-meta dt,
.report-caption,
.report-stat-label {
	color: var(--report-muted);
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.report-meta dd {
	margin: 0;
	word-break: break-word;
}

/* ── Stats and progress ────────────────────────────────────────────────── */

.report-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
	gap: 16px;
	margin: 0 0 16px;
}

.report-stat {
	padding: 16px 18px;
	background: var(--report-paper);
	border: 1px solid var(--report-line);
	border-radius: 5px;
	box-shadow: var(--report-shadow);
}

.report-stat-value {
	color: var(--report-title);
	font-size: 1.75em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.report-stat-caption {
	min-height: 1.4em;
	color: var(--report-muted);
	font-size: 0.8em;
}

.report-stat.tone-success .report-stat-value { color: var(--report-success-text); }
.report-stat.tone-error .report-stat-value { color: var(--report-error-text); }
.report-stat.tone-warning .report-stat-value { color: var(--report-warning-text); }
.report-stat.tone-info .report-stat-value { color: var(--report-info-text); }
.report-stat.tone-purple .report-stat-value { color: var(--report-purple-text); }

/* -- One segment per tone; each segment's flex-grow is its count. */
.report-progress {
	display: flex;
	height: 6px;
	margin: 0 0 32px;
	overflow: hidden;
	background: var(--report-line);
	border-radius: 3px;
}

.report-progress span {
	display: block;
	height: 100%;
}

/* ── Toolbar ───────────────────────────────────────────────────────────── */

.report-toolbar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	margin: 0 0 24px;
	padding: 12px 0;
	background: var(--report-page);
	border-bottom: 1px solid var(--report-line);
}

.report-segmented {
	display: inline-flex;
	padding: 3px;
	background: var(--report-paper);
	border: 1px solid var(--report-line);
	border-radius: 8px;
}

.report-segmented button {
	padding: 4px 14px;
	border: 0;
	border-radius: 6px;
	background: none;
	color: var(--report-muted);
	font: inherit;
	font-size: 0.8em;
	font-weight: 600;
	cursor: pointer;
}

.report-segmented button:hover {
	background: var(--report-hover);
}

.report-segmented button[aria-pressed="true"] {
	background: var(--report-accent);
	color: #ffffff;
}

.report-segmented button.tone-success[aria-pressed="true"] { background: var(--report-success); }
.report-segmented button.tone-error[aria-pressed="true"] { background: var(--report-error); }
.report-segmented button.tone-warning[aria-pressed="true"] { background: var(--report-warning); }
.report-segmented button.tone-info[aria-pressed="true"] { background: var(--report-info); }
.report-segmented button.tone-purple[aria-pressed="true"] { background: var(--report-purple); }

.report-search,
.report-select {
	padding: 7px 12px;
	border: 1px solid var(--report-line);
	border-radius: 8px;
	background: var(--report-paper);
	color: inherit;
	font: inherit;
	font-size: 0.9em;
}

.report-search {
	flex: 1 1 200px;
	min-width: 0;
}

.report-search:focus,
.report-select:focus,
.report-input:focus {
	outline: none;
	border-color: var(--report-accent);
	box-shadow: 0 0 0 2px var(--report-accent);
}

.report-button {
	padding: 5px 12px;
	border: 1px solid var(--report-line);
	border-radius: 6px;
	background: var(--report-paper);
	color: inherit;
	font: inherit;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
}

.report-button:hover {
	border-color: var(--report-accent);
	color: var(--report-accent);
}

.report-button[aria-pressed="true"].tone-success { background: var(--report-success-soft); border-color: var(--report-success); color: var(--report-success-text); }
.report-button[aria-pressed="true"].tone-error { background: var(--report-error-soft); border-color: var(--report-error); color: var(--report-error-text); }

.report-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--report-muted);
	font-size: 0.85em;
}

.report-count {
	color: var(--report-muted);
	font-size: 0.85em;
}

.report-count:empty {
	display: none;
}

.report-input {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid var(--report-line);
	border-radius: 8px;
	background: var(--report-paper);
	color: inherit;
	font: inherit;
	font-size: 0.9em;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.report-tabs {
	display: flex;
	gap: 4px;
	margin: 0 0 24px;
	border-bottom: 1px solid var(--report-line);
}

.report-tabs button {
	margin-bottom: -1px;
	padding: 8px 14px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: none;
	color: var(--report-muted);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.report-tabs button[aria-selected="true"] {
	border-bottom-color: var(--report-accent);
	color: var(--report-title);
}

/* ── Groups ────────────────────────────────────────────────────────────── */

.report-group-title {
	margin: 32px 0 4px;
	color: var(--report-title);
	font-size: 1.15em;
	font-weight: 700;
}

.report-group-title + p {
	margin: 0 0 12px;
	color: var(--report-muted);
	font-size: 0.9em;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.report-card {
	margin: 0 0 12px;
	background: var(--report-paper);
	border: 1px solid var(--report-line);
	border-radius: 5px;
	box-shadow: var(--report-shadow);
}

.report-card.tone-error { border-color: var(--report-error); }
.report-card.tone-success { border-color: var(--report-success); }
.report-card.tone-accent { border-color: var(--report-accent); }

.report-card.is-dashed {
	background: none;
	border-style: dashed;
	box-shadow: none;
}

.report-card-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	padding: 12px 18px;
	list-style: none;
}

summary.report-card-head {
	cursor: pointer;
}

summary.report-card-head::-webkit-details-marker {
	display: none;
}

/* -- The chevron points right when closed and down when open. */
summary.report-card-head::after {
	content: '';
	width: 8px;
	height: 8px;
	margin-left: auto;
	border-right: 2px solid var(--report-muted);
	border-bottom: 2px solid var(--report-muted);
	transform: rotate(-45deg);
	transition: transform 0.15s;
}

details[open] > summary.report-card-head::after {
	transform: rotate(45deg);
}

.report-card-title {
	margin: 0;
	color: var(--report-title);
	font-size: 1.05em;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.report-card-title .report-dim {
	color: var(--report-muted);
	font-weight: 400;
}

/* -- A title with a line of meta under it, when a card head carries more than a name. */
.report-card-main {
	flex: 1 1 20rem;
	min-width: 0;
}

.report-card-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	color: var(--report-muted);
	font-size: 0.85em;
}

/* -- Briefly marks the card a link or search just jumped to. */
.report-card.is-flash {
	outline: 2px solid var(--report-accent);
	outline-offset: 2px;
}

.report-card-aside {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-left: auto;
}

/* -- With an aside, the aside takes the free space and the chevron sits right after it. */
summary.report-card-head:has(> .report-card-aside)::after {
	margin-left: 4px;
}

.report-jump {
	display: inline-flex;
	gap: 4px;
}

.report-jump a {
	padding: 3px 9px;
	border-radius: 6px;
	color: var(--report-muted);
	font-size: 0.85em;
	font-weight: 600;
}

.report-jump a:hover {
	background: var(--report-hover);
	color: var(--report-accent);
	text-decoration: none;
}

.report-card-body {
	padding: 4px 18px 12px;
	border-top: 1px solid var(--report-line);
}

.report-card-body > .report-caption {
	margin: 14px 0 4px;
}

.report-card-body > :first-child {
	margin-top: 12px;
}

/* ── Pills, badges and chips ───────────────────────────────────────────── */

.report-pill {
	display: inline-block;
	padding: 1px 9px;
	border-radius: 999px;
	background: var(--report-neutral-soft);
	color: var(--report-neutral-text);
	font-size: 0.72em;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.6;
	white-space: nowrap;
	vertical-align: 1px;
}

.report-pill.tone-success { background: var(--report-success-soft); color: var(--report-success-text); }
.report-pill.tone-error { background: var(--report-error-soft); color: var(--report-error-text); }
.report-pill.tone-warning { background: var(--report-warning-soft); color: var(--report-warning-text); }
.report-pill.tone-info { background: var(--report-info-soft); color: var(--report-info-text); }
.report-pill.tone-purple { background: var(--report-purple-soft); color: var(--report-purple-text); }

.report-badge {
	display: inline-block;
	padding: 1px 9px;
	border-radius: 999px;
	background: var(--report-accent);
	color: #ffffff;
	font-size: 0.72em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
}

.report-badge.tone-success { background: var(--report-success); }
.report-badge.tone-error { background: var(--report-error); }
.report-badge.tone-warning { background: var(--report-warning); }
.report-badge.tone-info { background: var(--report-info); }
.report-badge.tone-purple { background: var(--report-purple); }

.report-chip {
	display: inline-block;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--report-chip);
	color: var(--report-muted);
	font-family: var(--report-mono);
	font-size: 0.72em;
	line-height: 1.6;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
	vertical-align: 1px;
}

/* -- A pill or chip can be a link to elsewhere in the report. */
button.report-pill,
button.report-chip {
	border: 0;
	cursor: pointer;
}

button.report-pill {
	font-family: inherit;
}

button.report-pill:hover,
button.report-chip:hover {
	color: var(--report-accent);
}

.report-pills {
	display: inline-flex;
	gap: 4px;
	margin-right: 8px;
	vertical-align: 1px;
}

.report-chip + .report-chip {
	margin-left: 4px;
}

.report-counts {
	color: var(--report-muted);
	font-size: 0.8em;
}

/* ── Lists and rows ────────────────────────────────────────────────────── */

/* -- Pills lead each entry, so bullets would only add noise. */
.report-list {
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
}

.report-list li {
	margin: 0.4em 0;
}

.report-rows {
	margin: 0 -18px -12px;
}

.report-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 18px;
	border-top: 1px solid var(--report-line);
	font-size: 0.9em;
}

.report-row:first-child {
	border-top: 0;
}

.report-row:hover {
	background: var(--report-hover);
}

.report-row-name {
	flex: 1;
	min-width: 0;
	word-break: break-word;
}

.report-dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--report-neutral);
}

.report-dot.tone-success { background: var(--report-success); }
.report-dot.tone-error { background: var(--report-error); }
.report-dot.tone-warning { background: var(--report-warning); }
.report-dot.tone-info { background: var(--report-info); }
.report-dot.tone-purple { background: var(--report-purple); }

/* -- A callout under a row: failures, skip reasons, notes. */
.report-detail {
	margin: 0 18px 10px 36px;
	padding: 10px 12px;
	border-left: 3px solid var(--report-neutral);
	border-radius: 5px;
	background: var(--report-neutral-soft);
	font-size: 0.85em;
}

.report-detail.tone-error { border-left-color: var(--report-error); background: var(--report-error-soft); }
.report-detail.tone-warning { border-left-color: var(--report-warning); background: var(--report-warning-soft); }
.report-detail.tone-info { border-left-color: var(--report-info); background: var(--report-info-soft); }

.report-detail-message {
	font-weight: 600;
	white-space: pre-wrap;
}

.report-detail.tone-error .report-detail-message { color: var(--report-error-text); }
.report-detail.tone-warning .report-detail-message { color: var(--report-warning-text); }

.report-detail pre {
	margin: 6px 0 0;
	white-space: pre-wrap;
	word-break: break-word;
}

.report-source {
	margin-top: 6px;
	color: var(--report-muted);
	font-family: var(--report-mono);
	font-size: 0.85em;
}

/* ── Tables ────────────────────────────────────────────────────────────── */

.report-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.report-table th {
	padding: 6px 8px;
	border-bottom: 1px solid var(--report-line);
	color: var(--report-muted);
	font-size: 0.8em;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-align: left;
	text-transform: uppercase;
}

.report-table td {
	padding: 6px 8px;
	border-bottom: 1px solid var(--report-line);
	vertical-align: top;
	overflow-wrap: anywhere;
}

.report-table tr:last-child td {
	border-bottom: 0;
}

.report-table tbody tr:hover {
	background: var(--report-hover);
}

/* ── Timeline ──────────────────────────────────────────────────────────── */

.report-timeline {
	position: relative;
	padding-left: 30px;
}

.report-timeline::before {
	content: '';
	position: absolute;
	top: 8px;
	bottom: 8px;
	left: 9px;
	width: 2px;
	background: var(--report-line);
}

.report-timeline > .report-card {
	position: relative;
	margin-bottom: 16px;
}

.report-timeline > .report-card::before {
	content: '';
	position: absolute;
	top: 19px;
	left: -27px;
	width: 10px;
	height: 10px;
	border: 2px solid var(--report-page);
	border-radius: 50%;
	background: var(--report-muted);
	box-shadow: 0 0 0 2px var(--report-line);
}

.report-timeline > .report-card[open]::before,
.report-timeline > .report-card.tone-success::before {
	background: var(--report-accent);
}

/* -- Work in progress: a hollow dot with a ring that grows and fades. */
.report-timeline > .report-card.is-dashed::before {
	background: var(--report-page);
	box-shadow: 0 0 0 2px var(--report-accent);
	animation: report-pulse 2s ease-out infinite;
}

@keyframes report-pulse {
	0% {
		box-shadow: 0 0 0 2px var(--report-accent), 0 0 0 2px var(--report-accent-glow);
	}

	70%,
	100% {
		box-shadow: 0 0 0 2px var(--report-accent), 0 0 0 12px transparent;
	}
}

@media (prefers-reduced-motion: reduce) {
	.report-timeline > .report-card.is-dashed::before {
		animation: none;
	}
}

/* ── Footer, empty state, toast ────────────────────────────────────────── */

.report-empty {
	padding: 40px 0;
	color: var(--report-muted);
	text-align: center;
}

.report-footer {
	margin-top: 32px;
	color: var(--report-muted);
	font-size: 0.85em;
}

.report-toast {
	position: fixed;
	bottom: 16px;
	left: 50%;
	z-index: 20;
	padding: 8px 14px;
	border-radius: 6px;
	background: var(--report-title);
	color: var(--report-paper);
	font-size: 0.9em;
	opacity: 0;
	pointer-events: none;
	transform: translateX(-50%);
	transition: opacity 0.2s;
}

.report-toast.is-shown {
	opacity: 1;
}

/* ── Theme toggle: a bare icon that cycles light, dark and auto ────────── */

.report-theme {
	position: fixed;
	top: 12px;
	right: 12px;
	z-index: 10;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--report-muted);
	cursor: pointer;
	transition: color 0.2s;
}

.report-theme:hover,
.report-theme:focus-visible {
	color: var(--report-text);
}

.report-theme svg {
	display: none;
	width: 18px;
	height: 18px;
}

.report-theme svg path {
	fill: currentColor;
}

.report-theme[data-mode="light"] svg[data-mode="light"],
.report-theme[data-mode="dark"] svg[data-mode="dark"],
.report-theme[data-mode="auto"] svg[data-mode="auto"] {
	display: block;
}

/* ── Phones ────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
	.report-page {
		padding: 56px 16px 48px;
	}

	/* -- Sticky, the toolbar would hide too much of a small screen. */
	.report-toolbar {
		position: static;
	}

	.report-timeline {
		padding-left: 0;
	}

	.report-timeline::before,
	.report-timeline > .report-card::before {
		display: none;
	}

	.report-detail {
		margin-left: 18px;
	}
}
