/* Shared reading tokens. No remote fonts, framework, or build step. */
:root {
    color-scheme: light;
    --canvas: #fff;
    --surface: #f6f7f9;
    --hover: #f1f2f4;
    --ink: #17191e;
    --secondary: #4b5260;
    --muted: #626b79;
    --line: #e7e9ee;
    --accent: #245cdb;
    --accent-soft: #edf3ff;
    --code: #f5f6f8;
    --shadow: 0 8px 28px #18233d12, 0 2px 5px #18233d08;
    --header-height: 64px;
    --reading-offset: 90px;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #111215;
    --surface: #1b1d22;
    --hover: #24262d;
    --ink: #f0f1f4;
    --secondary: #b7bdc9;
    --muted: #9da6b5;
    --line: #2a2d35;
    --accent: #8ab4ff;
    --accent-soft: #1c2b45;
    --code: #1b1d22;
    --shadow: 0 8px 28px #0005;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) { color-scheme: dark; --canvas: #111215; --surface: #1b1d22; --hover: #24262d; --ink: #f0f1f4; --secondary: #b7bdc9; --muted: #9da6b5; --line: #2a2d35; --accent: #8ab4ff; --accent-soft: #1c2b45; --code: #1b1d22; }
}
* { box-sizing: border-box; }
html { scroll-padding-top: var(--reading-offset); scrollbar-gutter: stable; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; line-height: 1.7; }
a { color: inherit; text-decoration: none; text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, summary, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
button, input, select { border-radius: 6px; }
input { min-width: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; }
input::placeholder { color: var(--muted); }
button { background: transparent; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { color: var(--ink); background: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: -80px; left: 16px; padding: 8px 16px; color: var(--canvas); background: var(--ink); border-radius: 6px; }
.skip-link:focus { top: 8px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); font-size: 13px; }
.site-header { height: var(--header-height); position: sticky; top: 0; z-index: 30; background: var(--canvas); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1440px; height: 100%; margin: auto; padding: 0 32px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.04em; white-space: nowrap; }
.brand img { object-fit: contain; }
.brand-mark { display: inline-block; font-size: 30px; line-height: 1; font-weight: 900; font-style: italic; letter-spacing: -.12em; padding-right: 4px; }
.site-menu { display: none; }
.site-menu > summary { display: none; }
.desktop-site-nav { flex: 1; display: flex; align-items: center; gap: 26px; }
:is(.desktop-site-nav, .site-menu nav) > a { color: var(--secondary); font-size: 14px; white-space: nowrap; }
:is(.desktop-site-nav, .site-menu nav) > a:hover, :is(.desktop-site-nav, .site-menu nav) > a[aria-current] { color: var(--accent); }
:is(.desktop-site-nav, .site-menu nav) > a[aria-current] { font-weight: 600; }
:is(.desktop-site-nav, .site-menu) .icon { width: 14px; height: 14px; }
.mobile-theme { display: none; }
.search-trigger { min-height: 36px; width: 240px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 5px 10px; font-size: 13px; color: var(--muted); }
.search-trigger:hover { border-color: var(--muted); }
kbd { margin-left: auto; padding: 0 5px; border: 1px solid var(--line); background: var(--canvas); border-radius: 4px; font: 11px/1.8 inherit; white-space: nowrap; }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; max-width: 1440px; margin: auto; align-items: start; }
.document-sidebar { height: calc(100dvh - var(--header-height)); position: sticky; top: var(--header-height); display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 24px 16px 16px 24px; }
.document-tree { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; font-size: 14px; }
.document-sidebar > .document-tree { flex: 1; padding-right: 4px; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.category { margin: 0 0 18px; }
.category > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; font-weight: 600; border-radius: 5px; }
.category > summary:hover { background: var(--hover); }
.category > summary > .icon { width: 16px; height: 16px; color: var(--muted); transform: rotate(-90deg); }
.category[open] > summary > .icon { transform: rotate(0); }
.category-children { margin: 3px 0 0 9px; padding-left: 8px; border-left: 1px solid var(--line); }
.category-children .category { margin: 10px 0; }
.document-link { display: block; color: var(--secondary); padding: 6px 10px; margin: 2px 0; line-height: 1.6; border-radius: 5px; overflow-wrap: anywhere; }
.document-link:hover { background: var(--hover); color: var(--ink); }
.document-link.is-current { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.category-index { display: block; padding: 5px 10px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.category-index:hover { color: var(--accent); }
.sidebar-bottom { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.theme-control { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--secondary); }
.theme-control select { border: 0; color: inherit; background: var(--canvas); padding: 6px 24px 6px 4px; }
.main-content { min-width: 0; min-height: calc(100dvh - var(--header-height)); padding: 32px 48px 0; display: flex; flex-direction: column; }
.main-content > article, .main-content > section { flex: 1; }
.main-content:focus { outline: none; }
h1, h2, h3, h4 { color: var(--ink); font-weight: 650; line-height: 1.35; letter-spacing: -.025em; overflow-wrap: anywhere; }
h1 { margin: 8px 0 20px; font-size: 36px; font-weight: 750; letter-spacing: -.045em; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; font-size: 13px; color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current] { color: var(--secondary); }
.document-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin: -6px 0 24px; }
.document-meta a:hover { color: var(--accent); }
.text-button { padding: 3px 0; color: var(--muted); font-size: 12px; }
.copy-page { margin-left: auto; }
.text-button:hover { color: var(--accent); }
[data-copied] { color: var(--accent) !important; }
.document-summary { font-size: 17px; line-height: 1.85; color: var(--secondary); margin-bottom: 30px; }
.prose { font-size: 16px; line-height: 1.9; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose details { margin: 20px 0; }
.prose h2 { margin: 44px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.prose h3 { margin: 30px 0 12px; }
.prose h4 { font-size: 17px; margin-top: 26px; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose .heading-anchor { display: inline-block; margin-left: 9px; text-decoration: none; font-size: .75em; font-weight: 400; opacity: 0; }
.prose :is(h2, h3):hover .heading-anchor, .prose .heading-anchor:focus-visible { opacity: 1; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { padding-left: 3px; margin: 6px 0; }
.prose li > ul, .prose li > ol { margin: 6px 0; }
.prose code, .prose pre { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .85em; font-variant-ligatures: none; }
.prose :not(pre) > code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--code); }
.prose pre { position: relative; padding: 20px; padding-top: 38px; background: var(--code); border: 1px solid var(--line); border-radius: 9px; line-height: 1.8; overflow-x: auto; overscroll-behavior-x: contain; tab-size: 4; }
.prose pre code { font-size: inherit; display: block; min-width: max-content; }
.copy-code { position: absolute; right: 9px; top: 7px; padding: 3px 7px; font: 11px/1.7 ui-sans-serif, system-ui, sans-serif; color: var(--muted); background: var(--code); border: 1px solid var(--line); }
.copy-code:hover { color: var(--ink); }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 1px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; color: var(--secondary); }
.prose blockquote p { margin: 12px 0; }
.prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }
.prose img, .prose video { max-width: 100%; height: auto; border-radius: 7px; }
.prose iframe { max-width: 100%; }
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; margin: 24px 0; border: 1px solid var(--line); border-radius: 7px; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.table-scroll table { display: table; min-width: 100%; margin: 0; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.prose th { background: var(--surface); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.prose details { padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; }
.prose summary { font-weight: 600; }
.prose summary::before { content: '+ '; color: var(--accent); }
.prose details[open] > summary::before { content: '− '; }
.source-note { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.source-note a { color: var(--accent); }
.source-note .icon { width: 13px; height: 13px; }
.document-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 44px 0 20px; padding-top: 24px; border-top: 1px solid var(--line); }
.document-pagination > div { min-width: 0; }
.document-pagination a { display: flex; flex-direction: column; gap: 4px; color: var(--accent); overflow-wrap: anywhere; }
.document-pagination > div:last-child { text-align: right; }
.pagination-label { font-size: 12px; color: var(--muted); }
.toc-sidebar { position: sticky; top: var(--header-height); max-height: calc(100dvh - var(--header-height)); padding: 34px 20px 20px 0; overflow-y: auto; scrollbar-width: thin; }
.toc-heading { font-size: 13px; font-weight: 650; margin: 0 0 16px; }
.toc-list { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); font-size: 13px; }
.toc-list a { display: block; padding: 5px 12px; margin-left: -1px; color: var(--muted); border-left: 2px solid transparent; overflow-wrap: anywhere; line-height: 1.6; }
.toc-list a:hover { color: var(--ink); }
.toc-list a[aria-current] { color: var(--accent); border-left-color: var(--accent); }
.toc-level-3 a { padding-left: 24px; font-size: 12px; }
.back-top { display: block; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 24px; color: var(--muted); font-size: 12px; }
.back-top:hover { color: var(--accent); }
.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 22px 0; margin-top: 48px; color: var(--muted); font-size: 11px; }
.discovery-links { display: flex; gap: 14px; }
.page-footer a:hover { color: var(--accent); }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .09em; font-weight: 600; margin: 0 0 18px; }
.home-intro { font-size: 18px; color: var(--secondary); line-height: 1.8; margin: 0 0 24px; }
.start-link { display: inline-flex; gap: 28px; align-items: center; padding: 9px 15px; background: var(--accent); color: #fff; border-radius: 6px; font-size: 14px; font-weight: 550; }
[data-theme="dark"] .start-link { color: #111215; }
.start-link:hover { filter: brightness(.95); }
.section-title { margin: 40px 0 18px; font-size: 21px; }
.chapter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chapter-card { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.chapter-card:hover { background: var(--surface); border-color: var(--muted); }
.chapter-icon { color: var(--muted); }
.chapter-card h3 { font-size: 16px; margin: 12px 0 8px; }
.chapter-card h3 span { float: right; color: var(--muted); font-weight: 400; }
.chapter-card p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.7; }
.home-index { padding: 0; list-style: none; margin: 0; }
.home-index a { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 12px 0; font-size: 14px; }
.home-index a:hover { color: var(--accent); }
.home-index a span { color: var(--muted); }
.archive-entry { padding: 24px 0; border-bottom: 1px solid var(--line); }
.archive-entry h2 { font-size: 20px; margin: 0 0 10px; }
.archive-entry h2 a:hover { color: var(--accent); }
.archive-entry p { color: var(--secondary); font-size: 14px; margin: 0 0 10px; }
.entry-date { font-size: 12px; color: var(--muted); }
.archive-pagination ul { display: flex; flex-wrap: wrap; list-style: none; padding: 0; gap: 8px; margin: 26px 0 0; }
.archive-pagination li a, .archive-pagination li span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 5px; }
.archive-pagination .current a { color: var(--accent); background: var(--accent-soft); }
.archive-search { display: flex; gap: 8px; margin: 24px 0 8px; }
.archive-search input { flex: 1; }
.fallback-search { display: none; scroll-margin-top: var(--reading-offset); }
.fallback-search:target { display: flex; margin-top: 0; margin-bottom: 26px; }
.empty-state { padding: 40px 0; }
.empty-state h2 { font-size: 22px; }
.empty-state p { color: var(--secondary); }
.empty-state > a:not(.start-link) { color: var(--accent); }
.error-page { padding-top: 60px; }
.primary-button, .protected input[type="submit"] { padding: 9px 16px; border: 0; background: var(--accent); color: #fff; font-size: 14px; }
[data-theme="dark"] :is(.primary-button, .protected input[type="submit"]) { color: #111215; }
.protected input { max-width: 100%; margin: 4px 4px 4px 0; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; border-radius: 6px; font-size: 26px; line-height: 1; }
.icon-button:hover { background: var(--hover); }
dialog { color: var(--ink); background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 20px 24px; width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: #0006; }
dialog:not([open]) { display: none; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-heading h2 { margin: 0; font-size: 18px; }
.search-input-row { display: flex; gap: 8px; }
.search-input-row input { flex: 1; }
.mobile-document-bar { display: none; }
.inline-toc { display: none; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; }
.inline-toc > summary { display: flex; align-items: center; justify-content: space-between; color: var(--secondary); font-size: 13px; }
.inline-toc[open] > summary { margin-bottom: 12px; }
.token.comment, .token.prolog, .token.doctype { color: var(--muted); }
.token.keyword, .token.boolean, .token.tag { color: #a020b0; }
.token.string, .token.attr-value { color: #137344; }
.token.number, .token.function { color: #b14f13; }
[data-theme="dark"] .token.keyword, [data-theme="dark"] .token.boolean, [data-theme="dark"] .token.tag { color: #c4a0ff; }
[data-theme="dark"] .token.string, [data-theme="dark"] .token.attr-value { color: #91d9b0; }
[data-theme="dark"] .token.number, [data-theme="dark"] .token.function { color: #f3ba83; }
@media (min-width: 1440px) { .main-content { padding-left: 64px; padding-right: 64px; } }
@media (min-width: 768px) and (max-width: 1100px) {
    .layout { grid-template-columns: 220px minmax(0, 1fr); }
    .toc-sidebar { display: none; }
    .inline-toc { display: block; }
    .main-content { padding-left: 32px; padding-right: 32px; }
    .header-inner { gap: 24px; padding: 0 24px; }
    .search-trigger { width: 185px; }
    .desktop-site-nav { gap: 18px; }
}
@media (max-width: 767px) {
    :root { --header-height: 58px; --reading-offset: 126px; }
    .header-inner { padding: 0 16px; gap: 4px; }
    .brand { font-size: 17px; margin-right: auto; max-width: calc(100% - 90px); }
    .brand > span:last-child { overflow: hidden; text-overflow: ellipsis; }
    .brand-mark { font-size: 27px; }
    .search-trigger { order: 1; width: 40px; height: 40px; min-height: 40px; justify-content: center; padding: 0; border: 0; background: transparent; color: var(--ink); }
    .search-trigger > span, .search-trigger kbd { display: none; }
    .desktop-site-nav { display: none; }
    .site-menu { display: block; flex: 0; order: 2; }
    .site-menu > summary { display: flex; }
    .site-menu .menu-close-icon { display: none; }
    .site-menu[open] .menu-close-icon { display: inline; }
    .site-menu[open] .menu-open-icon { display: none; }
    .site-menu:not([open]) > nav { display: none; }
    .site-menu > nav { position: absolute; top: 57px; left: 0; right: 0; padding: 12px 20px 18px; display: flex; align-items: stretch; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); background: var(--canvas); box-shadow: var(--shadow); max-height: calc(100dvh - 70px); overflow-y: auto; }
    .site-menu nav > a { display: block; padding: 10px 12px; border-radius: 5px; font-size: 15px; }
    .site-menu nav > a:hover { background: var(--hover); }
    .site-menu nav > a[aria-current] { background: var(--accent-soft); }
    .mobile-theme { display: block; margin: 12px 0 0; padding: 16px 12px 0; border-top: 1px solid var(--line); }
    .mobile-theme .icon { width: 20px; height: 20px; }
    .layout { display: block; }
    .document-sidebar, .toc-sidebar { display: none; }
    .mobile-document-bar { position: sticky; top: var(--header-height); z-index: 20; display: flex; gap: 12px; height: 54px; padding: 8px 16px; background: var(--canvas); border-bottom: 1px solid var(--line); }
    .document-disclosure { flex: 1; min-width: 0; }
    .document-disclosure > summary { display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; font-weight: 500; }
    .document-disclosure > summary > .icon { width: 16px; height: 16px; }
    .document-disclosure[open] > summary { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
    .document-disclosure[open] > summary > .icon:last-child { transform: rotate(180deg); }
    .mobile-panel { position: absolute; top: 53px; left: 0; right: 0; max-height: min(65dvh, calc(100dvh - 128px)); overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--canvas); box-shadow: var(--shadow); }
    .mobile-panel .category { margin-bottom: 14px; }
    .mobile-panel .document-link { padding: 8px 10px; }
    .mobile-panel .toc-list { font-size: 14px; }
    .mobile-panel .toc-list a { padding-top: 8px; padding-bottom: 8px; }
    .main-content { min-height: calc(100dvh - 112px); padding: 24px 22px 0; }
    h1 { font-size: 30px; margin-bottom: 18px; }
    .breadcrumbs { font-size: 12px; gap: 6px; margin-bottom: 20px; }
    .document-meta { font-size: 11px; gap: 6px; }
    .copy-page { font-size: 11px; }
    .document-summary { font-size: 16px; }
    .prose { font-size: 15px; line-height: 1.9; }
    .prose h2 { font-size: 23px; margin-top: 36px; }
    .prose h3 { font-size: 19px; }
    .prose pre { padding-left: 14px; padding-right: 14px; font-size: 12px; }
    .prose .heading-anchor { opacity: .65; }
    .chapter-grid { gap: 12px; }
    .chapter-card { padding: 16px; }
    .chapter-card h3 { font-size: 15px; }
    .home-intro { font-size: 16px; }
    .section-title { font-size: 21px; margin-top: 34px; }
    .document-pagination { gap: 14px; font-size: 13px; }
    .page-footer { margin-top: 36px; padding: 20px 0; }
    dialog { padding: 16px; }
}
@media (max-width: 359px) { .chapter-grid { grid-template-columns: 1fr; } .main-content { padding-left: 16px; padding-right: 16px; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media print {
    :root { --canvas: #fff; --ink: #000; --secondary: #333; --muted: #444; --line: #ccc; --accent: #000; --code: #f5f5f5; }
    .site-header, .document-sidebar, .toc-sidebar, .mobile-document-bar, .page-footer, .document-pagination, .copy-page, .copy-code, .heading-anchor { display: none !important; }
    .layout, .main-content { display: block; padding: 0; min-height: 0; }
    .prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }
    .prose pre code { min-width: 0; }
    .prose a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: .8em; }
}
