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

:root {
    --orange:       #E07820;
    --orange-light: #F5A05A;
    --orange-pale:  #FEF3E8;
    --sidebar-w:    260px;
    --header-h:     52px;
    --font:         "Segoe UI", system-ui, sans-serif;
    --gray-100:     #F7F7F7;
    --gray-200:     #EBEBEB;
    --gray-400:     #AAAAAA;
    --gray-700:     #444444;
    --gray-900:     #1A1A1A;
    --content-max:  820px;
}

html { font-size: 15px; }

body {
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-100);
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--orange);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}

.header-left  { display: flex; align-items: center; gap: 10px; }
.logo-mark    { color: #fff; font-size: 1.2rem; opacity: .85; }
.site-title   { color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: .3px; }
.site-subtitle{ font-weight: 400; opacity: .85; }

/* ── Language switcher ───────────────────────────────────────── */
.lang-switcher { display: flex; gap: 4px; }

.lang-btn {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,.75);
    border: 1px solid rgba(255,255,255,.35);
    transition: background .15s, color .15s;
}
.lang-btn:hover       { background: rgba(255,255,255,.2); color: #fff; }
.lang-active          { background: rgba(255,255,255,.25); color: #fff; border-color: rgba(255,255,255,.6); }
.lang-disabled        { opacity: .4; cursor: default; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
    display: flex;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    bottom: 0;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--gray-200);
    padding: 18px 0 40px;
}

.nav-section {
    padding: 14px 18px 4px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gray-400);
}

.nav-link {
    display: block;
    padding: 6px 18px 6px 22px;
    font-size: .88rem;
    color: var(--gray-700);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
}
.nav-link:hover       { background: var(--orange-pale); color: var(--orange); border-left-color: var(--orange-light); }
.nav-link-active      { background: var(--orange-pale); color: var(--orange); border-left-color: var(--orange); font-weight: 600; }

/* ── Content area ────────────────────────────────────────────── */
.content-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    gap: 32px;
    padding: 40px 32px 80px;
    max-width: calc(var(--sidebar-w) + var(--content-max) + 280px);
}

.content {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 8px;
    padding: 36px 40px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

/* ── Table of contents ───────────────────────────────────────── */
.toc-wrap {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-h) + 20px);
    align-self: flex-start;
    font-size: .8rem;
    order: 2;
}

.toc-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.toc-wrap .toc { list-style: none; }
.toc-wrap .toc li { margin: 2px 0; }
.toc-wrap .toc a {
    color: var(--gray-700);
    text-decoration: none;
    line-height: 1.5;
    display: block;
    padding: 1px 0;
    border-left: 2px solid var(--gray-200);
    padding-left: 8px;
    transition: color .12s, border-color .12s;
}
.toc-wrap .toc a:hover { color: var(--orange); border-left-color: var(--orange); }
.toc-wrap .toc .toc2 { padding-left: 8px; }
.toc-wrap .toc .toc3 { padding-left: 20px; }

/* ── Typography ─────────────────────────────────────────────── */
.content h1 { font-size: 1.7rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; line-height: 1.2; }
.content h2 { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--gray-200); }
.content h3 { font-size: 1rem;   font-weight: 700; color: var(--orange);   margin: 22px 0 8px; }
.content h4 { font-size: .9rem;  font-weight: 700; color: var(--gray-700); margin: 16px 0 6px; }

.content p  { line-height: 1.7; margin-bottom: 14px; color: var(--gray-700); }
.content a  { color: var(--orange); text-decoration: none; }
.content a:hover { text-decoration: underline; }

.content ul, .content ol { margin: 0 0 14px 22px; }
.content li { line-height: 1.7; color: var(--gray-700); margin-bottom: 3px; }

.content strong { color: var(--gray-900); }
.content code {
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: .85em;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    padding: 1px 5px;
}
.content pre {
    background: #1E1E1E;
    border-radius: 6px;
    padding: 16px 20px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #D4D4D4;
    font-size: .85rem;
    line-height: 1.6;
}

/* ── Tables ─────────────────────────────────────────────────── */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: .88rem;
}
.content th {
    background: var(--orange);
    color: #fff;
    font-weight: 600;
    padding: 9px 14px;
    text-align: left;
}
.content td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}
.content tr:nth-child(even) td { background: var(--gray-100); }
.content tr:hover td { background: var(--orange-pale); }

/* ── Admonitions (note / warning / tip) ─────────────────────── */
.content .admonition {
    border-left: 4px solid var(--orange);
    background: var(--orange-pale);
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.content .admonition.warning { border-color: #C0392B; background: #FEF0EE; }
.content .admonition.tip     { border-color: #27AE60; background: #EEF8F2; }
.content .admonition-title   { font-weight: 700; font-size: .88rem; margin-bottom: 4px; }

/* ── Scrollbar (sidebar) ─────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }
