/*
 * telemetry.catualus.dev
 *
 * One stylesheet, no framework, no web fonts. The Content-Security-Policy on this host is
 * default-src 'none' with 'self' for scripts and styles and nothing else - so there is no
 * inline style anywhere in the markup and nothing is fetched from another origin. Bars are
 * sized by setting a custom property from JavaScript, which is CSSOM rather than an inline
 * style attribute and is unaffected by the policy.
 */

:root {
	color-scheme: light dark;

	--bg: #f6f7f9;
	--panel: #ffffff;
	--ink: #16181d;
	--ink-soft: #5b6270;
	--ink-faint: #868d9b;
	--line: #e2e5ea;
	--accent: #3b6ea5;
	--accent-soft: #e8f0f8;
	--good: #2f7d4f;
	--bad: #a5463b;
	--radius: 10px;
	--shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 4%);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #14161a;
		--panel: #1c1f25;
		--ink: #e8eaee;
		--ink-soft: #a2a9b6;
		--ink-faint: #767d8a;
		--line: #2b303a;
		--accent: #7aa9d8;
		--accent-soft: #232c36;
		--good: #6cbf8f;
		--bad: #e08a7f;
		--shadow: none;
	}
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-text-size-adjust: 100%;
}

.wrap {
	width: 100%;
	max-width: 860px;
	margin: 0 auto;
	padding: 0 20px;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- masthead */

.masthead {
	padding: 56px 0 32px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 32px;
}

.eyebrow {
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
}

h1 {
	margin: 0 0 14px;
	font-size: clamp(28px, 5vw, 38px);
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.lede {
	margin: 0;
	max-width: 62ch;
	font-size: 17px;
	color: var(--ink-soft);
}

/* ---------------------------------------------------------------- panels */

.panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 24px;
	margin-bottom: 24px;
}

.panel h2 {
	margin: 0 0 16px;
	font-size: 20px;
	letter-spacing: -0.01em;
}

.panel h3 {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 600;
}

.panel-head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}

.panel-head h2 { margin: 0; }

.note {
	margin: 16px 0 0;
	padding-top: 14px;
	border-top: 1px solid var(--line);
	font-size: 14px;
	color: var(--ink-soft);
}

.hint {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--ink-faint);
}

/* ---------------------------------------------------------------- window picker */

.windows { display: flex; gap: 4px; }

.window {
	padding: 6px 12px;
	font: inherit;
	font-size: 14px;
	color: var(--ink-soft);
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 7px;
	cursor: pointer;
}

.window:hover { color: var(--ink); border-color: var(--accent); }

.window.is-active {
	color: var(--accent);
	background: var(--accent-soft);
	border-color: var(--accent);
	font-weight: 600;
}

.window:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- state */

.state {
	padding: 28px 20px;
	text-align: center;
	color: var(--ink-soft);
	background: var(--bg);
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	font-size: 15px;
}

.state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; }
.state p { margin: 0 auto; max-width: 54ch; }
.state.is-error { border-color: var(--bad); color: var(--bad); }

.spinner {
	display: inline-block;
	width: 13px; height: 13px;
	margin-right: 6px;
	vertical-align: -1px;
	border: 2px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.spinner { animation: none; }
	* { transition: none !important; }
}

/* ---------------------------------------------------------------- totals */

.totals {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	margin: 0 0 28px;
	padding: 0;
	list-style: none;
}

.totals li {
	padding: 14px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 8px;
}

.totals .value {
	display: block;
	font-size: 26px;
	font-weight: 650;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.totals .label {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: var(--ink-soft);
}

/* ---------------------------------------------------------------- charts */

.chart-block { margin-bottom: 26px; }
.chart-block:last-child { margin-bottom: 0; }

.chart { display: flex; flex-direction: column; gap: 7px; }

.bar-row {
	display: grid;
	grid-template-columns: minmax(76px, 22%) 1fr auto;
	gap: 10px;
	align-items: center;
	font-size: 14px;
}

.bar-label { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-track {
	height: 20px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 5px;
	overflow: hidden;
}

.bar-fill {
	height: 100%;
	width: var(--fill, 0%);
	background: var(--accent);
	border-radius: 4px 0 0 4px;
	min-width: 2px;
}

.bar-value {
	font-variant-numeric: tabular-nums;
	color: var(--ink);
	font-weight: 600;
	min-width: 4ch;
	text-align: right;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

@media (max-width: 640px) {
	.split { grid-template-columns: 1fr; }
	.bar-row { grid-template-columns: minmax(64px, 30%) 1fr auto; }
	.panel { padding: 18px; }
}

.empty { color: var(--ink-faint); font-size: 14px; font-style: italic; }

.withheld {
	margin: 20px 0 0;
	padding: 12px 14px;
	background: var(--accent-soft);
	border-radius: 8px;
	font-size: 14px;
	color: var(--ink-soft);
}

/* ---------------------------------------------------------------- lists */

.ticks, .crosses { margin: 0; padding: 0; list-style: none; font-size: 15px; }

.ticks li, .crosses li {
	position: relative;
	padding-left: 24px;
	margin-bottom: 8px;
	color: var(--ink-soft);
}

.ticks li::before, .crosses li::before {
	position: absolute;
	left: 0;
	font-weight: 700;
}

.ticks li::before { content: "✓"; color: var(--good); }
.crosses li::before { content: "✕"; color: var(--bad); }

h3.yes { color: var(--good); }
h3.no { color: var(--bad); }

/* ---------------------------------------------------------------- rules */

.rules { margin: 0; }

.rules dt {
	margin-top: 14px;
	font-weight: 600;
	font-size: 15px;
}

.rules dt:first-child { margin-top: 0; }

.rules dd {
	margin: 3px 0 0;
	padding-left: 0;
	color: var(--ink-soft);
	font-size: 14.5px;
}

/* ---------------------------------------------------------------- footer */

footer {
	padding: 8px 20px 48px;
	font-size: 14px;
	color: var(--ink-soft);
}

footer p { margin: 0 0 6px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.sep { margin: 0 8px; color: var(--ink-faint); }
.muted { color: var(--ink-faint); }
.small { font-size: 13px; }

.dot {
	display: inline-block;
	width: 8px; height: 8px;
	margin-right: 5px;
	border-radius: 50%;
	vertical-align: 0;
	background: var(--ink-faint);
}

.dot.ok { background: var(--good); }
.dot.bad { background: var(--bad); }
