/* ──────────────────────────────────────────────────────────────
   blog.css —— /blog/ 内容区专用。只被 build_blog.py 生成的页面引用，
   不影响任何现有页面。改这个文件后要同步改 build_blog.py 里的
   CSS_VERSION（生成页面的 ?v= 参数），否则客户拿到旧缓存。
   变量沿用 style.css 的 :root，不重复定义。
   ────────────────────────────────────────────────────────────── */

/* 顶部导航条：.site-nav 是白字，必须坐在深色底上 */
.nav-bar { background: var(--dark-bg); }
.site-nav .nav-links a.on { color: var(--neon); }

/* ⚠️ style.css 里有一条裸 `header { display:flex; justify-content:space-between }`，
   会命中本页所有 <header>，把标题/分类/日期排成一行。这里显式改回块级。
   （改动只作用于 blog.css 引用的页面，不影响任何现有页面。） */
.blog-hero, .contact-hero, .post-head { display: block; }
.blog-hero, .contact-hero { margin-bottom: 0; }
/* .post-head 的 margin-bottom 在下面单独给，靠后写覆盖 style.css 的 32px */

/* ── 列表页 Hero ── */
.blog-hero {
  background: var(--dark-bg);
  border-bottom: 1px solid var(--dark-border);
  padding: 56px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.blog-hero::before {
  content: "";
  position: absolute;
  top: -160px; left: 50%;
  transform: translateX(-50%);
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(57,255,20,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.blog-hero h1 {
  position: relative;
  margin: 0 0 14px;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.blog-hero p {
  position: relative;
  margin: 0 auto;
  max-width: 620px;
  color: rgba(255,255,255,0.55);
  font-size: 0.95rem;
  line-height: 1.9;
}
.cat-line {
  position: relative;
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.cat-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.6);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 0.8rem;
}
.cat-chip b { color: var(--neon); font-weight: 700; margin-left: 4px; }

/* ── 列表页卡片 ── */
.blog-list {
  max-width: 960px;
  margin: 0 auto;
  padding: 44px 16px 72px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  align-items: start;
}
.blog-list .empty {
  grid-column: 1 / -1;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  font-size: 0.92rem;
}
.blog-list .empty strong { display: block; color: #0f1419; font-size: 1.05rem; margin-bottom: 10px; }
.blog-list .empty p { margin: 0; line-height: 1.9; }
.post-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  border-color: #cdd4da;
  text-decoration: none;
}
.pc-cat {
  display: inline-block;
  background: rgba(22,163,74,0.09);
  color: var(--primary);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.post-card h2 {
  margin: 0 0 10px;
  font-size: 1.06rem;
  font-weight: 800;
  line-height: 1.5;
  color: #111827;
  letter-spacing: -0.01em;
}
.post-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.75;
}
.pc-meta { color: #8b949e; font-size: 0.78rem; }

/* ── 文章页 ── */
.post-wrap { max-width: 720px; margin: 0 auto; padding: 28px 20px 80px; }

.crumbs { font-size: 0.8rem; color: var(--muted); margin-bottom: 26px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs span { color: #9aa3ac; }

.post-head { border-bottom: 1px solid var(--border); padding-bottom: 24px; margin-bottom: 30px; }
.post-cat {
  display: inline-block;
  background: rgba(22,163,74,0.09);
  color: var(--primary);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.post-head h1 {
  margin: 0 0 14px;
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: -0.03em;
  color: #0f1419;
}
.post-meta { color: #8b949e; font-size: 0.83rem; }

/* 目录 */
.post-toc {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
  padding: 18px 22px;
  margin-bottom: 34px;
}
.post-toc .toc-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.post-toc ol { margin: 0; padding-left: 20px; }
.post-toc li { margin: 5px 0; font-size: 0.88rem; }
.post-toc a { color: #3d4650; }

/* 正文排版 */
.post-body { font-size: 1.02rem; line-height: 1.95; color: #24292f; }
.post-body h2 {
  margin: 46px 0 16px;
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f1419;
  scroll-margin-top: 20px;
}
.post-body h3 {
  margin: 34px 0 12px;
  font-size: 1.08rem;
  font-weight: 800;
  color: #0f1419;
  scroll-margin-top: 20px;
}
.post-body h4 { margin: 26px 0 10px; font-size: 0.98rem; font-weight: 700; }
.post-body p { margin: 0 0 20px; }
.post-body ul, .post-body ol { margin: 0 0 20px; padding-left: 24px; }
.post-body li { margin: 7px 0; }
.post-body strong { font-weight: 700; color: #0f1419; }
.post-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.post-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

.post-body blockquote {
  margin: 0 0 22px;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
}
.post-body blockquote p { margin: 0; }

.post-body code {
  background: #eef1f4;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #b42318;
}
.post-body pre {
  background: var(--dark-bg);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 22px;
}
.post-body pre code {
  background: none;
  color: #e6edf3;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.7;
}

/* 表格：窄屏横向滚动，页面本身不横向滚 */
.table-scroll { overflow-x: auto; margin: 0 0 22px; -webkit-overflow-scrolling: touch; }
.post-body table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 0.9rem; }
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
.post-body th { background: #f6f8fa; font-weight: 700; white-space: nowrap; }

/* 标签 */
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 0; }
.post-tags .tag {
  background: #f1f3f5;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 11px;
  font-size: 0.78rem;
}

/* 广告位：ADSENSE_CLIENT 为空时不会生成这个容器 */
.ad-slot {
  margin: 40px 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 90px;
}
.ad-slot::before {
  content: "广告";
  display: block;
  font-size: 0.68rem;
  color: #b0b7bd;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

/* 作者卡 —— E-E-A-T 的落点，每篇都有 */
.author-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin: 40px 0 0;
}
.author-avatar {
  flex: 0 0 48px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--dark-bg);
  color: var(--neon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
}
.author-name { font-weight: 800; font-size: 0.98rem; margin-bottom: 6px; color: #0f1419; }
.author-info p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.8; }

/* 文末 CTA */
.post-cta {
  background: var(--dark-bg);
  border: 1px solid var(--dark-border);
  border-radius: 18px;
  padding: 32px 26px;
  text-align: center;
  margin: 24px 0 0;
}
.post-cta h3 { margin: 0 0 8px; color: #fff; font-size: 1.15rem; font-weight: 800; }
.post-cta p { margin: 0 0 18px; color: rgba(255,255,255,0.55); font-size: 0.88rem; }
.post-cta .wx {
  display: inline-block;
  background: rgba(57,255,20,0.08);
  border: 1px solid rgba(57,255,20,0.3);
  border-radius: 10px;
  padding: 11px 22px;
  color: var(--neon);
  font-weight: 800;
  font-family: ui-monospace, monospace;
  font-size: 0.98rem;
}

/* 上一篇 / 下一篇 */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.post-nav .pn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  text-decoration: none;
  color: #24292f;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.6;
  transition: border-color 0.15s;
}
.post-nav .pn:hover { border-color: var(--primary); text-decoration: none; }
.post-nav .pn span { display: block; color: #9aa3ac; font-size: 0.76rem; font-weight: 400; margin-bottom: 5px; }
.post-nav .next { text-align: right; }
.post-nav .pn.next:only-child { grid-column: 2; }

/* ── 移动端 ── */
@media (max-width: 640px) {
  .site-nav { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
  .site-nav .nav-links a { margin-left: 0; margin-right: 14px; }
  .blog-hero { padding: 40px 18px 36px; }
  .blog-hero h1 { font-size: 1.55rem; }
  .blog-list { padding: 30px 14px 56px; gap: 14px; grid-template-columns: 1fr; }
  .post-card { padding: 20px; }
  .post-wrap { padding: 20px 16px 60px; }
  .post-head h1 { font-size: 1.42rem; }
  .post-body { font-size: 1rem; }
  .post-body h2 { font-size: 1.18rem; margin-top: 36px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .post-nav .pn.next:only-child { grid-column: 1; }
  .author-card { flex-direction: column; }
}

/* ── 列表页封面缩略图 ── */
.post-card .pc-thumb {
  display: block;
  width: calc(100% + 48px);
  margin: -24px -24px 18px;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
  background: var(--dark-bg);
}

/* ── FAQ（GEO：AI 摘录优先命中问答结构） ── */
.post-faq { margin: 44px 0 0; }
.post-faq h2 {
  margin: 0 0 18px;
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f1419;
  scroll-margin-top: 20px;
}
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.faq-item > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.98rem;
  color: #0f1419;
  list-style: none;
  position: relative;
  padding-right: 28px;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "＋";
  position: absolute;
  right: 0; top: 0;
  color: var(--primary);
  font-weight: 700;
}
.faq-item[open] > summary::after { content: "－"; }
.faq-item > div {
  margin-top: 12px;
  color: #24292f;
  font-size: 0.94rem;
  line-height: 1.9;
}
.faq-item > div a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 640px) {
  .post-card .pc-thumb { width: calc(100% + 40px); margin: -20px -20px 16px; }
}
