/* Formatting inside an answer bubble (app/views/chat/rich_text.js). It sits in
   the bubble's own type: 15px, 1.65 line height. Blocks are spaced about a
   line apart, as paragraphs were before the formatter, and nothing here adds
   color the palette does not already use. */

.md { white-space: normal; }
.md > * { margin: 0; }
.md > * + * { margin-top: 0.9em; }
.md p, .md li, .md blockquote, .md td, .md th { white-space: pre-wrap; }

.md h3, .md h4, .md h5 {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.md h3 { font-size: 16.5px; }
.md > * + h3, .md > * + h4, .md > * + h5 { margin-top: 1.25em; }

.md strong { font-weight: 600; color: var(--text); }
.md em { font-style: italic; }
.md a:not(.cite) {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-hi);
  text-underline-offset: 3px;
}
.md a:not(.cite):hover { text-decoration-color: currentColor; }

.md ul, .md ol { padding-left: 1.35em; }
.md li + li { margin-top: 0.35em; }
.md li::marker { color: var(--subtle); }
.md ol > li::marker { font-variant-numeric: tabular-nums; }

.md blockquote {
  padding-left: 14px;
  border-left: 2px solid var(--line-hi);
  color: var(--muted);
}

.md hr { border: 0; border-top: 1px solid var(--line); }

.md code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.md pre {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  overflow-x: auto;
  white-space: pre;
  font-size: 13px;
  line-height: 1.55;
}
.md pre code { padding: 0; border: 0; background: none; font-size: inherit; }

/* A table scrolls sideways inside the bubble instead of squeezing columns. */
.md-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md table {
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
  min-width: 100%;
}
.md th, .md td {
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  /* The bubble breaks anywhere so long links never overflow it; a table
     scrolls instead, so its words wrap only at spaces. */
  overflow-wrap: normal;
  word-break: normal;
}
.md th {
  font-weight: 600;
  color: var(--text);
  border-bottom-color: var(--line-hi);
  white-space: nowrap;
}
.md th:first-child, .md td:first-child { padding-left: 0; }
.md tbody tr:last-child td { border-bottom: 0; }
