:root {
  color-scheme: light;
  --bg: #fcfcfb; --surface: #ffffff; --text: #202521; --muted: #69716b;
  --line: #dfe4df; --soft: #f0f3f0; --accent: #176b50; --accent-soft: #e7f1eb;
  --warm: #a04732; --code-bg: #f2f4f5; --code-text: #26333b;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171b19; --surface: #202622; --text: #e7ede7; --muted: #a2ada5;
  --line: #364039; --soft: #242c27; --accent: #8ad2ae; --accent-soft: #223a2d;
  --warm: #eda18a; --code-bg: #202729; --code-text: #e0e8ed;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 105px; letter-spacing: 0; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
.site-main { flex: 1; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
button:focus-visible, input:focus-visible { outline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.4; font-weight: 650; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.container { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
.icon { width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
.icon-button { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--soft); color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px 20px; background: var(--accent); color: var(--bg); }
.skip-link:focus { top: 12px; }
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-inner { width: min(1280px, calc(100% - 80px)); margin-inline: auto; height: 80px; display: flex; align-items: center; gap: 44px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 750; line-height: 1; }
.brand-mark { display: block; width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.main-nav { display: flex; gap: 30px; height: 100%; margin-left: auto; }
.main-nav a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 15px; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--text); }
.main-nav a[aria-current]::after { content: ""; position: absolute; bottom: 0; width: 100%; height: 2px; background: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 2px; padding-left: 22px; border-left: 1px solid var(--line); }
.theme-sun, .menu-toggle, .menu-close-icon { display: none; }
.menu-toggle[aria-expanded="true"] .menu-open-icon { display: none; }
.menu-toggle[aria-expanded="true"] .menu-close-icon { display: inline; }
.header-search { width: auto; padding-inline: 10px; gap: 8px; font-size: 13px; margin-right: 4px; }
[data-theme="dark"] .theme-sun { display: inline; }
[data-theme="dark"] .theme-moon { display: none; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; font-weight: 500; line-height: 1.6; color: var(--muted); }
.tiny-square { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; background: var(--accent); }
.journal-heading { padding-block: 52px 40px; }
.masthead { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-top: 12px; }
.masthead h1 { font-size: 64px; line-height: 1.15; font-weight: 780; margin: 0; }
.masthead h1 span, .page-heading h1 span, .project-intro h2 span { color: var(--accent); }
.masthead p { font-size: 17px; margin: 0 0 5px; line-height: 1.8; }
.masthead p span { color: var(--muted); font-size: 13px; }
.journal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 66px; padding-bottom: 90px; }
.mobile-series { display: none; }
.journal-list, .journal-sidebar { min-width: 0; }
.section-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; border-top: 2px solid var(--text); }
.section-bar h2 { font-size: 15px; margin: 0; }
.section-bar > span, .count { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.filters { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-top: 15px; }
.filters a { display: flex; align-items: center; min-height: 46px; padding: 7px 0 11px; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.filters a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.journal-entry { border-bottom: 1px solid var(--line); padding: 28px 0 24px; }
.entry-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.topic-label { color: var(--accent); font-family: var(--font); font-size: 12px; font-weight: 600; }
.topic-algorithm { color: var(--warm); }
.meta-divider { color: var(--line); }
.reading-time { margin-left: auto; }
.journal-entry h2 { font-size: 25px; margin: 12px 0 10px; line-height: 1.5; text-wrap: pretty; }
.journal-entry p { color: var(--muted); font-size: 15px; line-height: 1.9; margin-bottom: 15px; overflow-wrap: anywhere; }
.entry-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.entry-tags a { display: inline-flex; align-items: center; min-height: 28px; }
.entry-tags a::before { content: "#"; color: var(--accent); margin-right: 2px; }
.entry-link { color: var(--accent); display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 44px; }
.entry-link:hover { background: var(--accent-soft); border-radius: 4px; }
.empty-filter { padding: 40px 0; color: var(--muted); }
.series-title { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 24px; font-weight: 650; margin-top: 24px; }
.series-sidebar > p { font-size: 14px; color: var(--muted); margin: 5px 0 20px; }
.project-teaser { display: block; margin: 18px 0; }
.project-teaser img { display: block; width: 100%; height: auto; }
.project-teaser > span { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.project-teaser .icon { width: 14px; height: 14px; }
.stage-list { padding: 0; margin: 0; list-style: none; }
.stage-list a { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 13px; }
.stage-number { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 25px; }
.stage-list .icon { width: 14px; height: 14px; flex-basis: 14px; margin-left: auto; color: var(--muted); }
.stage-list a[aria-current] { color: var(--accent); font-weight: 650; }
.text-link { display: inline-flex; align-items: center; min-height: 36px; gap: 8px; font-size: 14px; color: var(--accent); background: transparent; border: 0; padding: 0; }
.text-link .icon { width: 16px; height: 16px; flex-basis: 16px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 5px; }
.series-sidebar > .text-link { margin-top: 15px; }
.series-sidebar > .series-start { margin-top: 0; display: flex; }
.algorithm-sidebar, .topics-sidebar { margin-top: 38px; }
.algorithm-sidebar .section-bar, .topics-sidebar .section-bar { border-top-width: 1px; }
.algorithm-preview { display: block; margin-top: 20px; }
.algorithm-preview img { display: block; width: 100%; height: auto; background: #fff; padding: 15px 0; }
.algorithm-preview > span { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; margin-top: 12px; }
.algorithm-preview .icon { width: 16px; height: 16px; flex-basis: 16px; }
.topic-links { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 20px; }
.topic-links a { font-size: 13px; min-height: 32px; display: inline-flex; align-items: center; }
.topic-links span { font-family: var(--mono); font-size: 12px; margin-left: 6px; color: var(--muted); }
.sidebar-note { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 24px; }
.sidebar-note p { font-size: 17px; font-weight: 650; margin: 12px 0 2px; }
.sidebar-note > span:not(.eyebrow) { color: var(--muted); font-size: 12px; }
.sidebar-note .text-link { display: flex; margin-top: 18px; }
.page-heading { padding-block: 65px 45px; }
.page-heading h1 { margin: 12px 0 15px; font-size: 46px; line-height: 1.3; }
.page-heading p { color: var(--muted); margin-bottom: 10px; }
.project-intro { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 80px; padding-block: 36px 45px; border-block: 1px solid var(--line); }
.project-intro h2 { font-family: var(--mono); font-size: 38px; margin: 15px 0 12px; }
.project-intro p { color: var(--muted); line-height: 2; margin: 0; }
.project-facts { border-left: 1px solid var(--line); padding-left: 35px; }
.project-facts > div { margin-bottom: 15px; }
.project-facts span { color: var(--muted); font-size: 11px; display: block; }
.project-facts strong { font-family: var(--mono); font-size: 21px; font-weight: 500; }
.project-facts > div:first-child strong { font-size: 38px; line-height: 1.5; }
.project-facts a { font-size: 13px; color: var(--accent); }
.project-facts .icon { width: 16px; height: 16px; }
.project-stages { padding-top: 45px; padding-bottom: 80px; }
.project-stages ol { list-style: none; padding: 0; margin: 0; }
.project-stages li { display: grid; grid-template-columns: 85px minmax(0, 1fr) 40px; gap: 28px; padding-block: 30px; border-bottom: 1px solid var(--line); }
.milestone-label { font-family: var(--mono); font-size: 30px; line-height: 1.5; color: var(--accent); }
.project-stages h3 { font-size: 23px; margin: 9px 0; }
.project-stages p { color: var(--muted); font-size: 14px; margin: 0; max-width: 770px; }
.project-stages .entry-link { align-self: center; }
.article-shell { display: grid; grid-template-columns: minmax(0, 760px) 240px; gap: 90px; padding-block: 36px 80px; }
.article-column { min-width: 0; }
.breadcrumbs { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); min-height: 30px; }
.breadcrumbs .icon { width: 12px; height: 12px; flex-basis: 12px; }
.article-header { padding: 30px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.article-header .eyebrow { color: var(--accent); }
.article-header h1 { font-size: 35px; line-height: 1.5; margin: 14px 0 20px; text-wrap: balance; }
.article-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.article-header .entry-tags { margin-top: 16px; }
.article-sidebar-inner { position: sticky; top: 114px; max-height: calc(100vh - 145px); display: flex; flex-direction: column; }
.article-sidebar { padding-top: 70px; min-width: 0; }
.article-sidebar h2 { margin: 0 0 15px; }
.desktop-toc { overflow-y: auto; min-height: 80px; scrollbar-width: thin; padding-right: 10px; }
.toc { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.toc-child { list-style: none; padding-left: 14px; }
.toc a { display: block; color: var(--muted); border-left: 2px solid var(--line); padding: 6px 0 6px 12px; overflow-wrap: anywhere; }
.toc a:hover, .toc a[aria-current] { color: var(--accent); border-left-color: var(--accent); }
.article-series { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 22px; flex-shrink: 0; }
.article-series .stage-list { margin-top: 10px; }
.article-series .stage-list a { min-height: 36px; font-size: 13px; }
.mobile-toc { display: none; }
.reading-progress { position: absolute; bottom: -1px; width: 100%; height: 2px; overflow: hidden; }
.reading-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.prose { font-size: 17px; line-height: 1.95; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.5em; }
.prose h1 { font-size: 29px; }
.prose h2 { font-size: 24px; margin: 2.4em 0 1em; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 19px; margin: 2em 0 .9em; }
.prose h4 { font-size: 16px; margin: 1.7em 0 .7em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.5em; margin: 0 0 1.5em; }
.prose li { margin-bottom: .4em; }
.prose li > p { margin-bottom: .5em; }
.prose blockquote { margin: 1.7em 0; padding: 12px 0 12px 22px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { font-family: var(--mono); font-size: .84em; padding: 2px 5px; background: var(--soft); border-radius: 3px; color: var(--code-text); word-break: break-word; }
.prose pre { font-family: var(--mono); white-space: pre; overflow-x: auto; margin: 0; }
.prose > pre, .prose figure.highlight { position: relative; margin: 1.7em 0; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--line); border-radius: 4px; font-size: 13px; line-height: 1.8; }
.prose > pre { padding: 22px 48px 22px 22px; }
.prose pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; word-break: normal; }
.prose .highlight table { margin: 0; display: block; width: 100%; overflow-x: auto; border: 0; font-size: inherit; }
.prose .highlight td { border: 0; padding: 20px 0; min-width: 0; }
.prose .highlight .gutter { color: var(--muted); background: transparent; user-select: none; padding-left: 16px; padding-right: 16px; border-right: 1px solid var(--line); }
.prose .highlight .code { width: 100%; padding-left: 18px; padding-right: 50px; }
.prose .highlight pre { overflow: visible; }
.code-copy { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; background: var(--code-bg); color: var(--muted); }
.code-copy .icon { width: 16px; height: 16px; flex-basis: 16px; }
.copied { color: var(--accent); background: var(--accent-soft); }
.prose .hljs-keyword, .prose .hljs-selector-tag, .prose .hljs-literal { color: #985186; }
.prose .hljs-string, .prose .hljs-attr { color: #357c50; }
.prose .hljs-number, .prose .hljs-built_in { color: #a54d2c; }
.prose .hljs-title, .prose .hljs-function { color: #326b9b; }
.prose .hljs-comment { color: #626e66; }
[data-theme="dark"] .prose .hljs-keyword, [data-theme="dark"] .prose .hljs-selector-tag, [data-theme="dark"] .prose .hljs-literal { color: #cba4db; }
[data-theme="dark"] .prose .hljs-string, [data-theme="dark"] .prose .hljs-attr { color: #9dccad; }
[data-theme="dark"] .prose .hljs-number, [data-theme="dark"] .prose .hljs-built_in { color: #edb28d; }
[data-theme="dark"] .prose .hljs-title, [data-theme="dark"] .prose .hljs-function { color: #9ec6eb; }
[data-theme="dark"] .prose .hljs-comment { color: #a2ada5; }
.prose > table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.8em 0; font-size: 13px; line-height: 1.8; scrollbar-width: thin; }
.prose th, .prose td { padding: 12px 14px; text-align: left; border: 1px solid var(--line); min-width: 100px; }
.prose th { background: var(--soft); font-weight: 600; }
.prose td code { font-size: 12px; white-space: nowrap; word-break: normal; }
.prose img { max-width: 100%; height: auto; display: block; margin: 25px auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 35px 0; }
.prose details { border: 1px solid var(--line); padding: 15px 20px; border-radius: 4px; margin: 22px 0; }
.prose summary { cursor: pointer; font-weight: 600; }
.prose .success, .prose .tips { border-left: 3px solid var(--accent); padding: 12px 20px; margin: 22px 0; background: var(--soft); }
.prose .warning, .prose .danger { border-left: 3px solid var(--warm); padding: 12px 20px; margin: 22px 0; background: var(--soft); }
.article-footer { margin-top: 55px; padding-block: 20px; border-block: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; color: var(--muted); }
.article-footer p { margin: 0; }
.article-footer a { text-decoration: underline; text-underline-offset: 3px; }
.article-footer .text-link { font-size: 12px; flex-shrink: 0; min-width: 124px; justify-content: center; }
.article-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 30px; }
.article-pagination a { display: block; }
.article-pagination span { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; }
.article-pagination .icon { width: 14px; height: 14px; flex-basis: 14px; }
.article-pagination strong { display: block; font-size: 16px; font-weight: 600; margin-top: 9px; }
.related-posts { margin-top: 30px; }
.related-posts h2 { font-size: 15px; margin-bottom: 15px; }
.related-posts .text-link { display: flex; margin-bottom: 10px; }
.archive-list { padding-bottom: 90px; }
.archive-year { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 45px; border-top: 1px solid var(--line); padding-block: 30px; }
.archive-year h2 { font-family: var(--mono); font-size: 36px; margin: 0; }
.archive-year h2 span { display: block; font-family: var(--font); font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 8px; }
.archive-entry { display: flex; align-items: baseline; gap: 20px; padding-block: 15px; border-bottom: 1px solid var(--line); }
.archive-entry time { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: 0 0 40px; }
.archive-entry strong { font-size: 16px; font-weight: 550; overflow-wrap: anywhere; }
.archive-entry .icon { width: 16px; height: 16px; flex-basis: 16px; align-self: center; color: var(--muted); }
.archive-topic { margin-left: auto; white-space: nowrap; font-size: 11px; color: var(--muted); }
.tag-index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 50px; padding-bottom: 90px; }
.tag-index a { position: relative; border-top: 1px solid var(--line); padding-block: 30px; }
.tag-index h2 { font-family: var(--mono); font-size: 22px; margin: 0 0 8px; }
.tag-index span { color: var(--muted); font-size: 12px; }
.tag-index .icon { position: absolute; right: 0; top: 34px; }
.about-layout { padding-block: 36px 100px; border-top: 1px solid var(--line); }
.about-copy p { color: var(--muted); font-size: 16px; line-height: 2.1; margin-bottom: 22px; }
.about-contact { display: flex; gap: 30px; margin-top: 35px; }
.standalone-prose { max-width: 760px; margin-bottom: 80px; }
.pagination { display: flex; justify-content: center; gap: 18px; margin-top: 30px; font-size: 13px; }
.pagination .current { color: var(--accent); border-bottom: 1px solid var(--accent); }
.not-found { min-height: 65vh; }
.not-found .text-link { margin: 25px 25px 0 0; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { width: min(1120px, calc(100% - 80px)); margin-inline: auto; display: grid; grid-template-columns: 1fr auto; gap: 25px; padding-block: 36px 28px; }
.footer-brand { font-size: 20px; font-weight: 750; }
.footer-brand span { color: var(--accent); }
.footer-inner p { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.footer-links { display: flex; gap: 25px; align-items: start; padding-top: 6px; }
.footer-links a { font-size: 12px; }
.footer-links .icon { width: 14px; height: 14px; }
.footer-inner small { grid-column: 1 / -1; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.dialog-open { overflow: hidden; }
.search-dialog { width: min(700px, calc(100% - 32px)); max-height: min(740px, calc(100dvh - 64px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); box-shadow: 0 20px 80px #0003; margin: 70px auto; }
.search-dialog::backdrop { background: #101a1566; }
.search-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 16px 20px 8px; }
.search-top h2 { font-size: 16px; margin: 0; }
.search-form { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.search-form .icon { color: var(--accent); }
.search-form input { width: 100%; min-width: 0; background: transparent; border: 0; padding: 6px 0; font-size: 16px; }
.search-form input:focus { outline: none; }
.search-form:focus-within { border-bottom-color: var(--accent); }
.search-form input::placeholder { color: var(--muted); }
.search-form input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-status { font-size: 12px; color: var(--muted); padding: 12px 22px; margin: 0; }
.search-results { overflow-y: auto; max-height: min(500px, calc(100dvh - 285px)); overscroll-behavior: contain; padding: 0 22px 12px; }
.search-result { display: block; padding: 17px 0; border-top: 1px solid var(--line); }
.search-result h3 { font-size: 16px; margin: 0 0 7px; }
.search-result p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.8; overflow-wrap: anywhere; }
.search-result-meta { display: block; margin-top: 9px; font-size: 11px; font-family: var(--mono); color: var(--muted); }
.search-result:hover h3, .search-result:focus-visible h3 { color: var(--accent); }
.search-retry { margin: 0 22px 20px; }
mark { color: var(--accent); background: var(--accent-soft); padding: 1px 2px; }
.search-empty { padding: 28px 0 35px; color: var(--muted); font-size: 14px; }
.back-top { position: fixed; right: 24px; bottom: 24px; background: var(--surface); border: 1px solid var(--line); z-index: 10; }
.action-status { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 120px); padding: 9px 16px; border-radius: 4px; background: var(--text); color: var(--bg); font-size: 13px; text-align: center; pointer-events: none; }
.action-status:empty { display: none; }
@media (min-width: 1500px) { .journal-heading { padding-top: 65px; } }
@media (max-width: 1100px) {
  .journal-grid { gap: 38px; grid-template-columns: minmax(0, 1fr) 250px; }
  .article-shell { gap: 42px; grid-template-columns: minmax(0, 1fr) 210px; }
  .article-header h1 { font-size: 31px; }
  .project-intro { gap: 45px; grid-template-columns: minmax(0, 1fr) 240px; }
}
@media (max-width: 850px) {
  .container { width: calc(100% - 48px); }
  .header-inner, .footer-inner { width: calc(100% - 48px); }
  .header-inner { height: 68px; gap: 25px; }
  .main-nav { gap: 22px; }
  .header-actions { padding-left: 16px; }
  .masthead h1 { font-size: 52px; }
  .masthead p { font-size: 14px; }
  .journal-grid { grid-template-columns: minmax(0, 1fr); }
  .journal-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 35px; }
  .algorithm-sidebar, .topics-sidebar { margin: 0; }
  .sidebar-note { margin: 0; }
  .article-shell { display: block; max-width: 760px; }
  .article-sidebar { display: none; }
  html { scroll-padding-top: 140px; }
  .mobile-series { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-block: 18px; margin-bottom: 30px; border-block: 1px solid var(--line); }
  .mobile-series strong { font-size: 16px; display: block; margin-top: 5px; font-weight: 600; }
  .mobile-series .icon { color: var(--accent); }
  .mobile-toc { position: sticky; top: 68px; z-index: 12; background: var(--bg); display: block; border-block: 1px solid var(--line); margin-bottom: 28px; font-size: 14px; }
  .mobile-toc summary { min-height: 48px; padding-block: 12px; cursor: pointer; color: var(--accent); font-weight: 600; }
  .mobile-toc nav { max-height: min(45dvh, 330px); overflow-y: auto; padding-bottom: 14px; }
  .archive-year { grid-template-columns: 110px minmax(0, 1fr); gap: 25px; }
  .archive-topic { display: none; }
  .tag-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .container, .header-inner, .footer-inner { width: calc(100% - 40px); }
  .header-inner { height: 64px; gap: 10px; }
  .brand { font-size: 18px; gap: 7px; }
  .brand-mark { width: 32px; height: 32px; }
  .header-actions { margin-left: auto; padding-left: 0; border: 0; gap: 0; }
  .header-actions .icon-button { width: 44px; height: 44px; padding: 0; margin: 0; }
  .header-search > span { display: none; }
  .menu-toggle { display: inline-flex; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; height: auto; background: var(--bg); padding: 15px 20px; border-bottom: 1px solid var(--line); gap: 0; }
  .main-nav.is-open { display: flex; }
  .main-nav a { justify-content: center; min-height: 44px; flex: 1; font-size: 14px; }
  .main-nav a[aria-current]::after { width: 20px; }
  .journal-heading { padding-block: 33px 29px; }
  .journal-heading .eyebrow { font-size: 10px; }
  .masthead { display: block; margin-top: 14px; }
  .masthead h1 { font-size: 46px; }
  .masthead p { margin-top: 17px; line-height: 1.8; font-size: 15px; }
  .masthead p br { display: none; }
  .masthead p span { display: block; font-size: 12px; margin-top: 3px; }
  .journal-grid { gap: 38px; padding-bottom: 50px; }
  .section-bar { padding-top: 14px; }
  .filters { margin-top: 10px; gap: 24px; }
  .journal-entry { padding-block: 23px 20px; }
  .journal-entry h2 { font-size: 21px; margin: 11px 0 9px; }
  .journal-entry p { font-size: 14px; }
  .entry-meta { font-size: 12px; gap: 8px; }
  .topic-label { font-size: 12px; }
  .reading-time { display: none; }
  .entry-tags { font-size: 11px; gap: 12px; }
  .journal-sidebar { grid-template-columns: 1fr; gap: 30px; }
  .series-sidebar .stage-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .series-sidebar .stage-list a { font-size: 12px; gap: 7px; }
  .series-sidebar .stage-list .icon { display: none; }
  .algorithm-preview img { max-width: 320px; }
  .sidebar-note { padding-top: 20px; }
  .page-heading { padding-block: 38px 30px; }
  .page-heading h1 { font-size: 36px; }
  .page-heading p { font-size: 13px; }
  .project-intro { grid-template-columns: 1fr; gap: 26px; padding-block: 28px; }
  .project-intro h2 { font-size: 29px; }
  .project-intro p { font-size: 14px; }
  .project-facts { border: 0; padding: 0; display: flex; gap: 25px; flex-wrap: wrap; }
  .project-facts > div { margin: 0; }
  .project-facts > div:first-child strong { font-size: 21px; line-height: 1.7; }
  .project-facts strong { font-size: 16px; }
  .project-stages { padding-top: 30px; padding-bottom: 50px; }
  .project-stages li { grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding-block: 22px; }
  .project-stages .entry-link { display: none; }
  .milestone-label { font-size: 23px; }
  .project-stages h3 { font-size: 19px; }
  .project-stages p { font-size: 13px; }
  .article-shell { padding-top: 24px; padding-bottom: 50px; }
  .article-header { padding-top: 24px; margin-bottom: 25px; }
  .article-header h1 { font-size: 27px; margin-block: 14px 17px; }
  .article-meta { font-size: 12px; gap: 8px; }
  .mobile-toc { top: 64px; }
  .prose { font-size: 16px; line-height: 1.95; }
  .prose h2 { font-size: 21px; margin-top: 2em; }
  .prose h3 { font-size: 18px; }
  .prose h1 { font-size: 25px; }
  .prose > table { font-size: 12px; }
  .prose th, .prose td { padding: 9px 11px; }
  .prose figure.highlight, .prose > pre { font-size: 13px; }
  .code-copy { width: 44px; height: 44px; top: 0; right: 0; }
  .prose blockquote { padding-left: 16px; }
  .article-footer { flex-direction: column; align-items: start; gap: 14px; margin-top: 35px; }
  .article-pagination { gap: 20px; }
  .article-pagination strong { font-size: 14px; }
  .archive-year { display: block; padding-top: 22px; }
  .archive-year h2 { font-size: 30px; display: flex; align-items: baseline; gap: 15px; margin-bottom: 10px; }
  .archive-entry { gap: 12px; padding-block: 14px; }
  .archive-entry strong { font-size: 14px; }
  .archive-entry .icon { margin-left: auto; }
  .archive-list { padding-bottom: 45px; }
  .tag-index { gap: 0 25px; padding-bottom: 50px; }
  .tag-index h2 { font-size: 18px; padding-right: 15px; }
  .tag-index .icon { width: 14px; height: 14px; }
  .about-layout { padding-block: 28px 50px; }
  .about-copy p { font-size: 15px; }
  .footer-inner { gap: 22px; padding-top: 28px; }
  .footer-links { gap: 16px; }
  .footer-inner small { font-size: 11px; }
  .search-dialog { margin: 20px auto; max-height: calc(100dvh - 40px); }
  .search-top { padding-inline: 16px; }
  .search-form, .search-status { padding-inline: 18px; }
  .search-results { padding-inline: 18px; max-height: calc(100dvh - 240px); }
  .back-top { right: 15px; bottom: 15px; width: 44px; height: 44px; }
}
html:not([data-theme]) .theme-toggle, html:not([data-theme]) [data-search-open], html:not([data-theme]) .menu-toggle { display: none; }
@media (max-width: 600px) {
  html:not([data-theme]) .header-inner { height: auto; min-height: 64px; flex-wrap: wrap; padding-top: 12px; }
  html:not([data-theme]) .main-nav { display: flex; position: static; width: 100%; order: 3; padding: 0; border: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: color .16s, background-color .16s; }
}
@media print {
  .site-header, .site-footer, .article-sidebar, .mobile-toc, .article-footer, .article-pagination, .breadcrumbs, .back-top, .code-copy, .search-dialog, .related-posts { display: none !important; }
  :root, :root[data-theme="dark"] { --bg: #fff; --text: #111; --muted: #555; --line: #ccc; --code-bg: #f7f7f7; --soft: #f5f5f5; --accent: #17543b; --code-text: #111; color-scheme: light; }
  .article-shell { display: block; width: 100%; padding: 0; }
  .article-header { padding-top: 0; }
  .article-header h1 { font-size: 25px; }
  .prose { font-size: 11pt; }
  .prose h2 { break-after: avoid; font-size: 17pt; }
  .prose pre, .prose .highlight pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .prose > table { display: table; width: 100%; font-size: 9pt; }
  .prose .highlight .code { padding-right: 15px; }
}
