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

:root {
  --fg: #111;
  --fg-muted: #666;
  --fg-faint: #777;
  --bg: #fff;
  --bg-code: #f6f6f6;
  --border: #ddd;
  --border-faint: #e8e8e8;
}

[data-theme="dark"] {
  --fg: #e0e0e0;
  --fg-muted: #aaa;
  --fg-faint: #777;
  --bg: #131313;
  --bg-code: #1c1c1c;
  --border: #333;
  --border-faint: #2a2a2a;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover { opacity: 0.6; }

/* Layout */
.site-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 20px 40px;
}

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 60px;
}

.site-header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-header-title a { text-decoration: none; }

.site-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav {
  list-style: none;
  display: flex;
  gap: 16px;
}

.site-nav a {
  font-size: 13px;
  color: var(--fg-faint);
  text-decoration: none;
}

.site-nav a:hover { color: var(--fg); opacity: 1; }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--fg-faint);
  padding: 2px;
  line-height: 1;
}

.theme-toggle:hover { color: var(--fg); }
[data-theme="dark"] .theme-toggle-icon::after { content: "☀"; }
.theme-toggle-icon::after { content: "●"; }

/* Footer */
.site-footer {
  margin-top: 80px;
  padding-top: 20px;
  border-top: 1px solid var(--border-faint);
  font-size: 12px;
  color: var(--fg-faint);
}

/* Home page */
.home-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.home-subtitle {
  color: var(--fg-muted);
  font-size: 16px;
  margin-bottom: 60px;
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  margin-bottom: 20px;
}

/* Post list items */
.post-item {
  margin-bottom: 32px;
}

.post-item-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-item-title a { text-decoration: none; }

.post-item-date {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--fg-faint);
  margin-top: 4px;
}

/* List page */
.list-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}

.list-description {
  color: var(--fg-muted);
  margin-top: -32px;
  margin-bottom: 40px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  font-size: 13px;
}

.pagination a {
  color: var(--fg-faint);
  text-decoration: none;
}

.pagination a:hover { color: var(--fg); opacity: 1; }
.pagination .disabled { color: var(--border); }

/* Single post */
.post-header { margin-bottom: 40px; }

.post-title {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.post-meta {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--fg-faint);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tags { display: inline-flex; gap: 6px; }

.post-tag {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  color: var(--fg-faint);
  text-decoration: none;
}

.post-tag::before { content: "#"; }
.post-tag:hover { color: var(--fg); opacity: 1; }

.post-divider {
  border: none;
  border-top: 1px solid var(--border-faint);
  margin-bottom: 32px;
}

/* Post content */
.post-content {
  font-size: 16px;
  line-height: 1.75;
}

.post-content h1, .post-content h2, .post-content h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
}
.post-content h1 { font-size: 1.5rem; }
.post-content h2 { font-size: 1.25rem; }
.post-content h3 { font-size: 1.1rem; }
.post-content p { margin-bottom: 16px; }
.post-content ul, .post-content ol { padding-left: 20px; margin-bottom: 16px; }
.post-content li { margin-bottom: 4px; }
.post-content blockquote {
  border-left: 2px solid var(--border);
  padding-left: 20px;
  color: var(--fg-muted);
  margin: 20px 0;
  font-style: italic;
}

.post-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--bg-code);
  padding: 2px 5px;
}

.post-content pre {
  background: var(--bg-code);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
  line-height: 1.5;
  font-size: 14px;
}

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

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

/* Figures */
figure { margin: 28px 0; }
figure img { max-width: 100%; height: auto; display: block; }
figcaption {
  font-size: 13px;
  color: var(--fg-faint);
  font-style: italic;
  margin-top: 8px;
}

/* Hugo highlight */
.highlight { margin: 20px 0; }
.highlight pre { margin: 0; background: var(--bg-code) !important; }
.highlight code { background: none; }

/* Mermaid */
.mermaid { margin: 20px 0; text-align: center; }

/* Mobile */
@media (max-width: 640px) {
  .site-wrapper { padding: 40px 16px 32px; }
  .site-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 40px;
  }
  .home-title { font-size: 26px; }
  .post-title { font-size: 24px; }
  .list-title { font-size: 24px; }
}
