/*
 * Document   : ext.math
 * Created on : 23.09.2013, 13:55:00
 * Author     : Physikerwelt (Moritz Schubotz)
 * Description: Shows browser-dependent math output.
 */
@namespace m url( http://www.w3.org/1998/Math/MathML );

/* Default style for MathML. */
.mwe-math-mathml-inline {
	display: inline !important; /* stylelint-disable-line declaration-no-important */
}

.mwe-math-mathml-display {
	display: block !important; /* stylelint-disable-line declaration-no-important */
	margin-left: auto;
	margin-right: auto;
}

.mwe-math-mathml-a11y {
	/* Reverse the `display: none` inline style */
	display: inline !important; /* stylelint-disable-line declaration-no-important */
	/* We try to hide the MathML formula in a way that still makes it accessible to accessibility tools. */
	clip: rect( 1px, 1px, 1px, 1px );
	overflow: hidden;
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

/* Default style for the image fallback. */
/* Note: We had to use !important rules because of conflicts with the style
generated by Mathoid. See https://gerrit.wikimedia.org/r/#/c/166213/ */
.mwe-math-fallback-image-inline {
	display: inline-block;
	vertical-align: middle;
}

.mwe-math-fallback-image-display {
	display: block;
	margin-left: auto !important; /* stylelint-disable-line declaration-no-important */
	margin-right: auto !important; /* stylelint-disable-line declaration-no-important */
}

/* Default style for the source fallback. */
.mwe-math-fallback-source-inline {
	display: inline;
	vertical-align: middle;
}

.mwe-math-fallback-source-display {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

/* the source rendering mode generates the class tex for backwards compatibility T348938 */
img.tex {
	vertical-align: middle;
}

div.mwe-math-element {
	overflow-x: auto;
	max-width: 100%;
}

/* Polyfill for MathML matrix elements with menclose https://github.com/w3c/mathml-core/issues/245 */
mtd.mwe-math-matrix-top {
	border-top: 0.06em solid;
}

mtd.mwe-math-matrix-bottom {
	border-bottom: 0.06em solid;
}

mtd.mwe-math-matrix-left {
	border-left: 0.06em solid;
}

mtd.mwe-math-matrix-right {
	border-right: 0.06em solid;
}

/*
 * MathML Core rendering of cancellation notations.
 * Values follow https://github.com/w3c/mathml-polyfills/tree/main/menclose:
 * 0.2em is the default enclosure padding; 0.067em is the stroke width;
 * 0.0335em is half the stroke width, centering it at 50%; and 0.268em
 * is the arrowhead size.
 */
mrow.menclose {
	display: inline-block;
	padding: 0.2em;
}

mrow.menclose-updiagonalstrike {
	background: linear-gradient( to bottom right, transparent calc( 50% - 0.0335em ), currentcolor calc( 50% - 0.0335em ) calc( 50% + 0.0335em ), transparent calc( 50% + 0.0335em ) );
}

mrow.menclose-downdiagonalstrike {
	background: linear-gradient( to top right, transparent calc( 50% - 0.0335em ), currentcolor calc( 50% - 0.0335em ) calc( 50% + 0.0335em ), transparent calc( 50% + 0.0335em ) );
}

mrow.menclose-updiagonalstrike.menclose-downdiagonalstrike {
	background: linear-gradient( to bottom right, transparent calc( 50% - 0.0335em ), currentcolor calc( 50% - 0.0335em ) calc( 50% + 0.0335em ), transparent calc( 50% + 0.0335em ) ), linear-gradient( to top right, transparent calc( 50% - 0.0335em ), currentcolor calc( 50% - 0.0335em ) calc( 50% + 0.0335em ), transparent calc( 50% + 0.0335em ) );
}

mrow.menclose-northeastarrow {
	background: linear-gradient( currentcolor, currentcolor ) top right / 0.268em 0.067em no-repeat, linear-gradient( currentcolor, currentcolor ) top right / 0.067em 0.268em no-repeat, linear-gradient( to bottom right, transparent calc( 50% - 0.0335em ), currentcolor calc( 50% - 0.0335em ) calc( 50% + 0.0335em ), transparent calc( 50% + 0.0335em ) );
}

/* Polyfill for columnalign elements attribute menclose https://github.com/w3c/mathml-core/issues/268 */
mtd.mwe-math-columnalign-l {
	text-align: left;
	text-align: -webkit-left;
	padding-left: 0;
}

mtd.mwe-math-columnalign-r {
	text-align: right;
	text-align: -webkit-right;
	padding-right: 0;
}

/*
 * Polyfill for columnspacing, set as a class in texutil.json.
 * 0em 2em is align, swh:1:cnt:32d2132763b2b01d0a77c2fb37dae43356a863aa;lines=116-124
 * 0em is alignat, swh:1:cnt:976a0ed45c7bff3f119ed30c07f3ed1347fad078;lines=160
 */
mtable.mwe-math-columnspacing-0em-2em > mtr > mtd.mwe-math-columnalign-l {
	padding-right: 1em;
}

mtable.mwe-math-columnspacing-0em-2em > mtr > mtd.mwe-math-columnalign-r {
	padding-left: 1em;
}

mtable.mwe-math-columnspacing-0em > mtr > mtd {
	padding-left: 0;
	padding-right: 0;
}

mtable.mwe-math-columnspacing-0em-2em > mtr > mtd:first-child {
	padding-left: 0;
}

mtable.mwe-math-columnspacing-0em-2em > mtr > mtd:last-child {
	padding-right: 0;
}

mo.mwe-math-vec {
	transform: scale( 0.75 );
}
