:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ==================== 头部 ==================== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo span { color: var(--primary); }

.site-nav { display: flex; gap: 20px; }
.site-nav a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 15px;
  transition: color .2s;
}
.site-nav a:hover, .site-nav a.active { color: var(--primary); }

.search-box {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.search-box input {
  width: 200px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, width .2s;
  font-family: inherit;
}
.search-box input:focus { border-color: var(--primary); width: 240px; }

/* ==================== 布局 ==================== */
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  padding: 32px 20px 60px;
  max-width: 1120px;
  margin: 0 auto;
}

/* ==================== 筛选栏 ==================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 6px 16px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  transition: all .2s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.result-count { font-size: 14px; color: var(--text-light); margin-bottom: 16px; }

/* ==================== 文章卡片 ==================== */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.post-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, .12);
}
.post-cover {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 2px;
}
.post-body { padding: 18px 20px 20px; flex: 1; display: flex; flex-direction: column; }
.post-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 10px;
}
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--primary); }
.post-excerpt {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.75;
  margin-bottom: 14px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #94a3b8;
  flex-wrap: wrap;
}
.post-cat {
  background: #eff6ff;
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
}

/* ==================== 侧边栏 ==================== */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.widget {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.widget-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.cat-list { list-style: none; }
.cat-list li { margin-bottom: 8px; }
.cat-list a {
  display: flex;
  justify-content: space-between;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
}
.cat-list a:hover { color: var(--primary); }
.cat-list .count { color: #94a3b8; font-size: 13px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  font-size: 13px;
  color: var(--text-light);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 14px;
  text-decoration: none;
}
.tag-cloud a:hover { color: var(--primary); border-color: var(--primary); }

.recent-list { list-style: none; }
.recent-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.recent-list li:last-child { border-bottom: none; }
.recent-list a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  display: block;
  line-height: 1.6;
}
.recent-list a:hover { color: var(--primary); }
.recent-list .date { color: #94a3b8; font-size: 12px; }

/* ==================== 文章详情 ==================== */
.article-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}
.article-header { margin-bottom: 28px; }
.article-title { font-size: 28px; font-weight: 700; line-height: 1.4; margin-bottom: 14px; }
.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-light);
  flex-wrap: wrap;
}
.article-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  font-size: 16px;
  line-height: 1.9;
}
.article-content h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 30px 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}
.article-content h2:first-child { margin-top: 0; }
.article-content p { margin-bottom: 16px; }
.article-content ul { margin: 0 0 18px 22px; }
.article-content li { margin-bottom: 8px; }
.article-content strong { color: var(--primary-dark); }
.article-content code {
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 14px;
  font-family: Consolas, Monaco, monospace;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}
.post-nav a {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: border-color .2s;
}
.post-nav a:hover { border-color: var(--primary); color: var(--primary); }
.post-nav .nav-label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.post-nav .next { text-align: right; }

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
}
.back-link:hover { color: var(--primary); }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ==================== 底部 ==================== */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 28px 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
}

/* ==================== 移动端 ==================== */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 20px; gap: 12px; }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { width: 100%; }
  .search-box input:focus { width: 100%; }
  .post-grid { grid-template-columns: 1fr; }
  .article-title { font-size: 22px; }
  .article-content { padding: 24px 20px; font-size: 15px; }
  .post-nav { flex-direction: column; }
  .post-nav .next { text-align: left; }
}

/* ==================== 底部备案 ==================== */
.footer-icp { margin-top: 8px; font-size: 13px; color: #94a3b8; }
.footer-icp a { color: #94a3b8; text-decoration: none; }
.footer-icp a:hover { color: var(--primary); }

/* ==================== 关于我 ==================== */
.profile-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}
.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 40px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-name { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.profile-tagline { color: var(--text-light); font-size: 15px; margin-bottom: 28px; }
.profile-section { text-align: left; margin-top: 28px; }
.profile-section .widget-title { text-align: left; }
.profile-text { font-size: 15px; line-height: 1.9; }
.profile-text p { margin-bottom: 12px; }
.profile-text p:last-child { margin-bottom: 0; }
.contact-list { list-style: none; }
.contact-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 15px;
}
.contact-list li:last-child { border-bottom: none; }
.contact-list .label { color: var(--text-light); }
.contact-list .value { color: var(--primary); font-weight: 500; word-break: break-all; }
.profile-hint {
  margin-top: 28px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-light);
  text-align: left;
  line-height: 1.7;
}
.profile-hint code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Consolas, Monaco, monospace;
}
.profile-card .tag-cloud a { cursor: default; }
@media (max-width: 640px) {
  .profile-card { padding: 28px 20px; }
  .avatar { width: 80px; height: 80px; font-size: 34px; }
}
