/* extras.css - math, Mermaid, inline table of contents, loose ends */

.strata-math-block {
  margin: 0 0 var(--strata-block-gap);
  padding: 8px 0;
  overflow-x: auto;
  text-align: center;
}

.strata-math-error,
.strata-math-error-inline {
  padding: 2px 6px;
  border-radius: var(--strata-radius-sm);
  background-color: rgba(var(--strata-color-red), 0.12);
  color: rgb(var(--strata-color-red));
  font-family: var(--strata-font-mono);
  font-size: 0.9em;
}

.strata-mermaid {
  display: flex;
  justify-content: center;
  margin: 0 0 var(--strata-block-gap);
  padding: 16px;
  border: 1px solid var(--strata-border);
  border-radius: var(--strata-radius-md);
  background-color: var(--strata-mermaid-bg, var(--strata-bg-elevated));
  overflow-x: auto;
}

.strata-mermaid svg {
  max-width: 100%;
  height: auto;
}

.strata-mermaid pre.mermaid {
  margin: 0;
  font-family: var(--strata-font-mono);
  font-size: var(--strata-code-font-size);
  color: var(--strata-text-muted);
  white-space: pre-wrap;
}

.strata-mermaid-error {
  border-color: rgb(var(--strata-color-red));
  background-color: rgba(var(--strata-color-red), 0.08);
}

.strata-mermaid-error pre {
  color: rgb(var(--strata-color-red));
}

/* Details / summary written directly in markdown (callouts style themselves). */
.strata-content details:not(.strata-callout) {
  margin: 0 0 var(--strata-block-gap);
  padding: 8px 12px;
  border: 1px solid var(--strata-border);
  border-radius: var(--strata-radius-md);
  background-color: var(--strata-bg-elevated);
}

.strata-content details:not(.strata-callout) > summary {
  cursor: pointer;
  font-weight: 600;
}

/* Keep KaTeX from inheriting the body line-height and clipping. */
.strata-content .katex {
  font-size: 1.05em;
  line-height: 1.2;
}

.strata-content .katex-display {
  margin: 0;
  padding: 4px 0;
}

/* Mermaid fallback: show the diagram source when rendering fails. */
.strata-mermaid-error {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.strata-mermaid-message {
  color: rgb(var(--strata-color-red));
  font-size: 0.875em;
}
