/* ============================================================
   详情页样式（story_detail/*）与教育领域页（education.html）
   布局基准取自原站探测值：
   - 正文区背景 #f4f4f4，白色内容卡 1040px 居中（内边距 30/0/100）
   - 标题与正文列宽 890px 居中，标题 22px/700 居中
   - 正文 16px/32px，#1c1d1f，段落两端对齐；图片最大 100%
   ============================================================ */

/* ----------------------- 详情正文 ----------------------- */
.detail-sec {
  background: #f4f4f4;
  padding: 80px 0 80px;
}

.detail-card {
  width: 1040px;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  padding: 30px 0 100px;
}

.detail-title {
  max-width: 890px;
  margin: 0 auto;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  color: #1c1d1f;
  text-align: center;
}

.detail-content {
  max-width: 890px;
  margin: 60px auto 0;
  font-size: 16px;
  line-height: 32px;
  color: #1c1d1f;
}

.detail-content p {
  margin: 0;
  text-align: justify;
  word-break: break-word;
  /* 原站正文段落首行缩进两字符（实测 19px 字号 → 38px，2em 随字号缩放） */
  text-indent: 2em;
}

/* 段内独占一行的媒体（图片所在段）不应被缩进顶歪：
   原站靠 text-indent 只作用于首行文本，纯图片段落同样缩进 38px，保持一致即可 */

/* 松散 img（不在 figure 里、随微信/秀米富文本导出的图）：
   原站 preview.css 对它们没有任何宽高约束——不缩放，保持原尺寸；
   超宽图（实测 960px）溢出文字列，由所在 P 的行内 overflow-y:auto
   （计算后 overflow-x 也为 auto）提供段内横向滚动，这是原站的真实行为。
   注意不要加 max-width:100%，否则 960px 原图会被压成 890 满宽。

   display 必须是 block：原站实测同一页首图 display=block、x=0，
   而 inline 会吃到段落的 text-indent:38px 被推右 38px（实测差异）。
   块级 + margin:auto 居中，宽度小于列宽时 x=(列宽-w)/2，
   宽度大于列宽时 auto 边距按规范退化为 0，x=0 —— 两种情形都与原站吻合。 */
.detail-content img {
  height: auto;
  display: block;
  margin: 0 auto;
  /* 用 revert 而不是 auto：auto 会把 HTML 的 width 属性（表现属性）
     一并覆盖掉（原站有 width="553" 的图，必须让它生效） */
  width: revert;
}

/* CKEditor figure 图片：原站 .image 是 display:table（宽度 shrink-to-fit，
   由图片自身宽度决定），配合 margin auto 居中；image_resized 才改成 block
   + 内联百分比宽度。此前缺 display:table，所有图被撑成 890 满宽。 */
.detail-content figure.image {
  display: table;
}

.detail-content figure.image.image_resized {
  display: block;
}

.detail-content figure.image img {
  display: block;
  margin: 0 auto;
  min-width: 100%;
}

.detail-content figure.image_resized img {
  /* 原站 .image_resized img { width:100% }：图片填满 figure 的百分比宽度 */
  width: 100%;
}

/* CKEditor 浮动侧图（--ck-image-style-spacing 默认 1.5em）。
   注意：这类 class 也可能直接挂在 img 上（不包 figure），
   浮动元素不受段落 text-indent 影响，缺了就会比原站右移一个缩进。 */
.detail-content img.image-style-align-left,
.detail-content figure.image-style-align-left {
  float: left;
  margin-right: 1.5em;
}

.detail-content img.image-style-align-right,
.detail-content figure.image-style-align-right {
  float: right;
  margin-left: 1.5em;
}

.detail-content img.image-style-side,
.detail-content figure.image-style-side {
  float: right;
  margin-left: 1.5em;
  max-width: 50%;
}

/* 原站 .image.image_resized（双类）优先级高于 .image-style-side（单类），
   所以带 image_resized 的侧图 max-width 回到 100%、实际满宽显示 */
.detail-content figure.image_resized {
  max-width: 100%;
}

.detail-content video {
  width: 100%;
  /* 不要写 aspect-ratio:16/9。原站视频按自身比例撑开：
     北大魂三部曲是 1080x1920 竖版，原站实测 890x1582；
     强制 16:9 会把它压成 890x501 的横条，画面严重变形。 */
  height: auto;
  display: block;
  background: #000;
}

.detail-content figure {
  /* 原站只重置 .image / .media 的 margin，无 class 的 <figure>
     仍用浏览器默认 1em 40px（实测 x=40、宽=列宽-80）。
     我们的全局 *{margin:0} 把它清掉了，这里按 UA 默认值补回。 */
  margin: 1em 40px;
  max-width: 100%;
  box-sizing: border-box;
}

/* 原站 CKEditor 规则：
   .image { margin:.9em auto }  → 上下 14.4px、左右 auto（块级水平居中）
   .media { margin:.9em 0 }     → 上下 14.4px、左右 0 */
.detail-content figure.image {
  margin: 0.9em auto;
}

.detail-content figure.media {
  margin: 0.9em 0;
}

.detail-content figure img {
  /* 原站 .image_resized img { width: 100% }：图片填满 figure 的百分比宽度 */
  width: 100%;
}

/* 观看更多视频（每个详情页底部的浅蓝引导条） */
.detail-more {
  max-width: 890px;
  margin: 90px auto 0;
  background: #f7f8fe;
  padding: 32px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.detail-more p {
  margin: 0;
  font-size: 16px;
  color: #333;
  text-align: center;
}

.detail-more img {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}

/* 相关栏目：仅移动端展示（原站行为） */
.detail-cat {
  display: none;
}

/* ----------------------- 教育领域页 ----------------------- */
.edu-main {
  background: #f4f4f4;
  padding: 80px 0 60px;
}

.edu-sec + .edu-sec {
  margin-top: 47px;
}

.edu-band {
  width: 1200px;
  max-width: calc(100% - 40px);
  margin: 0 auto;
  background: #fff;
  padding: 60px 60px 55px;
}

.edu-page-title {
  margin: 0 0 30px;
  font-size: 22px;
  font-weight: 700;
  color: #333;
}

.edu-sec-name {
  margin: 40px 0 45px;
  font-size: 20px;
  font-weight: 700;
  color: #1c1d1f;
  text-align: center;
}

.edu-sec-name img {
  display: inline-block;
  height: 44px;
  vertical-align: -12px;
  margin-right: 14px;
}

.edu-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 76px;
}

.edu-card {
  background: #f7f8fe;
  border-radius: 8px;
  padding: 20px 24px 23px;
}

.edu-card-title {
  margin: 0;
  padding-left: 20px;
  position: relative;
  font-size: 18px;
  font-weight: 700;
  color: #1c1d1f;
}

.edu-card-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5f8cff;
}

.edu-card-body {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 24px;
  color: #666;
  text-align: justify;
}

/* ----------------------- 移动端 ----------------------- */
@media (max-width: 768px) {
  .detail-sec {
    padding: 50px 0 50px;
  }

  .detail-card {
    width: auto;
    margin: 0;
    padding: 30px 20px 60px;
  }

  .detail-title {
    max-width: none;
    font-size: 22px;
    line-height: 33px;
  }

  .detail-content {
    max-width: none;
    margin-top: 30px;
    line-height: 24px;
  }

  /* 原站移动端：figure 内的图一律满宽（实测 1902 页 19 张全为 0/350）。
     桌面用 display:table 让窄图保持原始宽度，移动端必须收回列宽，
     否则 800/475 宽的图会撑出横向滚动（实测 scrollWidth 502 > 390）。
     CKEditor 输出的图文带内联 style="width:475px"，普通声明压不住，
     原站同样靠 !important 级别规则收回（实测原站 350、本地曾 475）。 */
  .detail-content figure.image {
    display: block;
  }

  .detail-content figure.image img {
    width: 100% !important;
    min-width: 0;
  }

  /* 原站移动端松散图回到 inline（实测 x=32/38，正好等于段落 text-indent:2em），
     而桌面是 block 且 x=0 —— 这是原站自带的断点差异，不能全局写死。
     另外 inline 内容溢出父级时不会扩展文档 scrollWidth（实测原站恒 390），
     超宽图由 <p> 的 overflow-y:auto 或 body 的 overflow-x:hidden 收边；
     若保留 block，863px 的图会把 scrollWidth 撑到 883（实测）。 */
  .detail-content img {
    display: inline;
    margin: 0;
  }

  /* 注意：松散图（不在 figure 内、直接躺在 <p> 里的）**不要**夹宽度。
     原站那类图保持原始尺寸（实测 960/863/553），由段落横向滚动或
     body 裁切收边。曾在此处加过全局 max-width:100%，把 960 压成 350，与原站不符。 */

  .detail-more {
    max-width: none;
    margin-top: 60px;
    padding: 24px 20px;
    flex-wrap: wrap;
    gap: 16px;
  }

  .detail-more p {
    font-size: 15px;
  }

  .detail-cat {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 22px 20px 12px;
  }

  .detail-cat a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 12px;
    background: #f7f8fa;
    border-radius: 4px;
    font-size: 14px;
    color: #1c1d1f;
    text-align: center;
  }

  .edu-main {
    padding: 50px 0 40px;
  }

  .edu-sec + .edu-sec {
    margin-top: 30px;
  }

  .edu-band {
    max-width: calc(100% - 40px);
    padding: 40px 20px 40px;
  }

  .edu-page-title {
    font-size: 19px;
  }

  .edu-sec-name {
    font-size: 19px;
  }

  .edu-sec-name img {
    height: 38px;
    margin-right: 10px;
  }

  .edu-cards {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
