/* Maths (tex.js), laid out by the browser as MathML. Letters, digits and
   the plain signs are in Comic Mono, as in the text around; the symbols
   Comic Mono doesn't have, and the shapes that grow (brackets, roots, big
   operators), come from Noto Sans Math, subset to what TeX reaches, which
   carries the OpenType MATH table the browser lays maths out with.
   Variables lean, as TeX sets them, Comic Mono's own slant standing in for
   an italic it doesn't have.

   Only the root and the growing shapes name a font: in Firefox, an
   element in a script that names its own font keeps its full size. */
@font-face {
	font-family: "Site Math";
	src: url("../../assets/fonts/NotoSansMath.woff2") format("woff2");
	font-display: swap;
}

math.tex {
	font-family: "Comic Mono", "Site Math";
}

math.tex :is(.tex-grow, msqrt, mroot) {
	font-family: "Site Math";
}

/* Identifiers are never Unicode's italic letters, which Comic Mono doesn't
   have (tex.js); variables lean instead. */
/* Chromium takes a fraction's gaps from its first font, Comic Mono, which
   has none; padding gives them room. */
math.tex mfrac > * {
	padding-block: 0.1em;
}

math.tex mi {
	font-style: normal;
}

math.tex .tex-var {
	font-style: italic;
}

math.tex .tex-bold {
	font-weight: 700;
}

math.tex .tex-italic {
	font-style: italic;
}

math.tex .tex-boxed {
	padding: 0.2em 0.3em;
	border: 1px solid currentColor;
	border-radius: 4px;
}

math.tex .tex-overline {
	padding-top: 0.12em;
	border-top: 0.06em solid currentColor;
}

math.tex .tex-underline {
	padding-bottom: 0.12em;
	border-bottom: 0.06em solid currentColor;
}

math.tex .tex-small {
	font-size: 0.75em;
}

/* Aligned equations meet at their relations; matrices keep their cells
   centred. */
math.tex mtd.tex-right {
	text-align: right;
}

math.tex mtd.tex-left {
	text-align: left;
}

math.tex .tex-aligned mtd {
	padding-inline: 0;
}

math.tex mtable {
	row-gap: 0.4em;
}

/* Maths that couldn't be read shows its source, marked. */
.tex-error {
	text-decoration: underline wavy color-mix(in srgb, var(--red) 70%, transparent);
	text-underline-offset: 3px;
}
