/* ========== 基础与变量 ========== */
:root {
  --primary: #e74c3c;
  --primary-dark: #c0392b;
  --text-main: #222;
  --text-sub: #666;
  --text-muted: #999;
  --bg-page: #f5f6f8;
  --bg-card: #fff;
  --border: #eaeaea;
  --shadow: 0 2px 12px rgba(0, 0, 0, .06);
  --radius: 10px;
  --header-h: 60px;
  --max-w: 1200px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
ul, li { list-style: none; }
img { max-width: 100%; }

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

/* ========== 头部 ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-mark {
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(231, 76, 60, .35);
}
.logo-text { letter-spacing: 1px; }

/* 桌面导航 */
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 15px;
  color: var(--text-sub);
  transition: all .2s;
  white-space: nowrap;
}
.nav a:hover { color: var(--primary); background: #fdf0ef; }
.nav a.active { color: #fff; background: var(--primary); font-weight: 600; }

/* 汉堡按钮（移动端） */
.menu-btn {
  display: none;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-main);
  line-height: 1;
}

/* 移动端下拉菜单 */
.mobile-menu {
  display: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px 12px;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 10px 8px;
  border-radius: 8px;
  color: var(--text-sub);
}
.mobile-menu a.active {
  background: #fdf0ef;
  color: var(--primary);
  font-weight: 600;
}

/* ========== 分类标签栏 ========== */
.cat-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.cat-tab {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 14px;
  color: var(--text-sub);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.cat-tab:hover { color: var(--primary); }
.cat-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ========== 主布局：列表 + 侧边栏 ========== */
.main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  padding: 20px 0 40px;
}

/* 文章卡片 */
.article-list { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
}
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title a { color: inherit; }
.card:hover .card-title a { color: var(--primary); }

/* ========== 分页（样式与静态站一致） ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 40px;
}
.pagination a, .pagination span {
  min-width: 36px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  color: var(--text-sub);
  transition: all .2s;
}
.pagination a:hover { color: var(--primary); }
.pagination .cur {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.pagination .disabled { opacity: .4; }
.pagination .dots {
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  min-width: auto;
  padding: 6px 2px;
}

/* ----- 移动端上滑加载 ----- */
.load-more {
  display: none;
  padding: 16px 0 34px;
  text-align: center;
  user-select: none;
}
.load-more .lm-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: 13px;
  transition: color .2s, background .2s;
}
.load-more .spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lm-spin .8s linear infinite;
}
.load-more.is-loading .spinner { display: inline-block; }
.load-more.is-done .lm-inner {
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
}
.load-more.is-error .lm-inner { color: var(--primary); }
.load-more.is-error .lm-inner:hover { background: #fdf0ef; }
@keyframes lm-spin { to { transform: rotate(360deg); } }

.card-summary {
  font-size: 14px;
  color: var(--text-sub);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  flex-wrap: wrap;
}
.tag-cat {
  background: #fdf0ef;
  color: var(--primary);
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* ========== 侧边栏 ========== */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.widget {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.widget-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 4px solid var(--primary);
}
.hot-list li { margin-bottom: 12px; }
.hot-list a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.45;
}
.hot-list a:hover { color: var(--primary); }
.hot-rank {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #eee;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.hot-list li:nth-child(1) .hot-rank,
.hot-list li:nth-child(2) .hot-rank,
.hot-list li:nth-child(3) .hot-rank {
  background: var(--primary);
  color: #fff;
}
/* 加载更多 / 空状态 */
.list-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  background: var(--bg-card);
  border-radius: var(--radius);
}

/* ========== 详情页 ========== */
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 0;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 6px; }

.article-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  padding-bottom: 40px;
}
.article-detail {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.article-title {
  font-size: 26px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.article-content p {
  font-size: 16px;
  line-height: 1.9;
  margin-bottom: 20px;
  color: #333;
  text-align: justify;
}
.article-content strong {
  font-weight: 700;
  color: #111;
}
.related {
  margin-top: 28px;
}
.related h3 {
  font-size: 18px;
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 4px solid var(--primary);
}
.related-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.related-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all .2s;
}
.related-item:hover { color: var(--primary); transform: translateY(-2px); }

/* 阅读进度条 */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  width: 0;
  z-index: 200;
  transition: width .1s linear;
}

/* 返回顶部 */
.back-top {
  position: fixed;
  right: 20px;
  bottom: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 150;
}
.back-top.show { opacity: 1; pointer-events: auto; }

/* ========== 页脚 ========== */
.footer {
  background: #23272e;
  color: #aab2bd;
  padding: 36px 0 20px;
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.footer h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.footer a { display: block; font-size: 13px; margin-bottom: 8px; color: #aab2bd; }
.footer a:hover { color: #fff; }
.footer-desc { font-size: 13px; line-height: 1.8; }
.copyright {
  text-align: center;
  font-size: 12px;
  padding-top: 16px;
  border-top: 1px solid #343a42;
  color: #6c7683;
}

/* ==========================================================
   响应式断点
   手机: < 768px | 平板: 768px - 1024px | 电脑: > 1024px
   ========================================================== */

/* ----- 平板 (768px ~ 1024px) ----- */
@media (max-width: 1024px) {
  .main, .article-wrap { grid-template-columns: 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: 16px; }
}

/* ----- 手机 (< 768px) ----- */
@media (max-width: 768px) {
  .nav { display: none; }              /* 桌面导航隐藏，改用汉堡菜单 */
  .menu-btn { display: block; }
  .header-inner { gap: 10px; }
  .logo { font-size: 18px; }

  .sidebar { display: flex; }          /* 侧边栏回到纵向排列 */
  .card { padding: 14px; }
  .card-title { font-size: 16px; }

  .article-detail { padding: 20px 16px; }
  .article-title { font-size: 21px; }
  .related-list { grid-template-columns: 1fr; }

  .footer-grid { gap: 18px; }

  .back-top { right: 14px; bottom: 20px; }

  /* 分页改为上滑加载 */
  .pagination { display: none; }
  .load-more { display: block; }
}

/* ----- 小屏手机 (< 380px) ----- */
@media (max-width: 380px) {
  .logo-text { display: none; }        /* 超小屏只保留 Logo 图标 */
}
