/*
 * 官网文章正文样式。将发布的 HTML 放在 .tiptap-article 容器内。
 *
 * | 正文元素 | Tiptap 编辑器里的样式 |
 * | --- | --- |
 * | 正文、段落 | 苹方 / 微软雅黑，字号 `14px`，行高 `24px`，文字色 `#32324d`，段落下方 `10px` |
 * | 标题 | H1 `32px`、H2 `22px`、H3 `16px`，字重都是 `600`，各级标题有独立的上下间距 |
 * | 有序、无序列表 | 数字或圆点，左缩进 `24px`，行高 `30px`，列表符号为紫色 `#623bff` |
 * | 引用块 | 浅紫底 `#f8f6ff`，左侧 `3px` 紫色竖线，右侧 `7px` 圆角 |
 * | 图片 | 居中，最大宽度 `100%`，等比缩放，上下间距 `16px`，圆角 `8px` |
 * | 链接、引用来源标记 | 链接为 `#5f55d6`，悬停显示下划线。引用来源标记带灰色虚线，悬停显示浅紫底 |
 * | 表格 | 表头浅灰底、偶数行浅底、`1px` 边框，单元格最小宽度 `88px`，宽表可横向滚动。这些主要展示样式已在发布时写入 HTML |
 */
.tiptap-article {
  min-width: 0;
  color: #32324d;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 24px;
}

.tiptap-article h1,
.tiptap-article h2,
.tiptap-article h3 {
  color: #32324d;
  font-weight: 600;
  line-height: 1.5;
}

.tiptap-article h1 {
  margin: 0 0 12px;
  font-size: 32px;
  line-height: 40px;
}

.tiptap-article h2 {
  margin: 30px 0 14px;
  font-size: 22px;
  line-height: 30px;
}

.tiptap-article h3 {
  margin: 18px 0 7px;
  font-size: 16px;
}

.tiptap-article p {
  margin: 0 0 10px;
}

/* 在官网使用全局 CSS Reset 时保留正文格式。 */
.tiptap-article b,
.tiptap-article strong {
  font-weight: bolder;
}

.tiptap-article i,
.tiptap-article em {
  font-style: italic;
}

.tiptap-article u {
  text-decoration: underline;
}

.tiptap-article s,
.tiptap-article del {
  text-decoration: line-through;
}

.tiptap-article ul,
.tiptap-article ol {
  margin: 8px 0 12px;
  padding-left: 24px;
  line-height: 30px;
  list-style-position: outside;
}

.tiptap-article ul {
  list-style-type: disc;
}

.tiptap-article ol {
  list-style-type: decimal;
}

.tiptap-article li::marker {
  color: #623bff;
}

.tiptap-article blockquote {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 3px solid #6f48ff;
  border-radius: 0 7px 7px 0;
  color: #666687;
  background: #f8f6ff;
}

/* 同时覆盖未带 article-content-image 类的旧文章图片。 */
.tiptap-article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px auto;
  border-radius: 8px;
}

.tiptap-article a {
  color: #5f55d6;
  text-decoration: none;
}

.tiptap-article a:hover,
.tiptap-article a:focus-visible {
  text-decoration: underline;
}

.tiptap-article span.article-citation-source {
  margin: -0.18em 0;
  padding: 0.18em 2px;
  border-radius: 3px;
  color: inherit;
  background-image: linear-gradient(to right, #cfcfcf 0 4px, transparent 4px 9px);
  background-repeat: repeat-x;
  background-position: 0 100%;
  background-size: 9px 1px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-color 0.15s ease;
}

.tiptap-article span.article-citation-source:hover {
  background-color: #edefff;
}

.tiptap-article sup.article-reference {
  display: none;
}

/* 表格内联样式优先。以下规则也覆盖未内联样式的存量正文。 */
.tiptap-article .tableWrapper {
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #dcdbe7 transparent;
  scrollbar-width: thin;
}

.tiptap-article table {
  width: 100%;
  margin: 18px 0;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 14px;
  line-height: 1.6;
}

.tiptap-article .tableWrapper > table {
  margin: 0;
}

.tiptap-article th,
.tiptap-article td {
  box-sizing: border-box;
  min-width: 88px;
  padding: 10px 14px;
  border: 1px solid #e7e7ef;
  vertical-align: top;
  overflow-wrap: break-word;
}

.tiptap-article th {
  color: #32324d;
  font-weight: 600;
  text-align: left;
  background-color: #f5f5fa;
}

.tiptap-article tr:nth-child(even) {
  background-color: #fafafe;
}

.tiptap-article th > p,
.tiptap-article td > p {
  margin: 0;
}

.tiptap-article th > p + p,
.tiptap-article td > p + p {
  margin-top: 6px;
}
