/**
 * Documentation layout and content — loaded only on /docs
 * Dark theme support, sidebar, typography, code blocks, tables.
 */

/* Layout — start below site header (content-header is fixed ~70px) */
.docs-layout {
    display: flex;
    gap: 0;
    width: 100%;
    min-height: 60vh;
    margin: 0;
    padding: 0;
    padding-top: 72px;
}

.docs-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary, #1a1a1f);
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.08));
    position: sticky;
    top: 72px;
    align-self: start;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.docs-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-lg, 0 10px 40px rgba(0,0,0,0.3));
}

.docs-sidebar-inner {
    padding: 20px 0 24px 0;
}

.docs-sidebar-home {
    display: block;
    padding: 8px 20px 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--turquoise);
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--turquoise-rgb), 0.25);
    margin-bottom: 12px;
    transition: color 0.15s ease, background 0.15s ease;
}

.docs-sidebar-home:hover {
    color: var(--turquoise-light);
}

.docs-sidebar-home.is-active {
    color: var(--turquoise);
}

.docs-nav {
    padding: 0 12px 0 0;
}

.docs-nav-category {
    margin-bottom: 4px;
}

.docs-nav-category-title {
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: rgba(var(--turquoise-rgb), 0.9);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.15s ease;
}

.docs-nav-category-title:hover {
    color: var(--turquoise);
}

.docs-nav-category-title::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.docs-nav-category.is-open .docs-nav-category-title::after {
    transform: rotate(180deg);
}

.docs-nav-list {
    list-style: none;
    margin: 0 0 8px 0;
    padding: 0 0 0 8px;
    border-left: 1px solid rgba(var(--turquoise-rgb), 0.25);
    margin-left: 16px;
    display: block;
}

.docs-nav-category.is-open .docs-nav-list {
    display: block;
}

.docs-nav-link {
    display: block;
    padding: 6px 12px;
    font-size: 14px;
    color: rgba(var(--turquoise-rgb), 0.85);
    text-decoration: none;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.docs-nav-link:hover {
    color: var(--turquoise);
    background: rgba(var(--turquoise-rgb), 0.08);
}

.docs-nav-link.is-active {
    color: var(--turquoise);
    font-weight: 600;
    background: rgba(var(--turquoise-rgb), 0.12);
}

.docs-main {
    flex: 1;
    min-width: 0;
    padding: 24px 32px 80px;
}

.docs-content-wrap {
    max-width: 980px;
    margin: 0 auto;
}

/* Content typography — turquoise headings */
.docs-content-wrap h1,
.docs-content-wrap .docs-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: var(--turquoise);
    line-height: 1.25;
}

.docs-content-wrap h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(var(--turquoise-rgb), 0.3);
    color: var(--turquoise);
}

.docs-content-wrap h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--turquoise);
}

.docs-content-wrap h4,
.docs-content-wrap h5,
.docs-content-wrap h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
    color: var(--turquoise);
}

.docs-content-wrap p {
    margin: 0 0 1rem 0;
    line-height: 1.65;
    color: var(--text-primary);
}

.docs-content-wrap ul,
.docs-content-wrap ol {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.docs-content-wrap li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

.docs-content-wrap a {
    color: var(--turquoise);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.docs-content-wrap a:hover {
    text-decoration: underline;
}

.docs-content-wrap code {
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    background: var(--bg-tertiary, rgba(255,255,255,0.06));
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.docs-content-wrap pre {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: var(--bg-tertiary, #0f0f12);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.docs-content-wrap pre code {
    padding: 0;
    background: none;
    border: none;
    font-size: 0.875rem;
    line-height: 1.5;
}

.docs-content-wrap blockquote {
    margin: 1rem 0;
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 4px solid var(--turquoise);
    color: var(--text-secondary);
    background: rgba(var(--turquoise-rgb), 0.04);
    border-radius: 0 6px 6px 0;
}

.docs-content-wrap blockquote p:last-child {
    margin-bottom: 0;
}

/* Tables */
.docs-content-wrap table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 14px;
}

.docs-content-wrap th,
.docs-content-wrap td {
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.docs-content-wrap th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.docs-content-wrap tr:hover td {
    background: rgba(255,255,255,0.02);
}

.docs-content-wrap hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* Not found */
.docs-not-found {
    padding: 2rem 0;
}

.docs-not-found h1 {
    margin-bottom: 0.5rem;
    color: var(--turquoise);
}

.docs-not-found a {
    color: var(--turquoise);
}

/* Mobile */
@media (max-width: 900px) {
    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
        max-height: none;
        box-shadow: none;
    }

    .docs-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0,0,0,0.4);
    }

    .docs-sidebar-toggle {
        display: flex;
    }

    .docs-main {
        padding: 20px 20px 80px;
    }
}

body.light-mode .docs-sidebar {
    background: var(--bg-secondary);
}

body.light-mode .docs-content-wrap code {
    background: rgba(0,0,0,0.06);
}

body.light-mode .docs-content-wrap pre {
    background: rgba(0,0,0,0.04);
}
