/* ============================================================
   KaTeX integration.

   The formulas are pre-rendered at author time, so this file and
   the KaTeX stylesheet are all that is needed to display them —
   the page loads no maths JavaScript.

   KaTeX draws in currentColor throughout, so both themes work
   without overrides; what it does not do is stay inside a narrow
   column, hence the scroll containers below.
   ============================================================ */

.katex {
  font-size: 1.06em;
  color: inherit;
}

/* Display maths: its own band, indented to line up with the prose,
   and scrollable rather than overflowing when a formula is long. */
.mathblock {
  margin: 1.15rem 0 1.35rem;
  padding: 0.15rem 0 0.15rem 14px;
  border-left: 2px solid var(--hot);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 66ch;
}

.mathblock .katex-display {
  margin: 0.35rem 0;
  text-align: left;
}

.mathblock .katex-display > .katex {
  text-align: left;
  white-space: nowrap;
}

/* Inline maths sits in running text, so keep it from changing the
   line box height and pushing the leading around. */
.katex .base {
  line-height: 1;
}

.report-wide .mathblock,
.wide + .mathblock {
  max-width: 82ch;
}

/* Inside a two-column block the measure is set by the column. */
.cols2 .mathblock,
.cols3 .mathblock {
  max-width: none;
  margin: 0.9rem 0 1rem;
}

/* Tables and figure captions occasionally carry a symbol; make sure
   it inherits the smaller size rather than the body size. */
td .katex,
th .katex,
figcaption .katex,
.tn .katex,
.cap .katex {
  font-size: 1em;
}

@media (max-width: 700px) {
  .katex { font-size: 1em; }
  .mathblock { padding-left: 10px; }
}
