/* =====================================================
   新闻资讯 - 公共样式
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text-base: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', sans-serif;
  --max-w: 1100px;
  --content-w: 740px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img { display: block; max-width: 100%; }

/* ── 头部导航 ── */
.news-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
}
.news-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-base);
}
.nav-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 16px;
}
.nav-crumb {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-crumb a { color: var(--primary); }
.nav-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

/* ── 页面布局 ── */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── 分类 Tab ── */
.topic-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.topic-tab {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.topic-tab:hover, .topic-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── 新闻卡片列表 ── */
.news-list { display: flex; flex-direction: column; gap: 0; }

.news-card {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity .18s;
}
.news-card:hover { opacity: .88; }
.news-card:hover .nc-title { color: var(--primary); }
.news-card:last-child { border-bottom: none; }

.nc-cover {
  flex-shrink: 0;
  width: 140px; height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
}
.nc-cover-placeholder {
  flex-shrink: 0;
  width: 140px; height: 96px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.nc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.nc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nc-topic {
  font-size: 12px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 500;
}
.nc-top-badge {
  font-size: 12px;
  background: #fef3c7;
  color: #d97706;
  border-radius: 4px;
  padding: 2px 6px;
}
.nc-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-base);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .15s;
}
.nc-summary {
  font-size: 14px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}
.nc-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-light);
  margin-top: auto;
}

/* ── 分页 ── */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}
.pager-btn {
  padding: 7px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-info { font-size: 14px; color: var(--text-muted); }

/* ── 加载骨架 ── */
.skeleton-card { display: flex; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.skel { background: #f1f5f9; border-radius: 6px; animation: skel-pulse 1.4s ease-in-out infinite; }
@keyframes skel-pulse { 0%,100%{ opacity:1 } 50%{ opacity:.5 } }
.skel-cover { flex-shrink:0; width:140px; height:96px; border-radius:8px; }
.skel-body  { flex:1; display:flex; flex-direction:column; gap:10px; padding-top:4px; }
.skel-line  { height:14px; border-radius:4px; }

/* ======================================================
   文章详情页
   ====================================================== */
.article-wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.article-header { margin-bottom: 24px; }
.article-meta {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.article-topic {
  background: #eff6ff; color: var(--primary);
  border-radius: 4px; padding: 3px 10px;
  font-size: 13px; font-weight: 500;
}
.article-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  color: var(--text-base);
  line-height: 1.4;
  margin-bottom: 12px;
  letter-spacing: -.01em;
}
.article-summary-block {
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ── 文章正文排版 ── */
.article-body {
  font-size: 16px;
  line-height: 1.9;
  color: #334155;
}
.article-body h2 {
  font-size: 20px; font-weight: 700; margin: 32px 0 14px;
  color: var(--text-base); padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.article-body h3 {
  font-size: 17px; font-weight: 600; margin: 24px 0 10px; color: var(--text-base);
}
.article-body p {
  margin-bottom: 16px;
}
.article-body ul, .article-body ol {
  padding-left: 22px; margin-bottom: 16px;
}
.article-body li { margin-bottom: 8px; }
.article-body strong { color: #1e293b; font-weight: 600; }
.article-body a { color: var(--primary); text-decoration: underline; }
.article-body img {
  max-width: 100%; border-radius: 8px; margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.article-body hr {
  border: none; border-top: 1px solid var(--border); margin: 10px 0;
}
.article-body blockquote {
  border-left: 3px solid var(--primary); padding: 10px 16px;
  background: #f8fafc; border-radius: 0 8px 8px 0;
  margin: 16px 0; color: var(--text-muted);
}
.article-body table {
  width: 100%; border-collapse: collapse; margin-bottom: 16px;
  font-size: 14px;
}
.article-body th, .article-body td {
  border: 1px solid var(--border); padding: 8px 12px;
}
.article-body th { background: #f8fafc; font-weight: 600; }

/* ── 分享栏 ── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 32px 0;
  padding: 18px 22px;
  background: #f8fafc;
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.share-label { font-size: 14px; color: var(--text-muted); margin-right: 4px; }
.share-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.share-btn:hover { border-color: var(--primary); color: var(--primary); }
.share-btn.copied { border-color: #22c55e; color: #22c55e; background: #f0fdf4; }
.share-wechat { color: #07c160; }
.share-wechat:hover { border-color: #07c160; color: #07c160; }
.share-weibo  { color: #e6162d; }
.share-weibo:hover  { border-color: #e6162d; color: #e6162d; }

/* ── 相关推荐 ── */
.related-section { margin-top: 40px; border-top: 2px solid var(--border); padding-top: 28px; }
.related-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; color: var(--text-base); }
.related-list { display: flex; flex-direction: column; gap: 0; }
.related-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.related-item:last-child { border-bottom: none; }
.related-item:hover .ri-title { color: var(--primary); }
.ri-cover {
  flex-shrink: 0; width: 80px; height: 56px;
  border-radius: 6px; object-fit: cover;
  background: #f1f5f9;
}
.ri-cover-ph {
  flex-shrink: 0; width: 80px; height: 56px;
  border-radius: 6px; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.ri-body { flex: 1; min-width: 0; }
.ri-title {
  font-size: 15px; font-weight: 500; color: var(--text-base);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.4; margin-bottom: 6px;
  transition: color .15s;
}
.ri-date { font-size: 12px; color: var(--text-light); }

/* ── 回到顶部 ── */
.back-top {
  position: fixed; right: 24px; bottom: 80px;
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: none; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--text-muted);
  transition: all .15s; z-index: 50;
}
.back-top:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.back-top.show { display: flex; }

/* ── 空状态 ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; }

/* ── 搜索框 ── */
.search-wrap {
  display: flex; gap: 10px; margin-bottom: 24px;
}
.search-input {
  flex: 1; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--primary); }
.search-btn {
  padding: 10px 20px; border-radius: 10px;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background .15s;
}
.search-btn:hover { background: var(--primary-dark); }

/* ── 响应式 ── */
@media (max-width: 640px) {
  .page-wrap, .article-wrap { padding: 16px 14px 60px; }
  .nc-cover, .nc-cover-placeholder { width: 100px; height: 70px; }
  .nc-title { font-size: 15px; }
  .share-bar { padding: 14px 16px; }
  .back-top { right: 14px; bottom: 16px; }
  .nc-summary { display: none; }
  .news-nav-inner { padding: 0 14px; }
}
@media (max-width: 400px) {
  .nc-cover, .nc-cover-placeholder { display: none; }
}

/* ── Markdown 渲染样式 ── */
.article-body h1 {
  font-size: 24px; font-weight: 700; margin: 32px 0 16px;
  color: var(--text-base); border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}
.article-body h4, .article-body h5, .article-body h6 {
  font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--text-base);
}
.article-body code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 14px; color: #be123c;
}
.article-body pre {
  background: #1e293b; color: #e2e8f0; padding: 16px 20px;
  border-radius: 8px; overflow-x: auto; margin: 16px 0;
}
.article-body pre code {
  background: none; padding: 0; color: inherit;
  font-size: 14px; line-height: 1.6;
}
