/*
 * base.css
 *
 * Theme-agnostic structural rules for MkDocs Material + Ask AI Drawer.
 * Loaded before every theme preset (see themes/*.css) — contains no colors,
 * only layout mechanics that every theme should share. Palette, fonts, and
 * component skinning live in the selected themes/<name>.css file instead.
 */

/* ── Sidebar viewport sizing fix ──────────────────────────────────────────── */
:root {
    --gnus-sidebar-width: 16rem;
}

.md-main__inner {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media screen and (min-width: 76.25em) {
    .md-container {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        height: calc(100vh - 2.4rem);
        overflow: hidden;
    }

    .md-main {
        min-height: 0;
        overflow: hidden;
    }

    .md-main__inner {
        height: 100%;
        min-height: 0;
        margin-top: 0;
        padding-top: 1.5rem;
        overflow: hidden;
    }

    .md-sidebar--primary,
    .md-sidebar--primary .md-sidebar__scrollwrap,
    .md-content {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0;
    }

    .md-content {
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
    }

    .md-main__inner > .md-sidebar--primary {
        flex: 0 0 var(--gnus-sidebar-width) !important;
    }

    .md-sidebar--primary {
        position: relative !important;
        width: var(--gnus-sidebar-width) !important;
        min-width: var(--gnus-sidebar-width) !important;
        max-width: var(--gnus-sidebar-width) !important;
    }
}

@media screen and (max-width: 76.234375em) {
    /* Keep the root drawer nav list expanded to intrinsic height on mobile. */
    .md-sidebar--primary .md-nav--primary > .md-nav__list {
        height: auto !important;
        max-height: none !important;
    }

    /* Material sets overflow:hidden on the scrollwrap for drill-down nav,
       but with navigation.sections enabled all sections are expanded.
       Allow scrolling so items below the viewport aren't clipped. */
    .md-sidebar--primary .md-sidebar__scrollwrap {
        overflow-y: auto !important;
    }
}

.md-main__inner > .md-content,
.md-main__inner > .md-grid {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin-left: 10px !important;
}

.md-main__inner > .md-content > .md-content__inner,
.md-main__inner > .md-grid,
.md-main__inner .md-grid {
    margin-left: 20px !important;
    margin-right: 20px !important;
    max-width: none !important;
}

@media screen and (min-width: 76.25em) {
    .md-sidebar--primary,
    .md-sidebar--primary .md-sidebar__scrollwrap,
    .md-sidebar--primary .md-sidebar__inner {
        min-height: 0;
    }

    .md-sidebar--primary {
        padding-top: 0 !important;
        padding-bottom: 2.5rem !important;
        overflow: hidden !important;
        overscroll-behavior: contain !important;
    }

    .md-sidebar--primary .md-sidebar__scrollwrap {
        width: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain !important;
    }

    .md-sidebar--primary .md-sidebar__inner {
        width: 100%;
        padding: 0 0.2rem !important;
        box-sizing: border-box;
        overflow: visible;
    }

    .md-sidebar--primary .md-nav--primary,
    .md-sidebar--primary .md-nav--integrated,
    .md-sidebar--primary .md-nav.md-nav--primary,
    .md-sidebar--primary .md-nav.md-nav--integrated {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    .gnus-sidebar-resizer {
        position: absolute;
        top: 0;
        right: -0.25rem;
        width: 0.5rem;
        height: 100%;
        cursor: col-resize;
        z-index: 20;
    }

    body.gnus-sidebar-resizing,
    body.gnus-sidebar-resizing * {
        cursor: col-resize !important;
        user-select: none !important;
    }
}

/* ── Suppress duplicate nav title labels (desktop only) ─────────────────────
   On desktop all sections are visible so the back-navigation label inside
   each nested <nav> duplicates the parent link.  On mobile the same label
   IS the back button — without it you can't leave a drill-down level. */
@media screen and (min-width: 76.25em) {
    .md-nav__item--nested > .md-nav > .md-nav__title {
        display: none;
    }
}

/* ── GitBook image / figure alignment ─────────────────────────────────────── */
.md-typeset figure                        { display:block; margin:1rem auto; text-align:center; }
.md-typeset figure img                    { display:inline-block; }

.md-typeset div[align="left"]             { text-align:left; }
.md-typeset div[align="left"] figure,
.md-typeset div[align="left"] img         { display:inline-block; margin:0; }

.md-typeset div[align="center"]           { text-align:center; }

.md-typeset div[data-full-width="true"]   { width:100%; text-align:left; }
.md-typeset div[data-full-width="true"] figure { display:block; width:100%; margin:1rem 0; }
.md-typeset div[data-full-width="true"] img:not([width]) { width:100%; max-width:100%; display:block; }

/* ── Content bottom margin ───────────────────────────────────────────────── */
.md-content__inner { padding-bottom: 4rem; }
