/**
 * Mathematics via MathJax.
 *
 * This is designed for MathJax v3
 * ref: https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax
 */

// Applies to all math elements
span.math,
div.math {
  align-items: center;
  display: flex;
  max-width: 100%;

  // This will be over-ridden for the y-direction and divs
  overflow: hidden;
}

// Inline-only
span.math {
  display: inline-flex;
  align-items: baseline;
}

// Block-level only
div.math {
  gap: 0.5em;

  // So that the eqno shows up after the equation
  flex-direction: row-reverse;

  // The equation number / link
  span.eqno a.headerlink {
    position: relative;
    font-size: 1em;
  }

  // The math container
  mjx-container {
    flex-grow: 1;
    padding-bottom: 0.2rem;
    overflow: auto;

    // Set height to 0 so that it does not cause scrollbars to appear
    // ref: https://github.com/mathjax/MathJax/issues/2521
    mjx-assistive-mml {
      height: 0;
    }
  }
}
