/* M5 help docs site stylesheet — independent from main style.css to avoid coupling. */

.doc-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

.doc-sidebar {
    border-right: 1px solid #eee;
    padding-right: 16px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.doc-sidebar .toc-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.doc-sidebar .toc-tree ul {
    list-style: none;
    padding-left: 16px;
    margin: 4px 0;
}

.doc-sidebar .toc-node > a,
.doc-sidebar .toc-doc > a {
    display: block;
    padding: 4px 8px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
}

.doc-sidebar .toc-node > a:hover,
.doc-sidebar .toc-doc > a:hover {
    background: #f5f5f5;
}

.doc-sidebar .toc-node--active > a {
    color: #23B14D;
    font-weight: 600;
}

.doc-sidebar .toc-doc--current > a {
    background: #e8f5ec;
    color: #23B14D;
    font-weight: 600;
}

.doc-main {
    min-width: 0;   /* let prose ellipsize/wrap inside grid */
}

.doc-breadcrumb {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
}

.doc-breadcrumb a {
    color: #888;
    text-decoration: none;
}

.doc-breadcrumb a:hover {
    color: #23B14D;
}

.doc-breadcrumb .sep {
    margin: 0 6px;
    color: #ccc;
}

.doc-article {
    max-width: 800px;
    line-height: 1.75;
    color: #222;
}

.doc-article h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #111;
}

.doc-article h2 { font-size: 22px; margin: 32px 0 12px; }
.doc-article h3 { font-size: 18px; margin: 24px 0 10px; }
.doc-article p  { margin: 0 0 16px; }
.doc-article ul, .doc-article ol { padding-left: 24px; margin: 0 0 16px; }
.doc-article li { margin-bottom: 6px; }
.doc-article img { max-width: 100%; height: auto; border-radius: 4px; }
.doc-article code {
    background: #f4f4f4;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
}
.doc-article pre {
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
}
.doc-article table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}
.doc-article th, .doc-article td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}
.doc-article th { background: #f8f8f8; font-weight: 600; }

.doc-meta {
    color: #999;
    font-size: 13px;
    margin-bottom: 24px;
}
.doc-meta span { margin-right: 12px; }

.doc-pager {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #eee;
    gap: 16px;
}

.doc-pager a {
    flex: 1;
    padding: 12px 16px;
    background: #f8f8f8;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background 0.15s;
}

.doc-pager a:hover {
    background: #e8f5ec;
    color: #23B14D;
}

.doc-pager .next { text-align: right; }

/* Doc home cards */
.doc-home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.doc-home-card {
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.doc-home-card:hover {
    border-color: #23B14D;
    box-shadow: 0 4px 12px rgba(35,177,77,0.12);
}

.doc-home-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.doc-home-card a {
    color: #23B14D;
    text-decoration: none;
}

/* Mobile drawer */
.doc-toc-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 16px;
    z-index: 100;
    background: #23B14D;
    color: #fff;
    padding: 12px 18px;
    border-radius: 24px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    text-decoration: none;
}

@media (max-width: 1023px) {
    .doc-layout {
        display: block;
        padding: 16px 12px;
    }

    .doc-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        z-index: 200;
        padding: 16px;
        border-right: 1px solid #eee;
        transition: left 0.25s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    }

    .doc-sidebar.is-open {
        left: 0;
    }

    .doc-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 150;
    }

    .doc-sidebar-overlay.is-open {
        display: block;
    }

    .doc-toc-toggle {
        display: inline-block;
    }

    .doc-article h1 { font-size: 22px; }
}
