:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border-color: #30363d;
    --border-subtle: #21262d;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --accent-emerald: #2ea043;
    --accent-cyan: #38bdf8;
    --accent-purple: #a855f7;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-blue: #58a6ff;
    --accent-retro-amber: #d97706;

    --code-bg: #090d13;
    --code-border: #30363d;
    --code-text: #7ee787;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --font-console: "Space Mono", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.68;
    font-size: 16px;
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 320px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 1.25rem 3rem 1.25rem;
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-console);
    letter-spacing: -0.02em;
}

.sidebar-header .version-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.15rem 0.5rem;
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 9999px;
    margin-top: 0.4rem;
}

.sidebar-nav section {
    margin-bottom: 1.5rem;
}

.sidebar-nav h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    padding-left: 0.5rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.sidebar-nav li a:hover {
    color: var(--accent-cyan);
    background-color: var(--bg-tertiary);
}

.sidebar-nav li a.active {
    color: var(--accent-cyan);
    background-color: rgba(56, 189, 248, 0.12);
    font-weight: 600;
}

/* Main Content Area */
.content {
    flex: 1;
    max-width: 980px;
    margin: 0 auto;
    padding: 3.5rem 3rem 6rem 3rem;
}

/* Typography */
h1.doc-title {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #e6edf3 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 300;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.badge {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.badge.emerald { border-color: rgba(46, 160, 67, 0.4); color: #3fb950; }
.badge.cyan { border-color: rgba(56, 189, 248, 0.4); color: var(--accent-cyan); }
.badge.purple { border-color: rgba(168, 85, 247, 0.4); color: #c084fc; }
.badge.amber { border-color: rgba(245, 158, 11, 0.4); color: var(--accent-amber); }

hr.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 3rem 0;
}

h2 {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

p, ul, ol {
    margin-bottom: 1.25rem;
    color: #c9d1d9;
}

ul, ol {
    padding-left: 1.75rem;
}

li {
    margin-bottom: 0.35rem;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: var(--code-text);
}

pre {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-primary);
}

pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Callout Boxes */
.callout {
    border-radius: 8px;
    padding: 1.15rem 1.35rem;
    margin: 1.5rem 0;
    border-left: 4px solid;
    background-color: var(--bg-secondary);
}

.callout.info {
    border-color: var(--accent-cyan);
    background-color: rgba(56, 189, 248, 0.08);
}
.callout.info .callout-title { color: var(--accent-cyan); }

.callout.success {
    border-color: var(--accent-emerald);
    background-color: rgba(46, 160, 67, 0.08);
}
.callout.success .callout-title { color: #3fb950; }

.callout.warning {
    border-color: var(--accent-amber);
    background-color: rgba(245, 158, 11, 0.08);
}
.callout.warning .callout-title { color: var(--accent-amber); }

.callout.danger {
    border-color: var(--accent-rose);
    background-color: rgba(244, 63, 94, 0.08);
}
.callout.danger .callout-title { color: var(--accent-rose); }

.callout-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Triad Sections (What It Does, How It Works, Why It Works) */
.triad-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 2rem 0;
    padding: 1.5rem;
}

.triad-block h3 {
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.triad-section {
    margin-top: 1.25rem;
}

.triad-label {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    display: inline-block;
}

.triad-label.what { color: #38bdf8; }
.triad-label.how { color: #f59e0b; }
.triad-label.why { color: #3fb950; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.92rem;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: rgba(22, 27, 34, 0.5);
}

/* Footer */
footer.doc-footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
    body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .content {
        padding: 2rem 1.25rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: #fff;
        color: #111;
        font-size: 11pt;
    }
    .sidebar {
        display: none;
    }
    .content {
        max-width: 100%;
        padding: 0;
    }
    pre, code {
        background: #f5f5f5;
        color: #111;
        border-color: #ddd;
    }
    .triad-block, .callout {
        background: #fafafa;
        border-color: #ddd;
    }
}
