:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-secondary: #666;
  --accent: #0066cc;
  --border: #e0e0e0;
  --code-bg: #f4f4f4;
  --max-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --text: #e0e0e0;
    --text-secondary: #999;
    --accent: #4d9fff;
    --border: #333;
    --code-bg: #1a1a1a;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
}

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

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Index page */
.posts h1 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.post-preview {
  margin-bottom: 2.5rem;
}

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

.post-preview h2 {
  font-size: 1.25rem;
  margin: 0.25rem 0 0.5rem;
}

.post-preview h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-preview h2 a:hover {
  color: var(--accent);
}

.post-preview p {
  color: var(--text-secondary);
}

/* Post page */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 1.8rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

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

.post-content h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 1rem;
  padding-top: 0.5rem;
}

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

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

.post-content strong {
  font-weight: 600;
}

.post-content em {
  font-style: italic;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.2rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.2rem 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.post-content code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.post-content p code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.92rem;
}

.post-content th,
.post-content td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
}

.post-content th {
  font-weight: 600;
  background: var(--code-bg);
}

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

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.author-bio {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
}

.author-bio a {
  color: var(--accent);
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: var(--accent);
}

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

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