:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --text: #1f2328;
  --text-soft: #656d76;
  --border: #d0d7de;
  --accent: #0969da;
  --card-shadow: 0 1px 3px rgba(27, 31, 36, 0.08);
  --max-width: 760px;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --text: #e6edf3;
  --text-soft: #8b949e;
  --border: #30363d;
  --accent: #58a6ff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s ease, color 0.2s ease;
}

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover { color: var(--accent); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.theme-toggle:hover { background: var(--bg-soft); }

/* Main */
main { padding: 48px 0 64px; min-height: 60vh; }

.page-title {
  font-size: 2rem;
  margin: 0 0 8px;
}

.page-subtitle {
  color: var(--text-soft);
  margin: 0 0 32px;
}

/* Tag filter */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.tag-filter button {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}

.tag-filter button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Post list */
.post-list { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--card-shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.post-card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: var(--text);
}

.post-card .post-meta { color: var(--text-soft); font-size: 0.85rem; margin-bottom: 10px; }

.post-card p { margin: 0; color: var(--text-soft); }

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.post-tags span {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.empty { color: var(--text-soft); text-align: center; padding: 40px 0; }

/* Article */
.article-header { margin-bottom: 32px; }
.article-header h1 { font-size: 2.1rem; margin: 0 0 10px; }
.article-meta { color: var(--text-soft); font-size: 0.9rem; }

.article-body { font-size: 1.05rem; }
.article-body h2 { margin-top: 40px; font-size: 1.5rem; }
.article-body h3 { margin-top: 28px; font-size: 1.2rem; }
.article-body p { margin: 18px 0; }
.article-body a { color: var(--accent); }
.article-body ul, .article-body ol { padding-left: 24px; }
.article-body li { margin: 6px 0; }

.article-body img { max-width: 100%; border-radius: 8px; }

.article-body blockquote {
  margin: 20px 0;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
}

.article-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.article-body code {
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.article-body pre code { background: none; padding: 0; }

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

.back-link:hover { text-decoration: underline; }

/* About */
.about-body { font-size: 1.05rem; }
.about-body p { margin: 18px 0; }
.about-body a { color: var(--accent); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-soft);
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 600px) {
  .page-title { font-size: 1.6rem; }
  .article-header h1 { font-size: 1.7rem; }
  main { padding: 32px 0 48px; }
}
