/* ========== 全局变量 ========== */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-card: #1c1f2e;
  --bg-card-hover: #232740;
  --text-primary: #e8eaf0;
  --text-secondary: #9a9fb5;
  --text-muted: #6b7089;
  --accent: #00d4ff;
  --accent2: #7c5cfc;
  --accent-gradient: linear(135deg, #00d4ff, #7c5cfc);
  --border: rgba(255,255,255,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --max-width: 1200px;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent2); }
img { max-width: 100%; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; width: 100%; }

/* ========== 头部导航 ========== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.logo-icon { font-size: 1.5rem; }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.92rem; font-weight: 500;
  transition: all .2s;
}
.main-nav a:hover, .main-nav a.active { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.menu-toggle span { display: block; width: 24px; height: 2px; background: var(--text-primary); margin: 5px 0; border-radius: 2px; transition: .3s; }

/* ========== 主内容 ========== */
#app { flex: 1; padding: 30px 20px 60px; max-width: var(--max-width); margin: 0 auto; width: 100%; }

/* ===== Hero ===== */
.hero {
  text-align: center; padding: 60px 20px 50px;
  background: radial-gradient(ellipse at top, rgba(0,212,255,0.12), transparent 60%),
              radial-gradient(ellipse at bottom right, rgba(124,92,252,0.1), transparent 50%);
  border-radius: var(--radius); margin-bottom: 40px;
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800;
  background: linear-gradient(135deg, #00d4ff, #7c5cfc, #00d4ff);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
  margin-bottom: 16px;
}
@keyframes shimmer { to { background-position: 200% center; } }
.hero p { color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.hero-stats { display: flex; justify-content: center; gap: 40px; margin-top: 30px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.hero-stat .label { font-size: 0.85rem; color: var(--text-muted); }

/* ===== 分类卡片 ===== */
.section-title {
  font-size: 1.4rem; font-weight: 700; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ''; width: 4px; height: 22px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 2px;
}
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 40px; }
.cat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 16px; text-align: center;
  cursor: pointer; transition: all .25s;
}
.cat-card:hover { background: var(--bg-card-hover); border-color: var(--accent); transform: translateY(-3px); }
.cat-card .cat-icon { font-size: 2rem; margin-bottom: 10px; }
.cat-card .cat-name { font-weight: 600; font-size: 0.95rem; }
.cat-card .cat-count { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ===== 文章列表 ===== */
.article-list { display: grid; gap: 16px; }
.article-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
  cursor: pointer; transition: all .25s; display: block;
}
.article-card:hover { background: var(--bg-card-hover); border-color: rgba(0,212,255,0.3); transform: translateY(-2px); }
.article-card .card-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  background: rgba(0,212,255,0.12); color: var(--accent);
}
.tag.cat-ai { background: rgba(124,92,252,0.15); color: #a78bfa; }
.tag.cat-cpp { background: rgba(0,212,255,0.12); color: #00d4ff; }
.tag.cat-python { background: rgba(255,193,7,0.15); color: #ffc107; }
.tag.cat-frontend { background: rgba(255,107,107,0.15); color: #ff6b6b; }
.tag.cat-db { background: rgba(76,209,146,0.15); color: #4cd192; }
.tag.cat-linux { background: rgba(255,159,67,0.15); color: #ff9f43; }
.tag.cat-arch { background: rgba(165,94,234,0.15); color: #a55eea; }
.article-card .card-date { font-size: 0.8rem; color: var(--text-muted); }
.article-card h3 { font-size: 1.15rem; margin-bottom: 8px; color: var(--text-primary); }
.article-card .card-excerpt { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.6; }
.article-card .card-read { margin-top: 12px; font-size: 0.82rem; color: var(--accent); }

/* ===== 面包屑 ===== */
.breadcrumb { margin-bottom: 20px; font-size: 0.88rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }

/* ===== 文章详情 ===== */
.article-detail {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px;
}
.article-detail h1 { font-size: 1.8rem; margin-bottom: 16px; line-height: 1.3; }
.article-detail .article-meta {
  display: flex; gap: 16px; align-items: center; margin-bottom: 28px;
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
  font-size: 0.88rem; color: var(--text-muted);
}
.article-content { font-size: 1rem; line-height: 1.9; }
.article-content h2 { font-size: 1.35rem; margin: 28px 0 14px; padding-left: 12px; border-left: 4px solid var(--accent); }
.article-content h3 { font-size: 1.15rem; margin: 22px 0 10px; color: var(--accent); }
.article-content p { margin-bottom: 14px; color: var(--text-secondary); }
.article-content ul, .article-content ol { margin: 12px 0 16px 24px; color: var(--text-secondary); }
.article-content li { margin-bottom: 6px; }
.article-content code {
  background: rgba(0,0,0,0.35); padding: 2px 7px; border-radius: 4px;
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 0.88em; color: #7ee787;
}
.article-content pre {
  background: #0d1117; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px; overflow-x: auto;
  margin: 16px 0;
}
.article-content pre code {
  background: none; padding: 0; color: #c9d1d9; font-size: 0.88rem; line-height: 1.6;
}
.article-content blockquote {
  border-left: 4px solid var(--accent2); background: rgba(124,92,252,0.08);
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0; color: var(--text-secondary);
}
.article-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.article-content th { background: rgba(255,255,255,0.04); font-weight: 600; }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.9rem;
  cursor: pointer; margin-bottom: 20px; transition: all .2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }

/* ===== 加载 ===== */
.loading { text-align: center; padding: 60px; color: var(--text-muted); }
.loading .spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  margin: 0 auto 16px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 页脚 ===== */
.site-footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 40px 0 20px; margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.footer-about h3 { margin-bottom: 12px; font-size: 1.1rem; }
.footer-about p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }
.footer-links h4 { margin-bottom: 12px; font-size: 0.95rem; color: var(--text-secondary); }
.footer-links a { display: block; color: var(--text-muted); font-size: 0.88rem; padding: 4px 0; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.82rem; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .main-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--bg-secondary); flex-direction: column;
    padding: 12px 20px; border-bottom: 1px solid var(--border);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 14px; }
  .menu-toggle { display: block; }
  .article-detail { padding: 22px 18px; }
  .article-detail h1 { font-size: 1.4rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero { padding: 40px 16px 30px; }
  .hero-stats { gap: 24px; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
