/* Mock Test Mitra — math rendering styles.
   Loaded on every page that includes MathJax. Keep this file small. */

/* Horizontal scroll for wide display equations on narrow screens.
   Without this, long derivations push the page width on mobile. */
mjx-container[jax="CHTML"][display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
  margin: 0.75rem 0;
}

/* Inline math should never break layout. */
mjx-container[jax="CHTML"]:not([display="true"]) {
  max-width: 100%;
  vertical-align: middle;
}

/* Dark mode — inherit text color from theme. */
mjx-container[jax="CHTML"] {
  color: inherit;
}

/* Variable description table — standard look across SM pages. */
.var-table {
  width: 100%;
  max-width: 620px;
  border-collapse: collapse;
  margin: 0.5rem 0 1.25rem;
  font-size: 0.95rem;
}
.var-table th,
.var-table td {
  border: 1px solid var(--border-color, #d0d7de);
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.var-table thead th {
  background: var(--surface-2, #f6f8fa);
  font-weight: 600;
}

/* Formula block wrapper — optional helper for the textbook template. */
.formula-block {
  margin: 1.25rem 0;
  padding: 0.5rem 0.9rem;
  border-left: 3px solid var(--accent1, #4f46e5);
  background: var(--surface-1, rgba(79, 70, 229, 0.04));
  border-radius: 4px;
}
.formula-block .formula-name {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  color: var(--accent1, #4f46e5);
}

/* Avoid layout shift while MathJax loads — give display blocks a min-height. */
.math-loading {
  min-height: 1.5em;
}

/* Print: keep equations on the page, no scrollbars. */
@media print {
  mjx-container[jax="CHTML"][display="true"] {
    overflow: visible;
    page-break-inside: avoid;
  }
}
