*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #090b10;
    --surface: #11141b;
    --surface-hover: #171b24;
    --border: #1e2430;
    --border-hover: #2e3a4a;
    --text: #e8ecf2;
    --text-secondary: #8a95a8;
    --accent: #22d3ee;
    --accent-soft: rgba(34, 211, 238, 0.1);
    --accent-glow: rgba(34, 211, 238, 0.15);
    --accent-deep: #06b6d4;
    --radius: 10px;
    --sidebar-w: 280px;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --success: #10b981;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* ===================== SIDEBAR ===================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.sidebar__header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar__brand {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
    transition: color 0.2s;
}

.sidebar__brand:hover {
    color: var(--accent);
    opacity: 1;
}

.sidebar__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.sidebar__search {
    padding: 12px 20px;
    position: relative;
}

.sidebar__search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.sidebar__search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.sidebar__search-input::placeholder {
    color: var(--text-secondary);
}

.sidebar__search-input:focus {
    border-color: var(--accent);
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 24px;
}

.sidebar__nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar__nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar__nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.nav__section {
    margin-bottom: 16px;
}

.nav__section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    margin-bottom: 4px;
}

.nav__link {
    display: block;
    padding: 7px 12px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.nav__link:hover {
    background: var(--surface-hover);
    color: var(--text);
    opacity: 1;
}

.nav__link.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav__link--hidden {
    display: none;
}

/* ===================== OVERLAY (mobile) ===================== */

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
}

.overlay.active {
    display: block;
}

/* ===================== CONTENT ===================== */

.content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    padding: 48px 64px 80px;
    max-width: 900px;
}

.content__menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 80;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.content__menu-btn svg {
    width: 20px;
    height: 20px;
}

/* ===================== ARTICLE (rendered markdown) ===================== */

.content__article h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.content__article h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.content__article h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.content__article h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 8px;
}

.content__article p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.content__article ul,
.content__article ol {
    margin-bottom: 16px;
    padding-left: 24px;
    color: var(--text-secondary);
}

.content__article li {
    margin-bottom: 6px;
}

.content__article strong {
    color: var(--text);
    font-weight: 600;
}

.content__article code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: rgba(34, 211, 238, 0.07);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
}

.content__article pre {
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    background: #0d1017;
    border: 1px solid var(--border);
}

.content__article pre code {
    display: block;
    padding: 20px 24px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.84rem;
    line-height: 1.7;
}

.content__article blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 20px;
    margin-bottom: 16px;
    background: var(--accent-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
}

.content__article blockquote p {
    margin-bottom: 0;
}

.content__article hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 32px 0;
}

.content__article table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.88rem;
}

.content__article th,
.content__article td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.content__article th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text);
}

.content__article td {
    color: var(--text-secondary);
}

.content__article img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 16px 0;
}

/* ===================== CALLOUT BLOCKS ===================== */

.callout {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid;
    font-size: 0.88rem;
}

.callout p {
    margin-bottom: 0;
    color: inherit;
}

.callout__title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.callout--info {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--info);
    color: #93c5fd;
}

.callout--warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--warning);
    color: #fcd34d;
}

.callout--danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--danger);
    color: #fca5a5;
}

.callout--success {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--success);
    color: #6ee7b7;
}

/* ===================== FOOTER NAV ===================== */

.content__footer {
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.content__nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.content__nav-btn {
    display: flex;
    flex-direction: column;
    padding: 14px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-decoration: none;
    min-width: 0;
    max-width: 48%;
}

.content__nav-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    opacity: 1;
}

.content__nav-btn--prev {
    align-items: flex-start;
}

.content__nav-btn--next {
    align-items: flex-end;
    margin-left: auto;
}

.content__nav-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.content__nav-title {
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        padding: 48px 24px 60px;
    }

    .content__menu-btn {
        display: flex;
    }

    .content__article h1 {
        font-size: 1.6rem;
        margin-top: 32px;
    }
}
