/* Heading accent: restrained brand-blue differentiation between section
   levels. Colour only: no rules, no backgrounds. Body text and the h1 page
   title keep the default typeset colour, so the clean typography is intact.
   The accent lifts to a lighter tint on the slate (dark) palette for legible
   contrast on the near-black canvas. */
[data-md-color-scheme="default"] {
  --ipmr-accent: #37589C;       /* Internews brand blue */
  --ipmr-accent-soft: #5b6f96;  /* muted brand tone for one level down */
}
[data-md-color-scheme="slate"] {
  --ipmr-accent: #9db4de;
  --ipmr-accent-soft: #8a99bb;
}
.md-typeset h2 { color: var(--ipmr-accent); }
.md-typeset h3 { color: var(--ipmr-accent-soft); }

/* Tool-card at-a-glance badges: cost (from the card's cost field) and
   difficulty (from the outline-cell tier). Text-labelled, so meaning never
   rests on colour; brand-toned outline so they sit quietly under the title.
   Cost is a solid outline, difficulty a dashed outline, a shape difference
   that survives greyscale and works in both palettes. */
.md-typeset .ipmr-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}
.md-typeset .ipmr-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--ipmr-accent);
  border-radius: 0.7rem;
  color: var(--ipmr-accent);
  background: transparent;
  white-space: nowrap;
}
.md-typeset .ipmr-badge--tier {
  border-style: dashed;
}

/* Footer palette override.
   Material's footer uses its own CSS variables independent of `primary` —
   defaults to dark in every scheme. Make footer follow the active palette
   so light mode renders a light footer, dark mode keeps the dark one. */
[data-md-color-scheme="default"] {
  --md-footer-bg-color: #ffffff;
  --md-footer-bg-color--dark: #f5f5f5;
  --md-footer-fg-color: rgba(0, 0, 0, 0.87);
  --md-footer-fg-color--light: rgba(0, 0, 0, 0.7);
  --md-footer-fg-color--lighter: rgba(0, 0, 0, 0.45);
}
[data-md-color-scheme="default"] .md-footer,
[data-md-color-scheme="default"] .md-footer-meta {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Centre Mermaid diagrams inside the Material content column and force
   high-contrast text inside nodes on both light and dark palettes. */

.md-typeset .mermaid {
  text-align: center;
}

.md-typeset .mermaid svg {
  display: block;
  margin: 0 auto;
  width: auto !important;
  max-width: 100% !important;
  height: auto;
}

/* Constrain mermaid SVG to a slightly narrower column so the asymmetric
   Dagre layout has visual breathing margin on both sides — the Dagre engine
   cannot horizontally centre an asymmetric tree natively, so we centre the
   SVG box instead. */
.md-typeset .mermaid {
  text-align: center;
  max-width: 100%;
}
.md-typeset .mermaid svg {
  max-width: min(100%, 760px) !important;
}

/* Node text — override Material's `fill: currentColor` cascade which on the
   slate (dark) palette desaturates labels to typeset grey. */
.md-typeset .mermaid svg .nodeLabel,
.md-typeset .mermaid svg .nodeLabel p,
.md-typeset .mermaid svg .nodeLabel span,
.md-typeset .mermaid svg .node text,
.md-typeset .mermaid svg foreignObject div {
  fill: #000 !important;
  color: #000 !important;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}
.md-typeset .mermaid svg .nodeLabel b,
.md-typeset .mermaid svg .nodeLabel strong {
  font-weight: 700 !important;
  font-size: 14px !important;
}

/* Cluster (subgraph) titles, if any. */
.md-typeset .mermaid svg .cluster text {
  fill: #000 !important;
  color: #000 !important;
}

/* Thicker, higher-contrast edges and arrowheads — on the slate palette the
   default disappears against the dark canvas. */
.md-typeset .mermaid svg .flowchart-link,
.md-typeset .mermaid svg .edge-path,
.md-typeset .mermaid svg path[class*="flowchart-link"],
.md-typeset .mermaid svg .edgePath .path {
  stroke-width: 3.5px !important;
  stroke: #cfcfcf !important;
}

.md-typeset .mermaid svg defs marker path,
.md-typeset .mermaid svg defs marker polyline,
.md-typeset .mermaid svg defs marker polygon {
  stroke: #cfcfcf !important;
  fill: #cfcfcf !important;
  stroke-width: 1px !important;
}

/* Subtle drop shadow on nodes for depth on dark theme. */
.md-typeset .mermaid svg .node rect,
.md-typeset .mermaid svg .node polygon {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: filter 0.18s ease, transform 0.18s ease;
}

/* Hover feedback on clickable nodes — slight lift + brighter shadow. */
.md-typeset .mermaid svg .node.clickable {
  cursor: pointer;
}
.md-typeset .mermaid svg .node.clickable:hover rect,
.md-typeset .mermaid svg .node.clickable:hover polygon {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) brightness(1.08);
}

/* T7 country × platform availability table — colour-code yes / partial / – */
.md-typeset table td:not([align]):where(:nth-child(n+2):nth-child(-n+6)) {
  text-align: center;
}
.md-typeset table td:has(> :where(strong)),
.md-typeset table td {
  /* fallback no-op */
}
/* Use generated content via attribute selectors is unreliable in pymdownx tables;
   target by exact cell text via :is/:has where supported. */
.md-typeset table tr td:where(:nth-child(n+2):nth-child(-n+6)):where(:not([class])) {
  font-weight: 500;
}

/* Edge labels — keep light background so they pop on dark theme. */
.md-typeset .mermaid svg .edgeLabel,
.md-typeset .mermaid svg .edgeLabel rect {
  background-color: #1e1e1e !important;
}
.md-typeset .mermaid svg .edgeLabel,
.md-typeset .mermaid svg .edgeLabel p,
.md-typeset .mermaid svg .edgeLabel span,
.md-typeset .mermaid svg .edgeLabel foreignObject div {
  color: #ddd !important;
  fill: #ddd !important;
  font-size: 13px !important;
}
