/* ============================================================================
 * СТИЛИ: css/math_render.css (Капитан Матан сайт v3.6)
 * Локальное оформление математических формул: дроби, корни, степени, системы.
 * Шрифт: математическая антиква (Cambria Math / STIX Two Math / Times New Roman)
 * с плавным переключением на KaTeX, если он установлен в web/vendor/katex/.
 * ============================================================================ */

.cm-math-inline {
  font-family: 'KaTeX_Math', 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', 'Times New Roman', Georgia, serif;
  font-size: 1.08em;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 0.08em;
  padding: 0 0.12em;
}

.cm-math-block {
  font-family: 'KaTeX_Math', 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', 'Times New Roman', Georgia, serif;
  font-size: 1.24em;
  line-height: 1.45;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.55em 0;
  padding: 0.45em 0.75em;
  border-radius: 0.75rem;
  background: rgba(248, 250, 252, 0.75);
}

.cyber-dark .cm-math-block {
  background: rgba(15, 23, 42, 0.55);
}

/* Дроби */
.cm-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.18em;
  font-size: 0.88em;
  line-height: 1.15;
}

.cm-frac-num {
  padding: 0 0.28em 0.1em;
  border-bottom: 1.5px solid currentColor;
  text-align: center;
}

.cm-frac-den {
  padding: 0.1em 0.28em 0;
  text-align: center;
}

/* Корни (квадратный и n-й степени) */
.cm-sqrt {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  margin: 0 0.12em;
}

.cm-sqrt-deg {
  font-size: 0.65em;
  align-self: flex-start;
  margin-right: -0.15em;
  margin-top: 0.05em;
}

.cm-sqrt-sign {
  font-weight: 700;
  font-size: 1.15em;
  line-height: 1;
  transform: scaleY(1.12);
  margin-right: 0.04em;
}

.cm-sqrt-body {
  border-top: 1.5px solid currentColor;
  padding: 0.04em 0.22em 0 0.15em;
  display: inline-flex;
  align-items: center;
}

/* Системы уравнений (\begin{cases} ... \end{cases}) */
.cm-cases {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  margin: 0.15em 0.25em;
}

.cm-cases-brace {
  display: flex;
  align-items: center;
  font-size: 2.1em;
  font-weight: 300;
  line-height: 1;
  padding-right: 0.18em;
  transform: scaleY(1.25);
  user-select: none;
}

.cm-cases-rows {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.22em;
  text-align: left;
  border-left: 2px solid currentColor;
  padding-left: 0.45em;
  border-radius: 6px 0 0 6px;
}

.cm-math-sup {
  font-size: 0.72em;
  vertical-align: super;
  line-height: 0;
}

.cm-math-sub {
  font-size: 0.72em;
  vertical-align: sub;
  line-height: 0;
}
