/*
XITS is released under the SIL Open Font License.
See https://github.com/stipub/stixfonts/blob/master/OFL.txt details.

The STIX2 WOFF font has been obtained from
https://github.com/stipub/stixfonts
*/

@font-face {
  font-family: STIX2;
  src: local("STIXTwoMath-Regular"), url("./STIXTwoMath-Regular.woff2");
}

math {
  font-style: normal;
  font-weight: normal;
  line-height: normal;
  /*font-size-adjust: none;*/
  text-indent: 0;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  direction: ltr;
}

math * {
  border-color: currentColor;
}

/* Next line is active in Firefox and Safari.
 * Not in Chromium, which recognizes display: "block math" written inline. */
math.tml-display {
  display: block;
}

mtext {
  font-family: STIX2;
}

math {
  font-family: STIX2, math;
}

*.mathscr {
  font-feature-settings: "ss01";
}

mo.tml-prime {
  font-feature-settings: "ss04";
}

mrow.tml-cancel {
  background: linear-gradient(
    to top left,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) calc(50% - 0.06em),
    rgba(0, 0, 0, 1) 50%,
    rgba(0, 0, 0, 0) calc(50% + 0.06em),
    rgba(0, 0, 0, 0) 100%
  );
}

mrow.tml-bcancel {
  background: linear-gradient(
    to top right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) calc(50% - 0.06em),
    rgba(0, 0, 0, 1) 50%,
    rgba(0, 0, 0, 0) calc(50% + 0.06em),
    rgba(0, 0, 0, 0) 100%
  );
}

mrow.tml-xcancel {
  background: linear-gradient(
      to top left,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0) calc(50% - 0.06em),
      rgba(0, 0, 0, 1) 50%,
      rgba(0, 0, 0, 0) calc(50% + 0.06em),
      rgba(0, 0, 0, 0) 100%
    ),
    linear-gradient(
      to top right,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0) calc(50% - 0.06em),
      rgba(0, 0, 0, 1) 50%,
      rgba(0, 0, 0, 0) calc(50% + 0.06em),
      rgba(0, 0, 0, 0) 100%
    );
}

/* Prevent f' from overlapping in Chromium */
mo.prime-pad {
  padding-left: 0.08em;
}

/* Array cell justification in Firefox & WebKit */
.tml-right {
  text-align: right;
}
.tml-left {
  text-align: left;
}

/* Stretch \widetilde & set array cell justification in Chromium */
@supports (not (-webkit-backdrop-filter: blur(1px))) and
  (not (-moz-appearance: none)) {
  .tml-crooked-2 {
    transform: scale(2, 1.1);
  }
  .tml-crooked-3 {
    transform: scale(3, 1.3);
  }
  .tml-crooked-4 {
    transform: scale(4, 1.4);
  }
  .tml-right {
    text-align: -webkit-right;
  }
  .tml-left {
    text-align: -webkit-left;
  }
}

/* Adjust WebKit accents */
@supports (-webkit-backdrop-filter: blur(1px)) {
  .tml-xshift {
    transform: translate(0px, 0.45em);
  }
  .tml-capshift {
    transform: translate(0px, 0.35em);
  }
}

/* flex-wrap for line-breaking in Chromium */
math {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
}
math > mrow {
  padding: 0.5ex 0ex;
}

/* Avoid flex-wrap in Firefox */
@-moz-document url-prefix() {
  math {
    display: inline;
  }
  math > mrow {
    padding: 0;
  }
}

/* AMS environment auto-numbering via CSS counter. */
.tml-eqn::before {
  counter-increment: tmlEqnNo;
  content: "(" counter(tmlEqnNo) ")";
}

body {
  counter-reset: tmlEqnNo;
}
