:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --border: #e5e7eb;
  --code-bg: #f3f4f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --radius: 12px;
  --max-w: 760px;
}

/* 用户手动切换暗色 */
[data-theme="dark"] {
  --bg: #0f0f19;
  --surface: #1a1a2e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --border: #2d2d44;
  --code-bg: #1e1e32;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

/* 跟随系统暗色（无手动设置时） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f0f19;
    --surface: #1a1a2e;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --border: #2d2d44;
    --code-bg: #1e1e32;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
  }
}

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

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

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

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.25rem;
}
.logo-icon { font-size: 1.4rem; }
nav { display: flex; gap: 20px; }
.nav-link {
  color: var(--text-muted); text-decoration: none; font-size: 0.9rem;
  font-weight: 500; transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--accent); }

/* Hero */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.hero-subtitle { color: var(--text-muted); font-size: 1.1rem; max-width: 480px; margin: 0 auto; }

/* Articles */
.articles { padding-bottom: 80px; }
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.article-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.article-card.featured { border-left: 3px solid var(--accent); }

.article-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.article-tag {
  background: var(--accent); color: #fff; font-size: 0.75rem;
  padding: 3px 10px; border-radius: 20px; font-weight: 600;
}
.article-date { color: var(--text-muted); font-size: 0.85rem; }

.article-title { font-size: 1.5rem; margin-bottom: 12px; }
.article-title a { color: var(--text); text-decoration: none; }
.article-title a:hover { color: var(--accent); }

.article-excerpt { color: var(--text-muted); margin-bottom: 20px; font-size: 0.95rem; }

.article-footer { display: flex; justify-content: space-between; align-items: center; }
.article-author { font-size: 0.85rem; color: var(--text-muted); }
.read-more {
  color: var(--accent); font-weight: 600; font-size: 0.9rem;
  text-decoration: none; transition: color 0.2s;
}
.read-more:hover { color: var(--accent-hover); }

/* Coming Soon */
.coming-soon { text-align: center; padding: 48px 0; }
.coming-soon h3 { font-size: 1.2rem; margin-bottom: 8px; }
.coming-soon p { color: var(--text-muted); }

/* Article Post */
.article-post { padding: 48px 0 80px; }
.article-post .article-header { margin-bottom: 40px; }
.article-post h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 16px; line-height: 1.3; }
.article-post .post-meta { display: flex; gap: 16px; color: var(--text-muted); font-size: 0.9rem; }

.post-content { color: var(--text); }
.post-content h2 {
  font-size: 1.4rem; margin-top: 48px; margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.post-content h3 { font-size: 1.15rem; margin-top: 32px; margin-bottom: 12px; }
.post-content p { margin-bottom: 18px; font-size: 1.02rem; }
.post-content ul, .post-content ol { margin-bottom: 18px; padding-left: 24px; }
.post-content li { margin-bottom: 8px; }
.post-content code {
  background: var(--code-bg); padding: 2px 6px; border-radius: 4px;
  font-size: 0.9em; font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}
.post-content pre {
  background: var(--code-bg); padding: 20px 24px; border-radius: var(--radius);
  overflow-x: auto; margin-bottom: 24px; font-size: 0.88rem;
  line-height: 1.6; border: 1px solid var(--border);
}
.post-content pre code { background: none; padding: 0; }
.post-content blockquote {
  border-left: 3px solid var(--accent); padding: 12px 20px;
  margin-bottom: 24px; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted); font-style: italic;
}
.post-content strong { color: var(--text); }
.post-content .gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-weight: 700;
}

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

/* Footer */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 40px 0; text-align: center;
}
.site-footer p { color: var(--text-muted); margin-bottom: 6px; font-size: 0.9rem; }
.site-footer strong { color: var(--text); }
.footer-muted { font-size: 0.8rem !important; opacity: 0.6; }

.theme-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 10px; font-size: 1rem; cursor: pointer; line-height: 1;
  transition: background 0.2s;
}
.theme-btn:hover { background: var(--code-bg); }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .article-card { padding: 20px; }
  .article-post h1 { font-size: 1.5rem; }
  .article-title { font-size: 1.2rem; }
}
