/* =========================================================
   Prose — 富文本内容区统一排版层
   作用域: .post-content / .page-content
   顺序: 在 style.css 之后加载, 同特异性下覆盖全局 reset
   原则: 只管语义元素排版; htmlBlock 的内联样式优先级更高, 互不干扰
   ========================================================= */

/* ---------- 基线 ---------- */
/* 宽列补偿: 1160px 列宽下用大字号 + 疏行距保证可读性 */
:is(.post-content, .page-content) { font-size: 16px; line-height: 2.0; overflow-wrap: break-word; }
:is(.post-content, .page-content) > :first-child { margin-top: 0; }

/* ---------- 标题梯度 ---------- */
:is(.post-content, .page-content) h1 { font-size: 26px; font-weight: 700; line-height: 1.4; color: #00356b; margin: 1.6em 0 0.6em; }
:is(.post-content, .page-content) h2 {
  font-size: 22px; font-weight: 700; color: #00356b; margin: 1.6em 0 0.6em;
  padding-left: 12px; border-left: 4px solid #00356b; line-height: 1.3;
}
:is(.post-content, .page-content) h3 { font-size: 18px; font-weight: 600; line-height: 1.4; color: #00356b; margin: 1.5em 0 0.5em; }
:is(.post-content, .page-content) h4 { font-size: 16px; font-weight: 600; line-height: 1.4; color: #1e293b; margin: 1.4em 0 0.5em; }
:is(.post-content, .page-content) h5 { font-size: 15px; font-weight: 600; line-height: 1.4; color: #1e293b; margin: 1.4em 0 0.4em; }
:is(.post-content, .page-content) h6 { font-size: 14px; font-weight: 600; line-height: 1.4; color: #64748b; margin: 1.4em 0 0.4em; }

/* ---------- 段落与行内 ---------- */
:is(.post-content, .page-content) p { margin-bottom: 24px; }
:is(.post-content, .page-content) p:empty { min-height: 1em; }
:is(.post-content, .page-content) s, :is(.post-content, .page-content) del { color: #94a3b8; }
:is(.post-content, .page-content) u { text-underline-offset: 3px; }
:is(.post-content, .page-content) sub, :is(.post-content, .page-content) sup { line-height: 0; }
:is(.post-content, .page-content) kbd {
  padding: 1px 6px; border: 1px solid #cbd5e1; border-bottom-width: 2px;
  border-radius: 4px; background: #f8fafc;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.85em; color: #334155;
}
:is(.post-content, .page-content) h1 code,
:is(.post-content, .page-content) h2 code,
:is(.post-content, .page-content) h3 code,
:is(.post-content, .page-content) h4 code {
  font-size: 0.9em; background: #e8f0fe; color: #00356b;
}

/* ---------- 链接 ---------- */
:is(.post-content, .page-content) a {
  color: #1a5a9e;
  text-decoration: underline;
  text-decoration-color: rgba(26, 90, 158, 0.35);
  text-underline-offset: 3px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
:is(.post-content, .page-content) a:hover { color: #00356b; text-decoration-color: #00356b; }
:is(.post-content, .page-content) :is(h1, h2, h3, h4, h5, h6) a { text-decoration: none; }

/* ---------- 列表 ---------- */
:is(.post-content, .page-content) ul { list-style: disc outside; padding-left: 1.4em; margin: 12px 0; }
:is(.post-content, .page-content) ol { list-style: decimal outside; padding-left: 1.4em; margin: 12px 0; }
:is(.post-content, .page-content) ul ul { list-style: circle outside; margin: 4px 0 0; }
:is(.post-content, .page-content) ul ul ul { list-style: square outside; }
:is(.post-content, .page-content) ol ol { list-style: lower-alpha outside; margin: 4px 0 0; }
:is(.post-content, .page-content) ol ul, :is(.post-content, .page-content) ul ol { margin: 4px 0 0; }
:is(.post-content, .page-content) li { margin: 0; }
:is(.post-content, .page-content) li + li { margin-top: 8px; }
:is(.post-content, .page-content) li > :is(ul, ol) { padding-left: 1.3em; }
:is(.post-content, .page-content) li > p { margin-bottom: 6px; }
:is(.post-content, .page-content) li::marker { color: #64748b; }

/* 任务列表 (Tiptap TaskList) */
:is(.post-content, .page-content) ul[data-type="taskList"] {
  list-style: none; padding-left: 0.2em; margin: 12px 0;
}
:is(.post-content, .page-content) ul[data-type="taskList"] li {
  display: flex; align-items: flex-start; gap: 8px;
}
:is(.post-content, .page-content) ul[data-type="taskList"] li + li { margin-top: 6px; }
:is(.post-content, .page-content) ul[data-type="taskList"] li > label {
  flex-shrink: 0; margin-top: 4px; user-select: none;
}
:is(.post-content, .page-content) ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
:is(.post-content, .page-content) input[type="checkbox"] { accent-color: #00356b; }

/* ---------- 引用块 ---------- */
:is(.post-content, .page-content) blockquote {
  margin: 20px 0; padding: 10px 18px;
  border-left: 3px solid #1a5a9e;
  background: #f5f8fc; border-radius: 0 6px 6px 0;
  color: #475569;
}
:is(.post-content, .page-content) blockquote p { margin-bottom: 8px; }
:is(.post-content, .page-content) blockquote p:last-child { margin-bottom: 0; }
:is(.post-content, .page-content) blockquote > :last-child { margin-bottom: 0; }

/* ---------- 分割线 ---------- */
:is(.post-content, .page-content) hr {
  border: none; height: 1px; background: #e2e8f0; margin: 2em 0;
}

/* ---------- 图片 ---------- */
:is(.post-content, .page-content) figure { margin: 20px 0; text-align: center; }
:is(.post-content, .page-content) figcaption { font-size: 13px; color: #94a3b8; margin-top: 8px; }

/* ---------- 表格补充 (表格基础样式在 style.css) ---------- */
:is(.post-content, .page-content) table code { white-space: nowrap; }
:is(.post-content, .page-content) :is(td, th) > :last-child { margin-bottom: 0; }
:is(.post-content, .page-content) :is(td, th) > :first-child { margin-top: 0; }
@media (max-width: 640px) {
  :is(.post-content, .page-content) table { display: block; overflow-x: auto; }
}

/* ---------- 中文排版 (CJK) ---------- */
/* 正文两端对齐, 避免中英混排的锯齿右边缘 */
:is(.post-content, .page-content) { text-align: justify; }
/* 段落首行缩进两字 — 仅正文直属段落, 列表/引用/表格内不缩进 */
:is(.post-content, .page-content) > p { text-indent: 2em; }
:is(.post-content, .page-content) :is(li, blockquote, td, th) p { text-indent: 0; }
/* 段落以图片/嵌入开头时不缩进 (text-indent 会推移行内元素) */
:is(.post-content, .page-content) > p:has(> img:first-child),
:is(.post-content, .page-content) > p:has(> iframe:first-child) { text-indent: 0; }
