/* ============================================================
   商讯频道 · 列表页样式（单文件，无第三方依赖）
   断点策略：默认（<1200px）为 WAP 布局，@media (min-width:1200px) 切换为 PC 布局。
   DOM 只有一套，布局差异全部由媒体查询承担。
   ============================================================ */

/* ---------- 0. 归一化 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
li,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  border: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 1. 设计变量 ---------- */
:root {
  --brand: #1a5fb4;
  --brand-dark: #134a8e;
  --text: #22262b;
  --text-sub: #666b73;
  --text-muted: #9aa0a6;
  --line: #eaeaec;
  --line-soft: #f0f1f3;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --ad-bg: #f2f3f5;
  --ad-text: #8a8f99;
  --ad-line: #e4e6ea;

  --radius: 4px;
  --wrap: 1200px;
  --gutter: 20px;
  --col-gap: 32px;
  --side-width: 320px;

  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* 全局焦点样式（可访问性） */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 2. 站点头部 ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* 品牌锁定：中国搜索 logo（555×251 原比例）+ 竖分隔 + 频道名 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  height: 42px;
  width: auto;
  flex: none;
}

.brand-split {
  width: 1px;
  height: 26px;
  background: var(--line);
  flex: none;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  white-space: nowrap;
}

.header-extra {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 3. 主体骨架 ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  gap: var(--col-gap);
  padding-top: 24px;
  padding-bottom: 48px;
}

.col-main {
  flex: 1 1 auto;
  min-width: 0; /* 防止长标题撑破 flex */
}

/* 右侧边栏：整段可删。删除后 .col-main 自动占满整行（flex 天然行为） */
.col-side {
  flex: 0 0 var(--side-width);
  width: var(--side-width);
}

/* ---------- 4. 栏目标题 ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--brand);
}

.section-title {
  position: relative;
  padding-left: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--brand);
}

.section-tip {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- 5. 稿件列表（PC / WAP 共用同一套元素） ---------- */
.news-list {
  margin-top: 0;
}

.news-item {
  border-bottom: 1px solid var(--line);
}

.news-link {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
}

.news-main {
  flex: 1 1 auto;
  min-width: 0;
}

.news-title {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
  transition: color 0.15s;
}

.news-link:hover .news-title {
  color: var(--brand);
}

.news-meta {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-sub);
}

.news-source {
  margin-right: 12px;
}

/* 缩略图：WAP 显示，PC 隐藏（见 §11 媒体查询） */
.news-thumb {
  flex: 0 0 110px;
  width: 110px;
}

.news-thumb img {
  width: 110px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-soft);
}

/* 图片加载失败 / 接口无图：收起图位，文字占满整行 */
.news-item.no-thumb .news-thumb {
  display: none;
}

/* ---------- 6. 广告标识 ---------- */
.badge-ad {
  display: inline-block;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 17px;
  color: var(--ad-text);
  background: var(--ad-bg);
  border: 1px solid var(--ad-line);
  border-radius: 2px;
  vertical-align: 1px;
  white-space: nowrap;
  /* 不参与标题换行挤压 */
  flex: none;
}

/* ---------- 7. 分页（PC） ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0 56px;
}

.pager a,
.pager .page {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 34px;
  text-align: center;
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    color 0.15s,
    border-color 0.15s,
    background-color 0.15s;
}

.pager a:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.pager .page.current {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.pager .page-dot {
  min-width: 24px;
  padding: 0;
  color: var(--text-muted);
  background: none;
  border-color: transparent;
}

.pager a.is-disabled {
  color: #c8ccd1;
  pointer-events: none;
  background: var(--bg-soft);
  border-color: var(--line-soft);
}

.pager .page-total {
  flex: 1 0 100%;
  padding-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  color: var(--text-muted);
  background: none;
  border: 0;
}

/* ---------- 8. 滚动加载（WAP） ---------- */
.loadmore {
  padding: 22px 0 40px;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  color: var(--text-muted);
  min-height: 20px;
}

.loadmore .spinner {
  display: none;
  width: 15px;
  height: 15px;
  margin-right: 7px;
  vertical-align: -2px;
  border: 2px solid #dfe3e8;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loadmore.is-loading .spinner {
  display: inline-block;
}

.loadmore.is-end {
  color: #c2c6cc;
}

.loadmore .retry {
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 9. 骨架屏 ----------
   刻意不加缩略图占位：接口带图条目仅约 10%，行高由「无图条目」决定，
   加了图位反而会在数据到达后整屏塌陷。详见 app.js skeleton() 的注释。 */
.sk-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.sk-line {
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(90deg, #f2f4f6 25%, #e9edf1 37%, #f2f4f6 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.2s ease infinite;
}

.sk-line.sk-title {
  width: 72%;
  height: 18px;
  margin-bottom: 12px;
}

.sk-line.sk-title.is-short {
  width: 46%;
}

.sk-line.sk-meta {
  width: 26%;
  height: 12px;
}

@keyframes sk-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---------- 10. 空 / 错误态 ---------- */
.list-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 20px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.list-state[hidden] {
  display: none;
}

.list-state .btn-retry {
  margin-top: 16px;
  padding: 7px 24px;
  font-size: 14px;
  color: var(--brand);
  background: var(--bg);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  transition:
    color 0.15s,
    background-color 0.15s;
}

.list-state .btn-retry:hover {
  color: #fff;
  background: var(--brand);
}

/* ---------- 11. 右侧边栏 ---------- */
.side-card {
  padding: 18px;
  background: var(--bg-soft);
  border-radius: 6px;
}

.side-title {
  padding-bottom: 12px;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  border-bottom: 1px solid var(--line);
}

.side-list {
  margin: 0;
}

.side-item {
  position: relative;
  padding: 11px 0 11px 14px;
  border-bottom: 1px dashed var(--line);
}

.side-item:last-child {
  border-bottom: 0;
}

.side-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c3ccd8;
}

.side-item a {
  display: block;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  transition: color 0.15s;
}

.side-item a:hover {
  color: var(--brand);
}

/* 侧栏首条带图样式 */
.side-item.has-thumb {
  display: flex;
  gap: 10px;
  padding-left: 14px;
}

.side-item.has-thumb img {
  flex: none;
  width: 84px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg);
}

.side-item.has-thumb.no-thumb::before {
  top: 17px;
}

/* ---------- 12. 底部 ---------- */
.site-footer {
  padding: 26px 0;
  font-size: 12px;
  line-height: 2;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
}

.site-footer .foot-links a {
  margin: 0 8px;
  color: var(--text-sub);
}

.site-footer .foot-links a:hover {
  color: var(--brand);
}

/* ---------- 13. 返回顶部 ---------- */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 36px;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition:
    color 0.15s,
    border-color 0.15s;
}

.to-top:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.to-top.is-show {
  display: flex;
}

/* ============================================================
   14. 断点切换：≥1200px = PC 布局；<1200px = WAP 布局
   同一套 DOM，只改样式
   ============================================================ */

/* ----- PC：宽栏列表 + 右侧栏 + 页码翻页 ----- */
@media (min-width: 1200px) {
  /* 稿件仍用同一套元素，只放大字号 / 行距 / 缩略图尺寸 */
  .news-item .news-link {
    gap: 20px;
    padding: 22px 0 24px;
  }

  .news-title {
    font-size: 20px;
    line-height: 34px;
  }

  .news-title:hover {
    color: var(--brand);
  }

  .news-meta {
    margin-top: 10px;
    font-size: 14px;
  }

  /* 宽栏下图片放大到 168×112（3:2），否则 20px 标题配 110px 小图会头重脚轻 */
  .news-thumb,
  .news-thumb img {
    flex-basis: 168px;
    width: 168px;
  }

  .news-thumb img {
    height: 112px;
  }

  .badge-ad {
    vertical-align: 2px;
  }

  .sk-item {
    padding: 22px 0 24px;
  }

  .sk-line.sk-title {
    height: 22px;
    width: 68%;
    margin-bottom: 14px;
  }

  .sk-line.sk-meta {
    width: 22%;
    height: 14px;
  }

  /* WAP 的滚动加载在 PC 下不出现 */
  .loadmore {
    display: none;
  }
}

/* ----- WAP：单列 + 缩略图 + 滚动加载 ----- */
@media (max-width: 1199px) {
  .col-side {
    display: none;
  }

  /* PC 的页码在 WAP 下不出现，改由滚动加载承担 */
  .pager {
    display: none;
  }
}

/* ----- 手机端细节微调 ----- */
@media (max-width: 767px) {
  :root {
    --gutter: 14px;
  }

  .header-inner {
    justify-content: center;
    height: 54px;
  }

  .header-extra {
    display: none;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    height: 32px;
  }

  .brand-split {
    height: 20px;
  }

  .brand-name {
    font-size: 16px;
  }

  .layout {
    padding-top: 14px;
    padding-bottom: 24px;
  }

  .section-head {
    padding-bottom: 10px;
  }

  .section-tip {
    display: none;
  }

  .news-link {
    gap: 12px;
    padding: 14px 0;
  }

  .news-title {
    font-size: 16px;
  }

  /* 小屏下把广告标识再收一点，减少被挤到下一行的情况 */
  .badge-ad {
    height: 17px;
    margin-left: 5px;
    padding: 0 4px;
    font-size: 11px;
    line-height: 16px;
  }

  .news-thumb,
  .news-thumb img {
    flex-basis: 96px;
    width: 96px;
  }

  .news-thumb img {
    height: 64px;
  }

  .to-top {
    right: 12px;
    bottom: 24px;
    width: 36px;
    height: 36px;
  }
}
