/* =============================================================================
   Metrale Engine docs skin.

   Colour values come from metrale-tokens.css (linked immediately
   before this file); mdBook's own chrome variables are mapped onto those
   tokens in variables.css. This file is the finish layer — the parts of the
   generated markup that have no variable to point at.

   Everything perceptual is wrapped in `@media screen`. mdBook links its own
   print.css with `media="print"`, and a dark skin fighting a stylesheet built
   for white paper produces unreadable printouts.
   ========================================================================== */

/* Kept from the previous skin: the model and kernel matrices are wide, and the
   stock row padding wraps them. Applies on paper too, hence outside @media. */
.content table td,
.content table th {
    padding: 4px 10px;
}

/* The sidebar toggle is a button that needs script (theme/index.hbs); without
   script, the <noscript> label beside it toggles the sidebar instead. */
.no-js #sidebar-toggle { display: none; }

/* FontAwesome is applied only once the page has loaded (theme/index.hbs). Until
   then each menu-bar icon keeps the box FontAwesome 4.7 gives it (its glyph's
   advance, 1536, 1664 or 1792 of 1792 units), so the title and the buttons
   do not move when the icons appear. */
#menu-bar .fa { display: inline-block; }
#menu-bar .fa-bars,
#menu-bar .fa-github { width: 0.857143em; }
#menu-bar .fa-search,
#menu-bar .fa-print { width: 0.928571em; }
#menu-bar .fa-paint-brush,
#menu-bar .fa-edit { width: 1em; }

@media screen {
    html {
        font-family: var(--font-sans);
    }
    .content {
        -webkit-font-smoothing: antialiased;
        font-feature-settings: 'kern' 1;
    }

    /* ---- type: the blog's editorial scale ------------------------------- */
    .content h1, .content h2, .content h3, .content h4 {
        color: var(--t1);
        font-weight: var(--heading-weight);
    }
    .content h1 { letter-spacing: -0.03em; }
    .content h2 { letter-spacing: -0.024em; }
    .content strong { color: var(--t1); }
    .content li::marker { color: color-mix(in srgb, var(--t2) 40%, transparent); }
    .content hr {
        border: 0;
        height: 1px;
        background: color-mix(in srgb, var(--border) 55%, transparent);
    }

    /* ---- links: the prose treatment used on the blog --------------------- */
    .content a {
        text-decoration: underline;
        text-decoration-thickness: 1.5px;
        text-underline-offset: 2.5px;
        text-decoration-color: color-mix(in srgb, var(--accent) 38%, transparent);
    }
    .content a:hover { text-decoration-color: var(--accent); }
    :focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; }

    /* ---- the top bar: the marketing nav's blur and hairline -------------- */
    #menu-bar {
        background: color-mix(in srgb, var(--bg) 82%, transparent);
        backdrop-filter: blur(12px) saturate(140%);
        -webkit-backdrop-filter: blur(12px) saturate(140%);
        border-bottom: 1px solid var(--border);
    }
    .menu-title {
        color: var(--t1);
        font-weight: 600;
        letter-spacing: -0.02em;
    }

    /* Every theme class now maps to the same palette, so the picker changes
       nothing. A control that does nothing is a defect, not a feature. */
    #theme-toggle { display: none; }

    /* ---- sidebar --------------------------------------------------------- */
    .chapter li.part-title {
        color: var(--t3);
        font-family: var(--font-mono);
        font-weight: 600;
        font-size: 0.78em;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }
    .chapter li.chapter-item a.active { color: var(--accent); }

    /* ---- code: the recessed terminal surface ----------------------------- */
    .content pre {
        border: 1px solid var(--border);
        border-radius: 10px;
    }
    .hljs {
        background: var(--sunk);
        color: var(--t2);
    }
    .content pre > code { line-height: 1.62; }
    .content :not(pre) > code {
        background: color-mix(in srgb, var(--t3) 16%, transparent);
        border-radius: 5px;
        padding: 2px 5px;
    }

    /* ---- syntax ----------------------------------------------------------
       mdBook links all three of its highlight themes and lets book.js enable
       one. This file is linked after all of them, so equal-specificity rules
       here win on order regardless of which is active. Every colour sits on
       --sunk, which is darker than --bg, so anything that clears contrast on
       the page ground clears it here too. Copper-led: keywords take the
       accent, strings its lighter step, names the ink; green and red only mark
       a diff's added and removed lines. */
    .hljs-comment, .hljs-quote { color: var(--t3); font-style: italic; }
    .hljs-keyword, .hljs-selector-tag, .hljs-meta { color: var(--accent); }
    .hljs-string { color: var(--accent-deep); }
    .hljs-number, .hljs-literal, .hljs-built_in, .hljs-type { color: var(--t1); }
    .hljs-title, .hljs-section, .hljs-name { color: var(--t1); font-weight: 600; }
    .hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--t2); }
    .hljs-symbol, .hljs-bullet, .hljs-link { color: var(--accent); }
    .hljs-addition { color: var(--green); }
    .hljs-deletion { color: var(--red); }
    .hljs-emphasis { font-style: italic; }
    .hljs-strong { font-weight: bold; }

    /* ---- blockquotes, used as note banners ------------------------------- */
    .content blockquote {
        background: var(--bg2);
        border: 1px solid var(--border);
        border-left: 2px solid var(--accent);
        border-radius: 9px;
        padding: 12px 18px;
        margin: 1.4em 0;
        color: var(--t2);
    }

    /* ---- tables ---------------------------------------------------------- */
    .content table thead th {
        background: var(--table-header-bg);
        font-family: var(--font-mono);
        font-size: 0.72em;
        font-weight: 500;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--t3);
    }

    /* mdBook gives <mark> a background variable but no colour, so the UA's
       black MarkText would land on a dark copper wash. */
    mark {
        background-color: var(--accent-soft);
        color: var(--t1);
        border-radius: 2px;
    }

    /* Kept from the previous skin, re-inked: the introduction's headline. */
    .metrale-headline {
        font-size: 1.6em;
        font-weight: 600;
        color: var(--accent);
    }
}

/* The table header's recessed fill is a screen affordance; on paper it prints
   as a grey slab behind grey text. */
@media print {
    .content table thead th { background: none; color: inherit; }
}
