:root {
    --bg: #fafafa;
    --card: #ffffff;
    --text: #111827;
    --text-soft: #374151;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --accent: #1868db;
    --accent-hover: #174bb2;
    --accent-soft: #dbeafe;
    --code-bg: #f3f4f6;
    --code-dark-bg: #0f172a;
    --code-dark-fg: #e5e7eb;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, Monaco, 'Cascadia Mono', Consolas, monospace;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card: #1e293b;
        --text: #f1f5f9;
        --text-soft: #cbd5e1;
        --text-muted: #94a3b8;
        --border: #334155;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --accent-soft: rgba(96, 165, 250, 0.12);
        --code-bg: #0f172a;
        --code-dark-bg: #0b1220;
        --code-dark-fg: #e5e7eb;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.sidebar__subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar__section {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.5rem 0 0.5rem;
    padding: 0 0.5rem;
}

.sidebar__link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover { background: var(--accent-soft); color: var(--accent); }
.sidebar__link--active { background: var(--accent); color: white; }
.sidebar__link--active:hover { background: var(--accent-hover); color: white; }

.main {
    padding: 2.5rem 3rem;
    max-width: 64rem;
    width: 100%;
}

.content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
}

.content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.content h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 2.5rem 0 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text);
}

.content h2:first-of-type { border-top: none; padding-top: 0; }

.content h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 1.75rem 0 0.5rem;
    color: var(--text);
}

.content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 1.25rem 0 0.375rem;
    color: var(--text);
}

.content p { margin: 0 0 1rem; color: var(--text-soft); }
.content ul, .content ol { margin: 0 0 1rem; padding-left: 1.5rem; color: var(--text-soft); }
.content li { margin-bottom: 0.375rem; }
.content li > ul, .content li > ol { margin-top: 0.375rem; }
.content strong { font-weight: 600; color: var(--text); }
.content em { color: var(--text-muted); font-style: italic; }

.content code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text);
}

.content pre {
    background: var(--code-dark-bg);
    color: var(--code-dark-fg);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.55;
    margin: 0 0 1.25rem;
    border: 1px solid var(--border);
}

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

.content blockquote {
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    color: var(--text-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.content blockquote p:last-child { margin-bottom: 0; }

.content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.content a:hover { color: var(--accent-hover); }

.content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    display: block;
    overflow-x: auto;
}

.content th, .content td {
    text-align: left;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.content th {
    background: var(--code-bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.content table tr:last-child td { border-bottom: none; }

/* Mobile */
@media (max-width: 768px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .main { padding: 1.5rem 1rem; }
    .content { padding: 1.25rem 1.25rem; }
    .content h1 { font-size: 1.5rem; }
    .content h2 { font-size: 1.25rem; }
}

/* Header mobile só aparece em telas pequenas */
.mobile-header { display: none; }
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        padding: 0.75rem 1rem;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        align-items: center;
        gap: 0.5rem;
        font-weight: 600;
    }
}
