:root {
    --bg: #0d1117;
    --bg-surface: #161b22;
    --bg-sidebar: #0d1117;
    --fg: #e6edf3;
    --fg-muted: #8b949e;
    --primary: #38bdf8;
    --primary-hover: #0284c7;
    --border: #30363d;
    --code-bg: #161b22;
    --header-height: 52px;
}

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

html {
    scrollbar-gutter: stable;
}

html, body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:visited {
    color: var(--primary);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}


/* Header */
.site-header {
    width: 100%;
    height: var(--header-height);
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.logo-icon {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.nav-link {
    color: var(--fg);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: -0.5rem;
    flex-direction: column;
    justify-content: space-between;
    width: 36px;
    height: 32px;
}

.hamburger-btn .bar {
    width: 22px;
    height: 2px;
    background-color: var(--fg);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.hamburger-btn.is-active .bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger-btn.is-active .bar:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.is-active .bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Layout */
.main-wrapper {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2.5rem;
    padding: 0 0 4rem;
    align-items: start;
}

/* Desktop Sidebar */
.docs-sidebar {
    position: sticky;
    top: var(--header-height);
    align-self: start;
    height: calc(100vh - var(--header-height));
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
    padding-right: 1rem;
    border-right: 1px solid var(--border);
    box-sizing: border-box;
}

.docs-content {
    padding-top: 2rem;
}

.docs-sidebar h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.docs-sidebar ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

.docs-sidebar li {
    margin-bottom: 0.2rem;
}

.docs-sidebar a {
    display: block;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
}

.docs-sidebar a:hover {
    color: var(--primary);
    background: var(--bg-surface);
    text-decoration: none;
}

.docs-sidebar a.active {
    color: #fff;
    background: #1f6feb33;
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

/* Content */
.docs-content {
    width: 100%;
    min-width: 0;
    max-width: 820px;
}

.markdown-body {
    width: 100%;
    color: var(--fg);
    font-size: 1rem;
    line-height: 1.7;
    word-break: break-word;
    overflow-wrap: break-word;
}


.markdown-body > :first-child {
    margin-top: 0 !important;
}

.markdown-body h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.02em;
}

.markdown-body h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.markdown-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body code {
    background: var(--code-bg);
    color: #79c0ff;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    border: 1px solid var(--border);
    word-break: break-word;
}

/* Code Blocks: horizontally scrollable */
.markdown-body pre {
    width: 100%;
    max-width: 100%;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin: 1rem 0 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: #e6edf3;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    display: inline-block;
    min-width: 100%;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 1.35rem;
}

.markdown-body li {
    margin-bottom: 0.3rem;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.75rem 0;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding: 0.65rem 1rem;
    background: var(--bg-surface);
    border-radius: 0 6px 6px 0;
    margin: 1.25rem 0;
    color: var(--fg-muted);
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    color: var(--fg-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Drawer Backdrop */
.drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 45;
}

.drawer-backdrop.open {
    display: block;
}

/* Mobile Rules (strict width, zero horizontal viewport bounce) */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .grid {
        display: block;
        width: 100%;
        max-width: 100%;
        padding: 1rem 0 2.5rem;
    }

    .docs-content {
        width: 100%;
        max-width: 100%;
    }

    .markdown-body {
        font-size: 0.95rem;
    }

    
.markdown-body > :first-child {
    margin-top: 0 !important;
}

.markdown-body h1 {
        font-size: 1.55rem;
    }

    .markdown-body h2 {
        font-size: 1.25rem;
    }

    .markdown-body pre {
        border-radius: 6px;
        padding: 0.75rem;
    }

    .markdown-body pre code {
        font-size: 0.8rem;
    }

    /* Off-canvas menu on phone */
    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 80vw;
        height: 100vh;
        background: var(--bg-sidebar);
        border-right: 1px solid var(--border);
        padding: calc(var(--header-height) + 1rem) 1rem 2rem;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.25s ease-in-out;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    .docs-sidebar.open {
        transform: translateX(0);
    }

    .docs-sidebar a {
        padding: 0.5rem 0.65rem;
        font-size: 0.92rem;
    }
}

/* ===== Home Page ===== */
.hero {
    text-align: center;
    padding: 5rem 1rem 3.5rem;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.2rem;
    color: var(--fg-muted);
    margin-bottom: 2rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.badges {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
}

.badge {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.hero a[role="button"] {
    display: inline-block;
    background: var(--primary);
    color: #0b0f19 !important;
    font-weight: 600;
    padding: 0.7rem 1.6rem;
    border-radius: 8px;
    text-decoration: none !important;
    font-size: 0.95rem;
    margin: 0 0.4rem;
    transition: all 0.15s ease;
}

.hero a[role="button"]:hover {
    background: #7dd3fc;
    color: #0b0f19 !important;
    text-decoration: none !important;
}

.hero a.secondary[role="button"] {
    background: var(--bg-surface);
    color: var(--fg) !important;
    border: 1px solid var(--border);
    text-decoration: none !important;
}

.hero a.secondary[role="button"]:hover {
    background: #21262d;
    color: #fff !important;
    text-decoration: none !important;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0 4rem;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
}

.card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.6rem;
}

.card p {
    color: var(--fg-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 0 2.5rem;
    }

    .hero h1 {
        font-size: 2.4rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero a[role="button"] {
        display: block;
        margin: 0.4rem 0;
        text-align: center;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        padding: 1.5rem 0 3rem;
    }
}
