/* ======================================================================
 * WP Maker 编辑器内容样式（前台）
 *
 * 所有规则以 .wpmk-editor-content 作用域限定，仅作用于编辑器保存的正文，
 * 避免主题全局标签样式污染，并还原编辑器内的视觉层级。
 * 颜色取值与编辑器主题（src/style.css）一致。
 * ====================================================================== */

.wpmk-editor-content {
	box-sizing: border-box;
	font-size: 16px;
	line-height: 1.7;
	overflow-wrap: break-word;
	word-break: break-word;
}

.wpmk-editor-content *,
.wpmk-editor-content *::before,
.wpmk-editor-content *::after {
	box-sizing: border-box;
}

/* ── 标题 ── */
.wpmk-editor-content h1,
.wpmk-editor-content h2,
.wpmk-editor-content h3,
.wpmk-editor-content h4,
.wpmk-editor-content h5,
.wpmk-editor-content h6 {
	margin: 1.2em 0 0.6em;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
}
.wpmk-editor-content h1 { font-size: 2em; }
.wpmk-editor-content h2 { font-size: 1.6em; }
.wpmk-editor-content h3 { font-size: 1.35em; }
.wpmk-editor-content h4 { font-size: 1.15em; }
.wpmk-editor-content h5 { font-size: 1em; }
.wpmk-editor-content h6 { font-size: 0.9em; }

/* ── 段落（Plate 段落为 div.slate-p） ── */
.wpmk-editor-content .slate-p {
	margin: 0 0 1em;
}
.wpmk-editor-content > :last-child,
.wpmk-editor-content .slate-p:last-child,
.wpmk-editor-content blockquote .slate-p:last-child {
	margin-bottom: 0;
}

/* ── 行内文本标记 ── */
.wpmk-editor-content strong { font-weight: 700; }
.wpmk-editor-content em { font-style: italic; }
.wpmk-editor-content s { text-decoration: line-through; }
.wpmk-editor-content u { text-decoration: underline; }

/* 行内代码（排除代码块 pre 内的 code） */
.wpmk-editor-content :not(pre) > code {
	background: oklch(0.97 0 0);
	border: 1px solid oklch(0.922 0 0);
	border-radius: 0.25rem;
	padding: 0.1em 0.35em;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	font-size: 0.875em;
}

/* ── 代码块 ── */
.wpmk-editor-content pre {
	background: oklch(0.97 0 0 / 0.5);
	border-radius: 0.5rem;
	margin: 1em 0;
	padding: 1rem 1rem 1rem 2rem; /* 保留编辑器 p-8 的上/右留白观感 */
	overflow-x: auto;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	font-size: 0.875rem;
	line-height: 1.6;
	tab-size: 2;
}
.wpmk-editor-content pre code {
	background: none;
	border: 0;
	padding: 0;
	font-size: inherit;
	color: inherit;
}
.wpmk-editor-content .slate-code_line {
	margin: 0;
}

/* 代码语法高亮（与编辑器 lowlight 配色一致，浅色） */
.wpmk-editor-content .hljs-comment,
.wpmk-editor-content .hljs-code,
.wpmk-editor-content .hljs-formula { color: #6a737d; }
.wpmk-editor-content .hljs-keyword,
.wpmk-editor-content .hljs-doctag,
.wpmk-editor-content .hljs-template-tag,
.wpmk-editor-content .hljs-template-variable,
.wpmk-editor-content .hljs-type { color: #d73a49; }
.wpmk-editor-content .hljs-string,
.wpmk-editor-content .hljs-regexp { color: #032f62; }
.wpmk-editor-content .hljs-number,
.wpmk-editor-content .hljs-literal,
.wpmk-editor-content .hljs-meta,
.wpmk-editor-content .hljs-operator,
.wpmk-editor-content .hljs-attr,
.wpmk-editor-content .hljs-attribute { color: #005cc5; }
.wpmk-editor-content .hljs-title,
.wpmk-editor-content .hljs-title.function_ { color: #6f42c1; }
.wpmk-editor-content .hljs-built_in,
.wpmk-editor-content .hljs-symbol { color: #e36209; }
.wpmk-editor-content .hljs-name,
.wpmk-editor-content .hljs-quote,
.wpmk-editor-content .hljs-selector-tag,
.wpmk-editor-content .hljs-selector-pseudo { color: #22863a; }
.wpmk-editor-content .hljs-section { color: #005cc5; font-weight: 700; }
.wpmk-editor-content .hljs-strong { font-weight: 700; }
.wpmk-editor-content .hljs-emphasis { font-style: italic; }

/* ── 列表 ── */
/* 无序列表：Plate 序列化为独立块级项（div.list-item + data-slate-list-style-type） */
.wpmk-editor-content div[data-slate-list-style-type],
.wpmk-editor-content div[role="listitem"] {
	margin: 0.3em 0;
}
.wpmk-editor-content div[data-slate-list-style-type] .slate-p {
	margin-bottom: 0;
}

/* 有序列表 */
.wpmk-editor-content ol {
	margin: 1em 0;
	padding-left: 1.6em;
	list-style-type: decimal;
}
.wpmk-editor-content ol li {
	margin: 0.3em 0;
	padding-left: 0.25em;
}

/* ── 引用 ── */
.wpmk-editor-content blockquote {
	background: oklch(0.97 0 0 / 0.5);
	border-left: 3px solid oklch(0.708 0 0);
	border-radius: 0 0.375rem 0.375rem 0;
	margin: 1em 0;
	padding: 0.25em 1em;
	color: inherit;
}

/* ── 表格 ── */
.wpmk-editor-content table {
	border-collapse: collapse;
	margin: 1em 0;
	table-layout: fixed; /* 与编辑器 table-fixed 一致，colgroup 列宽生效 */
}
.wpmk-editor-content th,
.wpmk-editor-content td {
	border: 1px solid oklch(0.922 0 0);
	padding: 0.5em 0.75em;
	text-align: left;
	vertical-align: top;
}
.wpmk-editor-content th {
	background: oklch(0.97 0 0 / 0.6);
	font-weight: 600;
}
/* 表格控制列（contenteditable=false 的空列，仅编辑器 UI 残留） */
.wpmk-editor-content td[contenteditable="false"] {
	border-color: transparent;
	padding: 0;
	width: 8px;
}

/* ── 分隔线 ── */
.wpmk-editor-content hr {
	border: 0;
	border-top: 1px solid oklch(0.922 0 0);
	margin: 2em 0;
}

/* ── 图片 ── */
.wpmk-editor-content img {
	border-radius: 0.375rem;
	height: auto;
	max-width: 100%;
}

/* ── 链接：颜色跟随主题，仅保证可读性 ── */
.wpmk-editor-content a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* ── Callout（序列化无语义类，仅内联背景色；兜底排版） ── */
.wpmk-editor-content div[style*="background-color"] {
	border-radius: 0.375rem;
	padding: 1rem;
}
.wpmk-editor-content div[style*="background-color"] > div > div:last-child > .slate-p:last-child {
	margin-bottom: 0;
}
