/*!
 * news.css —— 新闻中心（2026-09-16 v2 视觉改版）
 * ---------------------------------------------------------------------------
 * 服务两个入口：
 *   1) /news（列表页 = www/news.html）
 *   2) /news/<id|slug>（详情页 = api.mjs 服务端渲染，直接引用本文件）
 * 页面级隔离：只被 news.html 与新闻详情 SSR 引用，不塞进 site-polish.css。
 * ⚠️ 规矩：不写 padding-bottom（移动端底栏 .bottom-nav 需要 96px 净空）。
 */
:root {
  --c-primary: #c93628;
  --c-primary-deep: #a63329;
  --c-ink: #26211d;
  --c-bg: #f8f5f0;
  --c-line: #e3d9cf;
  --radius: 14px;
}

/* ---------- 详情页 SSR 顶栏 ---------- */
.news-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
}
.news-brand {
  font-weight: 800;
  font-size: 17px;
  color: var(--c-primary);
  text-decoration: none;
}
.news-topnav { display: flex; gap: 18px; }
.news-topnav a { color: var(--c-ink); text-decoration: none; font-size: 14px; }
.news-topnav a:hover { color: var(--c-primary); }

/* ---------- 列表页横幅（红色主题大横幅） ---------- */
.news-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #d24233 0%, var(--c-primary) 45%, var(--c-primary-deep) 100%);
  color: #fff;
  padding-top: 34px;
  padding-bottom: 38px;
}
.news-hero::before,
.news-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}
.news-hero::before { width: 340px; height: 340px; top: -170px; right: 6%; }
.news-hero::after { width: 220px; height: 220px; bottom: -130px; right: 22%; background: rgba(255, 255, 255, 0.05); }
.news-hero .wrap { position: relative; z-index: 1; }
.news-hero .crumb { font-size: 13px; color: rgba(255, 255, 255, 0.75); margin-bottom: 12px; }
.news-hero .crumb a { color: rgba(255, 255, 255, 0.75); text-decoration: none; }
.news-hero .crumb a:hover { color: #fff; }
.news-hero h1 { font-size: 30px; letter-spacing: 0.5px; margin: 0 0 10px; }
.news-hero .hl { color: #ffd9c2; }
.news-hero-sub { color: rgba(255, 255, 255, 0.88); font-size: 14.5px; margin: 0; max-width: 640px; line-height: 1.7; }
/* 横幅上的统计胶囊（文章数 / 最近更新，由 news.js 填充） */
.news-hero-stats { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.news-hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  color: #fff;
}
.news-hero-stat b { font-size: 14px; }

/* ---------- 主体两栏：列表 + 侧栏 ---------- */
.news-body-sec { padding-top: 26px; padding-bottom: 40px; }
.news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}
.news-list { display: grid; gap: 14px; }

/* ---------- 新闻卡片 ---------- */
.news-card {
  position: relative;
  display: flex;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--c-ink);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.news-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c-primary);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.news-card:hover { box-shadow: 0 10px 26px rgba(38, 33, 29, 0.1); transform: translateY(-2px); border-color: #ecd9cd; }
.news-card:hover::before { opacity: 1; }
.news-card-cover {
  width: 168px;
  height: 108px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
  background: var(--c-bg);
}
/* 无封面时的占位块（红色渐变 + 栏目字样） */
.news-card-ph {
  width: 168px;
  height: 108px;
  border-radius: 10px;
  flex: none;
  background: linear-gradient(135deg, #f3e2dc 0%, #f8f5f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c98d7d;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 4px;
}
.news-card-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.news-card-title {
  font-size: 17.5px;
  font-weight: 700;
  margin: 0;
  color: var(--c-ink);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.news-card:hover .news-card-title { color: var(--c-primary); }
.news-card-summary {
  font-size: 13.5px;
  color: #6f655a;
  margin: 0;
  line-height: 1.75;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.news-card-meta {
  font-size: 12.5px;
  color: #9a8f84;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}
.news-chip {
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  padding: 2px 10px;
  color: #8a7f74;
}

/* ---------- 头条（第一篇，大卡） ---------- */
.news-card--feat { padding: 22px; }
.news-card--feat .news-card-title { font-size: 21px; -webkit-line-clamp: 2; }
.news-card--feat .news-card-summary { font-size: 14.5px; -webkit-line-clamp: 3; }
.news-card--feat .news-card-cover,
.news-card--feat .news-card-ph { width: 236px; height: 150px; }
.news-card--feat .news-feat-tag {
  align-self: flex-start;
  background: var(--c-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 9px;
  letter-spacing: 2px;
}

.news-empty {
  text-align: center;
  color: #9a8f84;
  background: #fff;
  border: 1px dashed var(--c-line);
  border-radius: var(--radius);
  padding: 56px 20px;
}

/* ---------- 分页 ---------- */
.news-pager { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.news-pager button {
  min-width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--c-line);
  background: #fff;
  color: var(--c-ink);
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.news-pager button:hover:not(:disabled):not(.on) { border-color: var(--c-primary); color: var(--c-primary); }
.news-pager button.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.news-pager button:disabled { opacity: 0.45; cursor: default; }

/* ---------- 侧栏 ---------- */
.news-aside { display: grid; gap: 14px; }
.side-card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 18px;
}
.side-card h3 {
  margin: 0 0 12px;
  font-size: 15.5px;
  color: var(--c-ink);
  padding-left: 10px;
  border-left: 3px solid var(--c-primary);
  line-height: 1.3;
}
.side-card p { margin: 0; font-size: 13px; color: #6f655a; line-height: 1.8; }
.side-links { display: grid; gap: 2px; }
.side-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 4px;
  font-size: 13.5px;
  color: var(--c-ink);
  text-decoration: none;
  border-bottom: 1px dashed var(--c-line);
}
.side-links a:last-child { border-bottom: 0; }
.side-links a:hover { color: var(--c-primary); }
.side-links .arrow { color: #c9bcb0; font-size: 12px; }
/* 会员价格小卡（红底） */
.side-price {
  background: linear-gradient(135deg, #d24233, var(--c-primary-deep));
  border: 0;
  color: #fff;
}
.side-price h3 { color: #fff; border-left-color: rgba(255, 255, 255, 0.6); }
.side-price p { color: rgba(255, 255, 255, 0.88); }
.side-price .price-row { display: flex; gap: 18px; margin-top: 10px; }
.side-price .price-row b { font-size: 20px; }
.side-price .price-row span { display: block; font-size: 12px; opacity: 0.8; margin-top: 2px; }

/* ---------- 详情页（SSR） ---------- */
/* 窄红条：仅放面包屑（标题在文章卡里） */
.news-hero--slim { padding-top: 16px; padding-bottom: 16px; }
.news-hero--slim .crumb { margin-bottom: 0; }
.news-hero--slim .crumb a { color: rgba(255,255,255,0.75); text-decoration: none; }
.news-hero--slim .crumb { color: rgba(255,255,255,0.75); }

.news-detail-wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 40px; }
.news-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}
.news-article {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 32px 34px 28px;
  box-shadow: 0 4px 16px rgba(38, 33, 29, 0.04);
}
.news-crumb { font-size: 13px; color: #9a8f84; margin-bottom: 16px; }
.news-crumb a { color: #9a8f84; text-decoration: none; }
.news-crumb a:hover { color: var(--c-primary); }
.news-article h1 { font-size: 25px; line-height: 1.45; color: var(--c-ink); margin: 0 0 14px; }
.news-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: #9a8f84;
  border-bottom: 1px solid var(--c-line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.news-meta .news-chip { font-size: 12px; }
/* ⚠️ 必须写 height:auto：SSR 模板给 <img> 带了 width="1200" height="675" 属性，
   只写 width:100% 时 height 属性会作为表现性提示生效 → 图被强制 100%宽 × 675px 高，
   窄屏/移动端直接拉伸变形（2026-09-16 用户反馈）。height:auto 交回给图片固有比例。 */
.news-cover { display: block; width: 100%; height: auto; border-radius: 10px; margin-bottom: 20px; }
.news-body { font-size: 16px; line-height: 1.9; color: #3a342e; overflow-wrap: break-word; }
.news-body img { max-width: 100%; height: auto; border-radius: 10px; }
.news-body p { margin: 0 0 14px; }
.news-body h2, .news-body h3 { color: var(--c-ink); line-height: 1.5; margin: 24px 0 10px; }
.news-body a { color: var(--c-primary); }
.news-body blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--c-primary);
  background: var(--c-bg);
  border-radius: 8px;
  color: #6f655a;
}
.news-foot { border-top: 1px solid var(--c-line); margin-top: 24px; padding-top: 16px; display: flex; justify-content: space-between; align-items: center; }
.news-back { color: var(--c-primary); text-decoration: none; font-size: 14px; font-weight: 600; }
.news-foot .news-chip { font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .news-layout, .news-detail-layout { grid-template-columns: 1fr; }
  .news-aside { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .news-hero h1 { font-size: 23px; }
  .news-hero { padding-top: 26px; padding-bottom: 30px; }
  .news-card, .news-card--feat { flex-direction: column; }
  .news-card-cover, .news-card-ph,
  .news-card--feat .news-card-cover,
  .news-card--feat .news-card-ph { width: 100%; height: 160px; }
  .news-aside { grid-template-columns: 1fr; }
  .news-article { padding: 22px 16px 20px; }
  .news-article h1 { font-size: 20px; }
  .news-body { font-size: 15.5px; }
  /* 底栏净空：mobile-nav.js 会在 ≤860px 挂出固定底栏，只补下边距，不动 padding-bottom */
  .news-body-sec { margin-bottom: 96px; }
  .news-detail-wrap { margin-bottom: 96px; }
}
