/* Shared styles for the inline SVG diagrams made by tools/diagrams.py (flows, cycles, matrices, stacks, trees, bars, timelines).
   Colours come from the theme tokens, so every diagram follows light and dark mode. Posts that use a diagram link this file. */
.dgm-figure { margin: 1.9rem 0; }
.dgm-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 0.7rem 0.5rem 0.35rem; }
.dgm-svg { display: block; width: 100%; min-width: 580px; height: auto; font-family: inherit; }
.dgm-figure figcaption { font-size: 0.85rem; color: var(--text-light); margin-top: 0.55rem; line-height: 1.5; }
.dgm-hint { display: none; font-size: 0.8rem; color: var(--text-light); margin: 0 0 0.35rem; }
@media (max-width: 760px) { .dgm-hint { display: block; } }

.dgm-svg text { font-family: inherit; fill: var(--text-primary); }
.dgm-t { font-size: 14px; font-weight: 700; }
.dgm-s { font-size: 12.5px; font-weight: 500; fill: var(--text-secondary) !important; }
.dgm-n { font-size: 12.5px; font-weight: 600; fill: var(--text-secondary) !important; }
.dgm-big { font-size: 17px; font-weight: 800; }
.dgm-lab { font-size: 12px; font-weight: 700; letter-spacing: .04em; fill: var(--text-light) !important; }

.dgm-box { fill: var(--bg-gray); stroke: var(--border); stroke-width: 1.5; }
.dgm-hi  { fill: #eef2ff; stroke: #2563eb; stroke-width: 1.6; }
.dgm-warn { fill: #fff4ea; stroke: #ea580c; stroke-width: 1.6; }
.dgm-ok  { fill: #ecfdf5; stroke: #0d9488; stroke-width: 1.6; }
.dgm-mute { fill: var(--bg-gray); stroke: var(--border); stroke-width: 1.2; stroke-dasharray: 5 4; }
html[data-theme="dark"] .dgm-hi { fill: #151c36; stroke: #4f8ff7; }
html[data-theme="dark"] .dgm-warn { fill: #2a1a10; stroke: #e8691c; }
html[data-theme="dark"] .dgm-ok { fill: #0f2420; stroke: #0fa595; }

.dgm-arrow { stroke: var(--text-secondary); stroke-width: 1.8; fill: none; }
.dgm-dash { stroke-dasharray: 5 4; }
.dgm-mk { fill: var(--text-secondary); }
.dgm-line { stroke: var(--border); stroke-width: 1.5; fill: none; }
.dgm-axis { stroke: var(--text-light); stroke-width: 1.5; fill: none; }

.dgm-bar { fill: #2563eb; }
.dgm-bar.dgm-b-warn { fill: #ea580c; }
.dgm-bar.dgm-b-ok { fill: #0d9488; }
.dgm-bar.dgm-b-mute { fill: #94a3b8; }
html[data-theme="dark"] .dgm-bar { fill: #4f8ff7; }
html[data-theme="dark"] .dgm-bar.dgm-b-warn { fill: #e8691c; }
html[data-theme="dark"] .dgm-bar.dgm-b-ok { fill: #0fa595; }

/* Inside a case-study slide: no frame, and no sideways scroll (it would fight the deck's swipe navigation). */
.slide .dgm-wrap { border: 0; background: none; padding: 0; overflow: visible; }
.slide .dgm-svg { min-width: 0; }
.slide .dgm-hint { display: none; }
/* Case-study slides carry two layouts of the same diagram: wide for desktop, one column for phones. */
.slide .dgm-mob { display: none; }
@media (max-width: 640px) { .slide .dgm-desk { display: none; } .slide .dgm-mob { display: block; } }
