/* Dark is the default. Soft yellow needs a dark ground to stay readable, so
   the light theme drops to a deep amber instead of carrying the same hue. */
:root {
	color-scheme: dark;
	--bg: #16161a;
	--fg: #f0dfa6;
	--muted: #bfae7d;
	--accent: #ffd76b;
	--rule: #2c2c33;
	--code-bg: #1f1f25;
	--measure: 34rem;
}

:root[data-theme="light"] {
	color-scheme: light;
	--bg: #fdfdfc;
	--fg: #4a3a00;
	--muted: #6b5300;
	--accent: #8a5c00;
	--rule: #e6e2d5;
	--code-bg: #f2f2ee;
}

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

body {
	margin: 0 auto;
	padding: 2rem 1.25rem 4rem;
	max-width: var(--measure);
	background: var(--bg);
	color: var(--fg);
	font: 16px/1.65 ui-serif, Georgia, "Times New Roman", serif;
	-webkit-text-size-adjust: 100%;
}

a {
	color: var(--accent);
	text-underline-offset: 2px;
}

a:hover {
	text-decoration-thickness: 2px;
}

/* Header */

.site-header {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	align-items: baseline;
	justify-content: space-between;
	padding-bottom: 1.25rem;
	margin-bottom: 2.5rem;
	border-bottom: 1px solid var(--rule);
}

.site-title {
	font-weight: 700;
	font-size: 1.05rem;
	color: var(--fg);
	text-decoration: none;
	letter-spacing: -0.01em;
}

.site-header nav {
	display: flex;
	gap: 1rem;
	font-family: ui-sans-serif, system-ui, sans-serif;
	font-size: 0.875rem;
}

.site-header nav a[aria-current="page"] {
	color: var(--fg);
	text-decoration: none;
	font-weight: 600;
}

/* Theme toggle */

#theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0;
	margin-left: -0.25rem;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--accent);
	cursor: pointer;
}

#theme-toggle:hover {
	color: var(--fg);
}

#theme-toggle svg {
	width: 1rem;
	height: 1rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
}

.icon-moon {
	fill: currentColor;
	stroke: none;
}

/* Show the icon for the theme you'd switch *to*. */
:root[data-theme="light"] #theme-toggle .icon-sun,
#theme-toggle .icon-moon {
	display: none;
}

:root[data-theme="light"] #theme-toggle .icon-moon {
	display: block;
}

/* Typography */

h1,
h2,
h3 {
	line-height: 1.25;
	letter-spacing: -0.015em;
	margin: 2.25rem 0 0.75rem;
}

h1 {
	font-size: 1.85rem;
	margin-top: 0;
}

h2 {
	font-size: 1.3rem;
}

h3 {
	font-size: 1.1rem;
}

p,
ul,
ol {
	margin: 0 0 1.1rem;
}

time {
	color: var(--muted);
	font-family: ui-sans-serif, system-ui, sans-serif;
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
}

.intro p {
	color: var(--muted);
	font-size: 1.05rem;
}

/* Post list */

.post-list {
	list-style: none;
	padding: 0;
}

.post-list li {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	align-items: baseline;
	justify-content: space-between;
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--rule);
}

.post .back {
	margin-top: 3rem;
	font-family: ui-sans-serif, system-ui, sans-serif;
	font-size: 0.875rem;
}

/* Gallery */

body.wide {
	max-width: 52rem;
}

.gallery {
	list-style: none;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem 1.25rem;
}

/* Three across is too tight to read on a phone. */
@media (max-width: 34rem) {
	.gallery {
		grid-template-columns: repeat(2, 1fr);
	}
}

.gallery li {
	margin: 0;
}

.gallery img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
	background: var(--code-bg);
}

/* CV */

h3 + p strong {
	font-variant-numeric: tabular-nums;
}

/* Pagination */

.pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	justify-content: space-between;
	margin-top: 2.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--rule);
	font-family: ui-sans-serif, system-ui, sans-serif;
	font-size: 0.875rem;
}

.pagination > span[aria-hidden] {
	color: var(--rule);
}

.pagination ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pagination ol a,
.pagination ol span {
	display: block;
	min-width: 1.75rem;
	padding: 0.15rem 0.3rem;
	border-radius: 3px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.pagination ol [aria-current="page"] {
	background: var(--code-bg);
	color: var(--fg);
	font-weight: 600;
}

/* Social links */

.social {
	display: flex;
	gap: 0.75rem;
	margin: 3rem 0 0;
	padding: 0;
	list-style: none;
}

.social li {
	margin: 0;
}

.social a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 1px solid var(--rule);
	border-radius: 50%;
	color: var(--muted);
	transition:
		color 0.15s ease,
		border-color 0.15s ease;
}

.social a:hover {
	color: var(--accent);
	border-color: var(--accent);
}

.social svg {
	width: 1.125rem;
	height: 1.125rem;
	fill: currentColor;
}

/* Code */

code {
	background: var(--code-bg);
	padding: 0.1em 0.35em;
	border-radius: 3px;
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	font-size: 0.85em;
}

pre {
	background: var(--code-bg);
	padding: 0.9rem 1rem;
	border-radius: 6px;
	overflow-x: auto;
}

pre code {
	background: none;
	padding: 0;
	font-size: 0.8125rem;
	line-height: 1.5;
}

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

img {
	max-width: 100%;
	height: auto;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

th,
td {
	text-align: left;
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid var(--rule);
}

/* Footer */

.site-footer {
	margin-top: 4rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-family: ui-sans-serif, system-ui, sans-serif;
	font-size: 0.8125rem;
}
