/* @llui/markdown — dark theme override.
 *
 * Import AFTER theme.css to opt into dark colors:
 *     import '@llui/markdown/styles/theme.css'
 *     import '@llui/markdown/styles/theme-dark.css'
 * Only re-declares the CSS variables, so all layout rules in theme.css apply.
 * Gate with a media query / class toggle as you prefer — here it tracks the OS. */

@media (prefers-color-scheme: dark) {
  .markdown-body {
    --md-fg: #e6edf3;
    --md-muted: #9198a1;
    --md-border: #3d444d;
    --md-accent: #4493f8;
    --md-code-bg: #151b23;
    --md-code-fg: #e6edf3;
    --md-quote-border: #3d444d;
  }
}

/* Explicit opt-in regardless of OS setting: add `data-theme="dark"` to the
 * wrapper (or any ancestor) — e.g. `markdown(src, { class: 'markdown-body' })`
 * on an element with `data-theme="dark"`. */
[data-theme='dark'] .markdown-body,
.markdown-body[data-theme='dark'] {
  --md-fg: #e6edf3;
  --md-muted: #9198a1;
  --md-border: #3d444d;
  --md-accent: #4493f8;
  --md-code-bg: #151b23;
  --md-code-fg: #e6edf3;
  --md-quote-border: #3d444d;
}

/* Explicit light opt-out: when an app drives the theme itself (a `data-theme`
 * toggle on the wrapper/ancestor) it must be authoritative in BOTH directions.
 * Without this, the `prefers-color-scheme: dark` block above leaks dark colors
 * into a preview the app has explicitly set to light whenever the OS is dark —
 * giving light text on a light background. The attribute selector outranks the
 * media query's bare `.markdown-body`, so explicit light always wins. */
[data-theme='light'] .markdown-body,
.markdown-body[data-theme='light'] {
  --md-fg: #1f2328;
  --md-muted: #59636e;
  --md-border: #d1d9e0;
  --md-accent: #0969da;
  --md-code-bg: #f6f8fa;
  --md-code-fg: #1f2328;
  --md-quote-border: #d1d9e0;
}
