/* ============================================================
   组件样式（双主题通用，全部用 themes.css 的变量）
   ============================================================ */

/* ---------- 基础 ---------- */
body {
  font-family: var(--font-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  transition: background .35s, color .35s;
}
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; }

/* 主题化滚动条（WebKit） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

/* 主题化文本选中色 */
::selection { background: var(--selection-bg); color: inherit; }

/* 吸顶 header（带模糊） */
#header.sticky {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg-header) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- 顶部 Header ---------- */
#header {
  background: var(--bg-header);
  position: relative;
  z-index: 9999;
  box-shadow: var(--shadow);
  transition: background .35s;
}
#header .header-wrapper {
  height: 100px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-branding img { max-height: 60px; width: auto !important; }
.site-branding .brand-text {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: var(--header-text);
  letter-spacing: 1px;
}
.site-branding .brand-text .accent { color: var(--primary); }
.site-branding p {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 1px;
  margin: 4px 0 0;
}
.main-nav { text-align: center; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: inline-flex; gap: 28px; }
.main-nav li a {
  color: var(--header-text);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.main-nav li a:hover { border-bottom-color: var(--primary); color: var(--primary); }
.header-social { display: flex; gap: 14px; align-items: center; }
.header-social a { color: var(--text-muted); font-size: 16px; }
.header-social a:hover { color: var(--primary); }

/* 顶部分类条 */
#category-bar {
  background: var(--bg-elev);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px;
}
#category-bar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
#category-bar a:hover { color: var(--primary); }
#category-bar .cat-dot { width: 8px; height: 8px; border-radius: 50%; }
#category-bar .cat-num {
  background: var(--border);
  border-radius: 10px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- Hero 精选 ---------- */
#hero {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 480px;
  display: flex;
  align-items: center;
  color: #fff;
  transition: background .3s;
}
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--hero-overlay-from) 0%, var(--hero-overlay-to) 100%);
}
.hero-overlay { position: relative; z-index: 2; padding: 60px 0; width: 100%; }
.hero-content { max-width: 680px; }
.hero-cat {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff !important;
  margin-bottom: 16px;
}
.hero-title { font-size: 36px; font-weight: 700; line-height: 1.3; margin: 0 0 16px; color: #fff; }
.hero-title a { color: #fff; }
.hero-title a:hover { color: var(--primary); }
.hero-meta { display: flex; gap: 22px; font-size: 13px; opacity: .85; margin-bottom: 18px; }
.hero-meta i { margin-right: 5px; }
.hero-excerpt { font-size: 15px; opacity: .9; margin-bottom: 24px; }
.hero-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--primary);
  color: #fff !important;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 14px;
  transition: background .2s, box-shadow .2s, transform .2s;
}
.hero-btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: var(--glow); }

/* ---------- 内容布局 ---------- */
.main-wrap { padding: 50px 0; }
.main-content { display: grid; grid-template-columns: 1fr 320px; gap: 40px; }
@media (max-width: 900px) { .main-content { grid-template-columns: 1fr; } }

/* ---------- 文章卡片 ---------- */
#article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 1100px) { #article-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { #article-grid { grid-template-columns: 1fr; } }

.post {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s, border-color .25s;
  display: flex;
  flex-direction: column;
}
.post:hover { transform: translateY(-4px); box-shadow: var(--card-hover-shadow); border-color: var(--primary); }
.post-thumbnail { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--bg-input); }
.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.post:hover .post-thumbnail img { transform: scale(1.05); }
.category-label {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  color: #fff !important;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 2px;
}
.post-content { padding: 18px 20px 22px; flex: 1; display: flex; flex-direction: column; }
.post-title { font-size: 17px; font-weight: 600; line-height: 1.45; margin: 0 0 10px; }
.post-title a { color: var(--text-strong); }
.post-title a:hover { color: var(--primary); }
.post-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.post-meta i { margin-right: 4px; }
.post-excerpt { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; flex: 1; }
.read-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  align-self: flex-start;
}
.read-more i { margin-left: 3px; transition: transform .2s; }
.read-more:hover i { transform: translateX(4px); }

/* ---------- 侧边栏 ---------- */
#sidebar .widget {
  background: var(--bg-elev);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.widget-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  position: relative;
  color: var(--text-strong);
}
.widget-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--primary);
}
.popular-list { list-style: none; margin: 0; padding: 0; }
.popular-list li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.popular-list li:last-child { border-bottom: none; }
.popular-thumb img { width: 70px; height: 56px; object-fit: cover; border-radius: 3px; }
.popular-info { flex: 1; }
.popular-title { font-size: 13px; color: var(--text); line-height: 1.4; display: block; margin-bottom: 4px; }
.popular-title:hover { color: var(--primary); }
.popular-meta { font-size: 11px; color: var(--text-muted); }
.category-list { list-style: none; margin: 0; padding: 0; }
.category-list li { margin-bottom: 8px; }
.category-list a { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 14px; padding: 6px 0; }
.category-list a:hover { color: var(--primary); }
.category-list .count { font-size: 11px; color: #fff; padding: 1px 8px; border-radius: 10px; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud-link {
  display: inline-block;
  padding: 5px 12px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 12px;
  border-radius: 2px;
  transition: all .2s;
}
.tag-cloud-link:hover { background: var(--primary); color: #fff; }
.tag-count { margin-left: 4px; opacity: .6; }

/* ---------- 分页 ---------- */
#pagination { margin-top: 40px; text-align: center; }
#pagination a {
  display: inline-block;
  padding: 8px 14px;
  margin: 0 4px;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-weight: 500;
}
#pagination a.active, #pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Footer ---------- */
#footer { background: var(--bg-header); color: var(--text-muted); padding: 50px 0 24px; margin-top: 60px; border-top: 1px solid var(--border); }
#footer .widget-title { color: var(--text-strong); border-bottom-color: var(--border-strong); }
#footer .widget-title::after { background: var(--primary); }
#footer a { color: var(--text-muted); }
#footer a:hover { color: var(--primary); }
.footer-social { margin-top: 16px; display: flex; gap: 12px; }
.footer-social a { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elev); display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); border: 1px solid var(--border); }
.footer-social a:hover { background: var(--primary); color: #fff; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-contact { list-style: none; margin: 0; padding: 0; }
.footer-contact li { margin-bottom: 10px; font-size: 14px; }
.footer-contact i { margin-right: 8px; color: var(--primary); }
.footer-contact a { color: var(--text); }
.footer-contact a:hover { color: var(--primary); }
.footer-copyright { text-align: center; padding-top: 24px; margin-top: 30px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* ---------- 文章详情页 ---------- */
.single-post { background: var(--bg-elev); padding: 40px; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.single-header { margin-bottom: 24px; }
.single-title { font-size: 30px; font-weight: 700; line-height: 1.3; margin: 14px 0 16px; color: var(--text-strong); }
.single-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: var(--text-muted); }
.single-meta i { margin-right: 4px; }
.single-thumbnail { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; }
.single-thumbnail img { width: 100%; }
.single-content { font-size: 16px; line-height: 1.85; color: var(--text); }
.single-content p { margin: 0 0 18px; }
.single-content img { border-radius: var(--radius); margin: 14px 0; }
.single-content h2, .single-content h3 { margin: 28px 0 14px; color: var(--text-strong); }
.single-content a { color: var(--primary); border-bottom: 1px solid var(--primary-soft); }
.single-content blockquote { border-left: 4px solid var(--primary); padding: 10px 20px; margin: 20px 0; background: var(--primary-soft); color: var(--text-muted); }
.single-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--border);
  margin: 18px 0;
}
.single-content pre code { font-family: var(--font-base); color: inherit; }
.single-gallery { margin: 36px 0; }
.single-gallery h3 { font-size: 20px; margin-bottom: 16px; color: var(--text-strong); }
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.gallery-item img { aspect-ratio: 1; object-fit: cover; border-radius: 3px; }
.single-tags { margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--border); }
.tag-link { display: inline-block; padding: 4px 12px; background: var(--border); color: var(--text-muted); font-size: 12px; margin-right: 6px; margin-bottom: 6px; border-radius: 2px; }
.tag-link:hover { background: var(--primary); color: #fff; }
.single-actions { display: flex; gap: 14px; padding: 24px 0; border-top: 1px solid var(--border); }
.like-btn, .share-btn { padding: 10px 24px; border: 1px solid var(--primary); background: transparent; color: var(--primary); border-radius: 2px; font-size: 14px; cursor: pointer; transition: all .2s; }
.like-btn:hover, .share-btn:hover, .like-btn.liked { background: var(--primary); color: #fff; }
.comments { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--border); }
.comments-title { font-size: 20px; margin-bottom: 20px; color: var(--text-strong); }
.comment { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-avatar { width: 48px; height: 48px; border-radius: 50%; }
.comment-author { font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.comment-date { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-left: 10px; }
.comment-text { color: var(--text-muted); font-size: 14px; }

/* ---------- 列表页 ---------- */
.list-title { font-size: 28px; font-weight: 700; margin: 0 0 8px; color: var(--text-strong); }
.list-breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 30px; }
.list-breadcrumb a { color: var(--text-muted); }
.empty { grid-column: 1/-1; padding: 60px; text-align: center; color: var(--text-muted); background: var(--bg-elev); border-radius: var(--radius); border: 1px solid var(--border); }

/* ---------- 关于页 ---------- */
.about-wrap { background: var(--bg-elev); padding: 40px; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.about-avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--bg-input); border: 2px solid var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 36px; color: var(--primary); margin-bottom: 18px; box-shadow: 0 0 0 6px var(--primary-soft); }
.about-name { font-size: 28px; font-weight: 700; color: var(--text-strong); margin-bottom: 8px; }
.about-bio { font-size: 15px; color: var(--text); line-height: 1.8; margin-bottom: 20px; }
.about-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.about-meta i { margin-right: 6px; color: var(--primary); }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 100px 20px; }
.error-page h1 { font-size: 96px; color: var(--primary); margin: 0; }
.error-page p { font-size: 18px; color: var(--text-muted); margin: 16px 0 28px; }

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
  #header .header-wrapper { height: auto; padding: 16px 0; flex-direction: column; gap: 14px; }
  .main-nav ul { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .hero-title { font-size: 26px; }
  .single-post { padding: 24px; }
  .single-title { font-size: 22px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
