:root {
	--bg: #f5f6f8;
	--text: #1c2027;
	--muted: #646b76;
	--rule: #e1e4e9;
	--link: #1767c2;
	--link-hover: #f09228;
	--thumb-border: #d9dde3;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #121519;
		--text: #e3e6eb;
		--muted: #949ba6;
		--rule: #262a31;
		--link: #6fa8ee;
		--link-hover: #f5b062;
		--thumb-border: #2e333b;
	}
}

:root[data-theme="dark"] {
	--bg: #121519;
	--text: #e3e6eb;
	--muted: #949ba6;
	--rule: #262a31;
	--link: #6fa8ee;
	--link-hover: #f5b062;
	--thumb-border: #2e333b;
}

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Lato", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
	font-size: 16.5px;
	line-height: 1.6;
}

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

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

p {
	margin: 0 0 0.75em;
}

.page {
	max-width: 780px;
	margin: 0 auto;
	padding: 56px 24px 40px;
}

/* Intro */

.intro {
	display: flex;
	flex-direction: row-reverse;
	align-items: stretch;
	gap: 36px;
	margin-bottom: 8px;
}

.intro-text {
	flex: 1;
	min-width: 0;
}

.intro h1 {
	margin: 0 0 12px;
	font-size: 2em;
	font-weight: 400;
	letter-spacing: 0.01em;
}

/* The frame stretches to the height of the bio, so its bottom lines up with the links line. */
.photo {
	position: relative;
	flex: none;
	width: 230px;
	margin: 10px 0 5px;
	overflow: hidden;
	border-radius: 4px;
}

.photo img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 85% 100%;
	transform: scale(1.15);
	transform-origin: 62% 100%;
}

.links {
	margin: 16px 0 0;
}

/* Theme toggle */

.theme-toggle {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--rule);
	border-radius: 8px;
	background: var(--bg);
	color: var(--muted);
	cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
	color: var(--text);
	border-color: var(--muted);
}

.theme-toggle svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.theme-toggle[data-mode="dark"] .icon-moon,
.theme-toggle:not([data-mode="dark"]) .icon-sun {
	display: none;
}

.links .sep {
	color: var(--muted);
	margin: 0 6px;
}

.email {
	white-space: nowrap;
}

/* Sections */

section {
	margin-top: 36px;
	padding-top: 20px;
	border-top: 1px solid var(--rule);
}

section h2 {
	margin: 0 0 16px;
	font-size: 0.85em;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
}

.date {
	color: var(--muted);
	white-space: nowrap;
}

/* News */

.news {
	list-style: none;
	margin: 0;
	padding: 0;
}

.news li {
	display: grid;
	grid-template-columns: 88px 1fr;
	gap: 12px;
	margin-bottom: 6px;
}

/* Education, experience, teaching */

.entry {
	margin-bottom: 16px;
}

.entry:last-child {
	margin-bottom: 0;
}

.entry-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
}

.entry p {
	margin: 2px 0 0;
}

/* Projects */

.project {
	display: grid;
	grid-template-columns: 160px 1fr;
	gap: 24px;
	margin-bottom: 28px;
}

.project:last-child {
	margin-bottom: 0;
}

.thumb {
	display: block;
	width: 160px;
	height: 120px;
	object-fit: cover;
	border: 1px solid var(--thumb-border);
	border-radius: 4px;
	background: #ffffff;
}

.project h3 {
	margin: 0;
	font-size: 1.05em;
	font-weight: 700;
}

.project .tech {
	margin: 0 0 6px;
	color: var(--muted);
	font-size: 0.92em;
}

.project-links {
	margin: 0;
}

/* Footer */

.footer {
	margin-top: 48px;
	padding-top: 16px;
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-size: 0.85em;
}

/* Small screens */

@media (max-width: 640px) {
	.page {
		padding: 32px 16px 32px;
	}

	.intro {
		flex-direction: column;
		align-items: center;
		gap: 20px;
	}

	.intro h1 {
		text-align: center;
	}

	.photo {
		width: 150px;
		height: 200px;
		margin-top: 0;
	}

	.entry-head {
		flex-direction: column;
		gap: 0;
	}

	.news li {
		grid-template-columns: 1fr;
		gap: 0;
		margin-bottom: 10px;
	}

	.project {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.thumb {
		width: 100%;
		height: auto;
		aspect-ratio: 4 / 3;
		max-width: 320px;
	}
}
