/* Colors from tipspeed.core.plot.colors (TIPSPEED_PURPLE and TIPSPEED_ACCENT).
 * Formerly generated by summix/semantic_layer/glossary.py render_theme_css(), which was removed
 * during the semantic-layer cleanup. Committed as static asset to preserve Tipspeed branding in docs.
 *
 * Every Tipspeed colour is declared per scheme: TIPSPEED_PURPLE is legible on white but far too
 * dark on the slate background, so the dark scheme steps up to the accent end of the palette.
 */

[data-md-color-scheme="default"] {
  --md-primary-fg-color: #2C1E4A;
  --md-primary-fg-color--light: #742181;
  --md-primary-fg-color--dark: #2C1E4A;
  --md-accent-fg-color: #CB6CE6;

  --ts-ink: #742181;            /* links, unit badge — TIPSPEED_PURPLE */
  --ts-ink-hover: #CB6CE6;      /* TIPSPEED_ACCENT_PURPLE */
  --ts-card-border: #742181;
  --ts-badge-bg: #F5E6F9;       /* TIPSPEED_PURPLE_PALE */
  --ts-badge-fg: #742181;
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #2C1E4A;
  --md-primary-fg-color--light: #742181;
  --md-primary-fg-color--dark: #2C1E4A;
  --md-accent-fg-color: #CB6CE6;

  --ts-ink: #CB6CE6;            /* TIPSPEED_ACCENT_PURPLE — TIPSPEED_PURPLE is unreadable here */
  --ts-ink-hover: #E9B8F5;
  --ts-card-border: #a95ac0;    /* TIPSPEED_ACCENT_PURPLE_60PCT */
  --ts-badge-bg: #3A2A4D;
  --ts-badge-fg: #E9B8F5;
}

.md-typeset a { color: var(--ts-ink); }
.md-typeset a:hover { color: var(--ts-ink-hover); }

.md-typeset code.unit-badge {
  font-size: 0.8em;
  padding: 0.05em 0.5em;
  border-radius: 0.7em;
  border: 1px solid var(--ts-ink);
  color: var(--ts-ink);
  background: transparent;
}

/* The metric's public key (the vocabulary of the `metric_keys` API parameter), pinned to the card's
 * bottom-right corner in the manner of the dashboard's "beta" badge. Absolutely positioned so a
 * long, wrapping heading can never push it out of place; its own background lets it sit astride
 * the card border. */
.md-typeset code.metric-key {
  position: absolute;
  bottom: -0.7em;
  right: 1rem;
  z-index: 1;
  max-width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.65em;
  font-weight: 400;
  padding: 0.1em 0.6em;
  border-radius: 0.7em;
  color: var(--ts-badge-fg);
  background: var(--ts-badge-bg);
}

.md-typeset .doc-card {
  position: relative;
  border: 1px solid var(--ts-card-border);
  border-radius: 0.5rem;
  padding: 0.6rem 1.25rem;
  margin: 1rem 0 1.5rem;  /* room below for the key badge straddling the bottom border */
}

.md-typeset .doc-card > :first-child { margin-top: 0; }

/* Mermaid node labels.
 *
 * Material renders each diagram into a *closed* shadow root, so no selector written here can reach
 * the SVG — only inherited custom properties cross that boundary. Material's injected diagram
 * stylesheet reads `.label { color: var(--md-mermaid-label-fg-color) }`, and that variable defaults
 * to `--md-code-fg-color`: near-white under slate. Our nodes keep Tipspeed's pale fill in both
 * schemes (set per node by summix.analytics.glossary._style_node), so a near-white label is
 * invisible. Pin the variable to the dark ink for both schemes instead.
 *
 * Set on the diagram host rather than `:root`: Material declares its defaults on `:root>*`, which
 * lands on <body> and so beats anything inherited from the root element. */
.md-typeset .mermaid {
  --md-mermaid-label-fg-color: #2C1E4A;  /* TIPSPEED_DARK_PURPLE */
}
