/* The man-page theme - the single stylesheet.
   Grammar: a man page. Section name in the left gutter, content indented
   to the right, rules at the top and bottom.
   Colours: Solarized (Ethan Schoonover). Never a hard-coded colour. */

@font-face {
	font-family: "JetBrains Mono";
	src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "JetBrains Mono";
	src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #FDF6E3;
	--bg-inset: #EEE8D5;
	--fg: #073642;
	--fg-muted: #506C75;
	--fg-faint: #93A1A1;
	--rule: #DED7C3;
	--accent: #0F6E68;
	--accent-bg: #D9EBE8;
	--warn: #A5501A;
	--error: #B3261E;

	--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	--measure: 68ch;
	--gutter: 13ch;

	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #002B36;
		--bg-inset: #073642;
		--fg: #B6C2C2;
		--fg-muted: #8C9B9B;
		--fg-faint: #586E75;
		--rule: #0E4653;
		--accent: #3EA89E;
		--accent-bg: #05313B;
		--warn: #CB8B4B;
		--error: #EF7A74;
	}
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 100%; /* the reader's setting, not a fixed 16px */
	line-height: 1.7;
}

.page {
	max-width: calc(var(--gutter) + var(--measure));
	margin: 0 auto;
	padding: 2rem 1.5rem 4rem;
	font-size: 1rem;
}

a {
	color: var(--accent);
	text-decoration: underline;
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.skip {
	position: absolute;
	left: -9999px;
}
.skip:focus {
	position: static;
	display: inline-block;
	font-family: var(--mono);
	margin-bottom: 0.5rem;
}

/* --- man-page rules ------------------------------------------------------ */

.manline {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 1ch;
	font-family: var(--mono);
	font-size: 0.72rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fg-muted);
}
.manline > :nth-child(2) { text-align: center; }
.manline > :nth-child(3) { text-align: right; }
.manline--head {
	border-bottom: 1px solid var(--rule);
	padding-bottom: 0.75rem;
}
.manline--foot {
	border-top: 1px solid var(--rule);
	padding-top: 0.75rem;
	margin-top: 0.75rem;
}

/* --- navigation --------------------------------------------------------- */

.nav {
	font-family: var(--mono);
	font-size: 0.85rem;
	padding: 1.1rem 0 0;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.15rem 0.5rem;
}
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav a[aria-current="page"] {
	color: var(--fg);
	background: var(--accent-bg);
	padding: 0 0.35ch;
	font-weight: 700;
}
.nav .sep { color: var(--fg-faint); }

/* --- wordmark ----------------------------------------------------------- */

.wordmark {
	font-family: var(--mono);
	font-weight: 700;
	font-size: 1.75rem;
	line-height: 1.2;
	text-transform: lowercase;
	margin: 2.5rem 0 0.35rem;
}
.wordmark .tilde { color: var(--accent); }
.wordmark a { color: inherit; text-decoration: none; }
.wordmark a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
/* ~/<site>/<title>: the page's title as the last segment of the path.
   It keeps its own case - the wordmark alone is lowercase. */
.wordmark .slash { color: var(--fg-muted); font-weight: 400; }
.wordmark .here { text-transform: none; }
.wordmark .cursor {
	display: inline-block;
	width: 0.55em;
	height: 1.02em;
	margin-left: 0.12em;
	vertical-align: -0.16em;
	background: var(--accent);
	/* Four blinks, then steady: blinking longer than 5 s needs a way to stop
	   it (WCAG 2.2.2). */
	animation: blink 1.06s step-end 4;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
/* Hovering the wordmark plays the four blinks again: a second, identical
   animation, since switching the name is what restarts it. */
@keyframes blink-again { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.wordmark:hover .cursor { animation-name: blink-again; }
@media (prefers-reduced-motion: reduce) {
	.wordmark .cursor { animation: none; }
}

.tagline {
	font-family: var(--mono);
	font-size: 0.82rem;
	color: var(--fg-muted);
	margin: 0 0 3.5rem;
}

/* --- sections ----------------------------------------------------------- */

.s {
	display: grid;
	grid-template-columns: var(--gutter) minmax(0, 1fr);
	margin: 0 0 3.25rem;
}
.s > h2 {
	grid-column: 1;
	font-family: var(--mono);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	color: var(--fg-muted);
	margin: 0.3rem 0 0;
	padding-right: 1ch;
	text-transform: uppercase;
}
.s > .b {
	grid-column: 2;
	max-width: var(--measure);
	min-width: 0;
}
.s > .b > :first-child { margin-top: 0; }
.s > .b > :last-child { margin-bottom: 0; }

@media (max-width: 42rem) {
	.s { grid-template-columns: minmax(0, 1fr); }
	.s > h2 { grid-column: 1; margin: 0 0 0.75rem; }
	.s > .b { grid-column: 1; }
	.manline > :nth-child(2) { display: none; }
	.manline { grid-template-columns: 1fr auto; }
}

p { margin: 0 0 1.15rem; }
.b ul { margin: 0 0 1.15rem; padding-left: 1.2rem; }
.b li { margin: 0 0 0.5rem; }

.mono { font-family: var(--mono); }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-muted); } /* text: never the faint tone, too pale to read */
.small { font-size: 0.82rem; }
.warn { color: var(--warn); }

/* --- blocks ------------------------------------------------------------- */

pre, code, kbd, samp {
	font-family: var(--mono);
	font-size: 0.85em;
}
pre {
	background: var(--bg-inset);
	border-radius: 2px;
	padding: 0.75rem 0.9rem;
	overflow-x: auto;
	line-height: 1.5;
	margin: 0 0 1.5rem;
}
:not(pre) > code {
	background: var(--bg-inset);
	border-radius: 2px;
	padding: 0.05em 0.35ch;
}

.inset {
	background: var(--bg-inset);
	border-left: 2px solid var(--rule);
	border-radius: 2px;
	padding: 0.75rem 0.9rem;
	margin: 0 0 1.5rem;
}
.inset > :last-child { margin-bottom: 0; }

/* --- code: language label, scroll, highlighting (builder/highlight.py) ---- */

pre.code {
	position: relative;
	scrollbar-color: var(--fg-faint) transparent;
	white-space: pre;
	tab-size: 4;
	max-width: 100%;
}
/* The language and the copy button sit over the code, top right, faded:
   they take no line of their own. Hovering the block, or reaching it from
   the keyboard, brings them back to full strength. */
pre.code[data-lang]::before {
	content: attr(data-lang);
	position: absolute;
	top: 0.35rem;
	right: 0.6rem;
	font-size: 0.72rem;
	letter-spacing: 0.08em;
	color: var(--fg-muted);
	background: var(--bg-inset);
	padding: 0 0.5ch;
	opacity: 0.4;
}
pre code { font-size: inherit; }

/* Copy button, added by code.js around each block. */
.code-wrap { position: relative; margin: 0 0 1.5rem; }
.code-wrap > pre { margin: 0; }
.code-wrap > pre.code[data-lang]::before { right: 5.2rem; }
.copy {
	position: absolute;
	top: 0.3rem;
	right: 0.5rem;
	opacity: 0.4;
	font-family: var(--mono);
	font-size: 0.72rem;
	color: var(--fg-muted);
	background: var(--bg);
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 0.05rem 0.8ch;
	cursor: pointer;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }
pre.code:hover::before, pre.code:focus-visible::before,
.code-wrap:hover > pre.code::before, .code-wrap:focus-within > pre.code::before,
.code-wrap:hover > .copy, .code-wrap:focus-within > .copy,
.copy[data-state="done"] { opacity: 1; }
/* Touch screens have no hover: a little less faded there. */
@media (hover: none) {
	pre.code[data-lang]::before, .copy { opacity: 0.7; }
}
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy[data-state="done"] { color: var(--accent); border-color: var(--accent); }
/* Tokens (builder/highlight.py): weight and the existing palette only - no new accent. Comments
   use the muted tone, not the faint one: faint is too pale on --bg-inset. */
.hl-k, .hl-t { font-weight: 700; }
.hl-s, .hl-v, .hl-gi { color: var(--accent); }
.hl-c { color: var(--fg-muted); font-style: italic; }
.hl-b, .hl-n, .hl-p, .hl-gh { color: var(--fg-muted); }
.hl-gd { color: var(--error); }

/* --- figures: ![alt](file "caption") ------------------------------------- */

.figure { margin: 2rem 0; }
.figure img {
	display: block;
	max-width: 100%;
	height: auto;
	border: 1px solid var(--rule);
	border-radius: 2px;
}
.figure figcaption {
	font-family: var(--mono);
	font-size: 0.78rem;
	color: var(--fg-muted);
	margin: 0.6rem 0 0;
}

/* --- tables ------------------------------------------------------------- */

/* The wrapper scrolls, not the page, when a table is wider than the column. */
.table {
	overflow-x: auto;
	scrollbar-color: var(--fg-faint) transparent;
	margin: 0 0 1.5rem;
}
table {
	border-collapse: collapse;
	font-size: 0.9rem;
	min-width: 60%;
}
th, td {
	text-align: left;
	vertical-align: top;
	padding: 0.35rem 1.2ch 0.35rem 0;
	border-bottom: 1px solid var(--rule);
}
th {
	font-family: var(--mono);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--fg-muted);
	border-bottom-color: var(--fg-faint);
	white-space: nowrap;
}
th.center, td.center { text-align: center; }
th.right, td.right { text-align: right; }
td.right { font-variant-numeric: tabular-nums; }

/* --- callouts: > [!INFO], > [!WARNING], > [!ERROR] ---------------------- */

.callout {
	background: var(--bg-inset);
	border-left: 3px solid var(--kind);
	border-radius: 2px;
	padding: 0.65rem 0.9rem 0.75rem;
	margin: 0 0 1.5rem;
}
.callout--info { --kind: var(--accent); }
.callout--warning { --kind: var(--warn); }
.callout--error { --kind: var(--error); }
.callout > :last-child { margin-bottom: 0; }
.callout-label {
	font-family: var(--mono);
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	color: var(--kind);
	margin: 0 0 0.3rem;
}

/* --- entries (events, posts, members) ----------------------------------- */

.entry {
	border-top: 1px solid var(--rule);
	padding: 1.3rem 0;
}
.entry:first-child { border-top: 0; padding-top: 0; }
.entry h3 {
	font-family: var(--mono);
	font-size: 0.95rem;
	font-weight: 700;
	margin: 0 0 0.4rem;
}
.entry h3 a { text-decoration: none; }
.entry h3 a:hover { text-decoration: underline; }
.entry p { margin: 0 0 0.6rem; }
/* The next event looks like every other card; its tag, in the accent,
   marks it. Posts and events share one card style. */

/* A listed post or event: a bordered card, and the title's link covers
   all of it. The frame is what says "this is clickable"; hover turns it to
   the accent. Same 1px rule and square corners as the member grid. */
.entry--link,
.entry--link:first-child {
	position: relative;
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 1rem 1.1rem 0.6rem;
	margin: 0 0 0.9rem;
}
.entry--link:hover { border-color: var(--accent); }
.entry--link h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
}
.entry--link:hover h3 a { text-decoration: underline; text-decoration-thickness: 2px; }

/* --- [TOC]: the page's sections ------------------------------------------ */

.toc {
	border-left: 2px solid var(--rule);
	padding: 0.1rem 0 0.1rem 1rem;
	margin: 0 0 1.5rem;
	font-family: var(--mono);
	font-size: 0.85rem;
}
.toc-label {
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	text-transform: uppercase;
	color: var(--fg-muted);
	cursor: pointer;
	min-height: 1.5rem;
	list-style: none;
}
.toc-label::-webkit-details-marker { display: none; }
/* A man-page style marker: [+] closed, [-] open. */
.toc-label::before { content: "[+] "; color: var(--accent); }
.toc details[open] > .toc-label::before { content: "[-] "; }
.toc-label:hover { color: var(--accent); }
.toc-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toc ol { margin: 0.4rem 0 0; padding-left: 1.6rem; }
.toc li { margin: 0 0 0.25rem; }
.toc li::marker { color: var(--fg-muted); }

/* ++underlined++: dotted, so it is not taken for a link (links are solid). */
u.u {
	text-decoration: underline dotted;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

/* --- member profiles: a row of logos ----------------------------------- */

.profiles {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.9rem;
	margin: 0.5rem 0 0;
	font-family: var(--mono);
	font-size: 0.78rem;
}
/* Above the card's stretched link, so they stay clickable in a card. */
.profiles a {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	min-height: 1.5rem;
	min-width: 1.5rem;
	color: var(--fg-muted);
	text-decoration: none;
}
.profiles a:hover, .profiles a:focus-visible { color: var(--accent); }
.icon { width: 1.05rem; height: 1.05rem; fill: currentColor; }

/* --- lists: numbered, nested, tasks ------------------------------------- */

.b ol { margin: 0 0 1.15rem; padding-left: 1.6rem; }
.b li > ul, .b li > ol { margin: 0.5rem 0 0; }
.b ol > li::marker { font-family: var(--mono); font-size: 0.85em; color: var(--fg-muted); }
.b ul.tasks { list-style: none; padding-left: 0.2rem; }
.task {
	display: inline-block;
	width: 0.85em;
	height: 0.85em;
	margin-right: 0.7ch;
	vertical-align: -0.08em;
	border: 1px solid var(--fg-muted);
	border-radius: 2px;
}
.task--done {
	border-color: var(--accent);
	background: var(--accent) content-box;
	padding: 2px;
}
del { color: var(--fg-muted); }
em { font-style: italic; }
hr {
	border: 0;
	border-top: 1px solid var(--rule);
	margin: 2rem 0;
}

/* --- back to top -------------------------------------------------------- */

.to-top {
	font-family: var(--mono);
	font-size: 0.78rem;
	text-align: right;
	margin: 3rem 0 0;
}
.to-top a { text-decoration: none; }
.to-top a:hover { text-decoration: underline; }

.meta {
	font-family: var(--mono);
	font-size: 0.76rem;
	color: var(--fg-muted);
	margin: 0 0 0.6rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 1ch;
}

/* Dense grid of entries - "cards", but inside the system: 1px rule, sharp
   corners, no shadow. §6 forbids cards that replace the man-page grammar;
   these only tighten a list. */
.b.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
	gap: 1rem;
	align-items: start;
}
.b.grid .entry,
.b.grid .entry:first-child {
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 1rem 1.1rem;
}
/* The title link covers the whole card: what reacts to hover must also be
   clickable. No JS, just an ::after stretched over the card. */
.b.grid .entry { position: relative; }
.b.grid .entry h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
}
.b.grid .entry:has(h3 a):hover,
.b.grid .entry:has(h3 a:focus-visible) { border-color: var(--accent); }
.b.grid .entry h3 { font-size: 0.9rem; }
.b.grid .meta {
	flex-direction: column;
	gap: 0.15rem;
	margin: 0;
}
.b.grid .meta > span + span:not(.tag)::before { content: ""; }
.b.grid .tag { align-self: flex-start; margin-top: 0.15rem; }

.meta > span + span:not(.tag)::before {
	content: "\00B7\00A0";
	color: var(--fg-faint);
}

.tag {
	font-family: var(--mono);
	font-size: 0.72rem;
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 0.05rem 0.5ch;
	color: var(--fg-muted);
	white-space: nowrap;
}
.tag--full { color: var(--warn); border-color: var(--warn); }
.tag--next { color: var(--accent); border-color: var(--accent); }
.slots {
	font-family: var(--mono);
	font-size: 0.76rem;
	color: var(--fg-muted);
	margin: 0.3rem 0 0;
}

.empty {
	font-family: var(--mono);
	font-size: 0.85rem;
	color: var(--fg-muted);
}

/* --- member search (members.js, the only script) ------------------------ */

[hidden] { display: none !important; }
.filter {
	grid-column: 1 / -1;
	font-family: var(--mono);
	font-size: 0.82rem;
}
.filter label {
	display: block;
	color: var(--fg-muted);
	margin: 0 0 0.2rem;
}
.filter input {
	width: 100%;
	max-width: 28rem;
	font: inherit;
	color: var(--fg);
	background: var(--bg);
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 0.35rem 0.5rem;
}
.filter input:focus-visible,
.filter button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
.filter-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.55rem 0 0;
}
.filter button {
	font: inherit;
	color: var(--fg);
	background: var(--bg-inset);
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 0.15rem 1ch;
	cursor: pointer;
}
.filter button:hover { border-color: var(--accent); }
.filter button[aria-pressed="true"] {
	background: var(--accent-bg);
	border-color: var(--accent);
	color: var(--accent);
}
.filter-status {
	color: var(--fg-muted);
	margin: 0.45rem 0 0;
}

/* --- accessibility ----------------------------------------------------- */

/* Read by screen readers, not shown. */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* A clickable card shows keyboard focus around the whole card. */
.entry--link:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.entry--link:focus-within h3 a:focus-visible { outline: none; }

/* Scrollable code and tables are focusable (keyboard scrolling). */
pre.code:focus-visible, .table:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Targets at least 24px high (WCAG 2.5.8). */
.nav a { display: inline-block; padding: 0.2rem 0; }
.copy { min-height: 1.5rem; }

/* More contrast when the reader asks for it. */
@media (prefers-contrast: more) {
	:root {
		--fg-muted: var(--fg);
		--fg-faint: var(--fg);
		--rule: var(--fg-muted);
	}
}

/* Windows high contrast and other forced colours: backgrounds are dropped,
   so what a background meant must survive as a border or a system colour. */
@media (forced-colors: active) {
	.task--done { background: CanvasText content-box; border-color: CanvasText; }
	.nav a[aria-current="page"] { outline: 1px solid CanvasText; }
	.callout { border-left-color: CanvasText; }
	.wordmark .cursor { background: CanvasText; }
}

@media print {
	/* Another medium, same mechanism as the dark theme: redefine the
	   tokens, never hard-code a colour in a rule. */
	:root {
		--bg: #FFFFFF;
		--bg-inset: #FFFFFF;
		--fg: #000000;
		--fg-muted: #333333;
		--fg-faint: #555555;
		--rule: #999999;
		--accent: #000000;
		--accent-bg: #FFFFFF;
		--warn: #000000;
		--error: #000000;
	}
	@page { margin: 14mm; }
	body { background: var(--bg); color: var(--fg); font-size: 11pt; }
	.page { max-width: none; padding: 0; }
	.nav, .filter { display: none !important; }
	a { color: var(--fg); text-decoration: none; }
	pre, .inset, .callout { border: 1px solid var(--rule); }
	.callout { border-left: 3px solid var(--fg); }
	pre.code { white-space: pre-wrap; }
}
