/*
Theme Name: Seokla
Theme URI: https://seokla.com
Author: Sandr Chenk
Author URI: https://sandr-chenk.com/
Description: Лёгкая классическая тема для каталога SEO-инструментов. Без Gutenberg, без фидов, без jQuery.
Version: 0.1.0
Requires at least: 7.1
Requires PHP: 8.5
Text Domain: seokla
*/

@layer reset, base, ui, pages;

@view-transition { navigation: auto; }

@layer reset {
	*, ::before, ::after { box-sizing: border-box; }
	body, h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
	img, svg { display: block; max-inline-size: 100%; }
	input, button, select, textarea { font: inherit; color: inherit; }
	a { color: inherit; text-decoration: none; }
}

@layer base {
	:root {
		color-scheme: light dark;
		interpolate-size: allow-keywords;

		--bg: light-dark(oklch(96% .03 285), oklch(17% .03 285));
		--ink: light-dark(oklch(26% .1 285), oklch(95% .02 285));
		--ink-2: light-dark(oklch(44% .13 285), oklch(78% .07 285));
		--brand: oklch(50% .17 285);
		--on-brand: oklch(97% .02 285);

		--glass: light-dark(oklch(100% 0 0 / .52), oklch(100% 0 0 / .07));
		--edge: light-dark(oklch(100% 0 0 / .85), oklch(100% 0 0 / .14));
		--card: light-dark(oklch(100% 0 0 / .86), oklch(100% 0 0 / .1));

		--high: oklch(60% .2 25);
		--mid: oklch(74% .16 75);
		--ok: oklch(64% .14 165);

		--r: 1.25rem;
		--gap: clamp(.625rem, 2vw, 1rem);
	}

	body {
		display: grid;
		grid-template-rows: auto 1fr auto;
		gap: var(--gap);
		min-block-size: 100dvb;
		padding: .75rem max(1rem, 50vw - 34rem) 1.5rem;
		font: 1rem/1.6 system-ui, sans-serif;
		color: var(--ink);
		background:
			radial-gradient(40rem 30rem at 0% 0%, oklch(75% .12 285 / .55), transparent 70%),
			radial-gradient(36rem 28rem at 100% 22rem, oklch(85% .1 170 / .5), transparent 70%),
			radial-gradient(34rem 26rem at 40% 60rem, oklch(85% .09 0 / .45), transparent 70%),
			var(--bg);
		background-repeat: no-repeat;
	}

	h1, h2, h3 { line-height: 1.2; font-weight: 600; text-wrap: balance; }
	h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
	h2 { font-size: 1.125rem; }
	p { text-wrap: pretty; }
	small { font-size: .8125rem; color: var(--ink-2); }
	/* A term with an explanation: the note appears at once on hover or tap, not after the browser's own delay. */
	abbr[data-tip] {
		position: relative;
		anchor-name: --tip;
		anchor-scope: --tip;
		text-decoration: underline dotted;
		cursor: help;

		&:hover::after {
			content: attr(data-tip);
			position: absolute;
			inset-block-end: calc(100% + .375rem);
			inset-inline-start: 0;
			z-index: 2;
			inline-size: max-content;
			max-inline-size: min(17rem, 80vw);
			padding: .375rem .625rem;
			border-radius: .5rem;
			background: var(--ink);
			color: var(--bg);
			font-size: .8125rem;
			font-weight: 400;
			line-height: 1.4;
			pointer-events: none;

			/* Where supported, centre the note over the term and flip it below when there's no room above. */
			@supports (position-area: top) {
				position: fixed;
				position-anchor: --tip;
				position-area: top;
				position-try-fallbacks: flip-block;
				inset: auto;
				margin-block: .375rem;
			}
		}
	}
	:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
}

@layer ui {
	/* Glass is for the header, the URL field and the task tiles only. The report uses solid cards. */
	.glass {
		background: var(--glass);
		border: 1px solid var(--edge);
		border-radius: var(--r);
		backdrop-filter: blur(18px) saturate(1.4);

		@media (prefers-reduced-transparency: reduce) {
			background: var(--card);
			backdrop-filter: none;
		}
	}

	.card {
		background: var(--card);
		border: 1px solid var(--edge);
		border-radius: var(--r);
		padding: 1rem 1.125rem;
	}

	.i {
		inline-size: 1.25em;
		block-size: 1.25em;
		fill: none;
		stroke: currentColor;
		stroke-width: 2;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	button, .btn {
		display: inline-flex;
		align-items: center;
		justify-self: start;
		gap: .5rem;
		block-size: 2.5rem;
		padding-inline: 1.125rem;
		border: 0;
		border-radius: 99rem;
		background: var(--brand);
		color: var(--on-brand);
		font-weight: 500;
		cursor: pointer;
		transition: scale .15s;

		&:active { scale: .97; }
		&:disabled { opacity: .6; cursor: progress; }	}

	.high { --tone: var(--high); }
	.mid { --tone: var(--mid); }
	.ok { --tone: var(--ok); }

	.chip {
		display: inline-block;
		padding: .125rem .75rem;
		border-radius: 99rem;
		font-size: .8125rem;
		font-weight: 500;
		background: color-mix(in oklch, var(--tone, var(--brand)) 18%, transparent);
		color: light-dark(
			color-mix(in oklch, var(--tone, var(--brand)) 55%, black),
			color-mix(in oklch, var(--tone, var(--brand)) 55%, white)
		);
	}

	.bar {
		position: sticky;
		inset-block-start: .75rem;
		z-index: 1;
		display: flex;
		align-items: center;
		gap: 1.25rem;
		padding: .625rem 1.125rem;
		border-radius: 99rem;

		nav { display: flex; gap: 1.25rem; overflow-x: auto; font-size: .9375rem; color: var(--ink-2); }
		nav a:is(:hover, [aria-current]) { color: var(--ink); }
	}

	.logo {
		display: flex;
		align-items: center;
		gap: .5rem;
		font-size: 1.0625rem;
		font-weight: 600;

		&::before { content: ""; inline-size: 1.5rem; aspect-ratio: 1; border-radius: 50%; background: var(--brand); }
	}

	.ask {
		display: flex;
		gap: .5rem;
		padding: .375rem;
		border-radius: 99rem;
		max-inline-size: 30rem;

		input {
			flex: 1;
			min-inline-size: 0;
			padding-inline: 1rem;
			border: 0;
			background: none;
			outline: 0;
		}
		&:focus-within { outline: 2px solid var(--brand); }

		/* Locked while a check is running. */
		:is(input, select):disabled { opacity: .6; cursor: progress; }

		/* Tools with extra choices: the URL gets its own row, the selects sit beside the button. */
		&:has(select) {
			flex-wrap: wrap;
			border-radius: var(--r);

			input { flex-basis: 100%; block-size: 2.5rem; }
		}
		select {
			flex: 1;
			min-inline-size: 9rem;
			block-size: 2.5rem;
			padding-inline: .875rem;
			border: 1px solid var(--edge);
			border-radius: 99rem;
			background: var(--card);
		}
	}

	body > footer {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		gap: 1rem;
		padding-block-start: 2rem;

		align-items: baseline;
		align-content: start;
		gap: .375rem 1rem;
		font-size: .8125rem;
		color: var(--ink-2);

		p { flex: 1 1 18rem; }
		strong { color: var(--ink); }
		nav { display: flex; flex-wrap: wrap; gap: 1rem; }
		/* The copyright line sits on its own row under the description and the links. */
		small { flex-basis: 100%; font-size: inherit; }
		small a { text-decoration: underline; }
	}
}

@layer pages {
	main { display: grid; align-content: start; gap: var(--gap); }

	/* Wide content (a long line of code, a table) scrolls inside its block instead of stretching the page. */
	body > *, main > * { min-inline-size: 0; }

	.hero {
		display: grid;
		justify-items: center;
		gap: .75rem;
		padding-block: clamp(1.5rem, 6vw, 3.5rem) 1rem;
		text-align: center;

		h1 { max-inline-size: 16em; }
		.ask { inline-size: 100%; margin-block-start: .5rem; }
	}

	.lead { max-inline-size: 34em; font-size: 1.0625rem; color: var(--ink-2); }

	/* The home page: a landing page in sections, each under a small label and a large heading. */
	.home {
		gap: clamp(3rem, 9vw, 5.5rem);

		> section { display: grid; gap: var(--gap); }
		> section > :is(.chip, h2, .lead) { justify-self: center; text-align: center; }
		h2 { font-size: clamp(1.5rem, 4.5vw, 2.25rem); }
		h2 + :not(.lead) { margin-block-start: .75rem; }
		.lead + * { margin-block-start: .75rem; }

		.hero {
			gap: 1rem;
			padding-block: clamp(2rem, 8vw, 4.5rem) 0;
		}
		/* The headline runs from the text colour into the brand colour. */
		h1 {
			max-inline-size: 14em;
			font-size: clamp(2.25rem, 7.5vw, 4rem);
			line-height: 1.08;
			letter-spacing: -.02em;
			background: linear-gradient(120deg, var(--ink) 30%, var(--brand));
			background-clip: text;
			color: transparent;
		}
		.hero .lead { font-size: clamp(1.0625rem, 2.4vw, 1.25rem); }
		.hero .ask {
			max-inline-size: 36rem;
			box-shadow: 0 1.5rem 3rem -1.5rem oklch(40% .15 285 / .35);
		}
	}

	/* The page for an address that is gone: the status code as a large, soft numeral, then the way back. */
	.gone {
		gap: clamp(2rem, 6vw, 3.5rem);

		section {
			display: grid;
			justify-items: center;
			gap: .75rem;
			padding-block-start: clamp(1.5rem, 6vw, 3.5rem);
			text-align: center;
		}
		.code {
			font-size: clamp(6rem, 26vw, 13rem);
			font-weight: 700;
			line-height: .9;
			letter-spacing: -.04em;
			background: linear-gradient(135deg, var(--brand), oklch(70% .14 170) 55%, oklch(75% .13 0));
			background-clip: text;
			color: transparent;
		}
		h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
		section p:last-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem 1.25rem; margin-block-start: .5rem; }
		a:not(.btn, .task) { color: var(--brand); text-decoration: underline; }
	}

	/* Under the form: what it costs to try, as a row of ticks. */
	.perks {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: .25rem 1.25rem;
		padding: 0;
		list-style: none;
		font-size: .875rem;
		color: var(--ink-2);

		li::before { content: "✓ "; font-weight: 700; color: var(--ok); }
	}

	/* A report in miniature, built from the same parts as a real one and labelled as a sample. */
	.sample {
		container-type: inline-size;
		display: grid;
		grid-template-columns: 6.5rem minmax(0, 1fr);
		align-items: center;
		gap: 1rem 1.25rem;
		justify-self: center;
		inline-size: min(100%, 50rem);
		margin-block-start: clamp(-4rem, -6vw, -2rem);
		padding: 1.25rem;
		box-shadow: 0 2.5rem 5rem -2.5rem oklch(40% .15 285 / .4);

		figcaption { grid-column: 1 / -1; justify-self: start; }
		strong { font-size: 1.125rem; }
		p { margin-block-start: .25rem; color: var(--ink-2); }
		.metrics { grid-column: 1 / -1; }

		@container (inline-size < 26rem) {
			.ring { inline-size: 5rem; }
			.ring, div { grid-column: 1 / -1; }
		}
	}

	/* Numbered steps, side by side where there is room. */
	.steps {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
		gap: var(--gap);
		padding: 0;
		list-style: none;
		counter-reset: step;

		li {
			display: grid;
			align-content: start;
			gap: .375rem;
			padding: 1.25rem;
			color: var(--ink-2);
			counter-increment: step;
		}
		li::before {
			content: counter(step);
			display: grid;
			place-items: center;
			inline-size: 2.25rem;
			aspect-ratio: 1;
			margin-block-end: .375rem;
			border-radius: 50%;
			background: var(--brand);
			color: var(--on-brand);
			font-weight: 600;
		}
		strong { font-size: 1.0625rem; color: var(--ink); }
	}

	/* What sets the service apart: an icon, a heading and a sentence or two per card. */
	.features {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
		gap: var(--gap);

		article { display: grid; align-content: start; gap: .375rem; padding: 1.25rem; }
		.i {
			inline-size: 2.25rem;
			block-size: 2.25rem;
			padding: .5rem;
			margin-block-end: .375rem;
			border-radius: .75rem;
			background: color-mix(in oklch, var(--brand) 14%, transparent);
			color: var(--brand);
		}
		h3 { font-size: 1.0625rem; }
		p { color: var(--ink-2); }
	}

	/* Questions that open one by one. */
	.faq {
		display: grid;
		gap: .5rem;
		justify-self: center;
		inline-size: min(100%, 44rem);

		summary { font-weight: 600; cursor: pointer; }
		summary::marker { color: var(--brand); }
		p { margin-block-start: .5rem; color: var(--ink-2); }
		a { color: var(--brand); text-decoration: underline; }
	}

	/* The closing band: one invitation on the brand colour. */
	.cta {
		justify-items: center;
		padding: clamp(2rem, 7vw, 4rem) 1.25rem;
		border-radius: calc(var(--r) * 1.5);
		background: linear-gradient(135deg, oklch(48% .18 285), oklch(56% .16 250));
		color: var(--on-brand);
		text-align: center;

		p { opacity: .9; }
		p:last-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem 1.25rem; margin-block-start: .5rem; opacity: 1; }
		a:not(.btn) { text-decoration: underline; }
		.btn { background: var(--on-brand); color: var(--brand); font-weight: 600; }
	}

	.tasks {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
		gap: var(--gap);
	}

	.task {
		display: grid;
		gap: .25rem;
		padding: 1rem;
		transition: translate .2s;

		&:hover { translate: 0 -2px; }
		&:nth-child(3n + 2) { --h: 170; }
		&:nth-child(3n) { --h: 0; }

		.i {
			inline-size: 2.25rem;
			block-size: 2.25rem;
			padding: .5rem;
			margin-block-end: .375rem;
			border-radius: .75rem;
			background: oklch(50% .15 var(--h, 285));
			color: oklch(97% .02 var(--h, 285));
		}
		strong { font-weight: 600; line-height: 1.35; }
	}

	.tool {
		.back { justify-self: start; color: var(--ink-2); font-size: .9375rem; }
		.ask { max-inline-size: none; }
	}

	.report {
		display: grid;
		gap: var(--gap);

		&:empty { display: none; }
	}

	/* Shown while a check runs: a bar from 0 to 100, with the status line and the percentage under it. */
	.loading {
		display: grid;
		gap: .625rem;

		/* Digits of equal width in a slot of fixed width, so the line doesn't shift as the number grows. */
		span { display: inline-block; min-inline-size: 4ch; font-variant-numeric: tabular-nums; }
	}

	progress {
		appearance: none;
		inline-size: 100%;
		block-size: .5rem;
		overflow: clip;
		border: 0;
		border-radius: 99rem;
		background: color-mix(in oklch, var(--ink) 8%, transparent);

		&::-webkit-progress-bar { background: none; }
		&::-webkit-progress-value { border-radius: 99rem; background: var(--brand); }
		&::-moz-progress-bar { border-radius: 99rem; background: var(--brand); }
	}

	.verdict {
		display: grid;
		grid-template-columns: 7.5rem 1fr;
		column-gap: 1.25rem;
		row-gap: .375rem;
		align-items: center;

		> :is(.ring, .rings) { grid-row: span 3; }
		h2 { font-size: 1.25rem; }
		p { color: var(--ink-2); }
		.chips { display: flex; flex-wrap: wrap; gap: .375rem; }

		/* Several scores: one ring each, side by side, with a caption underneath. */
		&:has(.rings) { grid-template-columns: auto 1fr; }
		/* Four rings or more take a row of their own, with the verdict underneath. */
		&:has(.rings > :nth-child(4)) {
			grid-template-columns: 1fr;
			row-gap: .75rem;
			.rings { grid-row: auto; }
		}

		@container (inline-size < 34rem) {
			&:has(.rings) { grid-template-columns: 1fr; row-gap: .75rem; }
			.rings { grid-row: auto; }
		}
		@container (inline-size < 26rem) {
			grid-template-columns: 1fr;
			> .ring { grid-row: auto; inline-size: 6rem; }
		}
	}

	/* A row of rings, each with a caption underneath: in the verdict, or in a card of its own. */
	.rings {
		display: flex;
		flex-wrap: wrap;
		gap: 1rem;

		figure { display: grid; align-content: start; justify-items: center; gap: .375rem; inline-size: 6.5rem; }
		figcaption { font-size: .8125rem; line-height: 1.35; text-align: center; color: var(--ink-2); }
		figcaption b { display: block; font-weight: 600; color: var(--ink); }
		+ .note { margin-block-start: .75rem; }
	}

	.report { container-type: inline-size; }

	.ring {
		circle { fill: none; stroke-width: 10; stroke: color-mix(in oklch, var(--ink) 10%, transparent); }
		.val {
			stroke: var(--tone);
			stroke-linecap: round;
			rotate: -90deg;
			transform-origin: center;
			animation: ring 1s ease-out;
		}
		text { font-size: 30px; font-weight: 600; fill: currentColor; text-anchor: middle; }

		/* A sign in place of a score: larger, and in the verdict's colour. */
		&.sign text { font-size: 46px; fill: var(--tone); translate: 0 6px; }

		/* For information only: the ring frames a figure, with no arc. The figure may carry a unit, so it is set smaller. */
		&.plain {
			.val { display: none; }
			text { font-size: 19px; translate: 0 -4px; }
		}
	}

	@keyframes ring { from { stroke-dasharray: 0 100; } }

	.metrics {
		display: grid;
		/* A fixed number of equal columns, the same in every group, so tiles line up from one group to the next
		   and a short last row keeps the same tile width instead of stretching. */
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: .5rem;

		/* A group of exactly five gets five columns, so it stays on one row instead of leaving one tile on its own. */
		@container (inline-size >= 44rem) {
			&:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
		}
		/* A group of exactly six does the same where the page is wide enough for six tiles. */
		@container (inline-size >= 52rem) {
			&:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
		}
		@container (inline-size < 44rem) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
		@container (inline-size < 22rem) { grid-template-columns: minmax(0, 1fr); }

		/* One tile per figure: the value first, its name underneath. */
		div {
			display: grid;
			align-content: start;
			gap: .125rem;
			padding: .75rem .875rem;
			border-radius: .875rem;
			background: color-mix(in oklch, var(--brand) 6%, transparent);
		}
		dt { order: 1; font-size: .8125rem; line-height: 1.35; color: var(--ink-2); }
		dd { font-size: 1.25rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }

		/* Something missing or wrong: the tile is tinted and edged in the verdict's colour. */
		:is(.high, .mid) {
			background: color-mix(in oklch, var(--tone) 14%, transparent);
			outline: 2px solid color-mix(in oklch, var(--tone) 55%, transparent);
			outline-offset: -2px;
		}

		/* A figure taken from an outside source as it is: the same dark outline as the reference cell of a grid. */
		.framed { outline: 2px solid var(--ink); outline-offset: -2px; }

		/* The tile for the option in use: a green edge and a tick in the corner. */
		/* A long value, such as an address or a headline: set smaller, so that it takes a line or two. */
		.long dd { font-size: .9375rem; line-height: 1.4; }
		/* Room for the tick in the corner. */
		.marked dd { padding-inline-end: 1.625rem; }

		.marked {
			position: relative;
			background: color-mix(in oklch, var(--ok) 12%, transparent);
			outline: 2px solid var(--ok);
			outline-offset: -2px;

			&::after {
				content: "✓";
				position: absolute;
				inset: .5rem .5rem auto auto;
				display: grid;
				place-items: center;
				inline-size: 1.375rem;
				aspect-ratio: 1;
				border-radius: 50%;
				background: var(--ok);
				color: white;
				font-size: .8125rem;
				font-weight: 700;
			}
		}

		& + h3 { margin-block-start: 1.25rem; }
	}

	/* A list of name/value rows. */
	/* A checklist: one card per thing looked for. A sign on the left says how it went, the name is in bold with
	   its weight beside it, and what was found sits underneath, cut to two lines. */
	.checks {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
		gap: .5rem;

		div {
			position: relative;
			display: grid;
			align-content: start;
			gap: .125rem;
			padding: .625rem .875rem .75rem 2.75rem;
			border-radius: .875rem;
			background: color-mix(in oklch, var(--tone, var(--brand)) 9%, transparent);
		}
		div::before {
			position: absolute;
			inset: .75rem auto auto .75rem;
			display: grid;
			place-items: center;
			inline-size: 1.375rem;
			aspect-ratio: 1;
			border-radius: 50%;
			background: var(--tone, var(--brand));
			color: white;
			font-size: .8125rem;
			font-weight: 700;
			line-height: 1;
		}
		.marked { --tone: var(--ok); }
		.marked::before { content: "✓"; }
		.mid::before { content: "!"; }
		.high::before { content: "✕"; }

		dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: .125rem .5rem; font-weight: 600; overflow-wrap: anywhere; }
		dt small { font-weight: 400; }
		dd {
			display: -webkit-box;
			overflow: hidden;
			font-size: .875rem;
			line-height: 1.45;
			color: var(--ink-2);
			overflow-wrap: anywhere;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2;
			line-clamp: 2;
		}
	}

	.rows {
		div {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			gap: .125rem 1rem;
			padding-block: .5rem;

			& + div { border-block-start: 1px solid color-mix(in oklch, var(--ink) 10%, transparent); }
		}
		/* A long value with no spaces in it (a cookie, a token, an address) breaks anywhere, so that it wraps inside
		   the card and doesn't stretch the row past the edge of the page. */
		:is(dt, dd) { min-inline-size: 0; max-inline-size: 100%; overflow-wrap: anywhere; }
		dd { font: .875rem/1.6 ui-monospace, monospace; text-align: end; }
	}

	/* The full path of a check: the same rows, numbered. */
	.trace {
		counter-reset: step;

		div { counter-increment: step; }
		dt::before { content: counter(step) ". "; color: var(--ink-2); }
	}

	/* One request as a ribbon of coloured stages, with a bracket over the part that counts as TTFB. */
	.timeline {
		.s0 { --c: oklch(55% .17 285); }
		.s1 { --c: oklch(62% .15 235); }
		.s2 { --c: oklch(68% .12 185); }
		.s3 { --c: oklch(72% .15 140); }
		.s4 { --c: oklch(78% .15 85); }
		.s5 { --c: oklch(68% .17 40); }
		/* Stages after the first byte are outside TTFB, so they are drawn muted. */
		.late { --c: color-mix(in oklch, var(--ink) 22%, transparent); }

		.span { font-weight: 600; }
		.bracket {
			inline-size: 100%;
			block-size: .625rem;

			path { fill: none; stroke: var(--ink-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
		}
		.ribbon {
			inline-size: 100%;
			block-size: 1.75rem;
			margin-block: .125rem .375rem;
			border-radius: .5rem;

			rect { fill: var(--c); }
			.mark { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
		}
		.legend {
			display: grid;
			grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
			gap: .375rem 1.5rem;
			margin-block-start: .75rem;

			div {
				display: grid;
				grid-template-columns: auto 1fr auto;
				align-items: center;
				gap: .5rem;

				&::before { content: ""; inline-size: .75rem; aspect-ratio: 1; border-radius: .25rem; background: var(--c); }
			}
			/* A moment, not a stage: the same dashed line as on the ribbon. */
			.mark::before {
				inline-size: 0;
				block-size: .875rem;
				aspect-ratio: auto;
				margin-inline: .3125rem;
				border-inline-start: 2px dashed var(--ink);
				border-radius: 0;
				background: none;
			}
			dt { font-size: .875rem; color: var(--ink-2); }
			dd { font-size: .875rem; font-variant-numeric: tabular-nums; }
		}
	}

	/* A timeline: name, bar, time. Bar position and width come from SVG attributes. */
	.waterfall {
		div {
			display: grid;
			grid-template-columns: 4.5rem 1fr 4.5rem;
			align-items: center;
			gap: .75rem;
			padding-block: .375rem;
		}
		dt { font-size: .875rem; color: var(--ink-2); }
		svg {
			inline-size: 100%;
			block-size: 1rem;
			border-radius: .3rem;
			background: color-mix(in oklch, var(--ink) 6%, transparent);
			fill: var(--brand);
		}
		dd:last-child { font: .875rem/1.6 ui-monospace, monospace; text-align: end; }
	}

	/* Bar chart: longer names and values than a timeline, and the bar drops to its own row on a narrow screen. */
	/* The columns belong to the whole chart, so every row lines up however long its name or value is. */
	.bars {
		display: grid;
		grid-template-columns: fit-content(14rem) 1fr max-content;
		column-gap: .75rem;

		div { grid-column: 1 / -1; grid-template-columns: subgrid; }

		@container (inline-size < 36rem) {
			grid-template-columns: 1fr max-content;

			dd:first-of-type { grid-area: 2 / 1 / auto / -1; }
		}
	}

	/* A chart with several figures per row, laid out as a table: heading row, hairlines, one column per figure. */
	.bars.table {
		grid-template-columns: fit-content(14rem) minmax(4rem, 1fr) repeat(3, max-content);
		column-gap: 1.25rem;

		div {
			padding-block: .5rem;

			& + div { border-block-start: 1px solid color-mix(in oklch, var(--ink) 8%, transparent); }
		}
		dt { font-size: .9375rem; color: var(--ink); }
		code {
			padding: .0625rem .375rem;
			border-radius: .375rem;
			background: color-mix(in oklch, var(--brand) 11%, transparent);
			font: 600 .8125rem/1.5 ui-monospace, monospace;
		}
		svg { block-size: .5rem; }
		dd {
			font: inherit;
			font-size: .9375rem;
			font-variant-numeric: tabular-nums;
			text-align: end;
		}
		/* The share is the figure to read first; the compressed size is secondary. */
		dd:nth-of-type(2) { font-weight: 600; }
		dd:last-child { color: var(--ink-2); }

		.head {
			padding-block: 0 .375rem;

			:is(dt, dd) { font-size: .75rem; font-weight: 500; color: var(--ink-2); }
		}

		/* Narrow screens: the name and the bar get a line each, the figures sit below with their column names. */
		@container (inline-size < 36rem) {
			grid-template-columns: repeat(3, 1fr);
			column-gap: .75rem;

			.head { display: none; }
			dt { grid-column: 1 / -1; }
			dd { text-align: start; }
			dd[title]::before {
				content: attr(title);
				display: block;
				font-size: .6875rem;
				font-weight: 400;
				color: var(--ink-2);
			}
		}
	}

	.report .card > .note { margin-block-end: .625rem; }

	/* World map: grey land, one dot per location in its verdict colour. */
	.map {
		svg { inline-size: 100%; block-size: auto; }
		use { fill: color-mix(in oklch, var(--ink) 13%, transparent); }
		circle {
			fill: var(--tone);
			stroke: light-dark(white, black);
			stroke-width: .8;
			cursor: pointer;
			outline: 0;
			transition: r .15s, stroke-width .15s;

			&:is(:hover, :focus) { r: 4.6px; stroke-width: 1.4; }
		}
		/* The label that appears beside a dot. */
		.tip {
			pointer-events: none;

			rect {
				fill: light-dark(white, oklch(28% .03 285));
				stroke: color-mix(in oklch, var(--ink) 18%, transparent);
				stroke-width: .25;
			}
			text { fill: var(--ink); font-weight: 500; }
		}
		.chips { display: flex; flex-wrap: wrap; gap: .375rem; margin-block-start: .5rem; }
		.note { margin-block-start: .5rem; }
	}

	/* A tree of files: each level is indented under its parent and hangs on a thin line. */
	.tree {
		font-size: .875rem;

		&, ul { list-style: none; padding: 0; }
		ul {
			margin-inline-start: .875rem;
			padding-inline-start: .875rem;
			border-inline-start: 1px solid color-mix(in oklch, var(--ink) 20%, transparent);
		}
		li { margin-block-start: .25rem; }
		/* One file: its name, what it is underneath, its size on the right. */
		div {
			display: grid;
			grid-template-columns: minmax(0, 1fr) auto;
			column-gap: .75rem;
			padding: .375rem .625rem;
			border-radius: .5rem;
			background: color-mix(in oklch, var(--tone, var(--brand)) 7%, transparent);
		}
		:is(.high, .mid) { background: color-mix(in oklch, var(--tone) 16%, transparent); }
		b { font-weight: 500; overflow-wrap: anywhere; }
		small { grid-column: 1; color: var(--ink-2); }
		span { grid-area: 1 / 2 / span 2; align-self: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
		+ .note { margin-block-start: .625rem; }
	}

	/* A grid of figures: every cell tinted by its verdict, the reference cell outlined. */
	.grid {
		overflow-x: auto;

		table {
			inline-size: 100%;
			border-collapse: separate;
			border-spacing: 2px;
			font-size: .8125rem;
			font-variant-numeric: tabular-nums;
			white-space: nowrap;
		}
		:is(th, td) { padding: .375rem .5rem; text-align: end; }
		th { font-weight: 500; color: var(--ink-2); }
		td {
			border-radius: .375rem;
			background: color-mix(in oklch, var(--tone, var(--brand)) 20%, transparent);
		}
		.marked { outline: 2px solid var(--ink); outline-offset: -2px; font-weight: 600; }
		+ .note { margin-block-start: .625rem; }

		/* A comparison of two things: a narrower table in the middle of the card, with its figures centred. */
		table:has(thead th:nth-child(3):last-child) {
			inline-size: min(100%, 44rem);
			margin-inline: auto;

			:is(td, thead th) { text-align: center; }
		}
	}

	/* The same page two ways, next to each other: a live frame and a screenshot, both the size of a small phone.
	   The frame is laid out 412 pixels wide, as the test phone is, and shrunk to fit; it can't be clicked. */
	.views {
		> div { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
		figure { display: grid; justify-items: center; align-content: start; gap: .5rem; }
		/* The label sits above its view, so that the two labels line up whatever the heights below them. */
		figcaption { order: -1; font-size: .875rem; font-weight: 600; }
		:is(figure > div, img) {
			inline-size: 256px;
			border: 1px solid color-mix(in oklch, var(--ink) 14%, transparent);
			border-radius: .875rem;
		}
		figure > div { block-size: 511px; overflow: hidden; background: white; }
		img { display: block; block-size: auto; }
		iframe {
			inline-size: 412px;
			block-size: 823px;
			border: 0;
			scale: .6214;
			transform-origin: 0 0;
			pointer-events: none;
		}
		.note { margin-block-start: .75rem; }
	}
	/* Charts side by side: two columns where there is room, one on a narrow screen. */
	.trends {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--gap);

		@container (inline-size < 44rem) { grid-template-columns: minmax(0, 1fr); }
	}

	/* A figure over time: the line, dashed levels in their verdict colours, then the latest split as one bar. */
	.trend {
		h3 { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
		svg { display: block; inline-size: 100%; }
		.chart { block-size: 7rem; overflow: visible; }
		path { fill: none; vector-effect: non-scaling-stroke; }
		.line { stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
		.level { stroke: var(--tone); stroke-width: 1.5; stroke-dasharray: 5 5; }
		.split { block-size: .625rem; margin-block-start: .75rem; border-radius: 99rem; }
		rect { fill: var(--tone); }
		.note { margin-block-start: .375rem; }
		.chips { display: flex; flex-wrap: wrap; gap: .375rem; margin-block-start: .5rem; }
	}

	.report h3 { font-size: 1rem; margin-block-end: .5rem; }

	.issue {
		summary {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			gap: .5rem .625rem;
			font-weight: 600;
			cursor: pointer;
			list-style: none;

			small { margin-inline-start: auto; font-weight: 400; }
		}
		p { margin-block-start: .625rem; color: var(--ink-2); }
		ol { margin-block-start: .625rem; padding-inline-start: 1.25rem; }
		li::marker { color: var(--brand); font-weight: 600; }

		&::details-content {
			block-size: 0;
			overflow: clip;
			transition: block-size .25s, content-visibility .25s allow-discrete;
		}
		&[open]::details-content { block-size: auto; }
	}

	/* A small table inside a card, e.g. now and after: names on the left, one column per figure. */
	.compare {
		display: grid;
		grid-template-columns: 1fr repeat(2, max-content);
		column-gap: 1.5rem;
		max-inline-size: 30rem;
		margin-block-start: .75rem;

		div {
			display: grid;
			grid-column: 1 / -1;
			grid-template-columns: subgrid;
			padding-block: .4375rem;

			& + div { border-block-start: 1px solid color-mix(in oklch, var(--ink) 8%, transparent); }
		}
		dt { color: var(--ink-2); }
		dd { font-variant-numeric: tabular-nums; text-align: end; }
		/* The last column is the result to look at. */
		dd:last-child { font-weight: 600; }
		.head :is(dt, dd) { font-size: .75rem; font-weight: 500; color: var(--ink-2); }
	}

	.note { font-size: .875rem; color: var(--ink-2); }

	/* A stacked form: each label sits above its field. */
	.form {
		display: grid;
		gap: 1rem;

		label { display: grid; gap: .375rem; font-size: .875rem; font-weight: 500; }
		:is(input, select, textarea) {
			inline-size: 100%;
			padding: .625rem .875rem;
			border: 1px solid color-mix(in oklch, var(--ink) 22%, transparent);
			border-radius: .75rem;
			background: light-dark(white, transparent);
			font-size: 1rem;
			font-weight: 400;

			&:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
		}
		textarea { resize: vertical; min-block-size: 8rem; }
		/* A field for spam scripts only: kept out of sight and out of the tab order. */
		.trap { position: absolute; inset-inline-start: -200vw; }
	}

	/* A one-line message above a form: sent, or what to fix. */
	.notice {
		padding: .75rem 1rem;
		border-radius: .75rem;
		background: color-mix(in oklch, var(--tone, var(--brand)) 14%, transparent);
		border-inline-start: .25rem solid var(--tone, var(--brand));
	}

	.prose {
		max-inline-size: 42rem;

		> * + * { margin-block-start: 1em; }
		h2 { margin-block-start: 1.75em; font-size: 1.375rem; }
		a { color: var(--brand); text-decoration: underline; }
		:is(ul, ol) { padding-inline-start: 1.25rem; }
		pre { overflow-x: auto; padding: 1rem; border-radius: .75rem; background: var(--card); font-size: .875rem; }
	}
}

@media (prefers-reduced-motion: reduce) {
	*, ::before, ::after { animation: none !important; transition: none !important; }
	@view-transition { navigation: none; }
}
