@import 'common.css';

/* ============================================================
   WriteInOne Docs
   ============================================================ */

/* Cross-fade between page loads instead of a hard cut; ignored where unsupported. */
@view-transition {
    navigation: auto;
}

:root {
    --docs-bg:        #fff;
    --docs-fg:        #1a1a1a;
    --docs-muted:     #888;
    --docs-muted-2:   #555;
    --docs-border:    #ddd;
    --docs-border-2:  #e5e5e5;
    --docs-code-bg:   #f6f6f6;
    --docs-inline-bg: #f0f0f0;
    --docs-th-bg:     #fafafa;
    --docs-btn-bg:    #fff;
}

/* Dark theme — activated by class="dark" on <html> (set by theme.js) */
html.dark {
    --docs-bg:        #111;
    --docs-fg:        #e5e5e5;
    --docs-muted:     #888;
    --docs-muted-2:   #aaa;
    --docs-border:    #333;
    --docs-border-2:  #2a2a2a;
    --docs-code-bg:   #1c1c1c;
    --docs-inline-bg: #232323;
    --docs-th-bg:     #161616;
    --docs-btn-bg:    #1c1c1c;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--docs-fg);
    background: var(--docs-bg);
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

.docs-layout {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
}

/* ── Sidebar ── */
.docs-sidebar {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--docs-border);
    min-height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    padding: 1.5rem 1.25rem;
}

.docs-sidebar__brand {
    display: block;
    font-weight: bold;
    font-size: 1rem;
    color: var(--docs-fg);
    text-decoration: none;
    margin-bottom: 2rem;
    letter-spacing: -0.3px;
}

.docs-group {
    margin-bottom: 0.25rem;
}

.docs-group summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--docs-muted);
    padding: 0.4rem 0;
    user-select: none;
}

.docs-group summary::-webkit-details-marker {
    display: none;
}

.docs-group summary::before {
    content: '+ ';
}

.docs-group details[open] summary::before {
    content: '– ';
}

.docs-group summary:hover {
    color: var(--docs-fg);
}

.docs-group ul {
    list-style: none;
    margin: 0.1rem 0 1rem;
    padding: 0;
}

.docs-nav-link {
    display: block;
    padding: 0.3rem 0 0.3rem 1.1rem;
    font-size: 0.9rem;
    color: var(--docs-muted-2);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.docs-nav-link:hover {
    color: var(--docs-fg);
}

.docs-nav-link--active {
    color: var(--docs-fg);
    font-weight: bold;
    border-left: 2px solid var(--docs-fg);
}

/* ── Main content ── */
.docs-main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 3rem 4rem;
}

.docs-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.docs-btn {
    font-family: inherit;
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    border: 1px solid var(--docs-border);
    background: var(--docs-btn-bg);
    color: var(--docs-muted-2);
    cursor: pointer;
}

.docs-btn:hover {
    border-color: var(--docs-muted);
    color: var(--docs-fg);
}

.docs-btn--copied {
    border-color: var(--docs-fg);
    color: var(--docs-fg);
}

.docs-btn--icon {
    padding: 0.35rem 0.6rem;
    margin-right: auto;
    font-size: 1rem;
    line-height: 1;
}

.docs-raw {
    background: var(--docs-code-bg);
    border: 1px solid var(--docs-border-2);
    padding: 1.25rem;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Rendered markdown content ── */
.docs-content h1,
.docs-content h2,
.docs-content h3,
.docs-content h4 {
    line-height: 1.3;
    margin: 1.75rem 0 0.75rem;
    font-weight: bold;
}

.docs-content h1 { font-size: 1.9rem; margin-top: 0; }
.docs-content h2 {
    font-size: 1.35rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--docs-border-2);
}
.docs-content h3 { font-size: 1.1rem; }

.docs-content p,
.docs-content ul,
.docs-content ol {
    margin: 0.9rem 0;
}

.docs-content ul,
.docs-content ol {
    padding-left: 1.5rem;
}

.docs-content li {
    margin: 0.3rem 0;
}

.docs-content a {
    color: var(--docs-fg);
    text-decoration: underline;
}

.docs-content blockquote {
    margin: 1rem 0;
    padding: 0.25rem 1rem;
    border-left: 3px solid var(--docs-border);
    color: var(--docs-muted-2);
}

.docs-content code {
    font-family: 'Courier New', Courier, monospace;
    background: var(--docs-inline-bg);
    padding: 0.15rem 0.4rem;
    font-size: 0.85em;
}

.docs-content pre {
    background: var(--docs-code-bg);
    border: 1px solid var(--docs-border-2);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.docs-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
}

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.docs-content th,
.docs-content td {
    border: 1px solid var(--docs-border-2);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.docs-content th {
    background: var(--docs-th-bg);
}

@media (max-width: 800px) {
    .docs-layout {
        flex-direction: column;
    }
    .docs-sidebar {
        width: 100%;
        min-height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--docs-border);
    }
    .docs-main {
        padding: 1.5rem 1.25rem 3rem;
    }
}
