/* ============================================================
   article.css — 文章模块（列表页 / 详情页 / 评论区）
   ============================================================ */

/* ---------- 列表页头（按模块换色） ---------- */
.list-hero {
  position: relative;
  padding: 58px 0 40px;
  text-align: center;
  overflow: hidden;
}
.list-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--cat, var(--brand)) 22%, transparent) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 60% 80% at 50% 0%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 60% 80% at 50% 0%, #000 20%, transparent 72%);
  pointer-events: none;
}
.list-hero > * { position: relative; }
.list-hero .kicker {
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: .3em;
  color: var(--cat, var(--brand));
  font-weight: 600;
  margin-bottom: 10px;
}
.list-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
}
.list-hero .desc { margin-top: 10px; color: var(--text-2); font-size: 14.5px; }

/* 分类 Tabs */
.cat-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 26px 0 34px;
}
.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--r-full);
  font-size: 14px;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--t);
}
.cat-tab:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }
.cat-tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.cat-tab .n {
  font-size: 12px;
  padding: 0 7px;
  border-radius: var(--r-full);
  background: var(--bg-secondary);
  color: var(--text-3);
}
.cat-tab.is-active .n { background: rgba(255, 255, 255, .22); color: #fff; }

/* 列表主体 */
.list-body { padding-bottom: 20px; }
.list-body .post-list { display: flex; flex-direction: column; gap: 20px; }

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 40px 0 10px;
}
.pagination a, .pagination span {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: var(--t);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---------- 详情页 ---------- */
.detail-hero { padding: 54px 0 30px; text-align: center; position: relative; }
.detail-hero .cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  border-radius: var(--r-full);
  font-size: 13px;
  color: #fff;
  background: var(--cat, var(--brand));
  box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--cat, var(--brand)) 55%, transparent);
}
.detail-hero h1 {
  margin: 18px auto 14px;
  max-width: 960px;
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.4;
}
.detail-hero .meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-3);
  font-size: 13.5px;
}
.detail-hero .keywords {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* 详情布局：正文贴左占满，右侧固定留给目录 */
.detail-layout {
  display: block;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 23% 36px calc(var(--fab-size) + 3vw);
}
.detail-main {
  min-width: 0;
  max-width: none;
  margin: 0;
}
@media (max-width: 1250px) {
  .detail-layout { padding: 0 20px 30px; }
  .detail-aside { display: none; }
}
.detail-card {
  padding: clamp(24px, 4vw, 50px);
  position: relative;
  background: var(--bg-card);
}
/* 沉浸阅读模式：纸面更宽更聚拢 */
body.immersive .detail-layout { padding-top: 8px; }
body.immersive .detail-hero { padding: 44px 0 22px; }

/* 目录：固定屏幕右侧、无卡片背景、固定宽度 */
.detail-aside {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 250px;
  z-index: 40;
}
.toc-card { font-size: 14px; max-height: 72vh; overflow-y: auto; padding: 4px 2px; }
.toc-card .toc-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .3em;
  color: var(--text-3);
  margin-bottom: 8px;
  padding-left: 12px;
}
.toc-card ul { list-style: none; }
.toc-card a {
  display: block;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-3);
  line-height: 1.55;
  border-left: 2px solid transparent;
  transition: var(--t);
  white-space: normal;
}
.toc-card a:hover { color: var(--brand); }
.toc-card a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 600; background: var(--brand-op); }
/* 屏幕不够宽时目录隐藏，正文不受挤压 */
@media (max-width: 1450px) { .detail-aside { display: none; } }

/* 正文内标题锚点偏移（吸顶导航遮挡） */
.prose h1, .prose h2, .prose h3, .prose h4 { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- 评论区（极简杂志风：无头像 · 名称突出 · 分界线清晰） ---------- */
.comments-section { margin-top: 22px; }
.comments-section .panel { padding: 24px clamp(16px, 3vw, 30px) 26px; }
.comments-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--text);
}
.comments-head h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .08em;
}
.comments-head .count { font-size: 12.5px; color: var(--text-3); font-weight: 400; }

/* 一级评论：整行分界线 */
.comment-item { padding: 16px 2px; display: flex; gap: 12px; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.cmt-main { flex: 1; min-width: 0; }
.cmt-meta { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.cmt-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: .02em;
}
.cmt-when { font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); }
.cmt-env { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.cmt-env .env-ico { display: inline-block; height: 13px; width: auto; vertical-align: -2px; margin-right: 3px; }
.cmt-content {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.cmt-actions { margin-top: 6px; }
.reply-btn {
  font-size: 12px;
  color: var(--text-3);
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  transition: var(--t);
}
.reply-btn:hover { color: var(--brand); border-color: var(--brand); }
/* 二级评论：左侧竖线缩进 */
.replies {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--brand-op);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.replies .comment-item {
  padding: 10px 0 10px 10px;
  border-bottom: 1px dashed var(--border);
}
.replies .comment-item:last-child { border-bottom: none; }
.replies .cmt-name { font-size: 13px; }
.replies .cmt-content { font-size: 13.5px; }
.comments-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 22px 0 10px;
}
.comments-empty .big { font-size: 34px; display: block; margin-bottom: 8px; }
/* 底部再写一条入口（唤起反馈抽屉） */
.cmt-more { text-align: center; padding-top: 20px; }

/* ============================================================
   列表页差异化变体
   ============================================================ */

/* ---------- 日记 · 时间轴 ---------- */
.diary-timeline { position: relative; max-width: 720px; margin: 0 auto; padding-left: 26px; }
.diary-timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: repeating-linear-gradient(180deg, var(--c-diary) 0 6px, transparent 6px 12px);
  opacity: .5;
  border-radius: 1px;
}
.timeline-month {
  position: relative;
  font-family: var(--font-kai);
  font-size: 16px;
  font-weight: 700;
  color: var(--c-diary-deep);
  margin: 26px 0 12px;
}
.timeline-month:first-child { margin-top: 0; }
.timeline-month::before {
  content: '';
  position: absolute;
  left: -26px; top: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--c-diary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-diary) 22%, transparent);
}
.timeline-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--t);
}
.timeline-item:hover { transform: translateX(4px); border-color: var(--c-diary); box-shadow: var(--shadow-card); }
.timeline-item .day {
  font-family: var(--font-kai);
  font-size: 13px;
  color: var(--text-3);
  flex-shrink: 0;
  width: 52px;
}
.timeline-item .t {
  font-family: var(--font-kai);
  font-size: 15.5px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-item:hover .t { color: var(--c-diary-deep); }
.timeline-item .views { font-size: 12px; color: var(--text-3); flex-shrink: 0; }

/* ---------- 散文 · 序号列表 ---------- */
.essay-list { max-width: 720px; margin: 0 auto; }
.essay-item {
  display: flex;
  gap: 22px;
  align-items: baseline;
  padding: 22px 8px;
  border-bottom: 1px solid var(--border);
  transition: var(--t);
}
.essay-item:last-child { border-bottom: none; }
.essay-item:hover { background: color-mix(in srgb, var(--c-essay) 5%, transparent); }
.essay-item .no {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  font-style: italic;
  color: var(--text-3);
  width: 52px;
  flex-shrink: 0;
  transition: var(--t);
}
.essay-item:hover .no { color: var(--c-essay); }
.essay-item .main { flex: 1; min-width: 0; }
.essay-item .t {
  font-family: var(--font-serif);
  font-size: 18.5px;
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.5;
}
.essay-item:hover .t { color: var(--c-essay); }
.essay-item .excerpt {
  margin-top: 6px;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.essay-item .d { margin-top: 8px; font-size: 12.5px; color: var(--text-3); letter-spacing: .1em; }

/* ---------- 诗句 · 竖排诗签墙 ---------- */
.poem-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 22px;
  max-width: 900px;
  margin: 0 auto;
}
.poem-tag-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  transition: var(--t);
  overflow: hidden;
}
.poem-tag-card::before {
  content: '';
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 42px; height: 5px;
  background: repeating-linear-gradient(45deg, rgba(179,52,46,.5) 0 5px, rgba(179,52,46,.28) 5px 10px);
  border-radius: 2px;
  opacity: .75;
}
.poem-tag-card:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: var(--shadow-card-hover); border-color: var(--c-poem); }
.poem-tag-card .vertical-lines {
  writing-mode: vertical-rl;
  height: 190px;
  font-family: var(--font-serif);
  font-size: 15.5px;
  line-height: 2;
  letter-spacing: .3em;
  color: var(--text);
  overflow: hidden;
}
.poem-tag-card:hover .vertical-lines { color: var(--c-poem); }
.poem-tag-card .pt-title {
  font-family: var(--font-brush);
  font-size: 15px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.poem-tag-card .pt-date { font-size: 11.5px; color: var(--text-3); }

/* ---------- 文章搜索 ---------- */
.search-box {
  margin: 24px auto 0;
  max-width: 460px;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 4px 6px 4px 20px;
  box-shadow: var(--shadow-card);
  transition: var(--t);
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-op); }
.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14.5px;
  color: var(--text);
  padding: 9px 0;
}
.search-box button {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  transition: var(--t);
}
.search-box button:hover { background: var(--brand-hover); }
.search-tip { margin-top: 14px; font-size: 13.5px; color: var(--text-3); }
.search-tip b { color: var(--brand); }

/* ---------- 卡内文章头 ---------- */
.post-head {
  text-align: center;
  padding: 6px 0 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
}
.post-head .cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 16px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  color: #fff;
  background: var(--cat, var(--brand));
}
.post-head .post-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 700;
  line-height: 1.45;
  margin: 16px 0 12px;
  color: var(--text);
}
.post-head .post-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- 评论区宽度对齐 ---------- */
/* 宽模式：与技术正文同位同宽（沉浸阅读布局） */
.comments-section.detail-comments {
  max-width: none;
  margin: 0;
  padding: 0 23% 40px calc(var(--fab-size) + 3vw);
}
@media (max-width: 1250px) {
  .comments-section.detail-comments { padding: 0 20px 30px; }
}
/* 窄模式：与散文/日记纸张同宽（纸张 760px） */
.comments-section.comments-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* 目录活动项更醒目 + 平滑切换 */
.toc-card a { transition: color .25s, background-color .25s, border-color .25s, padding-left .25s; }
.toc-card a.active {
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 700;
  background: var(--brand-op);
  padding-left: 14px;
}
