:root {
  color-scheme: dark;
  --bg: #191919;
  --panel: #212121;
  --panel-2: #292929;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --quiet: #737373;
  --line: #393939;
  --accent: #60a5fa;
  --max: 1280px;
  --measure: 760px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 var(--sans); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { color: inherit; font: inherit; }
.shell { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: rgba(25,25,25,.94); backdrop-filter: blur(16px); }
.header-inner { min-height: 64px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; }
.brand small { color: var(--quiet); font-weight: 500; }
.brand-mark { width: 27px; height: 27px; position: relative; border: 1.5px solid var(--accent); border-radius: 5px; background: var(--panel-2); }
.brand-mark::before { content: ""; position: absolute; inset: 9px -1px auto; height: 1px; background: var(--accent); }
.top-nav { display: flex; gap: 24px; margin-left: auto; font-size: 14px; }
.top-nav a { color: #c5c5c5; }
.top-nav a:hover { color: white; }
.menu-button, .mobile-nav { display: none; }
.overline { margin: 0; color: var(--accent); font: 700 12px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; color: var(--quiet); font: 12px var(--mono); }
.breadcrumbs a:hover { color: var(--accent); }

.home { max-width: 1000px; padding: 72px 0 100px; }
.home-header { max-width: 760px; padding-bottom: 54px; }
.home-header h1, .chapter-header h1, .article-header h1, .error-page h1 { margin: 14px 0 18px; font-size: clamp(42px, 6vw, 64px); line-height: 1.02; letter-spacing: -.05em; }
.home-header > p:not(.overline), .chapter-header > p:not(.overline), .article-header > p:not(.overline) { margin: 0; color: #c3c3c3; font-size: 18px; }
.home-meta { display: flex; gap: 24px; margin-top: 24px; color: var(--quiet); font: 12px var(--mono); }
.chapter-list { border-top: 1px solid var(--line); }
.chapter-block { padding: 42px 0 46px; border-bottom: 1px solid var(--line); }
.chapter-block > header { display: grid; grid-template-columns: 54px 1fr auto; gap: 22px; align-items: start; }
.chapter-block > header > span { color: var(--accent); font: 13px var(--mono); padding-top: 8px; }
.chapter-block h2 { margin: 0 0 5px; font-size: 27px; line-height: 1.2; letter-spacing: -.025em; }
.chapter-block h2 a:hover { color: var(--accent); }
.chapter-block header p { margin: 0; color: var(--muted); }
.chapter-open { color: var(--quiet); font: 12px var(--mono); white-space: nowrap; padding-top: 9px; }
.chapter-open:hover { color: var(--accent); }
.chapter-block ol { columns: 2; column-gap: 54px; margin: 28px 0 0 76px; padding: 0; list-style-position: inside; }
.chapter-block li { break-inside: avoid; padding: 6px 0; color: var(--quiet); font: 13px var(--mono); }
.chapter-block li a { color: #d7d7d7; font: 15px/1.45 var(--sans); }
.chapter-block li a:hover { color: var(--accent); }
.history-teaser { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; margin-top: 72px; padding: 52px 0 8px; border-top: 1px solid var(--line); }
.history-teaser h2 { margin: 14px 0 0; font-size: clamp(30px, 4vw, 43px); line-height: 1.1; letter-spacing: -.04em; }
.history-teaser p { margin: 0 0 20px; color: #c8c8c8; font-size: 17px; }
.text-link { color: var(--accent); font-weight: 650; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.manual-layout { display: grid; grid-template-columns: 250px minmax(0, 790px); gap: 64px; padding: 52px 0 96px; }
.chapter-sidebar { position: sticky; top: 98px; align-self: start; }
.chapter-sidebar .overline { color: var(--quiet); margin-bottom: 14px; }
.chapter-sidebar nav { display: grid; gap: 2px; }
.chapter-sidebar nav a { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 8px 10px; border-radius: 5px; color: #bdbdbd; font-size: 14px; line-height: 1.4; }
.chapter-sidebar nav a span { color: var(--quiet); font: 12px/1.6 var(--mono); }
.chapter-sidebar nav a:hover { background: var(--panel); }
.chapter-sidebar nav a.active { color: white; background: var(--panel-2); box-shadow: inset 2px 0 var(--accent); }
.chapter-sidebar nav a.active span { color: var(--accent); }
.chapter-content { min-width: 0; }
.chapter-header { padding-bottom: 36px; }
.chapter-header h1 { font-size: clamp(38px, 5vw, 54px); }
.article-list { border-top: 1px solid var(--line); }
.article-row { display: grid; grid-template-columns: 48px 1fr 20px; gap: 18px; align-items: center; min-height: 78px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.article-row:hover { background: var(--panel); }
.article-id { color: var(--quiet); font: 13px var(--mono); text-align: right; }
.article-row strong { display: block; font-size: 16px; line-height: 1.4; }
.article-row small { display: block; margin-top: 3px; color: var(--quiet); font-size: 13px; line-height: 1.45; }
.article-row .arrow { color: var(--quiet); font-family: var(--mono); }
.article-row:hover .arrow { color: var(--accent); }

.article-layout { display: grid; grid-template-columns: 210px minmax(0, var(--measure)) 210px; gap: 52px; padding: 52px 0 100px; }
.article { min-width: 0; }
.article-header { padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.article-header h1 { font-size: clamp(40px, 5vw, 58px); }
.article-toc { position: sticky; top: 98px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; }
.article-toc .overline { color: var(--quiet); margin-bottom: 13px; }
.article-toc nav { display: grid; gap: 7px; }
.article-toc a { color: #9f9f9f; font-size: 13px; line-height: 1.4; }
.article-toc a.level-3 { padding-left: 12px; color: var(--quiet); }
.article-toc a:hover, .article-toc a.active { color: var(--accent); }
.article-body { padding-top: 18px; }
.article-body h2, .article-body h3 { scroll-margin-top: 92px; letter-spacing: -.025em; }
.article-body h2 { margin: 50px 0 14px; font-size: 30px; line-height: 1.22; }
.article-body h3 { margin: 34px 0 10px; font-size: 21px; line-height: 1.3; }
.heading-anchor { margin-left: 9px; color: transparent; font: 15px var(--mono); }
.article-body h2:hover .heading-anchor, .article-body h3:hover .heading-anchor { color: var(--quiet); }
.article-body p { margin: 16px 0; color: #d0d0d0; }
.article-body strong { color: white; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body ul, .article-body ol { margin: 18px 0; padding-left: 24px; color: #d0d0d0; }
.article-body li { margin: 7px 0; padding-left: 4px; }
.article-body code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); color: #dbeafe; font: .9em var(--mono); }
.article-body pre { overflow-x: auto; margin: 24px 0; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: #141414; }
.article-body pre code { padding: 0; border: 0; background: transparent; }
.article-body figure { margin: 32px 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #1d1d1d; text-align: center; }
.article-body figure img { display: block; width: auto; max-height: 680px; margin-inline: auto; }
.article-body figcaption { margin-top: 14px; color: var(--muted); font-size: 14px; text-align: left; }
.table-scroll { overflow-x: auto; margin: 26px 0; border: 1px solid var(--line); border-radius: 7px; }
table { width: 100%; border-collapse: collapse; min-width: 560px; font-size: 14px; }
th, td { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--panel-2); color: white; }
td { color: #c7c7c7; }
.sources, .related { margin-top: 58px; padding-top: 26px; border-top: 1px solid var(--line); }
.sources h2 { margin: 0 0 14px; font-size: 24px; }
.sources ol { margin: 0; padding-left: 24px; color: var(--quiet); }
.sources li { padding: 4px 0 4px 5px; }
.sources a { color: #c7c7c7; text-decoration: underline; text-underline-offset: 3px; }
.sources a:hover { color: var(--accent); }
.related > div { margin-top: 12px; }
.article-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 42px; }
.article-pager a { min-height: 100px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.article-pager a:hover { border-color: var(--accent); }
.article-pager a.next { text-align: right; }
.article-pager small { display: block; margin-bottom: 8px; color: var(--quiet); font: 11px var(--mono); }
.article-pager strong { display: block; line-height: 1.4; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 48px; padding: 36px 0 44px; color: var(--quiet); font-size: 13px; }
.footer-brand { color: white; font-weight: 700; }
.footer-inner p { margin: 5px 0 0; }
.footer-links { display: flex; gap: 22px; }
.footer-links a:hover { color: var(--accent); }
.footer-note { justify-self: end; font-family: var(--mono); }
.error-page { min-height: 70vh; padding: 100px 0; }
.error-page p { color: var(--muted); }
.button { display: inline-flex; margin-top: 18px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 6px; }
.history-page { max-width: 1000px; padding: 54px 0 100px; }
.history-header { max-width: 850px; padding: 16px 0 44px; border-bottom: 1px solid var(--line); }
.history-header h1 { margin: 14px 0 20px; font-size: clamp(44px, 6vw, 66px); line-height: 1.02; letter-spacing: -.05em; }
.history-header > p:not(.overline) { margin: 0; color: #c7c7c7; font-size: 19px; }
.history-intro { max-width: 780px; padding: 38px 0 50px; }
.history-intro p { margin: 0 0 18px; color: #d0d0d0; font-size: 17px; }
.history-timeline { border-top: 1px solid var(--line); }
.history-timeline article { display: grid; grid-template-columns: 130px 1fr; gap: 30px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.history-timeline article > span { color: var(--accent); font: 13px var(--mono); padding-top: 5px; }
.history-timeline h2 { margin: 0 0 8px; font-size: 24px; }
.history-timeline p { margin: 0; color: var(--muted); }
.snapshots { padding: 70px 0 20px; }
.snapshots > header { max-width: 700px; margin-bottom: 30px; }
.snapshots h2 { margin: 13px 0 0; font-size: clamp(32px, 4vw, 46px); line-height: 1.1; letter-spacing: -.04em; }
.snapshots figure { margin: 0 0 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.snapshots figure a { display: block; overflow-x: auto; background: white; }
.snapshots img { display: block; width: 100%; min-width: 760px; height: auto; }
.snapshots figcaption { display: grid; grid-template-columns: 150px 1fr; gap: 22px; padding: 18px 20px; color: var(--muted); font-size: 14px; }
.snapshots figcaption strong { color: white; font: 13px var(--mono); }
.history-sources { max-width: 780px; padding-top: 38px; border-top: 1px solid var(--line); }
.history-sources h2 { margin: 0 0 10px; font-size: 28px; }
.history-sources p { color: var(--muted); }
.history-sources ul { padding-left: 22px; }
.history-sources li { margin: 8px 0; }
.history-sources a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 1120px) {
  .article-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .article-toc { display: none; }
}
@media (max-width: 820px) {
  .shell { width: min(calc(100% - 28px), var(--max)); }
  .top-nav { display: none; }
  .menu-button { display: block; margin-left: auto; padding: 7px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
  .mobile-nav.open { display: grid; padding-bottom: 16px; }
  .mobile-nav a { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
  .manual-layout, .article-layout { display: block; padding-top: 36px; }
  .chapter-sidebar { display: none; }
  .home { padding-top: 52px; }
  .chapter-block ol { columns: 1; }
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
  .footer-note { justify-self: start; }
  .history-teaser { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .home-header h1, .chapter-header h1, .article-header h1 { font-size: 40px; }
  .home-header > p:not(.overline), .chapter-header > p:not(.overline), .article-header > p:not(.overline) { font-size: 16px; }
  .chapter-block > header { grid-template-columns: 36px 1fr; gap: 10px; }
  .chapter-open { grid-column: 2; padding: 4px 0 0; }
  .chapter-block ol { margin-left: 46px; }
  .article-row { grid-template-columns: 38px 1fr 14px; gap: 10px; }
  .article-row small { display: none; }
  .article-pager { grid-template-columns: 1fr; }
  .footer-links { flex-direction: column; gap: 7px; }
  .history-timeline article { grid-template-columns: 1fr; gap: 8px; }
  .snapshots figcaption { grid-template-columns: 1fr; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
