:root {
    --bg: #1a1b26;
    --surface: #24283b;
    --surface-hover: #2a2f45;
    --border: #414868;
    --text: #c0caf5;
    --text-dim: #565f89;
    --accent: #f7768e;
    --accent2: #7aa2f7;
    --accent3: #9ece6a;
    --accent4: #e0af68;
    --code-bg: #1a1b26;
    --sidebar-width: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 0;
    z-index: 100;
}

.sidebar-header {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.nav-section {
    margin-bottom: 1.25rem;
}

.nav-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0.5rem 1.25rem 0.25rem;
    font-weight: 600;
}

.nav-link {
    display: block;
    padding: 0.35rem 1.25rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.nav-link.active {
    color: var(--accent2);
    border-left-color: var(--accent2);
    background: rgba(122, 162, 247, 0.08);
}

.nav-link.external::after {
    content: '';
}

/* ---- Main Content ---- */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

header {
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-row img { height: 20px; }

/* ---- Card Grid ---- */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, transform 0.15s;
}

.card:hover {
    border-color: var(--accent2);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}

.card p {
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.5;
}

.card-file {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--accent2);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ---- Code Blocks ---- */
pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.87rem;
    line-height: 1.7;
    margin: 1rem 0;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.kw { color: var(--accent); }
.fn { color: var(--accent2); }
.str { color: var(--accent3); }
.cmt { color: var(--text-dim); font-style: italic; }
.num { color: var(--accent4); }
.op { color: var(--text-dim); }
.type { color: var(--accent4); }

/* ---- Sections ---- */
section {
    margin-bottom: 3rem;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

section h3 {
    font-size: 1.15rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--accent2);
}

section p {
    margin-bottom: 0.75rem;
    color: var(--text-dim);
}

section a {
    color: var(--accent2);
    text-decoration: none;
}

section a:hover {
    text-decoration: underline;
}

/* ---- Example Page ---- */
.example-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.example-header .icon {
    font-size: 2rem;
}

.example-header h1 {
    font-size: 1.8rem;
}

.example-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.concept-badge {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--accent2);
}

.output-block {
    margin-top: 0.75rem;
}

.output-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.output-block pre {
    border-color: var(--accent3);
    color: var(--accent3);
    font-size: 0.82rem;
}

.nav-arrows {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.nav-arrow {
    color: var(--accent2);
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-arrow:hover { text-decoration: underline; }

/* ---- Quick Start ---- */
.quickstart pre {
    margin-bottom: 1rem;
}

/* ---- Learning Path ---- */
.stage {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.stage-number {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stage h3 {
    margin-top: 0;
    color: var(--text);
}

.stage h3 a {
    color: var(--accent2);
}

/* ---- Concept Index Table ---- */
.concept-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.concept-table th,
.concept-table td {
    text-align: left;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
}

.concept-table th {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.concept-table td a {
    color: var(--accent2);
    text-decoration: none;
}

.concept-table td a:hover {
    text-decoration: underline;
}

/* ---- Steps list ---- */
ol.steps {
    list-style: none;
    counter-reset: step;
    padding-left: 0;
}

ol.steps li {
    counter-increment: step;
    padding: 0.5rem 0 0.5rem 2.5rem;
    position: relative;
    color: var(--text-dim);
}

ol.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent2);
}

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

footer a {
    color: var(--accent2);
    text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .content {
        margin-left: 0;
    }
    .container {
        padding: 1.5rem 1rem;
    }
    header h1 {
        font-size: 1.6rem;
    }
    .overview-grid {
        grid-template-columns: 1fr;
    }
}
