/* Site stylesheet: a fixed profile column on the left (name, photo, links)
   and the page content on the right, in the spirit of the GitHub Pages
   "Minimal" theme. */

:root {
	--text: #555555;
	--strong: #222222;
	--heading: #2f2f2f;
	--muted: #8a8a8a;
	--link: #267cb9;
	--link-hover: #165a8c;
	--rule: #e5e5e5;
}

* {
	box-sizing: border-box;
}

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

body {
	margin: 0;
	padding: 56px 40px 40px;
	background: #ffffff;
	color: var(--text);
	font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.6;
}

/* ---------- layout ---------- */

#layout {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 64px;
	max-width: 980px;
	margin: 0 auto;
}

#layout-menu {
	flex: 0 0 240px;
	position: sticky;
	top: 56px;
}

#layout-content {
	flex: 1 1 auto;
	min-width: 0;
	max-width: 640px;
}

body > #layout-content {
	margin: 0 auto;
}

/* ---------- profile column ---------- */

.site-name {
	margin: 0 0 14px;
	color: var(--link);
	font-size: 28px;
	line-height: 1.1;
	font-weight: 700;
}

.portrait {
	display: block;
	width: 160px;
	height: auto;
	margin-bottom: 14px;
}

.contact {
	margin: 0 0 18px;
}

img.email {
	display: block;
	height: 16px;
	width: auto;
	max-width: 100%;
	margin-left: -1px;
}

div.menu-category {
	margin: 16px 0 4px;
	color: var(--muted);
	font-size: 0.8em;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

div.menu-item {
	line-height: 1.85;
}

img.social {
	width: 1.05em;
	height: 1.05em;
	margin-right: 0.45em;
	vertical-align: -0.15em;
}

/* ---------- text ---------- */

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

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

a:focus-visible {
	outline: 2px solid var(--link);
	outline-offset: 2px;
}

h2, h3 {
	color: var(--heading);
	line-height: 1.2;
	font-weight: 700;
	scroll-margin-top: 40px;
}

h2 {
	margin: 1.3em 0 0.7em;
	font-size: 21px;
}

#layout-content > h2:first-child {
	margin-top: 0.25em;
}

h3 {
	margin: 1.6em 0 0.6em;
	font-size: 16px;
}

p {
	margin: 0 0 1.2em;
}

b, strong {
	color: var(--strong);
}

ul, ol {
	margin: 0 0 1.2em;
	padding-left: 1.5em;
}

p + ul, p + ol {
	margin-top: -0.6em;
}

li {
	margin-bottom: 0.35em;
}

li p {
	margin: 0;
}

tt, pre {
	font-family: ui-monospace, Menlo, Monaco, monospace;
	font-size: 0.9em;
}

img {
	border: none;
	max-width: 100%;
}

/* Logos set inline with the text. */
img.icon {
	height: 1.25em;
	width: auto;
	vertical-align: -0.25em;
}

/* Logos that include a wordmark under a taller symbol. */
img.icon-tall {
	height: 1.55em;
	vertical-align: -0.4em;
}

img.icon-small {
	height: 1.1em;
	vertical-align: -0.18em;
}

img.wide {
	display: block;
	height: auto;
	margin-top: 1em;
}

/* ---------- news list (jemdoc ": {date} text" definition list) ---------- */

dl {
	display: grid;
	grid-template-columns: max-content 1fr;
	column-gap: 1.2em;
	row-gap: 0.7em;
	margin: 0 0 1.2em;
}

dt {
	color: var(--muted);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

dd {
	margin: 0;
}

dd p {
	margin: 0;
}

/* The news list scrolls inside a fixed-height box; its bottom edge fades out
   to show there is more below. */
h2#news + dl {
	max-height: 440px;
	overflow-y: auto;
	padding: 2px 14px 36px 0;
	border-top: 1px solid var(--rule);
	border-bottom: 1px solid var(--rule);
	padding-top: 14px;
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
}

/* With js/news-pin.js the box no longer scrolls on its own. The page content
   before the list (.news-head) sticks once the whole box is on screen, and the
   list (.news-track), laid out at full height, passes behind it. Two layers on .news-head
   hide the list outside the box: ::after covers everything below the box,
   ::before fades its bottom edge.
   The sticky offsets follow the dynamic viewport (dvh): on phones the browser
   toolbar hides while scrolling, and a box placed by the small viewport would
   sit too high for the end of the list ever to reach it. */
.news-pin {
	--news-h: 440px;
	--pin-max: 56px;
	--news-hold: 60vh;
	display: flex;
	flex-direction: column;
	overflow: clip;
}

.news-head {
	position: sticky;
	top: min(var(--pin-max), calc(100vh - var(--head-h, 0px) - var(--news-h) - 24px));
	top: min(var(--pin-max), calc(100svh - var(--head-h, 0px) - var(--news-h) - 24px));
	top: min(var(--pin-max), calc(100dvh - var(--head-h, 0px) - var(--news-h) - 24px));
	z-index: 1;
	margin-bottom: var(--news-h);
	border-bottom: 1px solid var(--rule);
	background: #ffffff;
}

.news-head > h2:first-child {
	margin-top: 0.25em;
}

.news-head::before,
.news-head::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
}

.news-head::before {
	top: calc(100% + var(--news-h) - 36px);
	height: 36px;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff);
	pointer-events: none;
}

.news-head::after {
	top: calc(100% + var(--news-h));
	height: 100000px;
	border-top: 1px solid var(--rule);
	background: #ffffff;
}

/* The list also sticks, for the first --news-hold of scrolling after the box
   locks in place, so that arriving at the box does not immediately move its
   first rows out of view. */
.news-track {
	margin-top: calc(-1 * var(--news-h));
}

/* Room for the list to stay stuck in; it has to be content, not padding. */
.news-track::after {
	content: "";
	display: block;
	height: var(--news-hold);
}

.news-track > dl {
	position: sticky;
	top: min(calc(var(--pin-max) + var(--head-h, 0px)), calc(100vh - var(--news-h) - 24px));
	top: min(calc(var(--pin-max) + var(--head-h, 0px)), calc(100svh - var(--news-h) - 24px));
	top: min(calc(var(--pin-max) + var(--head-h, 0px)), calc(100dvh - var(--news-h) - 24px));
	margin: 0;
	padding: 14px 14px 40px 0;
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
	body {
		padding: 28px 20px 28px;
	}

	#layout {
		display: block;
	}

	#layout-menu {
		position: static;
		display: grid;
		grid-template-columns: 96px 1fr;
		column-gap: 16px;
		align-items: center;
		padding-bottom: 18px;
		margin-bottom: 22px;
		border-bottom: 1px solid var(--rule);
	}

	.portrait {
		grid-column: 1;
		grid-row: 1 / span 2;
		width: 96px;
	}

	.site-name,
	.contact {
		grid-column: 2;
		margin-bottom: 4px;
	}

	.site-name {
		font-size: 24px;
	}

	.portrait {
		margin: 0;
		border-radius: 50%;
	}

	#layout-menu nav {
		grid-column: 1 / -1;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 0 16px;
		margin-top: 14px;
	}

	div.menu-category {
		display: none;
	}

	#layout-content {
		max-width: none;
	}

	.news-pin {
		--news-h: min(440px, 55vh);
		--pin-max: 28px;
	}
}

@media (max-width: 420px) {
	dl {
		grid-template-columns: 1fr;
		row-gap: 0;
	}

	dd {
		margin-bottom: 0.8em;
	}
}

@media print {
	#layout-menu nav {
		display: none;
	}

	h2#news + dl {
		max-height: none;
		overflow: visible;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.news-head {
		position: static;
		margin-bottom: 0;
	}

	.news-head::before,
	.news-head::after {
		display: none;
	}

	.news-track {
		margin-top: 0;
	}

	.news-track::after {
		display: none;
	}

	.news-track > dl {
		position: static;
	}
}
