/* ACE MathML: how equations look.

   One math font everywhere: Latin Modern Math (the LaTeX look), bundled, so an equation looks the same on an
   Android phone, an iPhone and Windows. Android has no math font of its own, and its fallbacks draw roots and
   tall brackets badly. The file is fetched only by a page that has an equation on it. The fonts the devices
   do have follow, in case it cannot load. */
@font-face {
	font-family: "ACE Math";
	src: url("fonts/latinmodern-math.woff") format("woff");
	font-display: swap;
}

math {
	font-family: "ACE Math", "Latin Modern Math", "STIX Two Math", "Cambria Math", "Noto Sans Math", math;
	font-size: 1.12em;           /* a math font sits smaller than the site's Inter at the same size */
	color: inherit;              /* the page's own text color: right on the dark and on every light theme */
	line-height: normal;         /* a tight line-height on a paragraph would clip tall fractions */
	font-style: normal;
	font-weight: normal;
	letter-spacing: normal;      /* uppercase labels with letter-spacing must not spread an equation */
	text-transform: none;
	white-space: normal;
}

/* An equation on its own line: centered, and on a narrow phone it scrolls sideways inside its own row
   instead of pushing the page wider than the screen. */
math[display="block"] {
	display: block math;
	margin: .75em auto;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	padding: .25em 0 .35em;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, currentColor 30%, transparent) transparent;
}
math[display="block"]::-webkit-scrollbar { height: 6px; }
math[display="block"]::-webkit-scrollbar-thumb { background: color-mix(in srgb, currentColor 30%, transparent); border-radius: 3px; }

/* In an answer choice, a block equation does not need the room around it it has in a lesson. */
.wpProQuiz_questionListItem math[display="block"],
.acqr-opt math[display="block"] {
	margin: .15em 0;
	text-align: left;
}

/* An answer choice holding more than one equation.

   A LearnDash choice is a flex row and a Quiz Review choice is a grid, so each equation in a choice
   becomes an item sitting beside the others. Two equations in one choice are squeezed side by side,
   and because a block equation carries overflow-x: auto the squeezed part is simply hidden: the
   student reads "x3 + x4 =" with the number gone, which is worse than a clumsy layout, because the
   choice cannot be read at all.

   Letting the row wrap gives each equation its own line at its natural width. A choice with no
   equation in it is laid out exactly as before. */
.wpProQuiz_questionListItem label {
	flex-wrap: wrap;
	row-gap: 4px;
}
.wpProQuiz_questionListItem label math {
	flex: 0 0 auto;      /* keep its own width and wrap, rather than be squeezed and cut off */
	min-width: 0;        /* one equation too wide on its own may still shrink and scroll */
	max-width: 100%;
}

/* Quiz Review lays a choice out as a grid; its text column must be allowed to shrink, or a wide
   equation pushes the choice past the card. */
.acqr-opt-text {
	min-width: 0;
}

/* The LaTeX source is stored for editing only; never show it. */
math annotation,
math annotation-xml {
	display: none;
}

/* Printed quizzes and lessons: black on white, like the rest of the print. */
@media print {
	math { color: #000; }
}
