/* ============================================================
   SDE 学员「长文阅读」统一排版 v1
   作用域：只对加了 body.sde-read 的学员正文页生效。
   原则：统一版心、字号、行高与节奏；**一律不碰配色**——
        每位学员页面的底色与主色是它自己的身份，全部原样保留。
   ============================================================ */

/* —— 1. 版心：统一 760px，并且两侧永远留白 ——
   原来各页写死 padding:26px 24px，窗口宽度或浏览器缩放一旦逼近列宽，
   正文就贴着屏幕两边、看起来"满屏"。max() 保证任何情况下都有边距。 */
body.sde-read .wrap,
body.sde-read .w,
body.sde-read .essay,
body.sde-read .art,
body.sde-read .lead {
  width: calc(100% - 40px);   /* 永远留 20px 外边距：窗口再窄、页面再放大也不贴边 */
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* 通栏标题带（header.hero，38 页，其中 10 页带背景）：
   带子本身保持通栏——底纹不能被切断——只把里面的字收进同一条版心，
   这样标题与正文左右对齐。 */
body.sde-read header.hero {
  padding-left: max(20px, 4vw);
  padding-right: max(20px, 4vw);
}
body.sde-read header.hero > * {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* —— 2. 字号与行高：收敛到站内多数派（17.5px / 2.0）—— */
body.sde-read {
  font-size: 17.5px;
  line-height: 2.0;
  scroll-behavior: smooth;
}

/* —— 3. 段落节奏与中文断行 —— */
body.sde-read .wrap p,
body.sde-read .w p,
body.sde-read .essay p {
  margin-bottom: 20px;
  overflow-wrap: anywhere;   /* 长英文/URL 不再撑破版心 */
  text-wrap: pretty;         /* 尽量不留孤字 */
}

/* —— 4. 标题层级与锚点偏移 ——
   顶部的「长文阅读 / 在线 PDF」条是 sticky 的，
   不给 scroll-margin，点目录锚点会把标题顶到条子底下看不见。 */
body.sde-read .wrap h2,
body.sde-read .w h2,
body.sde-read .essay h2 { margin: 46px 0 18px; }
body.sde-read .wrap h3,
body.sde-read .w h3,
body.sde-read .essay h3 { margin: 32px 0 12px; }
body.sde-read h2,
body.sde-read h3,
body.sde-read h4,
body.sde-read [id] { scroll-margin-top: 72px; }
body.sde-read h2, body.sde-read h3 { text-wrap: balance; }

/* —— 5. 参考文献：统一悬挂缩进、小一号、左对齐 —— */
body.sde-read p.ref,
body.sde-read .refs p {
  font-size: 0.86em;
  line-height: 1.75;
  margin-bottom: 8px;
  text-indent: -2em;
  padding-left: 2em;
  text-align: left;
  overflow-wrap: anywhere;
}

/* —— 6. 嵌入内容不溢出（中性灰边框，深浅底都成立）—— */
body.sde-read img,
body.sde-read video,
body.sde-read iframe { max-width: 100%; height: auto; }

body.sde-read table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 0.94em;
  line-height: 1.7;
  display: block;
  overflow-x: auto;          /* 宽表格自己滚，不撑破版心 */
}
body.sde-read th,
body.sde-read td {
  border: 1px solid rgba(128, 128, 128, 0.35);
  padding: 8px 11px;
  text-align: left;
  vertical-align: top;
}
body.sde-read th { font-weight: 700; }

body.sde-read blockquote {
  margin: 22px 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid rgba(128, 128, 128, 0.45);
}

body.sde-read pre,
body.sde-read code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.9em;
}
body.sde-read pre { overflow-x: auto; padding: 14px 16px; border-radius: 4px; }

body.sde-read hr {
  border: 0;
  border-top: 1px solid rgba(128, 128, 128, 0.3);
  margin: 34px 0;
}

/* —— 7. 手机：收窄边距、略降字号 —— */
@media (max-width: 640px) {
  body.sde-read { font-size: 16.5px; line-height: 1.92; }
  body.sde-read .wrap,
  body.sde-read .w,
  body.sde-read .essay,
  body.sde-read .art,
  body.sde-read .lead { width: calc(100% - 24px); padding-left: 16px; padding-right: 16px; }
  body.sde-read .wrap h2,
  body.sde-read .w h2,
  body.sde-read .essay h2 { margin: 34px 0 14px; }
}

/* —— 8. 打印：只留正文 —— */
@media print {
  body.sde-read { background: #fff !important; color: #000 !important; font-size: 11.5pt; line-height: 1.7; }
  body.sde-read .readbar,
  body.sde-read .endbox,
  body.sde-read .tk-wrap,
  body.sde-read footer { display: none !important; }
  body.sde-read .wrap,
  body.sde-read .w,
  body.sde-read .essay { max-width: none; padding: 0; }
  body.sde-read h2, body.sde-read h3 { break-after: avoid; }
  body.sde-read p { orphans: 2; widows: 2; }
}

/* 语言开关：body 带 zh/en 类时只显示对应语言（缺了这两行，中英会并列显示） */
body.zh .en-only{display:none}
body.en .zh-only{display:none}
