/* 公式（MathML）
   src 里用 $...$ / $$...$$ 写 LaTeX，构建时由 tools/mathf.py 渲染成 MathML，
   浏览器原生渲染，不需要 JS 和字体文件。
   独立的 $$ 公式外面套一层 .math-display-wrap，用来居中与横向滚动。 */

.math-inline {
	font-size: 1em;
}

/* aligned 环境的列对齐：latex2mathml 生成 <mtd columnalign="right|left">，
   但 Chromium 目前忽略 mtd 的 columnalign 属性（内容一律居中），
   多行推导的 = 号对不上。MathML Core 里 columnalign 就映射到 text-align，
   这里用 CSS 等价规则补上（Firefox/Safari 属性本身生效，规则与其一致不冲突）。 */
mtd {
	text-align: center;
}

mtd[columnalign="right"] {
	text-align: right;
}

mtd[columnalign="left"] {
	text-align: left;
}

.math-display-wrap {
	display: block;
	margin: 1.2em 0;
	text-align: center;
	overflow-x: auto;
	overflow-y: hidden;
}

/* 居中用 inline math + vertical-align: middle，
   高的公式（如多行矩阵）不会顶到上一行 */
.math-display-wrap math {
	display: inline math;
	vertical-align: middle;
}

/* 渲染失败的公式：把 LaTeX 源码原样显示出来 */
.math-error {
	color: #b32d2e;
	background: #fcf0f1;
	font-family: Consolas, Monaco, "Courier New", monospace;
	font-size: .9em;
	padding: 0 .25em;
	border-radius: 2px;
}
