/* The folio.  Mobile first: base styles are the small-screen layout and
   every @media block only adds.  No JavaScript, so anything a script would
   do here is done by the browser instead -- the menu is a wrapping list of
   links, not a button that reveals links, so with CSS switched off the page
   is still a readable document and every page is still reachable. */

:root {
	--text: #1a1a1a;
	--faint: #6a6a6a;
	--bg: #ffffff;
	--panel: #f6f6f6;
	--rule: #e2e2e2;
	--accent: #2a4d8b;
	--measure: 38rem;
}

@media (prefers-color-scheme: dark) {
	:root {
		--text: #e8e8e8;
		--faint: #9a9a9a;
		--bg: #141414;
		--panel: #1f1f1f;
		--rule: #333333;
		--accent: #8fb4e8;
	}
}

* { box-sizing: border-box; }

html {
	background: var(--bg);
	color: var(--text);
	font: 1rem/1.65 Georgia, "Times New Roman", serif;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	padding: 0 1rem;
	max-width: 46rem;
}

/* A keyboard reader should land on content, not on the menu. */
.skip {
	position: absolute;
	left: -9999px;
}
.skip:focus {
	position: static;
	left: 0;
}

a {
	color: var(--accent);
	text-decoration: none;
}
a:hover,
a:focus {
	text-decoration: underline;
}
a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* The menu.  A list of links that wraps, so it needs no toggle and works
   at any width, including when the reader zooms text. */
.masthead {
	border-bottom: 1px solid var(--rule);
	padding: 1rem 0 0;
	margin-bottom: 1.5rem;
}
.brand {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
	font-weight: 700;
}
.brand a { color: var(--text); }
.menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	padding-bottom: 0.75rem;
	font-size: 0.94rem;
}
.menu a {
	padding: 0.35rem 0;
	min-height: 2.25rem;
	display: inline-flex;
	align-items: center;
}

h1 {
	font-size: 1.55rem;
	line-height: 1.25;
	margin: 0 0 0.4rem;
}
h2 {
	font-size: 1.15rem;
	margin: 2rem 0 0.5rem;
}
h1, h2 { font-weight: 700; }

.byline {
	color: var(--faint);
	font-size: 0.9rem;
	margin: 0 0 1.5rem;
}
.byline time { font-style: normal; }
.byline .author { font-style: italic; }

.body { max-width: var(--measure); }
.body p { margin: 0 0 1rem; }
/* sblg replaces the <article> element itself, so the wrapper div is the
   structure this file owns; the first child to look at is inside it. */
.body > article > :first-child { margin-top: 0; }

/* Nothing in the document may be wider than the viewport. */
img,
video,
table,
pre {
	max-width: 100%;
	height: auto;
}
pre {
	overflow-x: auto;
	background: var(--panel);
	padding: 0.75rem;
	font-size: 0.85rem;
}
code { font-family: "DejaVu Sans Mono", Consolas, monospace; }

blockquote {
	margin: 1rem 0;
	padding-left: 1rem;
	border-left: 3px solid var(--rule);
	color: var(--faint);
}

/* Profile photo and any inline figure. */
.profile-img {
	width: 6rem;
	height: 6rem;
	object-fit: cover;
	border-radius: 50%;
	margin: 0 0 1rem;
}

/* Publications: a grid that reflows on its own.  One column on a phone,
   more as the screen widens, with no breakpoint to keep in sync. */
.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: 1.25rem;
	margin-top: 1.5rem;
}
.card {
	display: block;
	color: inherit;
	text-decoration: none;
}
.card:hover,
.card:focus { text-decoration: none; }
.card:hover .card-title,
.card:focus .card-title { text-decoration: underline; }
.cover {
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	background: var(--panel);
	border: 1px solid var(--rule);
}
.cover-page {
	width: 9rem;
	aspect-ratio: 2 / 3;
	margin: 0 0 1rem;
}
.card-title {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.95rem;
	line-height: 1.3;
	color: var(--text);
}
.card-meta,
.card-summary {
	display: block;
	font-size: 0.82rem;
	color: var(--faint);
	line-height: 1.4;
}
.card-summary { margin-top: 0.2rem; }
.card-action {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.82rem;
	color: var(--accent);
}

/* Article list. */
.list { display: block; }
.list .entry {
	display: block;
	padding: 1rem 0;
	border-bottom: 1px solid var(--rule);
	color: inherit;
	text-decoration: none;
}
.list .entry:hover,
.list .entry:focus { text-decoration: none; }
.list .entry:hover .entry-title,
.list .entry:focus .entry-title { text-decoration: underline; }
.entry-title {
	display: block;
	font-size: 1.05rem;
	color: var(--text);
}
.entry-date {
	display: block;
	font-size: 0.8rem;
	color: var(--faint);
	margin-top: 0.15rem;
}
.entry-summary {
	display: block;
	font-size: 0.9rem;
	color: var(--faint);
	margin-top: 0.35rem;
}

/* Contents list of a book.  Numbers come from ${sblg-pos}, so the list
   stays correct as chapters are added without touching any file. */
.toc { margin-top: 0.5rem; }
.toc-entry {
	display: flex;
	gap: 0.75rem;
	align-items: baseline;
	padding: 0.45rem 0;
	border-bottom: 1px solid var(--rule);
	color: inherit;
	text-decoration: none;
}
.toc-entry:hover,
.toc-entry:focus { text-decoration: none; }
.toc-entry:hover .toc-title,
.toc-entry:focus .toc-title { text-decoration: underline; }
.toc-no {
	color: var(--faint);
	font-size: 0.85rem;
	min-width: 1.75rem;
}
.toc-title { color: var(--text); }

.kicker {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--faint);
	margin: 0 0 0.3rem;
}

/* Reading width for a book is narrower than for an article. */
.body-reading { max-width: 34rem; }

.pager {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	margin: 2rem 0 0;
	font-size: 0.95rem;
}
.pager a {
	padding: 0.4rem 0;
	min-height: 2.25rem;
	display: inline-flex;
	align-items: center;
}

/* sblg's prev and next walk the article list and wrap at the ends, so the
   newest article would offer a "Newer" pointing at the oldest one.  sblg
   prints a marker only when the neighbour really exists, and that is what
   these selectors key on.  Without CSS the links stay, and a wrapped link
   still goes to a real page. */
.pager-newer:not(.sblg-next-has),
.pager-older:not(.sblg-prev-has) { display: none; }

.colophon {
	border-top: 1px solid var(--rule);
	margin: 3rem 0 2rem;
	padding-top: 1rem;
	font-size: 0.85rem;
	color: var(--faint);
}
.colophon p { margin: 0; }

/* Only add, never subtract. */
@media (min-width: 40rem) {
	html { font-size: 1.05rem; }
	h1 { font-size: 1.8rem; }
	.masthead {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
	}
	.brand { margin: 0; }
	.menu { padding-bottom: 0; }
}

@media (min-width: 56rem) {
	body { max-width: 52rem; }
	.cards {
		grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
		gap: 1.75rem;
	}
}

/* Print: the menu and the navigation chrome are for browsing, not for paper. */
@media print {
	.masthead,
	.pager,
	.colophon { display: none; }
	body { max-width: none; }
	a { color: inherit; }
	.cards { grid-template-columns: 1fr; }
}

/* Anything that moves must be stoppable. */
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
