:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #475569;
  --code-bg: #f3f4f6;
}

:root[data-theme="dark"] {
  --bg: #1f2937;
  --fg: #f9fafb;
  --muted: #9ca3af;
  --border: #374151;
  --accent: #94a3b8;
  --code-bg: #111827;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

article a, .home-intro a, .post-summary a {
  text-decoration: underline;
}

article a:hover, .home-intro a:hover, .post-summary a:hover {
  color: var(--bg);
  background: var(--accent);
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-title { font-weight: 700; font-size: 1.1rem; color: var(--fg); }
.site-header nav { display: flex; gap: 1rem; flex: 1; }

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.layout {
  display: flex;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  align-items: flex-start;
}

main { flex: 1; min-width: 0; }

.sidebar-tags {
  width: 140px;
  flex-shrink: 0;
}

.sidebar-tags h2 { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }

.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag-list li { display: inline-flex; align-items: baseline; gap: 0.2rem; }
.tag-count { font-size: 0.7em; color: var(--muted); }

.post-list { list-style: none; padding: 0; }
.post-item { padding: 1.2rem 0; border-bottom: 1px solid var(--border); }
.post-item h2 { margin: 0 0 0.3rem; font-size: 1.3rem; }
.post-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.5rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.tag, .tag-list a { text-transform: lowercase; }
.post-meta .tag { color: var(--accent); }
.read-more { font-size: 0.9rem; }

pre { background: var(--code-bg); padding: 1rem; overflow-x: auto; border-radius: 6px; }
code { background: var(--code-bg); padding: 0.1rem 0.3rem; border-radius: 4px; }
pre code { background: none; padding: 0; }

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.not-found { max-width: 900px; margin: 3rem auto; padding: 0 1rem; }

article img {
  max-width: 160px;
  border-radius: 50%;
  display: block;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar-tags { width: auto; }
}
