/* Theme variables */
:root {
  --color-bg: #fff;
  --color-text: #222;
  --color-text-muted: #555;
  --color-text-secondary: #666;
  --color-link: #0056b3;
  --color-border: #ddd;
  --color-tag-bg: #f0f0f0;
  --color-tag-bg-hover: #e0e0e0;
  --color-inline-code-bg: #f0f0f0;
  --color-code-bg: #1e1e1e;
  --color-code-text: #d4d4d4;
}

[data-theme="dark"] {
  --color-bg: #1a1a2e;
  --color-text: #e0e0e0;
  --color-text-muted: #aaa;
  --color-text-secondary: #999;
  --color-link: #6db3f2;
  --color-border: #333;
  --color-tag-bg: #2a2a3e;
  --color-tag-bg-hover: #3a3a4e;
  --color-inline-code-bg: #2a2a3e;
  --color-code-bg: #0d0d1a;
  --color-code-text: #d4d4d4;
}

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

/* Body */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  transition: color 0.3s, background 0.3s;
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header / Nav */
header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--color-text);
  transition: border-color 0.3s;
}

.theme-toggle:hover {
  border-color: var(--color-text-secondary);
}

/* Post list */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.post-entry time {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.post-entry h2 {
  margin: 0.2rem 0;
  font-size: 1.25rem;
}

.post-entry h2 a {
  color: var(--color-text);
}

/* Single post */
.single-post h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.single-post > time {
  display: block;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

/* Tag pills */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-text-muted);
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.8rem;
}

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

/* Post content */
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

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

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

.post-content blockquote {
  border-left: 3px solid var(--color-border);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: var(--color-text-muted);
}

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

.post-content code {
  font-size: 0.9em;
}

.post-content :not(pre) > code {
  background: var(--color-inline-code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

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

/* Footer */
footer {
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
  padding-top: 1rem;
}

footer p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  list-style: none;
  padding: 0;
}

.pagination li a,
.pagination li span {
  padding: 0.3rem 0.6rem;
}
