/* Material renders Mermaid inside a closed shadow root and drives its colours
   through custom properties. Subgraphs use --md-default-fg-color--lightest,
   edge labels use --md-mermaid-label-bg-color; give both the page background
   so labels blend into what is behind them. */
.md-typeset .mermaid {
  --md-default-fg-color--lightest: var(--md-default-bg-color);
}

/* Keep Mermaid's light palette in dark mode: the coloured nodes in the
   diagrams rely on dark text, which the dark label colour would hide. */
[data-md-color-scheme="slate"] .md-typeset .mermaid {
  --md-default-fg-color--lightest: #fff;
  --md-default-fg-color--lighter: #bbb;
  --md-mermaid-label-bg-color: #fff;
  --md-mermaid-label-fg-color: #333;
  --md-mermaid-node-bg-color: #ececff;
  --md-mermaid-node-fg-color: #9370db;
  --md-mermaid-edge-color: #333;
  /* Flip the light palette for dark mode while keeping the hues. */
  filter: invert(0.9) hue-rotate(180deg);
}
