/* ============================================================
 * Moliere · Wyckoff 教科书 V2 · Magazine 增强层
 *
 * 这一层在 layout / components / schematic 之上叠加：
 *   1. 章节扉页（cover）拍照感重塑：巨数字 + 红线脊柱 + 多列元信息
 *   2. 章节正文阅读节奏：drop-cap 升级、双栏正文、栏间分割线
 *   3. block 单元杂志化：浮动 figure、bleed 大图、侧栏 pull-quote
 *   4. dim-list 双栏排版（≥1280 时分成 2×2 矩阵，密度更杂志）
 *   5. Schematic 区块铆钉感 caption + 杂志式上下分割线
 *   6. callout / pull-quote spot color 强化
 *   7. 章节末「Editor's Note」编辑寄语条
 *
 * 兼容性：不破坏已有 class / verify.mjs 像素白名单
 * ============================================================ */

/* ─── 1. CHAPTER COVER：杂志感重塑 ─────────────────────────── */

/* 让封面区域更像跨页大版：背景 ink-200 浅褐纸 + 上下双红线脊柱 */
.chapter-cover {
  background:
    linear-gradient(180deg, var(--ink-100) 0%, var(--ink-200) 100%);
  padding-top: var(--space-7);
  padding-bottom: var(--space-6);
  overflow: hidden;
}

/* 巨数字背后的水印数字（半透明 outline，撑住右下角） */
.chapter-cover::after {
  content: attr(data-cover-num);
  position: absolute;
  right: var(--grid-margin);
  bottom: -36px;
  font-family: var(--font-display);
  font-size: var(--t-display-xl);
  font-weight: var(--w-medium);
  line-height: 1;
  letter-spacing: var(--tracking-display);
  color: transparent;
  -webkit-text-stroke: 1px rgba(196, 18, 32, 0.18);
  text-stroke: 1px rgba(196, 18, 32, 0.18);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* 顶部红线下方再加一条窄红 ribbon，做杂志「期号」感 */
.chapter-cover .cover-eyebrow {
  position: relative;
  padding-left: var(--space-3);
}
.chapter-cover .cover-eyebrow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 24px;
  height: 2px;
  background: var(--red-press);
  transform: translateY(-50%);
}

/* 巨数字加 red drop shadow + 上限红线 */
.chapter-cover .cover-number {
  position: relative;
  z-index: 1;
  text-shadow: 1px 0 0 rgba(196, 18, 32, 0.06);
}

.chapter-cover .cover-title {
  position: relative;
  z-index: 1;
}

/* 大标题侧加一条「副 ribbon」（仿杂志侧标） */
.chapter-cover .cover-title::after {
  content: "";
  display: block;
  width: 96px;
  height: 4px;
  background: var(--red-press);
  margin-top: var(--space-3);
}

/* lead 段也加 italic + 左侧细线 */
.chapter-cover .cover-lead {
  position: relative;
  padding-left: var(--space-4);
  border-left: 1px solid var(--red-press);
}

/* cover-meta 加边框 + 微 watermark */
.chapter-cover .cover-meta {
  border-top: 2px solid var(--ink-900);
  padding-top: var(--space-3);
  position: relative;
  z-index: 1;
}

.chapter-cover .cover-meta dt {
  font-family: var(--font-mono);
  color: var(--red-press);
}

.chapter-cover .cover-foot {
  border-top: 1px solid var(--red-press);
}

.cover-brand-lockup {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  color: var(--ink-900);
}

.cover-brand-lockup > span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--ink-900);
  padding: 0 var(--space-2);
  font-size: 13px;
  font-weight: var(--w-semibold);
  letter-spacing: 0;
  background: rgba(251, 250, 247, 0.72);
}

.cover-brand-lockup > span:first-child {
  border-color: var(--red-press);
  background: var(--red-press);
  color: var(--ink-100);
}

.cover-brand-lockup + span {
  font-family: var(--font-mono);
  color: var(--ink-700);
  letter-spacing: 0;
}

/* ─── 2. LEAD · 章节首段升级 ─────────────────────────────── */

/* drop cap 更大 + 红色脊柱 + 仅章节首段使用 */
.chapter-lead .lead--drop {
  font-family: var(--font-display);
  font-size: var(--t-lead);
  line-height: 1.55;
  color: var(--ink-700);
  position: relative;
  padding-left: 0;
}

.chapter-lead .lead--drop::first-letter {
  font-family: var(--font-display);
  font-size: 168px;
  font-weight: var(--w-medium);
  line-height: 0.85;
  float: left;
  padding: 14px 18px 0 0;
  color: var(--red-press);
  letter-spacing: var(--tracking-display);
}

/* 章节首段下面加一条红色 hairline */
.chapter-lead {
  position: relative;
}
.chapter-lead::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--grid-gap);
  right: var(--grid-gap);
  height: 2px;
  background: var(--red-press);
  opacity: 0.5;
}

/* ─── 3. BLOCK · 块单元杂志化 ──────────────────────────── */

/* block 顶部分割线由细 1px 升为 2px（更杂志） */
.block {
  border-top-width: 2px;
  padding: var(--space-5) 0;
}

/* block-meta sticky 增加杂志「期 + 节」徽章 */
.block-meta {
  padding-top: var(--space-2);
  border-top: 2px solid var(--red-press);
  margin-top: -2px;
}

.block-meta-id {
  font-size: 13px;
  letter-spacing: 0.1em;
  border: 1px solid var(--red-press);
  padding: 2px 6px;
  display: inline-block;
  background: var(--ink-100);
}

/* block-aside 升级成杂志侧栏：italic serif + 上下 hairline */
.block-aside {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--t-meta);
  border-left: 0;
  padding-left: 0;
  position: relative;
}

.block-aside::before {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--red-press);
  margin-bottom: var(--space-2);
}

/* block-title 加 kicker（在 title 上方插入一条小标） */
.block-title {
  margin-top: 0;
}

/* ─── 4. DIM-LIST · 五维列表杂志矩阵 ──────────────────── */

/* 在大屏上把五维列表分成 2×2 矩阵（更密、更杂志感）。
   注意：当条目数 ≥ 4 才视觉到位；少时退回单列。 */
@media (min-width: 1280px) {
  .dim-list {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-4);
  }
  .dim-list > li {
    background: var(--ink-100);
    padding: var(--space-3);
    border-left-width: 3px;
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  .dim-list > li::before {
    padding-top: 0;
    font-size: var(--t-micro);
    border-bottom: 1px solid var(--ink-300);
    padding-bottom: 4px;
    margin-bottom: 2px;
  }
}

/* ─── 5. SCHEMATIC · 图说杂志化 ──────────────────────── */

/* 容器外加一条上下红 hairline（杂志「图说带」） */
.schematic {
  position: relative;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--red-press);
  border-bottom: 1px solid var(--red-press);
}

.schematic-svg {
  border: 1px solid var(--ink-700);
}

/* caption 字号略大 + 与图说之间加 hairline */
.schematic-caption {
  border-top: 2px solid var(--ink-900);
  padding-top: var(--space-2);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: baseline;
}

.schematic-num {
  font-size: 12px;
  padding: 2px 8px;
  background: var(--red-press);
  color: var(--ink-100);
  border-radius: 0;
}

.schematic-title {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  line-height: 1.15;
  color: var(--ink-900);
  font-weight: var(--w-semibold);
}

.schematic-deck {
  grid-column: 1 / -1;
  font-style: italic;
  font-size: var(--t-caption);
  color: var(--ink-600);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--ink-300);
}

/* 读图四问框升级：杂志「编辑提问」感 */
.schematic-read {
  background: var(--ink-100);
  border: 1px solid var(--ink-900);
  border-left: 4px solid var(--red-press);
  position: relative;
  padding: var(--space-4);
}

.schematic-read::before {
  content: "读图四问 · Editor's Read";
  position: absolute;
  top: -10px;
  left: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--t-micro);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--ink-100);
  background: var(--red-press);
  padding: 2px 8px;
}

.schematic-read-q {
  font-family: var(--font-mono);
  color: var(--red-press);
  font-size: var(--t-micro);
}

.schematic-read-a {
  font-family: var(--font-serif);
  font-size: var(--t-meta);
  color: var(--ink-700);
}

/* ─── 6. PULL-QUOTE · 杂志拉引言 ─────────────────────── */

/* pull-quote 红色 spot 背景 + 大引号 */
.pullquote {
  position: relative;
  padding: var(--space-5) var(--space-4);
  border-top: 4px solid var(--red-press);
  border-bottom: 4px solid var(--red-press);
  background: var(--ink-100);
}

.pullquote::before {
  content: "\201C";
  position: absolute;
  top: -28px;
  left: var(--space-3);
  font-family: var(--font-display);
  font-size: 96px;
  line-height: 1;
  color: var(--red-press);
  font-weight: var(--w-medium);
  background: var(--ink-100);
  padding: 0 var(--space-2);
}

.pullquote p {
  font-family: var(--font-display);
  font-size: var(--t-quote);
  line-height: 1.25;
  color: var(--ink-900);
  font-weight: var(--w-medium);
}

/* ─── 7. CALLOUT · spot color 强化 ───────────────────── */

/* Wyckoff 锚点 callout 升级：左侧 6px 红条 + 顶部 hairline + 标签徽章 */
.callout--wyckoff {
  background: linear-gradient(180deg, rgba(196, 18, 32, 0.04) 0%, var(--ink-100) 60%);
  border: 1px solid var(--red-press);
  border-left-width: 6px;
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  position: relative;
}

.callout--wyckoff::after {
  content: "";
  position: absolute;
  top: 0;
  left: var(--space-5);
  right: var(--space-4);
  height: 2px;
  background: var(--red-press);
}

/* ─── 8. SECTION 标题升级：杂志「期 + 节」感 ──────────── */

.section-head {
  position: relative;
  border-bottom: 0;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
}

.section-head::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background:
    linear-gradient(90deg, var(--red-press) 0%, var(--red-press) 80px, var(--ink-300) 80px, var(--ink-300) 100%);
}

.section-num {
  font-family: var(--font-mono);
  background: var(--ink-900);
  color: var(--ink-100);
  padding: 2px 8px;
  width: max-content;
  height: max-content;
  align-self: start;
}

.section-title {
  letter-spacing: -0.025em;
  font-weight: var(--w-semibold);
}

.section-deck {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--t-lead);
  color: var(--ink-600);
}

/* ─── 9. KEY TAKEAWAYS · 章节摘要杂志化 ─────────────── */

.takeaways {
  background: var(--ink-100);
  border-top: 4px solid var(--red-press);
  border-bottom: 4px solid var(--red-press);
  padding: var(--space-5) var(--space-4);
  margin: var(--space-6) 0 var(--space-5) 0;
  position: relative;
}

.takeaways::before {
  content: "Key Takeaways";
  position: absolute;
  top: -14px;
  left: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--t-meta);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--ink-100);
  background: var(--red-press);
  padding: 4px 12px;
}

.takeaways-label {
  display: none; /* 用 ::before 上位替换 */
}

.takeaways {
  grid-template-columns: 1fr;
}

.takeaways-list {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  line-height: 1.35;
  color: var(--ink-900);
  font-weight: var(--w-medium);
}

.takeaways-list > li::before {
  content: "→";
  color: var(--red-press);
  font-family: var(--font-mono);
  font-weight: var(--w-semibold);
}

/* ─── 10. CHAPTER NAV · 章节末导航杂志化 ─────────────── */

.chapter-nav {
  border-top: 0;
  padding-top: var(--space-5);
  margin-top: var(--space-6);
  position: relative;
}

.chapter-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--red-press);
}

.chapter-nav-link {
  background: var(--ink-100);
  border: 1px solid var(--ink-900);
  padding: var(--space-4);
  transition: background var(--tx-fast), color var(--tx-fast), border-color var(--tx-fast);
  position: relative;
}

.chapter-nav-link:hover {
  background: var(--ink-900);
  color: var(--ink-100);
  border-color: var(--red-press);
}

.chapter-nav-link:hover .chapter-nav-title {
  color: var(--ink-100);
}

.chapter-nav-link:hover .chapter-nav-eyebrow {
  color: var(--ink-100);
}

.chapter-nav-eyebrow {
  font-family: var(--font-mono);
  font-weight: var(--w-semibold);
  letter-spacing: 0.1em;
}

.chapter-nav-title {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
}

/* ─── 11. FOOTNOTES · 杂志「编辑注脚」 ──────────────── */

.footnotes {
  border-top: 4px solid var(--ink-900);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 22px,
      rgba(20, 17, 13, 0.03) 22px,
      rgba(20, 17, 13, 0.03) 44px
    );
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.footnotes-title {
  font-family: var(--font-mono);
  font-size: var(--t-meta);
  color: var(--red-press);
}

/* ─── 12. ANIMATION READY HELPERS ────────────────────── */

/* Only reserve compositor layers when the optional animation runtime is active. */
html.anim-enabled [data-anim] {
  will-change: opacity, transform;
}

/* 给 GSAP 关闭 / reduced-motion 时强制可见 */
@media (prefers-reduced-motion: reduce) {
  html.anim-enabled [data-anim] {
    opacity: 1 !important;
    transform: none !important;
    will-change: auto;
  }
}

/* ─── 13. EDITOR'S CALLOUT · 杂志编辑寄语 ──────────── */

.editor-note {
  grid-column: 3 / span 7;
  border-top: 2px solid var(--ink-900);
  border-bottom: 2px solid var(--ink-900);
  padding: var(--space-4) 0;
  margin: var(--space-5) 0;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--space-4);
}

.editor-note-label {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--red-press);
}

.editor-note-body {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--t-body);
  line-height: var(--lh-relaxed);
  color: var(--ink-700);
}

/* ─── 14. INDEX / TOPBAR 配套精修 ─────────────────── */

.topbar {
  height: 60px;
  border-bottom: 2px solid var(--ink-900);
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--red-press);
}

/* TOC 红 hairline 标记 */
.toc {
  border-right: 1px solid var(--ink-900);
}

.toc-eyebrow {
  border-bottom: 2px solid var(--red-press);
  padding-bottom: var(--space-2);
}

@media (max-width: 640px) {
  .chapter-body {
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
  }

  .chapter-body > * {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: 100%;
  }

  .chapter-lead,
  .section,
  .section-head,
  .block,
  .chapter-nav {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
  }

  .chapter-lead-meta,
  .chapter-lead-text,
  .section-num,
  .section-title,
  .section-deck,
  .block-meta,
  .block-title,
  .block-body,
  .block-aside {
    grid-column: 1 / -1;
  }

  .chapter-nav-prev,
  .chapter-nav-next,
  .chapter-nav .cta-btn {
    justify-content: center;
    white-space: normal;
    text-align: center;
    width: 100%;
  }

  .cover-brand-lockup {
    grid-auto-flow: row;
    gap: var(--space-1);
    width: 100%;
  }

  .cover-brand-lockup > span {
    justify-content: center;
    width: 100%;
  }
}

/* ─── 15. PRINT 兼容（避免动画样式破坏 PDF 输出） ──── */

@media print {
  .chapter-cover::after,
  .chapter-cover .cover-title::after,
  .schematic-read::before,
  .takeaways::before,
  .topbar::after { display: none; }
}
