/* KaTeX 公式排版：统一文章页与知识库文档页的行内、块级公式表现。 */
:where(.post-content, .dm-content__body) .katex {
  color:inherit;
  font-size:1.08em;
  line-height:1.2;
  text-rendering:auto;
}

:where(.post-content, .dm-content__body) .katex-display,
:where(.post-content, .dm-content__body) [math-display],
:where(.post-content, .dm-content__body) .katex-block,
:where(.post-content, .dm-content__body) .katex-formula-block {
  display:block;
  width:100%;
  margin:1.25rem 0;
  padding:.25rem 0;
  overflow-x:auto;
  overflow-y:hidden;
  text-align:center;
  -webkit-overflow-scrolling:touch;
}

:where(.post-content, .dm-content__body) .katex-display > .katex,
:where(.post-content, .dm-content__body) .katex-block > .katex,
:where(.post-content, .dm-content__body) .katex-formula-block > .katex {
  display:inline-block;
  min-width:max-content;
  max-width:none;
  white-space:normal;
}

:where(.post-content, .dm-content__body) .katex-error {
  color:#dc2626;
  font-size:.95em;
}

body.dark :where(.post-content, .dm-content__body) .katex {
  color:#e5edf8;
}

body.dark :where(.post-content, .dm-content__body) .katex-error {
  color:#fca5a5;
}

.archive-card-desc .katex {
  font-size:1em;
  line-height:1.2;
}

.archive-card-desc--formula {
  overflow-x:auto;
  white-space:nowrap;
  -webkit-overflow-scrolling:touch;
}

@media(max-width:1000px){
  :where(.post-content, .dm-content__body) .katex {
    font-size:1em;
  }

  :where(.post-content, .dm-content__body) .katex-display,
  :where(.post-content, .dm-content__body) [math-display],
  :where(.post-content, .dm-content__body) .katex-block,
  :where(.post-content, .dm-content__body) .katex-formula-block {
    margin:1rem 0;
    padding:.2rem 0;
  }
}
