/**
 * DLP shared docs layout (D-166) — single source of truth for the
 * fixed-sidebar documentation chrome used by framework, faq, dlp-week1..4.
 *
 * Replaces six near-identical inline copies. The geometry guarantee: at
 * desktop widths the sidebar column is reserved by BODY padding, so every
 * body-level element (main content, site footer, standing-disclaimers aside,
 * hq-widget) clears the fixed sidebar by construction — the D-165 headline
 * break was content OUTSIDE .main-content sliding under the sidebar, because
 * the old layout only protected .main-content via margin-left.
 *
 * Pages opt in with body.docs-layout (set body_class in the page template)
 * and may override --docs-accent (sidebar-toggle color) and
 * .main-content max-width in their inline styles.
 */

body.docs-layout {
    --sidebar-width: 280px;
}

/* Desktop: reserve the sidebar column for ALL body-level content. */
@media (min-width: 1025px) {
    body.docs-layout {
        padding-left: var(--sidebar-width);
    }
}

body.docs-layout .layout {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

body.docs-layout .sidebar {
    width: var(--sidebar-width);
    background: var(--dark-mid, #16213e);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 1.5rem 0;
    z-index: 100;
    transition: transform 0.3s;
}

body.docs-layout .sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--docs-accent, #3498db);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

body.docs-layout .main-content {
    flex: 1;
    margin-left: 0; /* the body padding does the clearing at desktop */
    padding: 2rem 3rem;
    max-width: 900px;
    min-width: 0; /* wide children (tables/grids) scroll, not force overflow */
}

@media (max-width: 1024px) {
    body.docs-layout .sidebar {
        transform: translateX(-100%);
    }

    body.docs-layout .sidebar.open {
        transform: translateX(0);
    }

    body.docs-layout .sidebar-toggle {
        display: block;
    }

    body.docs-layout .main-content {
        margin-left: 0;
        padding: 1.5rem;
        max-width: 100%;
        /* clearance so end-of-page content can scroll above the floating
           sidebar-toggle button */
        padding-bottom: 5.5rem;
    }
}

/* ── Sidebar eco-grid (D-183: extracted from the 6 docs pages' inline <style>;
   previously inline-duplicated in framework/faq/dlp-week1..4. Canonical = the
   framework/faq variant with hover transition + text-align:center. The eco-grid
   HTML lives in templates/partials/ecosystem-sidebar.html. D-167 edits the
   partial content; layout/geometry is the .sidebar/.main-content rules above
   (D-166's single source). ── */
.sidebar-section { padding: 0 1rem; margin-bottom: 2rem; }
.sidebar-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 0.75rem; padding: 0 0.5rem; }
.eco-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.eco-link { display: flex; flex-direction: column; align-items: center; padding: 0.75rem 0.5rem; background: rgba(255,255,255,0.03); border-radius: 8px; text-decoration: none; color: var(--text-dim); font-size: 0.75rem; transition: all 0.2s; text-align: center; }
.eco-link:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.eco-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
