:root {
	--bg: #fafafa;
	--text: #333;
	--text-light: #666;
	--accent: #9c4dcc;
	--border: #ddd;
	--code-bg: #f5f5f5;
	--tag-bg: #f0f0f0;
	--tag-bg-hover: #e0e0e0;
}

[data-theme="dark"] {
	--bg: #1a1a1a;
	--text: #e0e0e0;
	--text-light: #a0a0a0;
	--accent: #b380ff;
	--border: #333;
	--code-bg: #2a2a2a;
	--tag-bg: #2a2a2a;
	--tag-bg-hover: #333;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #1a1a1a;
		--text: #e0e0e0;
		--text-light: #a0a0a0;
		--accent: #b380ff;
		--border: #333;
		--code-bg: #2a2a2a;
		--tag-bg: #2a2a2a;
		--tag-bg-hover: #333;
	}
}

* {
	box-sizing: border-box;
}

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

a:hover {
	text-decoration: underline;
}

body {
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
		Arial, sans-serif;
	line-height: 1.6;
	color: var(--text);
	background: var(--bg);
	margin: 0;
	padding: 0;
}

header,
main,
footer {
	max-width: 42rem;
	margin: 0 auto;
	padding: 0 1rem;
}

header {
	padding-top: 2rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--border);
	margin-bottom: 2rem;
}

header h1 {
	margin: 0 0 0.5rem 0;
	font-size: 1.5rem;
	font-weight: 600;
}

nav {
	display: flex;
	gap: 1rem;
}

nav a {
	color: var(--text-light);
	text-decoration: none;
	font-size: 0.9rem;
}

nav a:hover {
	color: var(--accent);
	text-decoration: none;
}

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

header h1 a:hover {
	color: var(--accent);
	text-decoration: none;
}

main {
	min-height: calc(100vh - 12rem);
}

.intro {
	margin: 2rem 0;
	font-size: 1.1rem;
	color: var(--text-light);
}

.posts h2 {
	font-size: 1.2rem;
	margin-bottom: 1rem;
}

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

.post-list li {
	margin-bottom: 1.5rem;
}

.post-list a {
	text-decoration: none;
	color: var(--text);
	display: block;
}

.post-list h3 {
	margin: 0 0 0.25rem 0;
	font-size: 1.1rem;
	font-weight: 600;
}

.post-list a:hover {
	text-decoration: none;
}

.post-list a:hover h3 {
	color: var(--accent);
}

.draft-warning {
	background: #fff3cd;
	border: 1px solid #ffc107;
	color: #856404;
	padding: 1rem;
	border-radius: 5px;
	margin-bottom: 2rem;
}

[data-theme="dark"] .draft-warning {
	background: #332b00;
	border-color: #665500;
	color: #ffdb4d;
}

.post-header {
	margin-bottom: 2rem;
}

.post-header h2 {
	margin: 0 0 0.5rem 0;
	font-size: 2rem;
	font-weight: 700;
}

.post-meta {
	color: var(--text-light);
	font-size: 0.9rem;
}

.post-meta time {
	margin-right: 1rem;
}

.post-list .post-meta {
	font-size: 0.85rem;
	color: var(--text-light);
}

.tags {
	display: inline-flex;
	gap: 0.5rem;
}

.tags a,
.tags span {
	background: var(--tag-bg);
	padding: 0.125rem 0.5rem;
	border-radius: 3px;
	font-size: 0.85rem;
	text-decoration: none;
	color: var(--text-light);
}

.tags a:hover {
	background: var(--tag-bg-hover);
	color: var(--text);
	text-decoration: none;
}

.post-content {
	font-size: 1rem;
}

.post-content h1,
.post-content h2,
.post-content h3 {
	margin-top: 2rem;
	margin-bottom: 1rem;
	font-weight: 600;
}

.post-content h1 {
	font-size: 1.8rem;
}

.post-content h2 {
	font-size: 1.5rem;
}

.post-content h3 {
	font-size: 1.2rem;
}

/* Heading anchor links */
.heading-anchor {
	opacity: 0;
	margin-left: 0.25rem;
	text-decoration: none;
	color: var(--text-light);
	font-weight: normal;
}

.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor,
.post-content h5:hover .heading-anchor,
.post-content h6:hover .heading-anchor,
.page-content h3:hover .heading-anchor,
.page-content h4:hover .heading-anchor,
.page-content h5:hover .heading-anchor,
.page-content h6:hover .heading-anchor,
.heading-anchor:focus {
	opacity: 1;
}

.heading-anchor:hover {
	color: var(--accent);
}

footer p {
	margin: 0 0 1rem 0;
}

.post-content p {
	margin: 1rem 0;
}

.post-content code {
	background: var(--code-bg);
	padding: 0.125rem 0.25rem;
	border-radius: 3px;
	font-family: "Consolas", "Monaco", monospace;
	font-size: 0.9em;
}

.post-content pre {
	background: var(--code-bg);
	padding: 1rem;
	border-radius: 5px;
	overflow-x: auto;
}

.post-content pre code {
	background: none;
	padding: 0;
}

.post-content ul,
.post-content ol {
	margin: 1rem 0;
	padding-left: 2rem;
}

.post-content li {
	margin: 0.5rem 0;
}

.post-content blockquote {
	margin: 1.5rem 0;
	padding-left: 1rem;
	border-left: 3px solid var(--border);
	color: var(--text-light);
	font-style: italic;
}

.post-content img {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 1.5rem 0;
}

.post-content a img {
	cursor: pointer;
}

/* Simple page styles */
.page h2 {
	margin: 0 0 2rem 0;
	font-size: 2rem;
	font-weight: 700;
}

.page-content {
	font-size: 1rem;
}

.page-content h2 {
	margin-top: 2rem;
	margin-bottom: 1rem;
	font-size: 1.5rem;
	font-weight: 600;
}

.page-content h3 {
	margin-top: 1.5rem;
	margin-bottom: 0.75rem;
	font-size: 1.2rem;
	font-weight: 600;
}

.page-content p {
	margin: 1rem 0;
}

.page-content ul,
.page-content ol {
	margin: 1rem 0;
	padding-left: 2rem;
}

.page-content li {
	margin: 0.5rem 0;
}

/* Tag and description links */
.tag-description a,
.tags-index p a,
.tag-list a {
	font-weight: 500;
}

/* Archive page compact layout */
.archive-year h2 {
	font-size: 1.5rem;
	margin-top: 2rem;
	margin-bottom: 1rem;
	font-weight: 600;
}

.archive-month h3 {
	font-size: 1.1rem;
	margin: 1.5rem 0 0.5rem 0;
	font-weight: 600;
	color: var(--text-light);
}

.archive .post-list li {
	margin-bottom: 0.5rem;
}

.archive .post-list h4 {
	display: inline;
	font-size: 1rem;
	font-weight: normal;
	margin: 0;
}

.archive .post-list .post-meta {
	display: inline;
	margin-left: 0.5rem;
}

.archive .post-list .post-meta::before {
	content: "— ";
}

.archive .post-list a:hover h4 {
	color: var(--accent);
}

footer {
	margin-top: 4rem;
	padding: 2rem 1rem;
	border-top: 1px solid var(--border);
	text-align: center;
	color: var(--text-light);
	font-size: 0.85rem;
}

.theme-switcher {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	justify-content: center;
}

.theme-switcher button {
	background: var(--tag-bg);
	border: 1px solid var(--border);
	color: var(--text-light);
	padding: 0.25rem 0.5rem;
	border-radius: 3px;
	font-size: 0.85rem;
	cursor: pointer;
	transition: all 0.2s;
}

.theme-switcher button:hover {
	background: var(--tag-bg-hover);
	color: var(--text);
}

.theme-switcher button.active {
	background: var(--accent);
	color: white;
	border-color: var(--accent);
}

/* Footnotes */
.footnotes {
	margin-top: 3rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
	font-size: 0.9rem;
}

.footnotes h2.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.footnotes ol {
	padding-left: 1.5rem;
}

.footnotes li {
	margin: 0.5rem 0;
}

/* Footnote reference (the superscript number) */
[data-footnote-ref] {
	text-decoration: none;
	color: var(--accent);
}

/* Tooltip */
.tooltip {
	position: absolute;
	max-width: 300px;
	padding: 0.5rem 0.75rem;
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 5px;
	font-size: 0.85rem;
	line-height: 1.4;
	z-index: 1000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .tooltip {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

@media (max-width: 600px) {
	header h1 {
		font-size: 1.25rem;
	}

	.post-header h2 {
		font-size: 1.5rem;
	}
}
