:root {
  --bg: #0a0a0b;
  --surface: #141415;
  --surface-raised: #1a1a1c;
  --surface-hover: #1f1f22;
  --border: #232326;
  --border-subtle: #1c1c1f;
  --text: #eeeeef;
  --text-secondary: #a0a0a6;
  --text-tertiary: #6b6b70;
  --accent: #c9a0ff;
  --accent-secondary: #8b7aff;
  --accent-dim: #c9a0ff12;
  --accent-border: #c9a0ff25;
  --accent-glow: #c9a0ff15;
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --font-serif: 'Libre Baskerville', 'Georgia', serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --max-width: 720px;
}

[data-theme="light"] {
  --bg: #f8f8fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #f3f3f5;
  --border: #e4e4e7;
  --border-subtle: #ececef;
  --text: #18181b;
  --text-secondary: #6b6b70;
  --text-tertiary: #a0a0a6;
  --accent: #7c3aed;
  --accent-secondary: #6d28d9;
  --accent-dim: #7c3aed10;
  --accent-border: #7c3aed20;
  --accent-glow: #7c3aed08;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ── */
header {
  padding: 28px 0 20px;
  margin-bottom: 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

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

header .subtitle {
  color: var(--text-tertiary);
  margin-top: 2px;
  font-size: 0.8rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-nav a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color var(--transition);
}

.header-nav a:hover { color: var(--text); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: all var(--transition);
  color: var(--text-tertiary);
}

.theme-toggle:hover {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ── Hero ── */
.hero {
  padding: 32px 0;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color var(--transition);
}

.hero-card:hover {
  border-color: var(--accent-border);
}

.hero .post-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--mono);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 12px;
}

.hero h2 a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}

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

.hero .post-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.hero .read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  transition: gap var(--transition);
}

.hero .read-more:hover { gap: 8px; }

/* ── Tag bar ── */
.tag-bar {
  padding: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-bar .label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-family: var(--mono);
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-family: var(--mono);
  background: var(--surface);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}

.tag-pill:hover, .tag-pill.active {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Post list ── */
.post-list {
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Post card ── */
article.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all var(--transition);
  opacity: 0;
  transform: translateY(8px);
  animation: fadeInUp 0.35s ease forwards;
}

article.post:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
}

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

article.post:nth-child(1) { animation-delay: 0.03s; }
article.post:nth-child(2) { animation-delay: 0.06s; }
article.post:nth-child(3) { animation-delay: 0.09s; }
article.post:nth-child(4) { animation-delay: 0.12s; }
article.post:nth-child(5) { animation-delay: 0.15s; }

.post-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--mono);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.reading-time { color: var(--text-tertiary); }
.reading-time::before { content: '·'; margin-right: 10px; }

.post h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.4;
}

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

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

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.tags span, .tags a {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--mono);
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--accent-border);
  transition: all var(--transition);
}

.tags a:hover {
  background: var(--accent-glow);
}

/* ── Single post ── */
.single-post {
  padding: 32px 0 80px;
}

.single-post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}

.single-post .post-meta {
  margin-bottom: 16px;
}

.single-post h1 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 8px;
}

/* ── Poetry / Verse ── */
.poetry-post .post-content .stanza {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.75;
  margin-bottom: 20px;
  padding: 16px 24px;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-border);
}

.poetry-post .post-content .stanza:hover {
  border-left-color: var(--accent);
}

.poetry-post .post-content .stanza:last-of-type {
  margin-bottom: 0;
}

.poetry-post .post-content em {
  color: var(--accent);
  font-style: italic;
}

.poetry-post .post-content .stanza p {
  margin-bottom: 0;
}

/* Prose drop cap */
.prose-post .post-content > p:first-of-type::first-letter {
  float: left;
  font-size: 3.2em;
  line-height: 0.8;
  padding-right: 10px;
  padding-top: 6px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-serif);
}

/* Post content */
.post-content {
  font-size: 0.95rem;
  line-height: 1.7;
}

.post-content h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 32px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.post-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--accent);
}

.post-content p { margin-bottom: 16px; }
.post-content ul, .post-content ol { margin: 0 0 16px 20px; }
.post-content li { margin-bottom: 4px; }

.post-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-raised);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.post-content pre {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 16px;
  font-size: 0.85em;
  line-height: 1.6;
}

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

.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 16px;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  font-style: italic;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}

.post-content a:hover { opacity: 0.8; }

/* ── Ornament ── */
.ornament {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin: 24px 0;
  opacity: 0.4;
  letter-spacing: 0.3em;
}

/* ── Credits ── */
.post-credits {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ── TOC ── */
.toc-wrapper {
  position: fixed;
  top: 100px;
  left: calc(50% + var(--max-width) / 2 + 32px);
  width: 200px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  font-size: 0.72rem;
  line-height: 1.5;
  display: none;
}

@media (min-width: 1200px) {
  .toc-wrapper { display: block; }
}

.toc-wrapper .toc-title {
  font-family: var(--mono);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  margin-bottom: 10px;
}

.toc-wrapper ul { list-style: none; padding: 0; }
.toc-wrapper li { margin-bottom: 6px; }

.toc-wrapper a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition);
  display: block;
  padding-left: 10px;
  border-left: 1px solid transparent;
}

.toc-wrapper a:hover,
.toc-wrapper a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ── Footer ── */
footer {
  padding: 24px 0 32px;
  margin-top: 32px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links { display: flex; gap: 16px; }

.footer-links a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--text); }

.rss-link {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color var(--transition);
}

.rss-link:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .hero-card { padding: 24px; }
  .single-post-card { padding: 24px; }
  .hero h2 { font-size: 1.3rem; }
  .single-post h1 { font-size: 1.4rem; }
  header h1 { font-size: 0.95rem; }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .poetry-post .post-content .stanza {
    padding: 12px 16px;
    font-size: 0.92rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
