/* 全局变量与版面基线 */
:root{
  --bg-ivory: #f7f4ee; /* 象牙白 */
  --deep-purple-gray: #2f2430; /* 深紫灰 */
  --muted: #6b6468;
  --accent: #3b2f3a;
  --max-width: 1280px; /* 在1120-1440之间 */
  --gutter: 24px;
  --track-width: 160px; /* 章节轨道 */
  --main-width: 820px; /* 正文目标宽度 */
  --type-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* 基础重置与色彩 */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--type-sans);
  background:var(--bg-ivory);
  color:var(--deep-purple-gray);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.6;
}

/* 报刊双层报头 */
.site-header{
  border-bottom:1px solid rgba(47,36,48,0.08);
  background:linear-gradient(to bottom, rgba(0,0,0,0.01), transparent);
}
.masthead-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px calc((100% - var(--max-width))/2 + 16px);
  color:var(--muted);
  font-size:13px;
}
.masthead-top .brand{font-weight:700}
.masthead-bottom{
  display:flex;
  justify-content:flex-start; /* 视觉识别差异：报头左对齐，正文基线不同 */
  align-items:baseline;
  padding:8px calc((100% - var(--max-width))/2 + 16px) 18px;
  border-top:1px solid rgba(47,36,48,0.03);
}
.masthead-bottom .title-line{
  font-size:20px;
  font-weight:800;
  letter-spacing:0.6px;
  color:var(--deep-purple-gray);
  margin-right:18px;
}
.masthead-bottom .subtitle{
  color:var(--muted);
  font-size:13px;
}

/* 栏目索引条 */
.index-bar{
  display:flex;
  gap:14px;
  padding:8px calc((100% - var(--max-width))/2 + 16px);
  font-size:13px;
  border-top:1px solid rgba(47,36,48,0.03);
}
.index-bar a, .index-bar span{
  color:var(--accent);
  text-decoration:none;
}
.index-bar a{font-weight:600}

/* 页内容器与栅格：桌面为三栏，正文固定约820px */
.page-wrap{padding:20px 0 40px}
.layout-grid{
  width:100%;
  max-width:var(--max-width);
  margin:0 auto;
  display:grid;
  grid-template-columns: var(--track-width) var(--main-width) 1fr;
  gap:var(--gutter);
  align-items:start;
}

/* 章节轨道（左）—— 纸刊式细窄轨道 */
.chapter-track{
  border-right:1px solid rgba(47,36,48,0.06);
  padding-right:18px;
}
.chapter-track ol{margin:0;padding:6px 0;list-style:none;color:var(--muted);font-size:13px}
.chapter-track li{padding:6px 0}

/* 主内容区 */
.content-area{padding-left:6px}
.article-head h1{
  margin:0 0 8px 0;
  font-weight:800;
  color:var(--deep-purple-gray);
  font-size:34px; /* 超大但不超两行 */
  line-height:1.08;
  max-height:2.16em; /* 约两行 */
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}

.meta-row{display:flex;gap:12px;font-size:13px;color:var(--muted);margin:8px 0}
.summary{
  margin:12px 0 18px 0;
  color:var(--muted);
  padding:8px 10px;
  border-left:3px solid rgba(47,36,48,0.06);
  background:#fff;
  max-width:880px;
}

.article-body{
  background:transparent; /* 保持纸刊式舒展正文 */
  color:var(--deep-purple-gray);
  font-size:16px;
  line-height:1.78;
}
.article-body p{margin:0 0 1em}

/* 广告容器——不悬浮、不遮盖 */
.ad{margin:20px 0;padding:8px;border:1px dashed rgba(47,36,48,0.06);background:transparent;color:var(--muted);font-size:13px}
.ad-top{margin-top:12px}

/* FAQ 无卡片 details 折叠样式 */
.faq-section{margin-top:28px}
.faq-section .section-title{font-size:18px;margin:0 0 10px 0;color:var(--accent)}
.faq-list details{margin:8px 0;padding:8px 10px;border-bottom:1px solid rgba(47,36,48,0.06)}
.faq-list summary{cursor:pointer;font-weight:600;color:var(--deep-purple-gray)}

/* 相关阅读：四列紧凑标题网格（视具体 {{related}} 填充而定） */
.related-section{margin-top:20px}
.related-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:10px;
  font-size:14px;
}
.related-grid > *{padding:8px 6px;color:var(--accent);border-top:1px solid rgba(47,36,48,0.03)}

/* 右侧留白列 */
.spare-column{min-height:20px}

/* 页脚 */
.site-footer{padding:20px 16px;border-top:1px solid rgba(47,36,48,0.04);color:var(--muted);font-size:13px;text-align:center}

/* ================== 桌面专用（>=1024px） ================== */
@media (min-width: 1024px){
  :root{--max-width:1280px}
  .masthead-bottom .title-line{font-size:22px}
  .layout-grid{grid-template-columns: var(--track-width) var(--main-width) 1fr;}
  .chapter-track{position:static;}
  .content-area{padding-left:24px}
  .article-body{font-size:17px}
  .related-grid{grid-template-columns:repeat(4, 1fr)}
}

/* ================== 平板与中宽（768px - 1023px）保持可读性 ================== */
@media (min-width:768px) and (max-width:1023px){
  :root{--max-width:960px}
  .layout-grid{grid-template-columns: 120px 1fr;}
  .chapter-track{border-right:1px solid rgba(47,36,48,0.06)}
  .related-grid{grid-template-columns:repeat(2,1fr)}
}

/* ================== 手机端（<=767px）专用 ================== */
@media (max-width: 767px){
  :root{--max-width:100%;}
  body{padding:0}
  .masthead-top, .masthead-bottom, .index-bar{padding-left:12px;padding-right:12px}
  .index-bar{overflow:auto}

  /* 将三栏折叠为单列：章节轨道变成标题下方横线 */
  .layout-grid{display:block;padding:0 12px}
  .chapter-track{border-right:none;border-bottom:1px solid rgba(47,36,48,0.06);padding:12px 0;margin-bottom:12px}
  .chapter-track ol{display:flex;gap:12px;overflow:auto}
  .chapter-track li{white-space:nowrap}

  .content-area{padding:0}
  .article-head h1{font-size:20px;line-height:1.12;max-height:2.24em}
  .summary{padding:8px;margin-right:0}
  .article-body{font-size:15px;line-height:1.7}

  /* FAQ 与相关阅读 恢复为单列 */
  .related-grid{grid-template-columns:1fr;gap:8px}

  /* 确保320px下不横向滚动 */
  html,body{overflow-x:hidden}
  .article-body img, .article-body iframe{max-width:100%;height:auto}
}

/* 可访问性与细节 */
a{color:var(--accent)}
section h2{margin:0 0 8px 0}
