:root {
	--teal: #76c7c0;
	--teal-bright: #a6f0e6;
	--teal-dim: rgba(118, 199, 192, 0.35);
	--text: #e0e0e0;
	--muted: #9aa8a6;
	--mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

/* Base */
html,
body {
	margin: 0;
	padding: 0;
	min-height: 100%;
	overflow-x: hidden;
}

body {
	font-family: var(--mono);
	font-size: 15px;
	line-height: 1.7;
	background-color: #000;
	color: var(--text);
}

canvas#game-of-life,
canvas#hex-glow {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	z-index: -1;
}

canvas#game-of-life {
	opacity: 0.55;
}

/* Links */
a {
	color: var(--teal);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--teal-bright);
}

.right-section a {
	text-decoration: underline;
	text-decoration-color: var(--teal-dim);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.right-section a:hover {
	text-decoration-color: currentColor;
}

/* Headings */
h1,
h2,
h3 {
	font-family: var(--mono);
	color: #fff;
	letter-spacing: 0.5px;
	margin: 0 0 0.5rem;
}

h1 {
	font-size: 2.1rem;
	font-weight: 700;
	margin: 1rem 0 1.25rem;
}

h2 {
	font-size: 1.35rem;
	font-weight: 700;
	margin-top: 2.5rem;
	padding-bottom: 0.4rem;
	border-bottom: 1px solid var(--teal-dim);
}

h2::before {
	content: '# ';
	color: var(--teal);
}

section:first-child > h2 {
	margin-top: 0;
}

h3 {
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--teal);
}

p {
	margin: 0.5rem 0;
}

/* Layout */
.container {
	display: flex;
	width: 100%;
	max-width: 70rem;
	margin: 0 auto;
	padding-top: 2.5rem;
	min-height: 100vh;
	box-sizing: border-box;
}

.left-section {
	width: clamp(16rem, 25vw, 22rem);
	padding: 1.75rem 1.25rem;
	box-sizing: border-box;
	text-align: center;
	position: fixed;
	top: 2.5rem;
	left: max(0rem, calc(50vw - 35rem));
	max-height: calc(100vh - 3.5rem);
	overflow-y: auto;
	z-index: 2;
}

.right-section {
	flex: 1 1 0;
	min-width: 0;
	margin-left: calc(clamp(16rem, 25vw, 22rem) + 1rem);
	margin-bottom: 2.5rem;
	padding: 1.75rem 2rem;
	box-sizing: border-box;
}

/* Tint and blur the Game of Life behind content */
.left-section,
.right-section {
	background: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(4px) brightness(0.5);
	-webkit-backdrop-filter: blur(4px) brightness(0.5);
	border: 1px solid rgba(118, 199, 192, 0.15);
	border-radius: 12px;
}

/* Sidebar */
.headshot {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--teal);
	box-shadow: 0 0 18px rgba(118, 199, 192, 0.35);
}

.pill-button {
	display: inline-block;
	position: relative;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text);
	background: #000;
	border: 2px solid var(--teal);
	border-radius: 6px;
	padding: 0.35rem 0.8rem;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.pill-button:hover,
.pill-button:focus-visible {
	background: var(--teal);
	color: #000;
}

.copied-popup {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--teal);
	color: #000;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.75rem;
	white-space: nowrap;
	z-index: 10;
}

.logos {
	display: flex;
	justify-content: center;
	gap: 1.1rem;
	margin: 1.5rem 0;
}

.logos a {
	color: var(--teal);
	display: inline-flex;
}

.logo {
	width: 30px;
	height: 30px;
	fill: currentColor;
	transition: transform 0.2s ease, filter 0.2s ease;
}

.logos a:hover {
	color: var(--teal-bright);
}

.logos a:hover .logo {
	transform: translateY(-2px);
	filter: drop-shadow(0 0 6px rgba(118, 199, 192, 0.6));
}

/* Entries with dates */
.entry {
	margin-top: 1.25rem;
}

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

.entry-head h3 {
	margin: 0;
}

.date {
	color: var(--muted);
	font-size: 0.8rem;
	white-space: nowrap;
}

/* Lists */
.right-section ul {
	padding-left: 1.25rem;
	margin: 0.75rem 0;
}

.right-section li {
	margin-bottom: 0.75rem;
}

.right-section li::marker {
	color: var(--teal);
}

.pubs .authors,
.pubs .venue {
	display: block;
	font-size: 0.85rem;
	color: var(--muted);
}

.pubs .authors strong {
	color: var(--text);
}

.awards li > span:first-child {
	margin-right: 0.75rem;
}

/* Mobile */
@media (max-width: 37.5em) {
	.container {
		flex-direction: column;
		padding: 0.75rem;
	}

	.left-section {
		position: static;
		width: 100%;
		max-height: none;
		margin-bottom: 0.75rem;
	}

	.right-section {
		margin-left: 0;
		padding: 1.25rem;
	}

	.headshot {
		width: 6.25rem;
		height: 6.25rem;
	}

	h1 {
		font-size: 1.7rem;
	}

	body {
		font-size: 14px;
	}

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

/* Sidebar buttons */
.sidebar-buttons {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.blog-button {
	background: var(--teal);
	color: #000;
}

.blog-button:hover,
.blog-button:focus-visible {
	background: var(--teal-bright);
	border-color: var(--teal-bright);
	color: #000;
}

/* Post cards (home page and blog index) */
.right-section a.post-card,
a.post-card {
	display: block;
	margin-top: 1rem;
	padding: 1rem 1.25rem;
	border: 1px solid var(--teal-dim);
	border-left: 3px solid var(--teal);
	border-radius: 8px;
	background: rgba(118, 199, 192, 0.06);
	color: var(--text);
	text-decoration: none;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

a.post-card:hover {
	background: rgba(118, 199, 192, 0.12);
	border-color: var(--teal);
	color: var(--text);
}

.post-card-title {
	display: block;
	font-weight: 700;
	font-size: 1.05rem;
	color: #fff;
}

.post-card-meta {
	display: block;
	font-size: 0.8rem;
	color: var(--muted);
	margin: 0.15rem 0 0.4rem;
}

.post-card-summary {
	display: block;
	font-size: 0.9rem;
}

.more-posts {
	font-size: 0.85rem;
	margin-top: 0.75rem;
}

/* Blog pages: one centered column */
.page {
	max-width: 56rem;
	margin: 0 auto;
	padding: 2.5rem 1rem 3rem;
	box-sizing: border-box;
}

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.topbar a {
	font-weight: 600;
}

.page-body {
	padding: 1.75rem 2rem;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(3px) brightness(0.7);
	-webkit-backdrop-filter: blur(3px) brightness(0.7);
	border: 1px solid rgba(118, 199, 192, 0.15);
	border-radius: 12px;
}

.page-body a {
	text-decoration: underline;
	text-decoration-color: var(--teal-dim);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.page-body a:hover {
	text-decoration-color: currentColor;
}

.page-body a.post-card {
	text-decoration: none;
}

.page-body h1 {
	margin-top: 0;
	line-height: 1.25;
}

.post-meta {
	color: var(--muted);
	font-size: 0.85rem;
	margin-bottom: 1.5rem;
}

.post p,
.post li {
	line-height: 1.8;
}

.post h2:first-of-type {
	margin-top: 2rem;
}

.post blockquote {
	margin: 1rem 0;
	padding: 0.5rem 1rem;
	border-left: 3px solid var(--teal);
	background: rgba(118, 199, 192, 0.06);
	color: #fff;
}

.post ul {
	padding-left: 1.25rem;
}

.post li::marker {
	color: var(--teal);
}

.post .lede {
	font-size: 1.05rem;
	color: #fff;
}

.post sup a {
	text-decoration: none;
	padding: 0 0.1em;
}

.footnotes {
	margin-top: 2.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--teal-dim);
	font-size: 0.85rem;
	color: var(--muted);
}

/* Figures: chess boards and charts */
.figure {
	margin: 1.75rem 0;
	padding: 1rem;
	border: 1px solid rgba(118, 199, 192, 0.2);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.02);
}

.figure-title {
	font-weight: 700;
	color: #fff;
	margin: 0;
}

.figure-sub,
.figure-caption {
	font-size: 0.8rem;
	color: var(--muted);
	margin: 0.15rem 0 0;
}

.figure-caption {
	margin-top: 0.75rem;
}

.chess {
	display: flex;
	gap: 1.25rem;
	margin-top: 0.9rem;
	align-items: flex-start;
}

.chess-board {
	flex: 0 0 auto;
	width: min(100%, 21rem);
}

.chess-board svg {
	display: block;
	width: 100%;
	height: auto;
}

.chess-panel {
	flex: 1 1 12rem;
	min-width: 0;
	display: flex;
	flex-direction: column;
	min-height: 100%;
}

.chess-move {
	font-size: 1.5rem;
	font-weight: 700;
	color: #fff;
}

.chess-move.illegal {
	color: #ff6b6b;
}

.chess-pos {
	font-size: 0.8rem;
	color: var(--muted);
}

.chess-note {
	margin-top: 0.6rem;
	font-size: 0.9rem;
	min-height: 6em;
}

.chess-controls {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.4rem;
	margin-top: 0.75rem;
}

.chess-controls .pill-button {
	font-size: 0.8rem;
	padding: 0.25rem 0.6rem;
}

.chess-controls .pill-button:disabled {
	opacity: 0.35;
	cursor: default;
	background: #000;
	color: var(--text);
}

.chess-legend {
	display: flex;
	gap: 1rem;
	margin-top: 0.75rem;
	font-size: 0.75rem;
	color: var(--muted);
}

.chess-legend span::before {
	content: '';
	display: inline-block;
	width: 0.75rem;
	height: 0.75rem;
	margin-right: 0.35rem;
	vertical-align: -0.1rem;
	border-radius: 2px;
}

.chess-legend .legend-last::before {
	background: rgba(118, 199, 192, 0.7);
}

.chess-legend .legend-illegal::before {
	background: rgba(255, 107, 107, 0.35);
	border: 2px solid #ff6b6b;
	box-sizing: border-box;
}

.chart svg {
	display: block;
	width: 100%;
	height: auto;
	margin-top: 0.75rem;
	font-family: var(--mono);
}

@media (max-width: 37.5em) {
	.page {
		padding: 0.75rem;
	}

	.page-body {
		padding: 1.25rem;
	}

	.chess {
		flex-direction: column;
	}

	.chess-board {
		width: 100%;
	}

	.chess-note {
		min-height: 0;
	}
}

/* Stack board and panel when there's no room for them side by side */
@media (max-width: 48em) {
	.chess {
		flex-direction: column;
	}

	.chess-board {
		width: min(100%, 24rem);
	}

	.chess-panel {
		flex: none;
		width: 100%;
	}

	.chess-note {
		min-height: 0;
	}
}
