:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --bg-card: #11161d;
  --fg: #c9d1d9;
  --fg-dim: #8b949e;
  --accent: #3fb950;
  --accent-2: #58a6ff;
  --border: #30363d;
  --code-bg: #010409;
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 22px 0 20px;
}

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

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  font-family: "Consolas", "Menlo", monospace;
}

.brand-mark { width: 48px; height: 48px; flex-shrink: 0; }

.site-nav a {
  color: var(--fg-dim);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent-2); }

.site-header .tagline {
  margin: 10px 0 0;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

main.wrap { padding: 40px 20px 60px; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}
.post-card:hover { border-color: var(--accent-2); }

.post-card h2 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.35; }
.post-card h2 a { color: var(--fg); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent-2); }

.post-card p { flex-grow: 1; font-size: 0.92rem; }

.post-meta { color: var(--fg-dim); font-size: 0.82rem; margin-bottom: 8px; }

.badges { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 9px;
  border-radius: 12px;
  text-decoration: none;
}
.badge.cat { background: rgba(63,185,80,0.15); color: var(--accent); border: 1px solid rgba(63,185,80,0.4); }
.badge.cat:hover { background: rgba(63,185,80,0.3); }
.badge.tag { background: rgba(88,166,255,0.12); color: var(--accent-2); border: 1px solid rgba(88,166,255,0.35); }
.badge.tag:hover { background: rgba(88,166,255,0.25); }

.read-more { color: var(--accent-2); text-decoration: none; font-size: 0.9rem; }
.read-more:hover { text-decoration: underline; }

article.post h1 { font-size: 2rem; margin: 12px 0 4px; line-height: 1.25; }

.post-content { margin-top: 24px; }
.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1em auto;
}
.post-content a { color: var(--accent-2); }
.post-content p { margin: 1em 0; }
.post-content pre.code-block,
.post-content pre[class*="language-"] {
  background: var(--code-bg) !important;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.85rem;
}
.post-content code { font-family: "Consolas", "Menlo", monospace; }

.comments { margin-top: 50px; border-top: 1px solid var(--border); padding-top: 24px; }
.comments h2 { font-size: 1.2rem; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 12px;
}
.comment-meta { font-size: 0.8rem; color: var(--fg-dim); margin-bottom: 6px; }
.comment-meta strong { color: var(--fg); }

.back-link a { color: var(--accent-2); text-decoration: none; font-size: 0.9rem; }
.back-link.top { margin: 0 0 18px; }

.post-pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.pn-link {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.9rem;
  max-width: 45%;
}
.pn-link:hover { text-decoration: underline; }
.pn-link.next { text-align: right; margin-left: auto; }

.archive-list { list-style: none; padding: 0; }
.archive-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.archive-list a { color: var(--fg); text-decoration: none; font-size: 1.05rem; }
.archive-list a:hover { color: var(--accent-2); }
.archive-list .count { color: var(--fg-dim); font-size: 0.85rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  color: var(--fg-dim);
  font-size: 0.8rem;
}

.not-found { text-align: center; padding: 60px 0; }

@media (max-width: 600px) {
  .post-grid { grid-template-columns: 1fr; }
  article.post h1 { font-size: 1.5rem; }
}
