/* Occam Approvals: the one stylesheet.
 *
 * Brand from Occam Sites: the cream page and the terracotta accent. Everything
 * else is warm-neutral gray rather than brown, which read muddy (and
 * purple-brown on some screens), especially in dark mode.
 *
 * Contrast (WCAG 2.1 AA), checked for every pairing in both modes
 * (docs/reviews/2026-10-13-design-review.md §4a, and its script):
 *   text 15-17:1, muted text 6.6-9.5:1, links and buttons 5.0-9.5:1,
 *   form-field borders (--field) 3.3-5.1:1 (non-text contrast needs 3:1).
 *   status badges (ok / warn / bad text on their own tint) 5.3-8.2:1.
 *   step numbers (--accent-tx on --accent-tint) 4.8:1 light, 7.1:1 dark.
 * Terracotta (#C45C28) is decorative and the focus ring only: on cream it is
 * ~4.1:1, under the 4.5:1 small text needs. Text, links and buttons use
 * --accent-tx. --border and --border-strong are decorative only, never the
 * only cue.
 *
 * Type: Georgia for reading pages (page titles, long-form section heads, the
 * home hero), the system sans for tools (headings inside cards, forms,
 * tables).
 *
 * Mostly element defaults, a few classes, no inline styles anywhere (the
 * Content-Security-Policy forbids them). The browser's light/dark preference
 * is followed. */

:root {
	color-scheme: light dark;

	--bg: #fffbf5;              /* Occam cream */
	--surface: #f2eee8;
	--sunken: #f7f2eb;          /* code blocks, the docs TOC */
	--card: #ffffff;
	--border: rgb(41 37 36 / 0.12);         /* decorative dividers only */
	--border-strong: rgb(41 37 36 / 0.22);  /* decorative: code edges, table heads, the step rail */
	--field: #857d75;           /* form-control edges: 3.9:1 on --bg */

	--text: #1a1a1a;
	--text-muted: #57534e;      /* 7.4:1 on --bg */

	--accent: #c45c28;          /* decorative: rules, the mark, focus rings */
	--accent-tx: #a54a1e;       /* text, links, buttons: 5.7:1 on --bg */
	--accent-tx-hover: #8a3d18;
	--on-accent: #ffffff;
	--accent-dim: rgb(196 92 40 / 0.08);
	--accent-tint: #f8e6da;     /* solid tint: step numbers, link-button hover */

	--ok: #2f6b3a;
	--ok-dim: rgb(47 107 58 / 0.08);
	--warn: #8a5a00;
	--warn-dim: rgb(192 120 48 / 0.1);
	--bad: #a3261f;
	--bad-dim: rgb(163 38 31 / 0.08);

	--shadow-card: 0 1px 2px rgb(41 37 36 / 0.05), 0 8px 24px -12px rgb(41 37 36 / 0.14);
	--scroll-shadow: rgb(41 37 36 / 0.16);

	--font: system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-display: Georgia, "Times New Roman", serif;
	--font-mono: ui-monospace, "Cascadia Code", Menlo, monospace;

	/* Type scale. rem + vw so zoom still scales; each max <= 1.6x its min. */
	--step--1: 0.875rem;
	--step-1: 1.125rem;
	--step-3: clamp(1.45rem, 1.25rem + 0.9vw, 1.85rem);  /* long-form section h2 */
	--step-4: clamp(1.75rem, 1.4rem + 1.6vw, 2.4rem);    /* page h1 */
	--step-5: clamp(2.2rem, 1.5rem + 3.2vw, 3.5rem);     /* the home hero */
	--measure: 68ch;

	--radius: 0.6rem;
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-5: 1.5rem;
	--space-6: 2rem;
	--space-7: 3rem;
	--space-8: 4.5rem;

	--shell: 60rem;             /* the header lines up with this; set per page width below */
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #161514;
		--surface: #262422;
		--sunken: #121110;
		--card: #1e1d1b;
		--border: rgb(255 255 255 / 0.12);
		--border-strong: rgb(255 255 255 / 0.22);
		--field: #8c8680;           /* 5.1:1 on --bg */

		--text: #f5f3f0;
		--text-muted: #bdb7b0;      /* 9.2:1 on --bg */

		--accent: #e8986a;
		--accent-tx: #f0a87d;       /* 9.2:1 on --bg */
		--accent-tx-hover: #f7c3a3;
		--on-accent: #161514;
		--accent-dim: rgb(232 152 106 / 0.12);
		--accent-tint: #3a271c;

		--ok: #8fd19e;
		--ok-dim: rgb(143 209 158 / 0.1);
		--warn: #f0c27a;
		--warn-dim: rgb(240 194 122 / 0.1);
		--bad: #f4a49c;
		--bad-dim: rgb(244 164 156 / 0.1);

		--shadow-card: none;        /* borders carry it in the dark */
		--scroll-shadow: rgb(0 0 0 / 0.6);
	}
}

/* ---- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font: 400 1rem/1.6 var(--font);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-4); text-wrap: balance; }
h1 { font: 400 var(--step-4)/1.15 var(--font-display); letter-spacing: -0.015em; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.0625rem; font-weight: 600; }
p, ul, ol, dl { margin: 0 0 var(--space-4); }
p, li, dd { text-wrap: pretty; }
small, .muted { color: var(--text-muted); }
small { font-size: var(--step--1); }

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

:is(h2, h3)[id] { scroll-margin-top: var(--space-5); }

code { font: 0.9em var(--font-mono); background: var(--surface); padding: 0.1em 0.35em; border-radius: 0.3em; }

/* ---- Accessibility ------------------------------------------------------- */

.skip-link {
	position: absolute;
	top: -5rem;
	left: var(--space-4);
	z-index: 10;
	padding: var(--space-2) var(--space-4);
	background: var(--text);
	color: var(--bg);
	border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-4); }

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

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

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---- Page shell ---------------------------------------------------------- */

/* The header lines up with the page's content column. */
body:has(> main.narrow) { --shell: 40rem; }
body:has(> main.medium) { --shell: 48rem; }

.site-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-4);
	padding: var(--space-3) max(var(--space-5), calc((100% - var(--shell)) / 2 + var(--space-5)));
	border-top: 3px solid var(--accent);
	border-bottom: 1px solid var(--border);
}

.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	color: var(--text);
	text-decoration: none;
	font: 400 1.2rem/1.2 var(--font-display);
	letter-spacing: -0.01em;
}
.wordmark img { width: 1.75rem; height: 1.75rem; }
.wordmark span { color: var(--text-muted); }
.wordmark .badge { font-family: var(--font); margin-left: var(--space-1); }

.site-header nav ul { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.site-header nav li { display: flex; align-items: center; }
.site-header nav a, .site-header nav .button.small, button.small { min-height: 2.25rem; padding: var(--space-1) var(--space-4); font-size: 0.9rem; }
.site-header nav a:not(.button) { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }
.site-header nav a:not(.button):hover { color: var(--accent-tx); text-decoration: underline; }
.site-header nav a[aria-current="page"] { text-decoration: underline 2px var(--accent); text-underline-offset: 0.45em; }
.site-header nav button.link { min-height: 2.25rem; padding: var(--space-1) var(--space-4); font-size: 0.9rem; color: var(--text); text-decoration: none; }
.site-header nav button.link:hover { color: var(--accent-tx); text-decoration: underline; }
/* Sign out is a form (it posts, with a CSRF token); it must sit like a link. */
.site-header form { display: contents; }

select { display: block; width: 100%; min-height: 2.75rem; padding: var(--space-2) var(--space-3); font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--field); border-radius: var(--radius); }
.dev-tools { border-style: dashed; }

fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 600; margin-bottom: var(--space-1); padding: 0; }
label.check { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); font-weight: 400; }
label.check .hint { flex-basis: 100%; padding-left: calc(1.1rem + var(--space-2)); }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent-tx); flex: none; transform: translateY(0.15em); }

/* Agent- and client-written text (titles, addresses) can be one long word. */
main { flex: 1; width: 100%; margin: 0 auto; padding: var(--space-7) var(--space-5); overflow-wrap: break-word; }
/* A comfortable reading width (~70 characters): sign-in and the client's pages. */
.narrow { max-width: 40rem; }
.medium { max-width: 48rem; }
.wide { max-width: 60rem; }

.site-footer {
	padding: var(--space-5);
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	font-size: var(--step--1);
	text-align: center;
}
.site-footer ul { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }

/* ---- Cards and notices --------------------------------------------------- */

.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) * 1.5);
	padding: var(--space-6);
	box-shadow: var(--shadow-card);
}
.card > :last-child { margin-bottom: 0; }
.card + .card, .item-list + .card, .notice + .card, .card + .notice { margin-top: var(--space-5); }
.card h3 { font-size: 1.05rem; margin-top: var(--space-5); }
/* A small label above a heading, e.g. "One last step". Sentence case: it can
 * hold a business name. */
.eyebrow { margin: 0 0 var(--space-2); color: var(--accent-tx); font-size: var(--step--1); font-weight: 600; }

.notice {
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius);
	border-left: 4px solid var(--accent);
	background: var(--accent-dim);
	margin-bottom: var(--space-5);
}
.notice > :last-child { margin-bottom: 0; }
.notice.ok { border-color: var(--ok); background: var(--ok-dim); }
.notice.warn { border-color: var(--warn); background: var(--warn-dim); }

.badge {
	display: inline-block;
	padding: 0.1em 0.6em;
	border-radius: 999px;
	background: var(--surface);
	color: var(--text-muted);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	vertical-align: middle;
	white-space: nowrap;
}
.badge.ok { background: var(--ok-dim); color: var(--ok); }
.badge.warn { background: var(--warn-dim); color: var(--warn); }
.badge.bad { background: var(--bad-dim); color: var(--bad); }

/* ---- Forms --------------------------------------------------------------- */

/* Space between a form's fields. Hidden inputs (the CSRF token) don't count,
 * or a one-button form like Sign out would sit a line lower than its row. */
form > :not([type="hidden"]) + * { margin-top: var(--space-4); }

label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.hint { display: block; color: var(--text-muted); font-size: var(--step--1); font-weight: 400; margin-top: var(--space-1); }

input[type="email"], input[type="text"], input[type="url"], textarea {
	display: block;
	width: 100%;
	min-height: 2.75rem;
	padding: var(--space-2) var(--space-3);
	font: inherit;
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--field);
	border-radius: var(--radius);
}
input:focus-visible, textarea:focus-visible { outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 7rem; resize: vertical; }
textarea.short { min-height: 4.5rem; font-family: var(--font-mono); font-size: 0.9rem; }

.button, button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	min-height: 2.75rem;
	padding: var(--space-2) var(--space-5);
	font: 600 1rem/1.25 var(--font);
	text-align: center;
	color: var(--on-accent);
	background: var(--accent-tx);
	border: 1px solid var(--accent-tx);
	border-radius: var(--radius);
	box-shadow: 0 1px 2px rgb(41 37 36 / 0.12);
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.button:hover, button:hover { background: var(--accent-tx-hover); border-color: var(--accent-tx-hover); color: var(--on-accent); }
.button:active, button:active { transform: translateY(1px); }

.button.secondary, button.secondary {
	color: var(--text);
	background: transparent;
	border-color: var(--field);
	box-shadow: none;
}
.button.secondary:hover, button.secondary:hover { background: var(--surface); color: var(--text); }

button.link {
	display: inline;
	min-height: 0;
	padding: 0;
	font: inherit;
	line-height: inherit;
	color: var(--accent-tx);
	background: none;
	border: 0;
	box-shadow: none;
	text-decoration: underline;
	text-underline-offset: 0.18em;
}
button.link:hover { color: var(--accent-tx-hover); background: none; }
button.link:active { transform: none; }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
/* Choices one above the other, full width: the client pages, on a phone. */
.stack { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); }
.stack button, .stack .button { width: 100%; }
.actions > * { flex: 1 1 10rem; }
form .actions { margin-top: var(--space-5); }

/* ---- Lists of projects, clients and agents -------------------------------- */

.item-list { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: grid; gap: var(--space-3); }
.card .item-list { gap: 0; }
.item {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: var(--space-4) var(--space-5);
}
.item > :last-child { margin-bottom: 0; }
/* Inside a card, items are rows divided by rules rather than boxes in a box. */
.card .item { background: none; border: 0; border-radius: 0; border-top: 1px solid var(--border); padding: var(--space-4) 0; }
.card .item:first-child { border-top: 0; padding-top: 0; }
.item p { margin-bottom: var(--space-1); }
.item-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-1); }
.item-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 var(--space-1); }
.item-head .item-title { margin: 0; }
.item-title a { text-decoration: none; }
.item-title a:hover { text-decoration: underline; }

.chips { list-style: none; padding: 0; margin: var(--space-2) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }

details.edit { margin-top: var(--space-2); }
details.edit summary { cursor: pointer; color: var(--accent-tx); width: fit-content; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 0.18em; }
details.edit summary:hover { color: var(--accent-tx-hover); }
details.edit[open] summary { margin-bottom: var(--space-3); }
details.edit form { padding: var(--space-4); background: var(--surface); border-radius: var(--radius); }
details.edit textarea.short { font-family: var(--font); font-size: 1rem; }
fieldset > * + * { margin-top: var(--space-3); }
legend .hint { font-weight: 400; }
input[readonly] { background: var(--surface); color: var(--text-muted); }

/* ---- The review page ------------------------------------------------------ */

.message { font-size: var(--step-1); line-height: 1.6; }
.message > :last-child { margin-bottom: 0; }
.message ul, .message ol { padding-left: 1.25rem; }
.message li + li { margin-top: var(--space-1); }

.link-buttons { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: var(--space-2); }
/* Look first: tonal, so a preview link never looks like "Decline". */
.link-buttons .button { width: 100%; justify-content: center; color: var(--accent-tx); background: var(--accent-dim); border-color: var(--accent); box-shadow: none; }
.link-buttons .button:hover { color: var(--accent-tx-hover); background: var(--accent-tint); border-color: var(--accent); }

.quote { border-left: 3px solid var(--border-strong); padding-left: var(--space-4); color: var(--text-muted); }
.decide > form button { width: 100%; }

/* Request changes / Decline: full-width 44px rows, peers of Approve. */
details.answer { margin-top: var(--space-3); }
details.answer summary {
	position: relative;
	display: block;              /* not flex: older Safari mishandles flex on <summary> */
	min-height: 2.75rem;
	padding: 0.6rem 2.75rem 0.6rem var(--space-4);
	list-style: none;
	cursor: pointer;
	font-weight: 600;
	color: var(--text);
	border: 1px solid var(--field);
	border-radius: var(--radius);
}
details.answer summary::-webkit-details-marker { display: none; }
details.answer summary::after {  /* a chevron drawn with borders: no text for screen readers */
	content: "";
	position: absolute;
	right: var(--space-4);
	top: 50%;
	width: 0.5rem;
	height: 0.5rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg);
}
details.answer[open] summary::after { transform: translateY(-20%) rotate(-135deg); }
details.answer summary:hover { background: var(--surface); }
details.answer[open] summary { margin-bottom: var(--space-4); }
details.answer button { width: 100%; }

/* Notes keep the developer's line breaks; long ones are cut short in lists. */
.prewrap, .clamp { white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* ---- Policies -------------------------------------------------------------- */

.policy h2 { margin-top: var(--space-7); font: 400 var(--step-3)/1.2 var(--font-display); letter-spacing: -0.01em; }
.policy h3 { font-size: 1rem; margin: var(--space-4) 0 var(--space-2); }
.policy li { margin-bottom: var(--space-2); }

/* ---- Tables -------------------------------------------------------------- */

/* Scrolling tables (the admin view) show a shadow on the side that scrolls. */
.table-scroll {
	--scroll-bg: var(--bg);
	overflow-x: auto;
	background:
		linear-gradient(to right, var(--scroll-bg) 40%, transparent) left center / 2.5rem 100% no-repeat local,
		linear-gradient(to left, var(--scroll-bg) 40%, transparent) right center / 2.5rem 100% no-repeat local,
		radial-gradient(farthest-side at 0 50%, var(--scroll-shadow), transparent) left center / 0.75rem 100% no-repeat scroll,
		radial-gradient(farthest-side at 100% 50%, var(--scroll-shadow), transparent) right center / 0.75rem 100% no-repeat scroll;
	background-color: var(--scroll-bg);
}
.card .table-scroll { --scroll-bg: var(--card); }
.table-scroll:focus-visible { outline-offset: 2px; }

table.data { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
table.data th, table.data td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--border); vertical-align: top; }
table.data thead th { color: var(--text-muted); font-weight: 600; white-space: nowrap; border-bottom-color: var(--border-strong); }
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data td { font-variant-numeric: tabular-nums; }
table.data code { overflow-wrap: anywhere; }
table.data td.flag { color: var(--bad); font-weight: 600; }
table.data tr.paused { background: var(--bad-dim); }
table.params th[scope="row"] { white-space: nowrap; font-weight: 400; }

/* The home page's comparison: the Occam column leads. */
table.compare thead th:last-child { color: var(--accent-tx); }
table.compare td:nth-of-type(1) { color: var(--text-muted); }

/* ---- Lists of facts ------------------------------------------------------ */

.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.permissions { padding-left: 0; list-style: none; }
.permissions li { padding: var(--space-2) 0 var(--space-2) var(--space-5); position: relative; border-top: 1px solid var(--border); }
.permissions li::before { content: ""; position: absolute; left: 0.25rem; top: 1.05rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); }

/* ---- Long-form pages: the home page and the docs -------------------------- */

.lede { font-size: var(--step-1); line-height: 1.55; color: var(--text-muted); max-width: var(--measure); }

:is(main, .docs-body) > section:not(.card) { margin-top: var(--space-8); }
:is(main, .docs-body) > section:not(.card) > h2 { font: 400 var(--step-3)/1.2 var(--font-display); letter-spacing: -0.01em; }
:is(main, .docs-body) > section:not(.card) > h3 { font-size: 1.125rem; margin-top: var(--space-6); }
:is(main, .docs-body) > section:not(.card) > :is(p, .steps) { max-width: var(--measure); }

/* The home hero */
.hero { padding-block: var(--space-4) var(--space-2); }
.hero h1 { font-size: var(--step-5); line-height: 1.08; letter-spacing: -0.025em; margin-bottom: var(--space-5); }
.hero h1 .accent { display: block; color: var(--accent-tx); }   /* 5.7:1 light, 9.2:1 dark */
.hero .lede { font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem); }
.hero .actions { margin: var(--space-6) 0 0; }
.hero .actions > * { flex: 0 0 auto; }
.hero-note { display: flex; align-items: flex-start; gap: var(--space-2); margin: var(--space-4) 0 0; color: var(--text-muted); font-size: var(--step--1); max-width: var(--measure); }
.hero-note::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; margin-top: 0.5em; border-radius: 50%; background: var(--accent); }
.hero-note strong { color: var(--text); }
.closing { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--border); }
.closing > * { flex: 0 0 auto; }

/* "What your client sees": a static miniature of the review page. Its
 * buttons are spans, not controls. */
.specimen { margin: var(--space-7) 0 0; }
.specimen-frame { max-width: 24rem; margin-inline: auto; padding: var(--space-5); background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) * 2); box-shadow: var(--shadow-card); }
.specimen-frame > p:last-of-type { margin-bottom: var(--space-4); }
.specimen-title { font: 400 1.5rem/1.2 var(--font-display); margin-bottom: var(--space-3); }
.specimen-btn { display: block; padding: 0.6rem; margin-top: var(--space-2); text-align: center; font-weight: 600; border-radius: var(--radius); background: var(--accent-tx); color: var(--on-accent); cursor: default; }
.specimen-btn.secondary { background: none; color: var(--text); border: 1px solid var(--field); }
.specimen figcaption { margin-top: var(--space-3); text-align: center; color: var(--text-muted); font-size: var(--step--1); }

/* Numbered steps with a rail */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li { position: relative; counter-increment: step; padding-left: 2.75rem; margin-bottom: var(--space-5); }
.steps > li::before {
	content: counter(step);
	position: absolute;
	left: 0;
	top: -0.1rem;
	display: grid;
	place-items: center;
	width: 1.875rem;
	height: 1.875rem;
	border-radius: 50%;
	background: var(--accent-tint);
	color: var(--accent-tx);     /* 4.8:1 light, 7.1:1 dark */
	font: 600 0.875rem/1 var(--font);
	font-variant-numeric: tabular-nums;
}
.steps > li:not(:last-child)::after {
	content: "";
	position: absolute;
	left: 0.9rem;
	top: 2.1rem;
	bottom: calc(-1 * var(--space-5) + 0.35rem);
	width: 1px;
	background: var(--border-strong);
}
.steps > li > strong:first-child { color: var(--text); }

/* Feature cards */
.features { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: var(--space-4); }
.features > li {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) * 1.5);
	padding: var(--space-5);
	box-shadow: var(--shadow-card);
	color: var(--text-muted);    /* 7.6:1 light, 8.5:1 dark on --card */
}
.features > li::before { content: ""; display: block; width: 1.5rem; height: 3px; border-radius: 2px; background: var(--accent); margin-bottom: var(--space-4); }
.features > li strong { display: block; margin-bottom: var(--space-1); color: var(--text); font-size: 1.0625rem; }

/* Docs: the contents and the layout */
.docs { margin-top: var(--space-6); }
.toc { background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4) var(--space-5); font-size: var(--step--1); }
.toc-title { margin: 0 0 var(--space-2); font-weight: 600; color: var(--text); }
.toc ul { list-style: none; margin: 0; padding: 0; columns: 2 12rem; column-gap: var(--space-6); }
.toc li { break-inside: avoid; }
.toc a { display: block; padding: 0.3rem 0; text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc ul ul { columns: auto; margin: 0 0 var(--space-2) 0.2rem; padding-left: var(--space-3); border-left: 1px solid var(--border-strong); }
.toc ul ul a { padding: 0.15rem 0; }
.toc code { background: none; padding: 0; }
.docs-body > section:first-child { margin-top: var(--space-7); }

@media (min-width: 64rem) {
	.docs { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: var(--space-7); align-items: start; }
	.toc { position: sticky; top: var(--space-5); max-height: calc(100vh - 2 * var(--space-5)); overflow-y: auto; padding: 0; background: none; border: 0; }
	.toc ul { columns: auto; }
	.docs-body > section:first-child { margin-top: 0; }
}

/* Code */
pre {
	margin: var(--space-3) 0 var(--space-4);
	padding: var(--space-3) var(--space-4);
	font: 0.875rem/1.65 var(--font-mono);
	background: var(--sunken);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	white-space: pre-wrap;       /* wraps on screen; copies as one line */
	overflow-wrap: anywhere;
	tab-size: 2;
}
pre code { font: inherit; background: none; padding: 0; white-space: inherit; }
blockquote { margin: 0; padding: var(--space-3) var(--space-4); border-left: 3px solid var(--accent); background: var(--sunken); border-radius: 0 var(--radius) var(--radius) 0; max-width: var(--measure); }

/* Tool cards */
.tool + .tool { margin-top: var(--space-4); }
.tool h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); margin: 0 0 var(--space-2); font-size: 1.125rem; }
.tool h3 code { background: none; padding: 0; font-size: 1em; font-weight: 600; color: var(--text); }
.tool h3 .muted { font-size: var(--step--1); font-weight: 400; }
.tool-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--step--1); margin-bottom: var(--space-4); }
.tool .prewrap { max-width: var(--measure); }
.tool:has(:target) { border-color: var(--accent); }

/* ---- Phones -------------------------------------------------------------- */

/* Tables marked .stacked become one block per row. Their markup carries
 * explicit ARIA table roles, so the semantics survive display: block. (Not
 * .stack: that's the client pages' column of choices.) */
@media (max-width: 36rem) {
	table.stacked, table.stacked tbody, table.stacked tr, table.stacked th, table.stacked td { display: block; }
	table.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
	table.stacked tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
	table.stacked tbody tr:last-child { border-bottom: 0; }
	table.stacked th, table.stacked td { padding: 0; border: 0; }
	table.stacked th[scope="row"] { white-space: normal; font-weight: 600; margin-bottom: var(--space-1); }
	table.stacked td + td { margin-top: var(--space-1); }
	table.stacked td[data-label]::before {
		content: attr(data-label);
		content: attr(data-label) / "";   /* hidden from screen readers where supported: the cell's role already says it */
		display: block;
		font-size: 0.8125rem;
		font-weight: 600;
		color: var(--text-muted);
	}
	table.compare tr { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1) var(--space-4); }
	table.compare th[scope="row"] { grid-column: 1 / -1; }
	table.compare td + td { margin-top: 0; }
	table.params td:nth-of-type(1) { color: var(--text-muted); }
}

/* Give the text the width. 12px around the page plus 16px inside a card
 * leaves about 320px of a 375px screen for reading. */
@media (max-width: 30rem) {
	main { padding: var(--space-5) var(--space-3); }
	.card { padding: var(--space-4); }
	.item { padding: var(--space-3) var(--space-4); }
	.site-header { padding: var(--space-3); }
	.facts { grid-template-columns: 1fr; gap: 0; }
	.facts dd { margin-bottom: var(--space-3); }
	.hero .actions > *, .closing > * { flex: 1 1 100%; }
	.features > li { padding: var(--space-4); }
}

/* Touch screens: every target at least 44px. */
@media (pointer: coarse) {
	.site-header nav a, .site-header nav button.link, button.small, .button.small { min-height: 2.75rem; }
	details.edit summary { padding-block: 0.6rem; }
	.site-footer a { display: inline-block; padding-block: 0.5rem; }
}
