/* Styling for public/markdown-renderer.js output (tables, blockquotes,
 * pre/code blocks, inline code). Uses this project's existing
 * design-system custom properties (--text-primary, --text-secondary,
 * --border, --border-mid, --border-strong, --bg-subtle, --radius-*)
 * rather than hardcoded colours, so it automatically follows whichever
 * theme and light/dark mode the host page has already defined for
 * those tokens. Fallback values are included for any page that hasn't
 * defined a given token, so this file degrades gracefully rather than
 * silently doing nothing.
 *
 * Scoped under .markdown-rendered (the class every renderer output
 * element already gets via RaiseMarkdown.renderInto) so it can't leak
 * into unrelated page chrome.
 */

.markdown-rendered blockquote {
  margin: 0.75em 0;
  padding: 0.5em 1em;
  border-left: 3px solid var(--border-strong, #999999);
  background: var(--bg-subtle, rgba(0, 0, 0, 0.03));
  border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary, inherit);
}

.markdown-rendered blockquote:first-child {
  margin-top: 0;
}

.markdown-rendered pre {
  margin: 0.75em 0;
  padding: 0.75em 1em;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.05));
  border: 0.5px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: var(--radius-md, 8px);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.markdown-rendered pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

.markdown-rendered code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.06));
  border: 0.5px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
  word-break: break-word;
}

.markdown-rendered .md-table-wrap {
  overflow-x: auto;
  margin: 0.75em 0;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md, 8px);
}

.markdown-rendered table.md-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 340px;
  font-size: 14px;
}

.markdown-rendered table.md-table th,
.markdown-rendered table.md-table td {
  border: 0.5px solid var(--border, rgba(0, 0, 0, 0.15));
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown-rendered table.md-table th {
  background: var(--bg-subtle, rgba(0, 0, 0, 0.05));
  font-weight: 600;
  color: var(--text-primary, inherit);
  white-space: nowrap;
}

.markdown-rendered table.md-table tbody tr:nth-child(even) td {
  background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
}

.markdown-rendered table.md-table td code,
.markdown-rendered table.md-table th code {
  white-space: nowrap;
}

.markdown-rendered ul,
.markdown-rendered ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.markdown-rendered li {
  margin: 0.2em 0;
}

.markdown-rendered hr {
  border: none;
  border-top: 0.5px solid var(--border-mid, rgba(0, 0, 0, 0.2));
  margin: 1em 0;
}

@media (max-width: 480px) {
  .markdown-rendered pre {
    padding: 0.6em 0.8em;
    font-size: 12px;
  }

  .markdown-rendered table.md-table {
    font-size: 13px;
    min-width: 280px;
  }

  .markdown-rendered table.md-table th,
  .markdown-rendered table.md-table td {
    padding: 5px 7px;
  }

  .markdown-rendered blockquote {
    padding: 0.4em 0.75em;
  }
}
