/* Colors and type for the hand-drawn SVG figures in docs/diagrams/.
   The figures carry class names only; every color comes from here, keyed to
   Zensical's theme variables so they follow the light/dark toggle. Gold marks
   the allowed path and red the blocked one; those two have no theme
   equivalent, so they get their own value per scheme. */

.diagram {
  --diagram-fg: var(--md-default-fg-color);
  --diagram-muted: var(--md-default-fg-color--light);
  --diagram-line: var(--md-default-fg-color--lightest);
  --diagram-surface: var(--md-default-bg-color);
  --diagram-inset: var(--md-code-bg-color);
  --diagram-ok: #a8680f;
  --diagram-block: #c0392b;
  margin: 1.5em 0;
}

[data-md-color-scheme="slate"] .diagram {
  --diagram-ok: #e3ab48;
  --diagram-block: #ef6a55;
}

/* Wide figures scroll inside their frame instead of widening the page. The
   minimum is below the narrowest desktop content column (688px at a 1300px
   window), so figures fit on desktop and scroll only on small screens. */
.diagram .scroll { overflow-x: auto; }
.diagram .scroll svg { display: block; min-width: 640px; width: 100%; height: auto; }

/* The theme centers and italicizes figure captions; these run to several
   sentences, so set them as ordinary left-aligned text. */
.diagram figcaption {
  max-width: none; margin-top: 0.8em;
  text-align: left; font-style: normal; color: var(--diagram-muted);
}

.diagram .key {
  display: flex; flex-wrap: wrap; gap: 0.4em 1.2em;
  margin-top: 0.8em; font-size: 0.75rem; color: var(--diagram-muted);
}
.diagram .key > span { display: inline-flex; align-items: center; gap: 0.5em; }
.diagram .swatch { width: 22px; height: 0; border-top: 2px solid; }
.diagram .swatch.fg { border-color: var(--diagram-fg); }
.diagram .swatch.muted { border-color: var(--diagram-muted); border-top-style: dashed; }
.diagram .swatch.ok { border-color: var(--diagram-ok); }
.diagram .swatch.no { border-color: var(--diagram-block); border-top-style: dashed; }

.diagram svg { color: var(--diagram-fg); font-family: var(--md-text-font-family); }
.diagram svg text { fill: currentColor; font-size: 12px; }
.diagram svg .t-strong { font-weight: 600; font-size: 13px; }
.diagram svg .t-muted { fill: var(--diagram-muted); font-size: 11px; }
.diagram svg .t-mono { font-family: var(--md-code-font-family); font-size: 11px; fill: var(--diagram-muted); }
.diagram svg .t-accent { fill: var(--diagram-ok); font-weight: 600; font-size: 11px; }
.diagram svg .t-block { fill: var(--diagram-block); font-weight: 600; font-size: 11px; }
.diagram svg .frame { fill: var(--diagram-inset); stroke: var(--diagram-line); stroke-width: 1; }
.diagram svg .frame.surface { fill: var(--diagram-surface); }
.diagram svg .box { fill: var(--diagram-surface); stroke: currentColor; stroke-width: 1.2; }
.diagram svg .band { fill: none; stroke: var(--diagram-line); stroke-width: 1.2; stroke-dasharray: 5 5; }
.diagram svg .wire { fill: none; stroke: currentColor; stroke-width: 1.4; }
.diagram svg .wire-muted { fill: none; stroke: var(--diagram-muted); stroke-width: 1.3; stroke-dasharray: 4 4; }
.diagram svg .ok { fill: none; stroke: var(--diagram-ok); stroke-width: 2.2; }
.diagram svg .no { fill: none; stroke: var(--diagram-block); stroke-width: 1.8; stroke-dasharray: 5 4; }
.diagram svg .x { stroke: var(--diagram-block); stroke-width: 2.4; }
.diagram svg .head { fill: currentColor; }
.diagram svg .head-muted { fill: var(--diagram-muted); }
.diagram svg .head-ok { fill: var(--diagram-ok); }
.diagram svg .blocked { fill: var(--diagram-surface); stroke: var(--diagram-block); stroke-width: 1.2; stroke-dasharray: 5 4; }
