.markdown code:not(pre > code) {
  font-family: var(--vscode-editor-font-family, monospace);
  filter: saturation(110%) brightness(95%);
  color: var(--vscode-textPreformat-foreground) !important;
  background-color: transparent;
  padding: 0px 2px;
  white-space: pre-line;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Target only Dark High Contrast theme using the data attribute VS Code adds to the body */
body[data-vscode-theme-kind="vscode-high-contrast"] & code:not(pre > code) {
  color: var(
    --vscode-editorInlayHint-foreground,
    var(
      --vscode-symbolIcon-stringForeground,
      var(--vscode-charts-orange, #e9a700)
    )
  );
}

/* KaTeX styling */
.markdown .katex {
  font-size: 1.1em;
  color: var(--vscode-editor-foreground);
  font-family: KaTeX_Main, "Times New Roman", serif;
  line-height: 1.2;
  white-space: normal;
  text-indent: 0;
}

.markdown .katex-display {
  display: block;
  /* margin: 1em 0; */
  text-align: center;
  padding: 0.5em;
  overflow-x: auto;
  overflow-y: hidden;
  background-color: var(--vscode-textCodeBlock-background);
  border-radius: 3px;
}

.markdown .katex-error {
  color: var(--vscode-errorForeground);
}

.markdown {
  font-family:
    var(--vscode-font-family),
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    "Open Sans",
    "Helvetica Neue",
    sans-serif;

  font-size: var(--vscode-font-size, 13px);
}

.markdown p,
.markdown li,
.markdown ol,
.markdown ul {
  line-height: 2 !important;
}

.markdown ol,
.markdown ul {
  padding-left: 2.5em;
  margin-left: 0;
}

.markdown ol {
  list-style-type: decimal;
}

.markdown ul {
  list-style-type: disc;
}

/* Nested list styles */
.markdown ul ul {
  list-style-type: circle;
}

.markdown ul ul ul {
  list-style-type: square;
}

.markdown ol ol {
  list-style-type: lower-alpha;
}

.markdown ol ol ol {
  list-style-type: lower-roman;
}

.markdown p {
  white-space: pre-wrap;
  margin: 0.5em 0;
}

/* Prevent layout shifts during streaming */
.markdown pre {
  min-height: 3em;
  transition: height 0.2s ease-out;
}

/* Code block container styling */
.markdown div:has(> pre) {
  position: relative;
  contain: layout style;
}

.markdown a {
  color: var(--vscode-textLink-foreground);
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--vscode-textLink-foreground);
  &:hover {
    color: var(--vscode-textLink-activeForeground);
    text-decoration-style: solid;
    text-decoration-color: var(--vscode-textLink-activeForeground);
  }
}
