:root {
	color-scheme: light dark;
	--bg: #ffffff;
	--fg: #111111;
	--fg-muted: #6b6b6b;
	--border: #ececec;
	--accent: #111111;
	--container: 44rem;
	--container-wide: 64rem;
	--radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0a0a0a;
		--fg: #f5f5f5;
		--fg-muted: #9a9a9a;
		--border: #1f1f1f;
		--accent: #f5f5f5;
	}
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
	background: var(--bg);
	color: var(--fg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; }

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

h1, h2, h3, h4 {
	font-weight: 700;
	letter-spacing: -0.015em;
	line-height: 1.25;
	margin: 0 0 0.75rem;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }

hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }

.container {
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 1.25rem;
}
.container-wide {
	max-width: var(--container-wide);
	margin: 0 auto;
	padding: 0 1.25rem;
}

.site-header {
	border-bottom: 1px solid var(--border);
	padding: 1.5rem 0;
	margin-bottom: 3rem;
}
.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
}
.site-header__brand {
	font-weight: 700;
	text-decoration: none;
	font-size: 1.05rem;
}
.site-header__nav { display: flex; gap: 1.5rem; }
.site-header__nav a {
	text-decoration: none;
	color: var(--fg-muted);
	font-size: 0.95rem;
}
.site-header__nav a:hover { color: var(--fg); }

.site-footer {
	border-top: 1px solid var(--border);
	margin-top: 5rem;
	padding: 2rem 0;
	color: var(--fg-muted);
	font-size: 0.9rem;
}

.page-title { margin-bottom: 0.5rem; }
.page-subtitle { color: var(--fg-muted); margin-bottom: 2.5rem; }

.post-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

.post-card {
	display: flex;
	align-items: flex-start;
	gap: 1.5rem;
	text-decoration: none;
	color: inherit;
	padding-bottom: 2rem;
	border-bottom: 1px solid var(--border);
}
.post-list > li:last-child .post-card { border-bottom: 0; }
.post-card:hover .post-card__title { text-decoration: underline; }
.post-card__body { flex: 1; min-width: 0; }
.post-card__media {
	flex: 0 0 clamp(7rem, 28vw, 12rem);
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--border);
}
.post-card__cover {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 200ms ease;
}
.post-card:hover .post-card__cover { transform: scale(1.02); }
.post-card__title { font-size: 1.35rem; margin: 0 0 0.4rem; }
.post-card__subtitle { color: var(--fg-muted); margin: 0 0 0.6rem; }
.post-card__meta { color: var(--fg-muted); font-size: 0.85rem; }

.post-header { margin-bottom: 2.5rem; text-align: center; }
.post-header__meta { color: var(--fg-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.post-header__title { font-size: 2.5rem; margin-bottom: 0.6rem; }
.post-header__subtitle { color: var(--fg-muted); font-size: 1.15rem; margin: 0; }
.post-header__cover { margin: 2rem 0 0; border-radius: var(--radius); overflow: hidden; }

.post-content { font-size: 1.05rem; }
.post-content > * + * { margin-top: 1.1em; }
.post-content h2, .post-content h3 { margin-top: 2.2em; }
.post-content img { margin: 1.5rem 0; border-radius: var(--radius); }
.post-content pre, .post-content code {
	background: var(--border);
	border-radius: 4px;
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	font-size: 0.92em;
}
.post-content code { padding: 0.12em 0.35em; }
.post-content pre { padding: 1rem; overflow-x: auto; }
.post-content pre code { background: transparent; padding: 0; }
.post-content blockquote {
	margin: 1.5rem 0;
	padding-left: 1.25rem;
	border-left: 3px solid var(--border);
	color: var(--fg-muted);
	font-style: italic;
}
.post-content table {
	width: 100%;
	border-collapse: collapse;
	display: block;
	overflow-x: auto;
}
.post-content th, .post-content td {
	border: 1px solid var(--border);
	padding: 0.65rem 0.8rem;
	text-align: left;
}
.post-content th { background: var(--border); }

.category-grid {
	display: grid;
	grid-template-columns: 1fr;
	grid-auto-rows: 1fr;
	gap: 1rem;
	padding: 0;
	margin: 0;
	list-style: none;
}
.category-grid > li { min-width: 0; height: 100%; }
.category-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	text-decoration: none;
	color: inherit;
	background: var(--bg);
	transition: border-color 200ms ease, box-shadow 200ms ease;
}
.category-card:hover {
	border-color: var(--fg-muted);
	box-shadow: 0 0.25rem 1rem color-mix(in srgb, var(--fg) 10%, transparent);
	text-decoration: none;
}
.category-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--border);
}
.category-card__cover {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 200ms ease;
}
.category-card:hover .category-card__cover { transform: scale(1.02); }
.category-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--fg-muted);
}
.category-card__placeholder svg { width: 2rem; height: 2rem; opacity: 0.4; }
.category-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.5rem;
	min-height: 8.25rem;
	padding: 1.25rem;
}
.category-card__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 1rem;
	font-weight: 600;
	margin: 0;
}
.category-card__description {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	color: var(--fg-muted);
	font-size: 0.9rem;
	margin: 0;
}
.categories-page > .page-title { margin-bottom: 1rem; }
.category-header { padding-bottom: 2rem; }
.category-header .page-subtitle { margin-bottom: 0; }

@media (min-width: 36rem) {
	.category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 54rem) {
	.category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 36rem) {
	.site-header__inner { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
	.site-header__nav { flex-wrap: wrap; gap: 0.75rem 1.25rem; }
	.post-card { gap: 1rem; }
	.post-card__title { font-size: 1.1rem; }
	.post-card__subtitle {
		display: -webkit-box;
		overflow: hidden;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		font-size: 0.9rem;
	}
	.post-header__title { font-size: 2rem; }
}

.pagination {
	display: flex;
	justify-content: space-between;
	margin-top: 3rem;
	gap: 1rem;
	font-size: 0.95rem;
}
.pagination a { color: var(--fg-muted); text-decoration: none; }
.pagination a:hover { color: var(--fg); }
.pagination__spacer { flex: 1; }

.empty {
	text-align: center;
	padding: 4rem 0;
	color: var(--fg-muted);
}

.not-found {
	text-align: center;
	padding: 6rem 0;
}
.not-found__code {
	font-size: 4rem;
	font-weight: 700;
	letter-spacing: -0.03em;
	margin: 0 0 0.5rem;
}
.not-found__message {
	color: var(--fg-muted);
	font-size: 1.05rem;
	margin: 0 0 2rem;
}
