/* Figure palette for inlined SVG architecture diagrams.
 *
 * Figures are embedded with `{{#include ../assets/.../figure.svg}}` rather than as images, so the
 * SVG becomes part of the page and can read these custom properties. Each figure carries
 * `class="tc-figure"` on its root element.
 *
 * Specificity matters here. Every figure also ships an internal `<style>` block defining the same
 * tokens under `.tc-figure` plus a `prefers-color-scheme` fallback, so it still themes itself when
 * viewed standalone, embedded as an image, or inlined into rustdoc by `include_str!`. That inline
 * block sits after this stylesheet in document order, so it would win at equal specificity. The
 * rules below are therefore qualified by the theme class mdBook sets on <html>, giving them
 * specificity (0,2,1) against the figure's own (0,1,0).
 *
 * mdBook themes: light and rust render on a light ground; coal, navy and ayu on a dark one.
 */

html.light .tc-figure,
html.rust .tc-figure {
    --fig-bg: #ffffff;
    --fig-edge: #d0d7de;
    --fig-ink: #17212b;
    --fig-ink-2: #52606d;
    --fig-line: #65758b;
    --fig-panel: #f7f9fb;
    --fig-panel-line: #a8b3bf;
    --fig-blue: #e8f1fb;
    --fig-blue-line: #2563a6;
    --fig-green: #e6f5f0;
    --fig-green-line: #147d64;
    --fig-orange: #fff1e6;
    --fig-orange-line: #b54708;
    --fig-purple: #f3ebf8;
    --fig-purple-line: #8055a3;
}

html.coal .tc-figure,
html.navy .tc-figure,
html.ayu .tc-figure {
    --fig-bg: #171b26;
    --fig-edge: #333a4d;
    --fig-ink: #e6e9f0;
    --fig-ink-2: #a2acbd;
    --fig-line: #8492a6;
    --fig-panel: #1e2432;
    --fig-panel-line: #3d465c;
    --fig-blue: #16283d;
    --fig-blue-line: #6aa9e0;
    --fig-green: #123029;
    --fig-green-line: #4fbfa0;
    --fig-orange: #33240f;
    --fig-orange-line: #e0a44e;
    --fig-purple: #241c33;
    --fig-purple-line: #b18fd4;
}

/* The two Redis knowledge figures carry their own semantic roles rather than the shared palette. */

html.light .tc-figure,
html.rust .tc-figure {
    --fig-source: #eef6ff;
    --fig-source-line: #3478b8;
    --fig-redis: #fff5e8;
    --fig-redis-line: #bc6b16;
    --fig-checker: #f1ecff;
    --fig-checker-line: #7254b3;
    --fig-knowledge: #eaf8ee;
    --fig-knowledge-line: #39834d;
}

html.coal .tc-figure,
html.navy .tc-figure,
html.ayu .tc-figure {
    --fig-source: #14283c;
    --fig-source-line: #6fa8db;
    --fig-redis: #33260f;
    --fig-redis-line: #d99a3f;
    --fig-checker: #241d34;
    --fig-checker-line: #a892d6;
    --fig-knowledge: #132c1c;
    --fig-knowledge-line: #5fae74;
}

/* Inlined figures are block-level content, not text. Keep them centred and responsive, and give
 * dense compositions a horizontal scroll rather than letting them shrink below legible label size.
 */

.tc-figure {
    display: block;
    width: 100%;
    height: auto;
    margin: 1.25rem auto;
}

.tc-figure-scroll {
    overflow-x: auto;
    margin: 1.25rem 0;
}

.tc-figure-scroll .tc-figure {
    margin: 0 auto;
}
