/* slides.css — slide mode: sidebar menu, navigation, collapse/expand chevrons.
   Breakpoint must match slideModeMinWidth in slides.js.
   The sidebar holds: .sidebar-menu-list (scrollable) → .sidebar-collapse-btn (bottom).
   A sibling .sidebar-expand-btn floats near the left edge when the sidebar is collapsed.
   Header (#site-header) with logo + theme switch lives in theme.css and is always shown. */

:root {
    --menu-width: 300px;
    --menu-gap: 20px;
}

/* Outside of slide mode (narrow screens) slide-UI is hidden,
   content is shown as a regular scrollable page. */
#slide-menu,
#slide-navigation,
.sidebar-expand-btn {
    display: none;
}

@media (min-width: 768px) {
    /* Layout: fixed sidebar menu + content */
    .slide-container {
        display: flex;
        align-items: flex-start;
        margin-left: var(--menu-width);
        transition: margin-left 0.3s ease;
    }

    .slide-container.menu-collapsed {
        margin-left: 0;
    }

    .slide-container > .content {
        flex-grow: 1;
        min-width: 0;
    }

    /* Sidebar — two rows in flex column:
       - .sidebar-menu-list (top, scrollable)
       - .sidebar-collapse-btn (bottom, fixed)
       Logo lives in #site-header (theme.css). */
    #slide-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: var(--menu-width);
        height: calc(100vh - var(--header-height));
        overflow: hidden;
        background: var(--color-chrome);
        border-right: 2px solid var(--color-border);
        z-index: 1000;
        transition: transform 0.3s ease;
    }

    .menu-collapsed #slide-menu {
        transform: translateX(calc(-100% - var(--menu-gap)));
    }

    /* Scrollable list of slide buttons */
    .sidebar-menu-list {
        flex: 1;
        overflow-y: auto;
        padding: 16px 12px;
    }

    /* Menu items — compact, with a transparent left border,
       which turns blue in the active state. */
    .sidebar-menu-list button {
        display: block;
        width: 100%;
        margin-bottom: 1px;
        padding: 8px 12px 8px 13px;
        font: inherit;
        font-size: 0.92rem;
        line-height: 1.4;
        text-align: left;
        color: var(--color-text-muted);
        background: none;
        border: 0;
        border-left: 3px solid transparent;
        border-radius: 0 4px 4px 0;
        cursor: pointer;
        transition: background-color 0.15s ease, color 0.15s ease,
            border-color 0.15s ease;
    }

    .sidebar-menu-list button:hover {
        background: var(--color-active-bg);
        color: var(--color-heading);
    }

    .sidebar-menu-list button[aria-current="true"] {
        color: var(--color-heading);
        background: var(--color-active-bg);
        border-left-color: var(--color-accent);
        font-weight: 500;
    }

    /* Collapse/expand chevron buttons (shared styles) */
    .sidebar-collapse-btn,
    .sidebar-expand-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        color: var(--color-text-muted);
        background: transparent;
        border: 1px solid var(--color-border);
        border-radius: 6px;
        cursor: pointer;
        transition: color 0.15s ease, background-color 0.15s ease,
            border-color 0.15s ease;
    }

    .sidebar-collapse-btn:hover,
    .sidebar-expand-btn:hover {
        color: var(--color-heading);
        background: var(--color-active-bg);
        border-color: var(--color-accent);
    }

    .sidebar-collapse-btn svg,
    .sidebar-expand-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Collapse button — bottom-right inside the sidebar */
    .sidebar-collapse-btn {
        flex-shrink: 0;
        align-self: flex-end;
        margin: 12px 16px 16px;
    }

    /* Expand button — floating near left edge, visible only when sidebar collapsed */
    .sidebar-expand-btn {
        position: fixed;
        bottom: 16px;
        left: 12px;
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease 0s, visibility 0s 0.2s,
            color 0.15s ease, background-color 0.15s ease,
            border-color 0.15s ease;
    }

    .slide-container.menu-collapsed .sidebar-expand-btn {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.2s ease 0.15s, visibility 0s 0s,
            color 0.15s ease, background-color 0.15s ease,
            border-color 0.15s ease;
    }

    /* Slides.
       Inactive slides are hidden via visibility+height (rather than display:none),
       so that all <pre> stay in the layout — otherwise the Prism line-numbers plugin
       cannot measure line heights in hidden slides. */
    .slide {
        visibility: hidden;
        opacity: 0;
        height: 0;
        overflow: hidden;
        transition: opacity 0.2s ease-in-out;
    }

    .slide.active {
        visibility: visible;
        opacity: 1;
        height: auto;
        overflow: visible;
    }

    /* Slide is programmatically focused when switching (for screen-readers),
       but we don't need a black focus outline around the content. */
    .slide:focus {
        outline: none;
    }

    /* Slide navigation */
    #slide-navigation {
        display: flex;
        justify-content: space-between;
        margin-top: 48px;
        padding-top: 24px;
        border-top: 2px solid var(--color-border);
    }

    #slide-navigation button {
        padding: 9px 22px;
        font-family: inherit;
        font-size: 1.33rem;
        font-weight: 500;
        line-height: 1;
        color: #fff;
        background: var(--color-accent);
        border: 0;
        border-radius: var(--radius);
        cursor: pointer;
        transition: background-color 0.15s ease;
    }

    #slide-navigation button:hover:not(:disabled) {
        background: var(--color-accent-dark);
    }

    #slide-navigation button:disabled {
        background: var(--color-border);
        color: var(--color-text-muted);
        cursor: not-allowed;
    }

}


@media print {
    #slide-menu,
    #slide-navigation,
    .sidebar-expand-btn {
        display: none !important;
    }

    .slide-container {
        margin-left: 0;
    }

    .slide {
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
    }
}
