@font-face {
	font-family: "JetBrains Mono";
	src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "JetBrains Mono";
	src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

:root {
	--text: #2b1e14;
	--bg: #f2e8d9;
	--accent: #6b1e23;
	--accent-green: #9c7a2e;
	--gray: #7a6a55;
	--border: #ddd0b8;
}

@media (prefers-color-scheme: dark) {
	:root {
		--text: #e6d9c3;
		--bg: #17130f;
		--accent: #d3776c;
		--accent-green: #d4af37;
		--gray: #a89880;
		--border: #3a2f22;
	}
}

* {
	box-sizing: border-box;
}

html {
	overflow-x: hidden;
}

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

pre {
	overflow-x: auto;
	max-width: 100%;
}

table {
	display: block;
	overflow-x: auto;
	max-width: 100%;
}

p,
li {
	overflow-wrap: break-word;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

body {
	overflow-x: hidden;
	margin: 0 auto;
	max-width: 78ch;
	padding: 2em 1em;
	font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 16px;
	line-height: 1.65;
	color: var(--text);
	background: var(--bg);
}

@media (min-width: 768px) {
	body {
		font-size: 18px;
	}
}

pre,
code {
	font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

header nav {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5em 1em;
	margin-bottom: 2em;
}

header .links a {
	margin-left: 1em;
}

.lang-switch select {
	font-family: inherit;
	font-size: 0.85em;
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.25em 0.4em;
	cursor: pointer;
}

.menu-toggle {
	display: none;
	font-family: inherit;
	font-size: 1.2em;
	line-height: 1;
	background: none;
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.25em 0.6em;
	cursor: pointer;
	color: var(--text);
}

@media (max-width: 1099px) {
	.menu-toggle {
		display: inline-block;
	}
}

.menu-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	z-index: 40;
}

.menu-backdrop.open {
	display: block;
}

a {
	color: var(--accent);
}

.social-buttons {
	display: flex;
	gap: 0.75em;
	flex-wrap: wrap;
	margin-top: 1.5em;
}

.social-buttons .button {
	display: inline-block;
	font-family: inherit;
	font-size: 0.95em;
	color: var(--text);
	background: none;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0.5em 1.1em;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease;
}

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

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

.post-list li {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	padding: 0.4em 0;
	border-bottom: 1px solid var(--border);
}

.post-list li:hover {
	border-bottom-color: var(--accent-green);
}

.date {
	color: var(--gray);
	font-size: 0.9em;
}

footer {
	margin-top: 3em;
	color: var(--gray);
	font-size: 0.9em;
}

.site-sidebar {
	position: fixed;
	background: var(--bg);
	z-index: 50;
}

.site-sidebar h2 {
	font-size: 0.8em;
	margin: 0 0 1em;
	color: var(--gray);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.site-sidebar ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 1em;
}

.site-sidebar li a {
	display: block;
	font-size: 0.9em;
}

.site-sidebar .date {
	display: block;
	font-size: 0.85em;
}

.sidebar-close {
	display: none;
}

@media (max-width: 1099px) {
	.site-sidebar {
		top: 0;
		left: 0;
		bottom: 0;
		width: 260px;
		max-width: 80vw;
		padding: 3.5em 1.5em 2em;
		border-right: 1px solid var(--border);
		transform: translateX(-100%);
		transition: transform 0.2s ease;
		overflow-y: auto;
	}

	.site-sidebar.open {
		transform: translateX(0);
	}

	.sidebar-close {
		display: block;
		position: absolute;
		top: 1em;
		right: 1em;
		font-family: inherit;
		font-size: 1.3em;
		line-height: 1;
		background: none;
		border: none;
		cursor: pointer;
		color: var(--text);
	}
}

@media (min-width: 1100px) {
	.site-sidebar {
		top: 4em;
		right: 2em;
		width: 200px;
		max-height: calc(100vh - 8em);
		overflow-y: auto;
	}
}

#comments {
	margin-top: 3em;
	padding-top: 1.5em;
	border-top: 1px solid var(--border);
}

#comments h2 {
	font-size: 1.1em;
}

#like-btn {
	font-family: inherit;
	font-size: 1em;
	background: none;
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 0.3em 0.9em;
	cursor: pointer;
	color: var(--text);
	margin-bottom: 1.5em;
}

#like-btn:disabled {
	cursor: default;
}

#comment-form {
	display: flex;
	flex-direction: column;
	gap: 0.6em;
	margin-bottom: 1.5em;
}

#comment-form input[type="text"],
#comment-form textarea {
	font-family: inherit;
	font-size: 1em;
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.5em;
	resize: vertical;
}

#comment-form button[type="submit"] {
	font-family: inherit;
	font-size: 1em;
	align-self: flex-start;
	background: var(--accent);
	color: var(--bg);
	border: none;
	border-radius: 4px;
	padding: 0.5em 1.2em;
	cursor: pointer;
}

#comment-status {
	margin: 0;
	color: var(--gray);
	font-size: 0.9em;
	min-height: 1.2em;
}

#comment-website {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

#comment-list {
	list-style: none;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1em;
}

#comment-list li {
	border-bottom: 1px solid var(--border);
	padding-bottom: 1em;
}

#comment-list li.empty {
	color: var(--gray);
	border-bottom: none;
}

#comment-list .comment-meta {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	margin-bottom: 0.3em;
}

#comment-list p {
	margin: 0;
	white-space: pre-wrap;
}
