:root {
	color-scheme: light dark;
	--ink: #1d1d1f;
	--muted: #5f5f66;
	--rule: #e3e3e6;
	--card: #f6f6f8;
	--link: #0a63d6;
	--page: #ffffff;
	--wordmark-fill: linear-gradient(100deg, #1d1d1f 0%, #1d1d1f 38%, #85858f 100%);
}

/* Dark follows the system unless someone has chosen. :not([data-theme="light"]) is what lets a
   manual light choice survive a dark system; the second rule is the manual dark choice. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--ink: #f2f2f5;
		--muted: #a3a3ac;
		--rule: #34343a;
		--card: #1c1c20;
		--link: #6aa9ff;
		--page: #141417;
		--wordmark-fill: linear-gradient(100deg, #f2f2f5 0%, #f2f2f5 38%, #8a8a95 100%);
	}
}
:root[data-theme="dark"] {
		--ink: #f2f2f5;
		--muted: #a3a3ac;
		--rule: #34343a;
		--card: #1c1c20;
		--link: #6aa9ff;
		--page: #141417;
		--wordmark-fill: linear-gradient(100deg, #f2f2f5 0%, #f2f2f5 38%, #8a8a95 100%);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	padding: 0;
	background: var(--page);
	color: var(--ink);
	font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-text-size-adjust: 100%;
}

main { display: block; max-width: 42rem; margin: 0 auto; padding: 40px 20px 80px; }

/* Pinned to the top of the window, full width, with its contents lined up with the column below. */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--page); border-bottom: 1px solid var(--rule); }
.topbar > div {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 20px;
	max-width: 42rem;
	margin: 0 auto;
	padding: 13px 20px;
}
.topbar a { text-decoration: none; }
.topbar nav { margin: 0; padding: 0; border: 0; }        /* the footer nav rule below doesn't apply up here */
.topbar nav a { margin-left: 18px; font-size: 15px; color: var(--muted); }
.topbar nav a:hover { color: var(--link); }
.topbar nav a[aria-current] { color: var(--ink); }
.wordmark {
	font-weight: 750; letter-spacing: 0.02em;
	color: var(--ink);  /* fallback first: without background-clip the letters would be invisible */
	background: var(--wordmark-fill);
	-webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
	.wordmark { background: none; -webkit-text-fill-color: currentColor; }
}

header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
header img { width: 64px; height: 64px; }
header h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
header p { margin: 4px 0 0; color: var(--muted); }

h2 { margin: 40px 0 12px; font-size: 21px; letter-spacing: -0.01em; }
h3 { margin: 28px 0 6px; font-size: 17px; }
p, li { color: var(--ink); }
ul { padding-left: 1.2em; }
li { margin: 6px 0; }
strong { font-weight: 600; }

a { color: var(--link); }
a:hover { text-decoration: none; }

kbd {
	padding: 2px 6px;
	border: 1px solid var(--rule);
	border-bottom-width: 2px;
	border-radius: 6px;
	background: var(--card);
	font: inherit;
	font-size: 0.95em;
	white-space: nowrap;
}

.lede { font-size: 19px; color: var(--muted); margin-top: 20px; }
.card { margin: 24px 0; padding: 18px 20px; background: var(--card); border-radius: 12px; }
.card p:first-child { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

nav { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--rule); }
footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 15px; }
footer p { margin: 4px 0; }

.theme {
	appearance: none; -webkit-appearance: none; cursor: pointer;
	background: none; border: 1px solid var(--rule); border-radius: 999px;
	color: var(--muted); font: inherit; font-size: 13px; line-height: 1;
	padding: 5px 11px; margin-left: 18px;
}
.theme:hover { color: var(--ink); border-color: var(--ink); }
/* theme.js writes the label, so an empty button means the script never ran — 404, blocked, or threw.
   The border and padding would otherwise leave a dead pill sitting in the nav of every page, which
   reads as a broken site rather than as a missing feature. Fail to nothing, not to wrong. */
.theme:empty { display: none; }
