/* The Windows Trust Chain — mdBook theme overrides.
   Ports the print book's designed components (trust ledger, named callouts,
   evidence certificates, figures) that tools/mdbook-trustchain.mjs emits, using
   mdBook's per-theme variables so light (light, rust) and dark (navy, coal, ayu)
   themes both read well. */

/* Provenance colors, keyed off mdBook's theme classes on <html>. */
:root {
    --tc-cap-ink: #15703b; --tc-cap-bg: #e9f3ec;
    --tc-emu-ink: #8a5a12; --tc-emu-bg: #f6eeda;
    --tc-doc-ink: #1f557f; --tc-doc-bg: #e7eff6;
    --tc-def: #2b5d8a;
    --tc-quote: #6a7b52;
    --tc-warn-ink: #a23b2c; --tc-warn-bg: #f7ece9;
}
.navy, .coal, .ayu {
    --tc-cap-ink: #6fcf97; --tc-cap-bg: #13241a;
    --tc-emu-ink: #d8a657; --tc-emu-bg: #241c10;
    --tc-doc-ink: #7fb0d8; --tc-doc-bg: #101a24;
    --tc-def: #6c9cc7;
    --tc-quote: #9bb06f;
    --tc-warn-ink: #d98a7e; --tc-warn-bg: #241412;
}

/* --- Preview banner: injected on every page by theme/preview-banner.js. ---- */
#preview-banner {
    margin: 0 0 1.6rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--tc-emu-ink);
    border-left: 4px solid var(--tc-emu-ink);
    border-radius: 6px;
    background: var(--tc-emu-bg);
    font-size: 0.9em;
    line-height: 1.5;
}
#preview-banner strong { color: var(--tc-emu-ink); }
@media print {
    #preview-banner { display: none; }
}

/* --- Trust ledger: the signature boxed sidebar opening each chapter. ------ */
.trust-ledger {
    margin: 1.8rem 0;
    padding: 0.9rem 1.2rem 0.7rem;
    border: 1px solid var(--quote-border, rgba(128, 128, 128, 0.3));
    border-left: 4px solid var(--links, #4a86c7);
    border-radius: 0 5px 5px 0;
    background: var(--quote-bg, rgba(128, 128, 128, 0.1));
    font-size: 0.95em;
}
.trust-ledger::before {
    content: "Trust-Chain Ledger";
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--links, #4a86c7);
    margin-bottom: 0.5rem;
}
.trust-ledger ul { margin: 0; padding-left: 1.1rem; list-style: none; }
.trust-ledger li { margin: 0.3rem 0; }
.trust-ledger li > strong:first-child { color: var(--links, #4a86c7); }

/* --- Named callouts: colored left rule + soft tint. ---------------------- */
.callout {
    margin: 1.5rem 0;
    padding: 0.7rem 1.1rem;
    border-left: 3px solid var(--links, #4a86c7);
    border-radius: 0 4px 4px 0;
    background: var(--quote-bg, rgba(128, 128, 128, 0.1));
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-definition  { border-left-color: var(--tc-def); }
.callout-foundations { border-left-color: var(--tc-def); }
.callout-insight     { border-left-color: var(--links, #4a86c7); }
.callout-aside       { border-left-color: var(--icons, #888); }
.callout-note        { border-left-color: var(--icons, #888); }
.callout-quote       { border-left-color: var(--tc-quote); font-style: italic; }
.callout-warning {
    border-left-color: var(--tc-warn-ink);
    background: var(--tc-warn-bg);
}

/* --- Diagram-in-prose figure. -------------------------------------------- */
.figure-prose {
    margin: 1.6rem 0;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--quote-border, rgba(128, 128, 128, 0.3));
    border-radius: 5px;
    text-align: center;
}
.figure-prose::before {
    content: "Figure";
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--icons, #888);
    margin-bottom: 0.4rem;
}

/* --- Evidence certificate: header band welded to the captured code block. - */
.evidence {
    margin: 1.6rem 0 0;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--quote-border, rgba(128, 128, 128, 0.3));
    border-radius: 5px 5px 0 0;
    font-size: 0.9em;
}
.evidence > :first-child { margin-top: 0; }
.evidence > :last-child { margin-bottom: 0; }
.evidence p { margin: 0.15rem 0; }

/* The code block mdBook renders next is welded on (rounded only at the bottom).
   `pre + pre` covers mdBook wrapping the code in a <pre class="playground">. */
.evidence + pre {
    margin-top: 0;
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.evidence-captured   { background: var(--tc-cap-bg); border-color: var(--tc-cap-ink); border-left: 4px solid var(--tc-cap-ink); }
.evidence-captured + pre   { border-left: 4px solid var(--tc-cap-ink); }
.evidence-emulated   { background: var(--tc-emu-bg); border-color: var(--tc-emu-ink); border-left: 4px solid var(--tc-emu-ink); }
.evidence-emulated + pre   { border-left: 4px solid var(--tc-emu-ink); }
.evidence-documented { background: var(--tc-doc-bg); border-color: var(--tc-doc-ink); border-left: 4px solid var(--tc-doc-ink); }
.evidence-documented + pre { border-left: 4px solid var(--tc-doc-ink); }

/* An evidence header not welded to a code block gets full rounding + margin. */
.evidence-standalone {
    margin-bottom: 1.6rem;
    border-radius: 5px;
}

/* --- Diagrams: print SVGs on a light card so dark strokes stay legible. --- */
.content img[src$=".svg"] {
    display: block;
    max-width: 100%;
    margin: 1.25rem auto;
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.content figure { margin: 1.5rem 0; }
.content figcaption {
    font-size: 0.85em;
    opacity: 0.75;
    text-align: center;
    margin-top: 0.4rem;
}

/* Wide reference/evidence tables should scroll rather than overflow. */
.content table { display: block; overflow-x: auto; }
