/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #6b7280;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-border: #e5e7eb;
  --color-tag-bg: #eff6ff;
  --color-tag-text: #2563eb;
  --color-tag-active-bg: #2563eb;
  --color-tag-active-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --max-width: 720px;
  --header-height: 60px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ===== Header ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

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

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text) !important;
  letter-spacing: -0.5px;
}

.site-nav { display: flex; gap: 24px; }

.site-nav a {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a.active { color: var(--color-primary); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 4px 8px;
}

/* ===== Hero ===== */
.hero {
  text-align: left;
  padding: 48px 0 28px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.hero-desc {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  max-width: 560px;
}

/* ===== Tag Filter ===== */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.tag-btn {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.5;
}

.tag-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tag-btn.active {
  background: var(--color-tag-active-bg);
  color: var(--color-tag-active-text);
  border-color: var(--color-tag-active-bg);
}

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

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d1d5db;
}

.post-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}

.post-card h2 a {
  color: var(--color-text) !important;
}

.post-card h2 a:hover { color: var(--color-primary) !important; }

.post-meta {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-meta .sep { color: #d1d5db; }

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.post-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
}

.post-summary {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.loading, .empty {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 60px 0;
  font-size: 0.9375rem;
}

/* ===== Post Detail ===== */
.post-detail { padding: 40px 0; }

.post-detail h1 {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.post-detail .post-meta { margin-bottom: 24px; }

.post-detail .post-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--color-text);
}

.post-detail .post-body h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 32px 0 12px;
}

.post-detail .post-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 24px 0 8px;
}

.post-detail .post-body p { margin-bottom: 16px; }

.post-detail .post-body ul,
.post-detail .post-body ol {
  margin: 8px 0 16px 24px;
}

.post-detail .post-body li { margin-bottom: 6px; }

.post-detail .post-body code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

.post-detail .post-body pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-detail .post-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.post-detail .post-body blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 8px 16px;
  margin: 16px 0;
  color: var(--color-text-secondary);
  background: #f9fafb;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-detail .post-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 16px 0;
}

.post-back {
  display: inline-block;
  margin-top: 32px;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ===== Page Content (About) ===== */
.page-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 40px 0;
}

.page-content h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.page-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 28px 0 12px;
}

.page-content p { margin-bottom: 12px; color: var(--color-text-secondary); }

.page-content ul {
  margin: 8px 0 16px 24px;
  color: var(--color-text-secondary);
}

.page-content li { margin-bottom: 6px; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 40px 0;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  border-top: 1px solid var(--color-border);
  margin-top: 60px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .site-nav { display: none; }

  .site-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 20px;
    gap: 12px;
  }

  .menu-toggle { display: block; }

  .hero { padding: 32px 0 20px; }
  .hero h1 { font-size: 1.5rem; }

  .post-card { padding: 20px; }
  .post-card h2 { font-size: 1.125rem; }

  .post-detail h1 { font-size: 1.5rem; }

  .page-content { padding: 24px; margin: 24px 0; }
}
