:root {
    --sidebar-width: 265px;
    --sidebar-bg: #1e3a8a;
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --sidebar-muted: rgba(255, 255, 255, 0.45);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: rgba(255, 255, 255, 0.14);
    --sidebar-active-border: #60a5fa;
    --page-bg: #f8fafc;
    --content-bg: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --link: #2563eb;
    --code-bg: #f1f5f9;
    --heading: #0f172a;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Sidebar ── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
}

.sidebar-logo svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-product {
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--sidebar-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-left: 31px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    padding: 8px 20px 5px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--sidebar-muted);
}

.nav-link {
    display: block;
    padding: 7px 20px 7px 28px;
    font-size: 0.875rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: #fff;
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    border-left-color: var(--sidebar-active-border);
    font-weight: 500;
}

.nav-empty {
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--sidebar-muted);
    font-style: italic;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-back-link {
    font-size: 0.8rem;
    color: var(--sidebar-muted);
    text-decoration: none;
    transition: color 0.12s;
}

.sidebar-back-link:hover {
    color: var(--sidebar-text);
}

/* ── Main ── */

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-wrapper {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 48px 80px;
}

/* ── Home ── */

.home-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    color: var(--muted);
}

.home-icon {
    margin-bottom: 20px;
    opacity: 0.6;
}

.home-empty h1 {
    font-size: 1.5rem;
    color: var(--text);
    margin: 0 0 10px;
}

.home-empty p {
    font-size: 1rem;
    margin: 0;
}

/* ── Article ── */

.article-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0 0 28px;
    line-height: 1.25;
}

.article-video {
    margin-bottom: 32px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
}

.article-video iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Markdown content ── */

.article-content {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    color: var(--heading);
    font-weight: 700;
    line-height: 1.3;
    margin: 2em 0 0.6em;
}

.article-content h1 { font-size: 1.5rem; margin-top: 0; }
.article-content h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4em; }
.article-content h3 { font-size: 1.1rem; }
.article-content h4 { font-size: 1rem; }

.article-content p  { margin: 0 0 1.2em; }
.article-content ul,
.article-content ol { margin: 0 0 1.2em; padding-left: 1.8em; }
.article-content li { margin-bottom: 0.3em; }

.article-content a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.article-content a:hover { color: #1d4ed8; }

.article-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    color: #c7254e;
}

.article-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 0 0 1.4em;
}

.article-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    color: var(--text);
}

.article-content blockquote {
    margin: 0 0 1.2em;
    padding: 12px 20px;
    border-left: 4px solid #2563eb;
    background: #eff6ff;
    border-radius: 0 6px 6px 0;
    color: var(--muted);
}

.article-content blockquote p { margin: 0; }

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 8px 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.4em;
    font-size: 0.9375rem;
}

.article-content th,
.article-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.article-content th {
    background: var(--code-bg);
    font-weight: 600;
}

.article-content tr:nth-child(even) td {
    background: #fafbfc;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}
