@charset "UTF-8";

/*
 * The site's chrome: the dark top bar (logo, page links, theme switch), the
 * weekly signup row and the footer. Every page loads this file after its own
 * stylesheet, so the header and the footer are the same everywhere: the home
 * page, the example pages, the category pages, the text pages and the Brand
 * page (home.css underneath), and the Tips page and tools (global.css underneath).
 *
 * The top bar is charcoal in both themes on every page (owner, 2026-11-10:
 * "I think that would help the soul of the design a lot"). The logo file is
 * already the light-on-dark wordmark: white "pure" and lime "css", with no
 * outline since 2026-11-11.
 *
 * Two theme directions share this file. The home page, the example pages and
 * the text pages start on paper, and the checked #theme-toggle switches them
 * dark. The
 * global.css pages start dark, and checked switches them light; they carry
 * body.ink-first, which flips the signup band and the switch's icon.
 *
 * Every rule names its own font, color and decoration, because global.css
 * styles bare links and the page under it may run another face.
 *
 * Flat CSS only (the repo's iOS 15.2 rule).
 */

/* Jost (option 03 of the font round, the owner's pick), its own file and
   license in fonts/; one variable file covers every weight the page uses */
@font-face {
	font-family: "Jost";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("/fonts/jost-latin-wght-normal.woff2") format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens ────────────────────────────────────────────────────────────── */

body {
	/* the sticky header's height; the home rail and the example page's
	   chapter bar sit under it */
	--head-h: 84px;
	/* the top bar: charcoal in both themes */
	--head: #0c0c0d;
	--head-ink: #f4f1eb;
	--head-chip: rgba(244, 241, 235, .1);
	/* the current page's pill outline and the theme switch's ring, at 3:1 or
	   more on the bar even with white passing under its glass */
	--head-ring: rgba(244, 241, 235, .6);
	--head-edge: rgba(244, 241, 235, .42);
	--head-line: rgba(244, 241, 235, .16);
	/* the signup row: paper, or the lifted gray in the dark theme */
	--band: #f4f1eb;
	--band-ink: #0c0c0d;
	--band-muted: #4f4e48;
	--band-line: rgba(12, 12, 13, .2);
	/* the footer: ink in both themes */
	--close: #0c0c0d;
	--close-ink: #f4f1eb;
	--close-muted: #a9a69e;
	--close-line: rgba(244, 241, 235, .2);
}

body:has(#theme-toggle:checked) {
	--band: #1f1f22;
	--band-ink: #f4f1eb;
	--band-muted: #a9a69e;
	--band-line: rgba(244, 241, 235, .2);
}

/* the global.css pages start dark and go light when checked */
body.ink-first {
	--band: #1f1f22;
	--band-ink: #f4f1eb;
	--band-muted: #a9a69e;
	--band-line: rgba(244, 241, 235, .2);
}

body.ink-first:has(#theme-toggle:checked) {
	--band: #f4f1eb;
	--band-ink: #0c0c0d;
	--band-muted: #4f4e48;
	--band-line: rgba(12, 12, 13, .2);
}

.top,
.weekly-mail,
.site-foot {
	--chrome-gutter: clamp(16px, 3.2vw, 48px);
	--chrome-ease: cubic-bezier(.16, 1, .3, 1);
	--chrome-press: cubic-bezier(.3, 0, .2, 1);
	font-family: "Jost", system-ui, sans-serif;
	font-size: 1.0625rem;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.top a,
.weekly-mail a,
.site-foot a {
	color: inherit;
}

/* no display here: the switch and the button lay their icons out as grid
   and flex items, and the switch shows one icon at a time */
.top .icon,
.weekly-mail .icon {
	width: 1em;
	height: 1em;
	flex: none;
}

/* ── The page column ───────────────────────────────────────────────────── */

/*
 * The footer takes its own height and main takes whatever a tall window has
 * left, so a short page never leaves bare ink under the footer's last line
 * (owner, 2026-11-13: flexbox, not grid). Example and category pages paint
 * main, so the extra is their page ground; text pages hand it on to their
 * last block (text-page.css).
 */
body {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

main {
	flex: 1 0 auto;
}

/* the theme checkbox: off screen, still focusable */
.mode-input {
	position: fixed;
	top: -2px;
	left: -2px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

/* ── The top bar ───────────────────────────────────────────────────────── */

/* the header stays: the logo, the page links and the theme switch ride
   along at the top of every page */
.top {
	position: sticky;
	top: 0;
	z-index: 45;
	color: var(--head-ink);
	background: var(--head);
	box-shadow: 0 1px 0 var(--head-line);
}

.masthead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	height: var(--head-h);
	padding: 0 var(--chrome-gutter);
}

.masthead-logo {
	display: block;
	flex: none;
	border-radius: 6px;
}

.top .logo-file,
.site-foot .logo-file {
	display: block;
	width: auto;
	max-width: none;
	height: clamp(28px, 2.5vw, 36px);
}

.masthead-nav {
	display: flex;
	align-items: center;
	gap: .25rem;
	min-width: 0;
}

/* the links sit in their own strip: the pages the site lists can outgrow a
   phone's header, so the strip scrolls sideways rather than wrap, and the
   theme switch stays put. The padding keeps a focused link's ring inside
   the scroll box */
.masthead-links {
	display: flex;
	align-items: center;
	gap: .25rem;
	min-width: 0;
	margin: -6px;
	padding: 6px;
	overflow-x: auto;
	scrollbar-width: none;
}

.masthead-links::-webkit-scrollbar {
	display: none;
}

/* while the strip has more to scroll to, its end fades. Tied to the strip's
   own scroll, so where the links fit the timeline is inactive and nothing
   fades; without scroll timelines the strip still scrolls, unfaded */
@supports (animation-timeline: scroll(x self)) {
	.masthead-links {
		animation: masthead-links-more linear both;
		animation-timeline: scroll(x self);
	}
}

@keyframes masthead-links-more {
	0%,
	92% {
		-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.75rem), transparent calc(100% - 6px));
		mask-image: linear-gradient(to right, #000 calc(100% - 1.75rem), transparent calc(100% - 6px));
	}

	100% {
		-webkit-mask-image: none;
		mask-image: none;
	}
}

.masthead-nav a {
	padding: .55rem .9rem;
	font-size: 1.0625rem;
	font-weight: 650;
	color: var(--head-ink);
	white-space: nowrap;
	text-decoration: none;
	border-radius: 999px;
}

.masthead-nav a:hover {
	text-decoration: none;
	background: var(--head-chip);
}

/* the page you are on: a ringed pill, so it never rests on a faint fill alone */
.masthead-nav a[aria-current="page"] {
	background: var(--head-chip);
	box-shadow: inset 0 0 0 1.5px var(--head-ring);
}

.mode-switch {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	margin-left: .35rem;
	font-size: 1.05rem;
	color: var(--head-ink);
	border: 1.5px solid var(--head-edge);
	border-radius: 50%;
	cursor: pointer;
	transition: transform .25s var(--chrome-ease);
}

.mode-switch:hover {
	border-color: var(--head-ink);
	transform: rotate(-18deg);
}

.mode-switch:active {
	transform: scale(.92);
}

/* the switch shows the theme it turns on: the moon on a light page, the sun
   on a dark one */
.mode-sun,
body:has(#theme-toggle:checked) .mode-moon {
	display: none;
}

body:has(#theme-toggle:checked) .mode-sun {
	display: block;
}

body.ink-first .mode-moon {
	display: none;
}

body.ink-first .mode-sun {
	display: block;
}

body.ink-first:has(#theme-toggle:checked) .mode-moon {
	display: block;
}

body.ink-first:has(#theme-toggle:checked) .mode-sun {
	display: none;
}

/* a lime ring with an ink edge, as everywhere on the site; lime on charcoal
   is well past 3:1 */
.top a:focus-visible,
.site-foot a:focus-visible,
.weekly-mail :focus-visible,
body:has(#theme-toggle:focus-visible) .mode-switch {
	outline: 3px solid #b8ff57;
	outline-offset: 2px;
	box-shadow: 0 0 0 2px #0c0c0d;
}

/* ── Frosted glass ─────────────────────────────────────────────────────── */

/* What scrolls under the header shows through it, lightly and blurred
   (owner, 2026-11-08). The charcoal sits at 96%, so over paper it still reads
   as the charcoal of the chapter bar below it, and holds the links at 4.5:1
   and the switch's ring at 3:1 over the brightest content that can pass
   under it (a white or lime field). At rest the header sits over the
   page's own ground, so the body paints the header's color there and the
   top of the page shows plain charcoal. Where backdrop-filter or
   color-mix() is unknown, and under reduced transparency, it stays solid. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) and (color: color-mix(in srgb, red 50%, transparent)) {
	body {
		background-image: linear-gradient(var(--head), var(--head));
		background-repeat: no-repeat;
		background-size: 100% var(--head-h);
	}

	.top {
		background: color-mix(in srgb, var(--head) 96%, transparent);
		-webkit-backdrop-filter: blur(14px);
		backdrop-filter: blur(14px);
	}
}

@media (prefers-reduced-transparency: reduce) {
	body {
		background-image: none;
	}

	.top {
		background: var(--head);
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}
}

/* ── The weekly signup: the footer's top row, full width ───────────────── */

/* named "weekly-mail" in classes and ids rather than the usual words for
   it, because ad blockers hide elements whose class names contain those */
.weekly-mail {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	align-items: end;
	gap: clamp(2rem, 5vw, 5rem);
	padding: clamp(3.5rem, 7vw, 6.5rem) var(--chrome-gutter) clamp(3rem, 6vw, 5rem);
	color: var(--band-ink);
	background: var(--band);
	border-top: 1px solid var(--band-line);
}

.weekly-mail h2 {
	max-width: 11ch;
	margin: 0;
	font-family: inherit;
	font-size: clamp(2.75rem, 6.4vw, 6.5rem);
	font-weight: 800;
	line-height: .88;
	letter-spacing: -.045em;
	color: inherit;
	text-wrap: balance;
}

.weekly-mail-sub {
	max-width: 40ch;
	margin-top: 1.25rem;
	font-size: clamp(1.125rem, 1.5vw, 1.3125rem);
	line-height: 1.4;
	color: var(--band-muted);
}

.weekly-mail-form {
	display: grid;
	gap: .6rem;
}

.weekly-mail-form label {
	font-weight: 700;
}

.weekly-mail-row {
	display: flex;
	gap: .5rem;
}

.weekly-mail-row input {
	flex: 1;
	min-width: 0;
	height: 64px;
	padding: 0 1.4rem;
	font: inherit;
	font-size: 1.125rem;
	color: var(--band-ink);
	background: transparent;
	border: 2px solid var(--band-ink);
	border-radius: 999px;
	caret-color: var(--band-ink);
}

.weekly-mail-row input::placeholder {
	color: var(--band-muted);
	opacity: 1;
}

.weekly-mail-row button {
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	height: 64px;
	padding: 0 1.6rem;
	font: inherit;
	font-size: 1.0625rem;
	font-weight: 750;
	color: var(--band);
	background: var(--band-ink);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: transform .15s var(--chrome-press);
}

.weekly-mail-row button .icon {
	transition: transform .4s var(--chrome-ease);
}

.weekly-mail-row button:hover .icon {
	transform: translateX(4px);
}

.weekly-mail-row button:active {
	transform: translateY(2px);
}

.weekly-mail-error {
	display: none;
	font-weight: 700;
}

.weekly-mail-form:has(input:user-invalid) .weekly-mail-error {
	display: block;
}

.weekly-mail-row input:user-invalid {
	border-style: dashed;
}

.weekly-mail-note {
	max-width: 46ch;
	font-size: .9375rem;
	line-height: 1.45;
	color: var(--band-muted);
}

/* the honeypot field: off screen and out of the tab order, so only bots fill it */
.weekly-mail-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-foot {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 1.25rem 3rem;
	padding: clamp(3rem, 6vw, 5rem) var(--chrome-gutter) 3.5rem;
	color: var(--close-ink);
	text-align: left;
	background: var(--close);
	border-top: 1px solid var(--close-line);
}

.site-foot-logo {
	grid-row: span 3;
	align-self: start;
	border-radius: 6px;
}

.site-foot-cats {
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1.5rem;
	font-size: 1.125rem;
	font-weight: 750;
}

.site-foot-cats a {
	padding: .25rem 0;
	text-decoration: none;
}

.site-foot-cats a:hover {
	text-decoration: underline;
}

.site-foot-bio,
.site-foot-line {
	max-width: 70ch;
	margin: 0;
	font-size: .9375rem;
	color: var(--close-muted);
}

.site-foot-bio a,
.site-foot-line a {
	color: var(--close-ink);
	text-decoration: underline;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
	.weekly-mail {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* below md: phones */
@media (max-width: 767.98px) {
	body {
		--head-h: 68px;
	}

	.top .logo-file {
		height: 26px;
	}

	.masthead-nav a {
		padding: .55rem .7rem;
		font-size: 1rem;
	}

	.weekly-mail-row {
		flex-direction: column;
	}

	.weekly-mail-row input {
		flex: none;
		height: 56px;
	}

	.weekly-mail-row button {
		height: 56px;
		justify-content: center;
	}

	.site-foot {
		grid-template-columns: minmax(0, 1fr);
	}

	.site-foot-logo {
		grid-row: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mode-switch,
	.weekly-mail-row button,
	.weekly-mail-row button .icon {
		transition: none;
	}
}

/* ── The notice over a demo this browser can't run ────────────────────────
   (owner, 2026-11-14). example.njk puts it at the top of a demo's section,
   so the example page, its home tile and its related cards all carry it.
   It stays hidden unless the browser fails the feature's test below. The
   browsers that show it are the ones missing new features, so this block
   uses only old, plain CSS: no :has(), nesting or color-mix(). */
.needs-note {
	display: none;
}

/* the look (owner's pick B, 2026-11-14, mockups/needs-note/): the demo
   dimmed behind a centered card. Without :has(), the card sits in the flow
   above the demo instead, which still says why the demo looks wrong */
.needs-note p {
	margin: 0;
}

.needs-note-box {
	max-width: 26rem;
	margin: 0 auto 1rem;
	padding: 1rem 1.15rem;
	border: 1px solid rgba(244, 241, 235, .22);
	border-radius: 12px;
	background: #0c0c0d;
	color: #f4f1eb;
	font: 500 .875rem/1.45 "Jost", system-ui, sans-serif;
	letter-spacing: 0;
	text-align: left;
	text-transform: none;
}

.needs-note-head {
	display: flex;
	align-items: center;
	gap: .5em;
	font-weight: 700;
}

.needs-note-head .fa-icon {
	flex: none;
	width: 1.05em;
	height: 1.05em;
	color: #b8ff57;
}

.needs-note-body {
	margin-top: .3em !important;
}

.needs-note-body code {
	font-size: .9em;
}

.needs-note-label {
	display: none !important;
}

@supports selector(:has(a)) {
	.demo-section:has(> .needs-note) {
		position: relative;
	}

	.needs-note {
		position: absolute;
		z-index: 20;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		padding: 1rem;
		background: rgba(12, 12, 13, .7);
		/* clicks pass through to the demo, which may still work in a plainer form */
		pointer-events: none;
		align-items: center;
		justify-content: center;
	}

	.needs-note-box {
		margin: 0;
		pointer-events: auto;
	}

	/* a demo that still works, only plainer, keeps its middle clear: the
	   card sits at the top, so its controls stay in reach */
	.needs-note-fallback {
		align-items: flex-start;
	}
}

/* one rule per feature, keyed by needsKey() in example-page/needs-note.mjs;
   scripts/verify-needs.mjs checks each key has a rule that Chrome passes */
@supports not ((anchor-name: --needs-test) and (position-area: top)) {
	.needs-note[data-needs~="anchor-positioning"] {
		display: flex;
	}
}

@supports not (corner-shape: squircle) {
	.needs-note[data-needs~="corner-shape"] {
		display: flex;
	}
}

@supports not (border-shape: none) {
	.needs-note[data-needs~="border-shape"] {
		display: flex;
	}
}

@supports not (field-sizing: content) {
	.needs-note[data-needs~="field-sizing"] {
		display: flex;
	}
}

@supports not (container-type: scroll-state) {
	.needs-note[data-needs~="scroll-state-container-queries"] {
		display: flex;
	}
}

@supports not (animation-timeline: scroll()) {
	.needs-note[data-needs~="scroll-driven-animations"] {
		display: flex;
	}
}

/* the older features, which most demos need and older phones lack
   (the Safari 15.2 check, 2026-11-14; src/_data/needsByExample.js) */
@supports not selector(:has(a)) {
	.needs-note[data-needs~="has"] {
		display: flex;
	}
}

@supports not (container-type: inline-size) {
	.needs-note[data-needs~="container-queries"] {
		display: flex;
	}
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.needs-note[data-needs~="color-mix"] {
		display: flex;
	}
}

@supports not (width: calc(1px * sin(1deg))) {
	.needs-note[data-needs~="trig-functions"] {
		display: flex;
	}
}

@supports not (width: round(1.5px, 1px)) {
	.needs-note[data-needs~="round"] {
		display: flex;
	}
}

@supports not (width: 1lh) {
	.needs-note[data-needs~="lh-unit"] {
		display: flex;
	}
}

@supports not (grid-template-columns: subgrid) {
	.needs-note[data-needs~="subgrid"] {
		display: flex;
	}
}

@supports not selector(:popover-open) {
	.needs-note[data-needs~="popover"] {
		display: flex;
	}
}

@supports not (height: 1dvh) {
	.needs-note[data-needs~="viewport-units"] {
		display: flex;
	}
}

/* ── The banner for a browser too old for most demos ─────────────────────
   (owner's pick B, 2026-11-14: one banner under the header, standing out).
   Most demos and the site's own controls need :has() (iOS 15.4, Chrome
   105), so a browser without it gets this banner, and each demo it can't
   run is also dimmed behind its card (owner, 2026-11-15: "the demos that
   won't work in the user's browser should [be] apparent as well"). Plain
   CSS only: this is what an old browser reads. */
.old-browser-bar,
.old-browser-note {
	display: none;
}

@supports not selector(:has(a)) {
	/* the short line rides in the sticky top bar, so the top bar is taller:
	   everything that sticks below it reads --head-h, so it grows by the
	   line and the masthead keeps its own height */
	body {
		--obn-line: 44px;
		--head-h: 128px;
	}

	.masthead {
		height: calc(var(--head-h) - var(--obn-line));
	}

	/* the top bar's bottom line would split the banner in two */
	.top {
		box-shadow: none;
	}

	/* the theme switch needs :has() too; without it the switch does nothing,
	   so it goes and each page shows its own default theme */
	.mode-switch {
		display: none;
	}

	.old-browser-bar {
		display: flex;
		text-decoration: none;
		cursor: pointer;
		align-items: center;
		height: var(--obn-line);
		margin: 0;
		padding: 0 var(--chrome-gutter, 20px);
		background: #6f2fd6;
		color: #ffffff;
		font: 700 1.0625rem/1.2 "Jost", system-ui, sans-serif;
	}

	.old-browser-bar .fa-icon {
		flex: none;
		width: 1.25em;
		height: 1.25em;
		margin-right: .55em;
		color: #b8ff57;
	}

	/* the explanation, under the bar at the top of the page; it scrolls away */
	.old-browser-note {
		display: block;
		padding: 0 var(--chrome-gutter, 20px) 16px;
		border-bottom: 3px solid #b8ff57;
		background: #6f2fd6;
		color: #ffffff;
		font: 500 .95rem/1.5 "Jost", system-ui, sans-serif;
	}

	.obn-body {
		margin: 0;
	}

	.obn-body code {
		padding: 1px 5px;
		border-radius: 4px;
		background: rgba(12, 12, 13, .35);
		font-size: .9em;
	}

	/* without :has() the notice can't make its demo section the box it covers,
	   so here every demo section is one, and the notice lies over its demo,
	   dimmed behind the card, as it does in newer browsers (owner, 2026-11-15) */
	.demo-section {
		position: relative;
	}

	.needs-note {
		position: absolute;
		z-index: 20;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		padding: 1rem;
		background: rgba(12, 12, 13, .7);
		pointer-events: none;
		align-items: center;
		justify-content: center;
	}

	.needs-note-box {
		margin: 0;
		pointer-events: auto;
	}

	/* a demo that still works, only plainer, keeps its middle clear: the
	   card sits at the top, so its controls stay in reach */
	.needs-note-fallback {
		align-items: flex-start;
	}
}

@media (max-width: 767.98px) {
	@supports not selector(:has(a)) {
		body {
			--head-h: 112px;
		}
	}
}
