/* ============================================================
   mdBook overrides to harmonise with the Zizq website theme.
   Loaded AFTER mdBook's own CSS so these take precedence.
   ============================================================ */

/* Push mdBook menu bar below our sticky header.
   ID + nesting needed to beat mdBook's specificity. */
#mdbook-page-wrapper #mdbook-menu-bar,
#mdbook-page-wrapper #mdbook-menu-bar.sticky {
    position: sticky !important;
    top: var(--zizq-header-height) !important;
}

/* Sidebar: offset below the sticky site header */
.sidebar {
    top: var(--zizq-header-height);
    height: calc(100vh - var(--zizq-header-height));
}

/* Override mdBook theme variables */
:root {
    --bg: var(--zizq-bg);
    --content-max-width: var(--zizq-max-width);
    --fg: var(--zizq-text);
    --icons: var(--zizq-text-secondary);
    --sidebar-fg: var(--zizq-text-secondary);
    --sidebar-active: var(--zizq-link);
    --sidebar-header-border-color: var(--zizq-link);
    --table-header-bg: var(--zizq-table-header-bg);
    --table-alternate-bg: var(--zizq-table-alternate-bg);
    --theme-hover: var(--zizq-code-background);
    --links: var(--zizq-link);
    --mono-font: var(--zizq-font-mono);
    --code-font-size: var(--zizq-code-font-size);
    --blockquote-note-color: var(--zizq-bright-blue);
    --blockquote-tip-color: var(--zizq-bright-cyan);
}

/* Sidebar "On this page" section */
.on-this-page {
    border-inline-start-width: 2px;
    padding-left: 12px;
}

/* Remove chapter numbering from sidebar */
.chapter-item a strong[aria-hidden="true"] {
    display: none;
}

/* Hide theme selector */
#mdbook-theme-toggle,
#mdbook-theme-list {
    display: none !important;
}

/* Match content padding to header */
.content main {
    padding: 0 var(--zizq-page-padding);
}

/* Shrink menu title to match nav */
.menu-title {
    font-size: 1em;
}

/* Lighten blockquote text */
blockquote {
    color: var(--zizq-text-secondary);
}

/* Code block background and text */
.hljs {
    background: var(--zizq-code-background) !important;
    color: var(--zizq-text) !important;
}

/* Tables: full width */
table {
    width: 100%;
    display: table;
}

/* ---- Footer inside mdBook ---- */

/* Reset link colours inside the footer (mdBook sets --links which
   makes them green). rem values now match between both contexts since
   we share the same 62.5% root font-size convention. */
#mdbook-page-wrapper .site-footer a {
    color: var(--zizq-text-muted);
}

#mdbook-page-wrapper .site-footer a:hover {
    color: var(--zizq-text);
}

/* Horizontal rules */
#mdbook-page-wrapper hr {
    border: none;
    border-top: 1px solid var(--zizq-border);
    margin: 3.2rem auto;
    width: 50%;
}
