
/* ── Sidebar scrollbar ── */
#sidebar {
    scrollbar-color: #b01010 #d4b84a;
}
#sidebar::-webkit-scrollbar-track {
    background: #d4b84a;
}
#sidebar::-webkit-scrollbar-thumb {
    background: #b01010;
    border-radius: 3px;
}

/* ── Align main content clear of sidebar (incl. scrollbar) ── */
/* min-width:0 overrides the flex default of min-width:auto, which otherwise
   prevents #main from shrinking below its content width at narrow desktop sizes. */
#main { min-width: 0; }

@media (min-width: 701px) {
    #main { margin-left: 184px; }
}

/* ── H1 centered over full content-header width ── */
#content-header {
    position: relative;
}

#content-header h1 {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    margin: 0;
    pointer-events: none;
}

/* section-list visibility is controlled by JS; CSS default is hidden so that
   removeProperty('display') reliably collapses even sections whose HTML has
   an explicit display:block inline style (e.g. the active chapter). */
.section-list { display: none; }

/* ── Mobile navigation ── */

#nav-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    right: auto;
    z-index: 300;
    background: #7bb8d4;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

#nav-toggle:hover {
    background: #5aa0bf;
}

#nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
}

/* The inline CSS removes the callout float at 900px, which collapses them
   inline mid-sentence. Override to keep them floating right at all sizes,
   just slightly smaller to fit narrower screens. */
@media (max-width: 900px) {
    .callout {
        float: right !important;
        clear: right !important;
        width: auto !important;
        min-width: 60px;
        margin: 3px 0 10px 12px !important;
        text-align: right !important;
        border-left: none !important;
        padding-left: 0 !important;
        font-size: 13px !important;
    }
}

@media (max-width: 700px) {
    #nav-toggle {
        display: block;
    }

    /* Home page: stack image above title instead of side-by-side */
    .home-hero {
        flex-direction: column !important;
        align-items: center !important;
        padding: 24px 16px !important;
    }

    .home-hero > div:first-child {
        margin-right: 0 !important;
        margin-bottom: 20px !important;
        text-align: center;
    }

    .home-hero > div:first-child img {
        width: 130px !important;
        margin: 0 auto !important;
    }

    .home-hero > div:last-child > div:first-child {
        font-size: 38px !important;
    }

    .home-hero > div:last-child > div:nth-child(2) {
        font-size: 18px !important;
        margin-bottom: 20px !important;
    }

    .home-hero > div:last-child > div:last-child {
        max-width: 100% !important;
    }

    /* Stack body children vertically so injected ads don't enter the flex row */
    body {
        display: block;
    }

    /* Push content down to clear the hamburger button. */
    #main {
        padding-top: 62px;
        padding-right: 12px !important;
    }

    /* Show sidebar as overlay when nav is open */
    body.nav-open #sidebar {
        display: block !important;
    }

    body.nav-open #nav-overlay {
        display: block;
    }
}

