/* figures/diagram.css -- shared look of every built figure. * * build-figures.py drops this file into the style element of every built * svg, so a figure carries its own styling and stays self-contained. * Classes, not per-element fills, do the work: one edit here restyles the * whole book. * * Colours are the extension's tokens (_extensions/notes/theme.css) with a * literal fallback, which covers all three ways a figure is seen: * * - inlined into the page by figures/flow-player.html: the tokens resolve * against the page, so the figure follows light, night and high contrast; * - as a plain (JavaScript off): the fallback applies, and night mode * comes from the extension's invert filter on main img[src$=".svg"]; * - in the pdf: librsvg ignores var() and uses the fallback, so print gets * the light palette -- which is what a printed page wants. * * The fallbacks are this book's own light values; the tokens carry the night * and high-contrast ones. Nothing here keys off prefers-color-scheme: the * page's toggle decides, never the reader's system setting. */ svg { font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif; /* the figure sits on the page, not on a white card of its own */ background: transparent; } /* ---- surfaces ------------------------------------------------------- */ .box { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; } .box-weak { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; } .box-accent { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; } .box-warn { fill: var(--calc-faint, #f8f1e0); stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.4; } .box-plain { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-grid, #dae0e8); stroke-width: 1.2; } .diamond { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; } .ellipse { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; } /* ---- lines ---------------------------------------------------------- */ .edge { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.3; } .edge-strong{ fill: none; stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; } .edge-warn { fill: none; stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.6; } .edge-dash { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; stroke-dasharray: 5 3; } .rule { stroke: var(--calc-grid, #dae0e8); stroke-width: 1; } /* ---- text ----------------------------------------------------------- */ .t { fill: var(--calc-ink, #1b2430); font-size: 13px; } .t-sm { fill: var(--calc-ink, #1b2430); font-size: 11px; } .t-lead { fill: var(--calc-ink, #1b2430); font-size: 14px; font-weight: 600; } .t-mut { fill: var(--calc-muted, #5a6879); font-size: 11px; } .t-key { fill: var(--calc-ink, #1b2430); font-size: 12px; text-decoration: underline; } .t-accent { fill: var(--calc-notecolor, #20666f); font-size: 12px; font-weight: 600; } .t-warn { fill: var(--calc-accent-b, #D1541F); font-size: 12px; font-weight: 600; } .t-mono { fill: var(--calc-ink, #1b2430); font-size: 11.5px; font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; } .mid { text-anchor: middle; } .end { text-anchor: end; } /* ---- interaction ==================================================== * A .node groups one box with its labels. Hovering it lifts the whole group * a little, which is enough to follow a path through a busy diagram without * any script. Pointer events stay off the decorative layers so the hover * target is the shape itself. */ .node { transition: opacity .12s ease; } .node:hover .box, .node:hover .box-accent, .node:hover .diamond { stroke-width: 2.6; } .node:hover .t, .node:hover .t-lead { fill: var(--calc-notecolor, #20666f); } svg:hover .node:not(:hover) { opacity: .55; } /* a figure that marks no nodes must not dim on hover */ svg:not(:has(.node)) .node { opacity: 1; } @media (prefers-reduced-motion: reduce) { .node { transition: none; } } /* ---- arrowheads ====================================================== * marker contents cannot inherit the referencing element's fill, so each * arrowhead is its own class and is themed alongside the line it ends. */ .arrow { fill: var(--calc-muted, #5a6879); } .arrow-strong { fill: var(--calc-notecolor, #20666f); } .arrow-warn { fill: var(--calc-accent-b, #D1541F); }