/* ── Variables ── */
:root {
    --primary: #4a5568;
    --primary-hover: #2d3748;
    --accent: #5a67d8;
    --bg: #ffffff;
    --bg-alt: #f7f7f8;
    --text: #2d3748;
    --text-muted: #718096;
    --text-light: #a0aec0;
    --border: #e8e8eb;
    --code-bg: #1b1b1f;
    --success: #48bb78;
    --warning: #d69e2e;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;
    --max-width: 860px;
    --sidebar-width: 240px;
    --nav-height: 56px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 15px;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

/* ── Top Navigation ── */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-logo span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 1.5px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-links a.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-hamburger svg {
    width: 22px;
    height: 22px;
    stroke: var(--text);
    stroke-width: 2;
    fill: none;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg);
    padding: 1.5rem 0;
    overflow-y: auto;
    z-index: 90;
    border-right: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.sidebar-section {
    padding: 0 1.25rem;
    margin-bottom: 1.5rem;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

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

.sidebar-nav li {
    margin-bottom: 1px;
}

.sidebar-nav a {
    display: block;
    padding: 0.35rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    color: var(--text);
    background: var(--bg-alt);
}

.sidebar-nav a.active {
    color: var(--text);
    background: var(--bg-alt);
    font-weight: 600;
}

/* ── Main Content ── */
.page-wrapper {
    padding-top: var(--nav-height);
}

.has-sidebar .main-content {
    margin-left: var(--sidebar-width);
}

.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    line-height: 1.3;
    font-weight: 600;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.35rem;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1.1rem;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-muted);
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.25rem;
}

/* ── Code ── */
code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 0.125em 0.35em;
    border-radius: 3px;
    color: var(--primary-hover);
}

pre {
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    overflow: hidden;
    background: var(--code-bg);
    border: 1px solid #2a2a2e;
}

pre code {
    display: block;
    padding: 1.1rem 1.25rem;
    background: var(--code-bg);
    border: none;
    font-size: 0.825rem;
    line-height: 1.65;
    overflow-x: auto;
    color: #b8bcc5;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
}

.copy-btn.copied {
    background: rgba(72, 187, 120, 0.2);
    color: var(--success);
    border-color: rgba(72, 187, 120, 0.3);
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

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

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

/* ── Hero Section ── */
.hero {
    text-align: center;
    padding: 4rem 2rem 3.5rem;
    margin: -2.5rem -2rem 2.5rem -2rem;
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.04em;
    font-weight: 700;
}

.hero h1 span {
    color: var(--accent);
}

.hero .tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--text);
    color: #fff;
}

.btn-primary:hover {
    background: #1a202c;
    color: #fff;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-alt);
    color: var(--text);
    border-color: var(--text-light);
}

/* ── Feature Cards ── */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.feature-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    transition: border-color 0.15s;
}

.feature-card:hover {
    border-color: var(--text-light);
}

.feature-card h3 {
    margin-top: 0;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
    line-height: 1.5;
}

.feature-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
    font-size: 1.1rem;
}

/* ── Info / Tip Boxes ── */
.info-box {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.info-box.tip {
    background: var(--bg-alt);
    border-left: 3px solid var(--accent);
}

.info-box.warning {
    background: #fffbeb;
    border-left: 3px solid var(--warning);
}

.info-box.note {
    background: var(--bg-alt);
    border-left: 3px solid var(--border);
}

.info-box strong {
    display: block;
    margin-bottom: 0.2rem;
}

/* ── Roadmap Cards ── */
.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.roadmap-card {
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
}

.roadmap-card h4 {
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.roadmap-card p {
    color: var(--text-muted);
    font-size: 0.825rem;
    margin-bottom: 0.5rem;
}

.roadmap-status {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.roadmap-status.planned {
    background: var(--bg-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.roadmap-status.in-progress {
    background: #fffbeb;
    color: var(--warning);
    border: 1px solid #fde68a;
}

/* ── Contact ── */
.contact-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background: var(--bg);
}

.contact-card-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.contact-card h4 {
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}

.contact-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
}

/* ── Footer ── */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 3rem;
}

.has-sidebar .footer {
    margin-left: var(--sidebar-width);
}

.footer a {
    color: var(--text-muted);
}

.footer a:hover {
    color: var(--text);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        background: var(--bg);
    }

    .has-sidebar .main-content,
    .has-sidebar .footer {
        margin-left: 0;
    }

    .hero {
        padding: 2.5rem 1.5rem 2rem;
    }

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

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

    .main-content {
        padding: 1.75rem 1.25rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--bg);
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        gap: 0;
    }

    .nav-links.open a {
        padding: 0.6rem 0;
    }
}

/* ── Sidebar overlay on mobile ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 85;
}

.sidebar-overlay.open {
    display: block;
}

/* ── Prism.js overrides ── */
pre[class*="language-"] {
    margin-bottom: 1.5rem;
    border-radius: 6px;
}

code[class*="language-"] {
    font-family: var(--font-mono);
    font-size: 0.825rem;
}

/* ── Directory tree ── */
.dir-tree {
    font-family: var(--font-mono);
    font-size: 0.825rem;
    line-height: 1.6;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    white-space: pre;
    color: var(--text);
}

/* ── Changelog ── */
.release-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.release-item {
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    overflow: hidden;
    transition: border-color 0.15s;
}

.release-item:hover {
    border-left-color: var(--text-light);
}

.release-item[open] {
    border-left-color: var(--accent);
}

.release-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    list-style: none;
    gap: 1rem;
    user-select: none;
    background: var(--bg-alt);
}

.release-summary { display: flex; }
.release-summary::-webkit-details-marker { display: none; }
.release-summary::marker { display: none; }

.release-summary:hover {
    background: #f0f0f2;
}

.release-summary-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.release-summary-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.825rem;
}

.release-tag {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    flex-shrink: 0;
}

.release-name {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.release-date {
    font-family: var(--font-mono);
    font-size: 0.775rem;
    color: var(--text-light);
}

.release-author {
    color: var(--text-muted);
    font-size: 0.825rem;
}

.release-chevron {
    width: 14px;
    height: 14px;
    min-width: 14px;
    stroke: var(--text-light);
    stroke-width: 2.5;
    fill: none;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.release-item[open] .release-chevron {
    transform: rotate(180deg);
}

.release-body {
    padding: 1.1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    line-height: 1.7;
}

.release-body p  { margin-bottom: 0.6rem; }
.release-body ul { margin-bottom: 0.75rem; padding-left: 1.25rem; }
.release-body li { margin-bottom: 0.2rem; }
.release-body h3 { font-size: 0.95rem; margin-top: 1rem; margin-bottom: 0.4rem; border: none; }
.release-body h4 { font-size: 0.875rem; margin-top: 0.75rem; margin-bottom: 0.3rem; }
.release-body br { display: none; }

/* ── Diagram / lifecycle ── */
.lifecycle {
    font-family: var(--font-mono);
    font-size: 0.825rem;
    line-height: 1.8;
    background: var(--code-bg);
    color: #b8bcc5;
    border-radius: 6px;
    border: 1px solid #2a2a2e;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    white-space: pre;
}

.lifecycle .highlight {
    color: var(--accent);
    font-weight: 600;
}
