/* GitHub Primer's official Light / Dark Tritanopia tokens are bundled with the site. */
:root {
  color-scheme: light;
  --page: var(--bgColor-default);
  --card: var(--card-bgColor);
  --ink: var(--fgColor-default);
  --muted: var(--fgColor-muted);
  --line: var(--borderColor-default);
  --surface: var(--bgColor-muted);
  --accent: var(--fgColor-accent);
  --accent-soft: var(--bgColor-accent-muted);
  --card-shadow: var(--shadow-resting-small);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --reading: var(--sans);
  --mono: "JetBrains Mono Variable", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
:root[data-color-mode="dark"] {
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-color-mode="auto"] { color-scheme: dark; }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 32px; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
a { color: inherit; text-underline-offset: .22em; }
::selection { background: var(--selection-bgColor); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.nav { max-width: 1072px; min-height: 76px; padding: 0 24px; margin: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo > a { padding: 2px 12px 4px; border-radius: 6px; background: var(--ink); color: var(--page); font-size: 22px; font-weight: 600; letter-spacing: -.5px; line-height: 1.5; text-decoration: none; }
.theme-toggle { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.theme-toggle:hover { background: var(--control-bgColor-hover); color: var(--ink); }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
.menu { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; font-size: 14px; }
.menu a { display: block; padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.menu a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu a:hover { background: var(--control-bgColor-hover); color: var(--accent); }
.menu span { font-size: 12px; }
.main { width: 100%; max-width: 828px; min-height: calc(100vh - 158px); margin: auto; padding: 30px 24px 56px; }
.post-page { max-width: 1072px; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.45; }
h1 { margin: 0; font-size: 36px; font-weight: 600; letter-spacing: -.02em; }
.post-header { margin: 22px 0 34px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.post-header h1 { font-family: var(--reading); text-wrap: balance; }
.post-header .post-meta { margin-top: 18px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.post-meta > * + *::before { content: "·"; margin: 0 9px; }
.prose { font-family: var(--reading); font-size: 17px; font-weight: 400; line-height: 1.85; }
.prose a { color: var(--accent); }
.prose h2, .prose h3, .prose h4 { font-weight: 600; letter-spacing: normal; text-wrap: wrap; }
.prose h2 { margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 24px; }
.prose h3 { margin: 26px 0 10px; font-size: 20px; }
.prose h4 { margin: 20px 0 8px; font-size: 17px; }
.prose h2 + h3, .prose h3 + h4 { margin-top: 16px; }
.prose > :first-child { margin-top: 0; }
.prose strong { font-weight: 600; }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: 28px; }
.prose p { margin: 0 0 20px; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 23px; }
.prose blockquote { margin: 24px 0; padding: 18px 22px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose .callout { border-left-color: var(--callout-accent, var(--accent)); }
.callout-note { --callout-accent: var(--fgColor-accent); }
.callout-tip { --callout-accent: var(--fgColor-success); }
.callout-important { --callout-accent: var(--fgColor-done); }
.callout-warning { --callout-accent: var(--fgColor-attention); }
.callout-caution { --callout-accent: var(--fgColor-danger); }
.table-scroll { max-width: 100%; overflow-x: auto; margin: 24px 0 28px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.prose table { width: 100%; min-width: 560px; border-collapse: collapse; font-family: var(--sans); font-size: 14px; line-height: 1.75; }
.prose th, .prose td { padding: 11px 14px; border: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--surface); text-align: left; font-weight: 600; }
.prose td > :last-child { margin-bottom: 0; }
.prose img { display: block; max-width: 100%; height: auto; margin: 24px auto; }
.prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }
.prose li { padding-left: 2px; margin: 9px 0; }
.prose li::marker { color: var(--muted); font-size: .8em; }
.prose li p { margin-bottom: 10px; }
.prose p[id], .prose figure[id] { scroll-margin-top: 28px; }
.prose :not(pre) > code { font: .875em/1.7 var(--mono); background: var(--surface); color: var(--ink); border-radius: 3px; padding: .16em .32em; overflow-wrap: anywhere; }
.prose strong > code { font-weight: 600; }
.math-inline { white-space: normal; }
.math-inline mjx-container { font-size: 1em; }
.equation { overflow-x: auto; overflow-y: hidden; margin: 26px 0 30px; padding: 10px 0 16px; max-width: 100%; font-size: 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.equation mjx-container[jax="SVG"][display="true"] { display: block; width: max-content; min-width: 100%; margin: 0; text-align: center; }
.equation svg { max-width: none; }
.code-block {
  --code-bg: var(--page);
  --code-ink: var(--ink);
  --code-muted: var(--prettylights-syntax-comment);
  --code-border: var(--line);
  --code-keyword: var(--prettylights-syntax-keyword);
  --code-string: var(--prettylights-syntax-string);
  --code-title: var(--prettylights-syntax-entity);
  --code-constant: var(--prettylights-syntax-constant);
  --code-variable: var(--prettylights-syntax-variable);
  --code-added: var(--prettylights-syntax-markup-inserted-text);
  --code-added-bg: var(--prettylights-syntax-markup-inserted-bg);
  --code-deleted: var(--prettylights-syntax-markup-deleted-text);
  --code-deleted-bg: var(--prettylights-syntax-markup-deleted-bg);
  font-family: var(--sans);
  margin: 26px 0 30px;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--code-bg);
}
.code-caption { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 43px; padding: 7px 18px; border-bottom: 1px solid var(--code-border); background: var(--surface); color: var(--muted); }
.code-caption-text { min-width: 0; font: 500 12px/1.6 var(--mono); overflow-wrap: anywhere; }
.code-actions { display: flex; align-items: center; gap: 10px; }
.code-language { padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font: 11px/1.6 var(--mono); }
.copy-button { border: 1px solid var(--line); border-radius: 5px; background: var(--button-default-bgColor-rest); font: 12px var(--sans); padding: 5px 10px; min-height: 28px; white-space: nowrap; color: var(--ink); }
.copy-button:hover { background: var(--button-default-bgColor-hover); }
.code-block :focus-visible { outline-color: var(--accent); outline-offset: -3px; }
.code-block pre { display: flex; align-items: flex-start; gap: 18px; margin: 0; padding: 20px 22px 22px; overflow-x: auto; font: 14px/1.75 var(--mono); font-variant-ligatures: none; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.line-numbers { flex: none; min-width: 2ch; padding-right: 16px; border-right: 1px solid var(--borderColor-muted); text-align: right; color: var(--code-muted); user-select: none; -webkit-user-select: none; }
.code-block code { display: block; flex: 1 0 auto; min-width: max-content; font: inherit; color: var(--code-ink); tab-size: 4; white-space: pre; }
/* Highlight.js GitHub scope mapping, using the active Tritanopia palette. */
.code-block .hljs-keyword, .code-block .hljs-doctag, .code-block .hljs-type,
.code-block .hljs-template-tag, .code-block .hljs-template-variable,
.code-block .hljs-variable.language_ { color: var(--code-keyword); }
.code-block .hljs-keyword { font-weight: 600; }
.code-block .hljs-title { color: var(--code-title); font-weight: 500; }
.code-block .hljs-attr, .code-block .hljs-attribute, .code-block .hljs-number,
.code-block .hljs-literal, .code-block .hljs-meta, .code-block .hljs-operator,
.code-block .hljs-variable { color: var(--code-constant); }
.code-block .hljs-string, .code-block .hljs-regexp { color: var(--code-string); }
.code-block .hljs-built_in, .code-block .hljs-symbol { color: var(--code-variable); }
.code-block .hljs-comment, .code-block .hljs-code, .code-block .hljs-formula { color: var(--code-muted); }
.code-block .hljs-name, .code-block .hljs-quote { color: var(--prettylights-syntax-entityTag); }
.code-block .hljs-params, .code-block .hljs-subst { color: var(--code-ink); }
.code-block .hljs-section { color: var(--code-constant); font-weight: 600; }
.code-block .hljs-addition { color: var(--code-added); background: var(--code-added-bg); }
.code-block .hljs-deletion { color: var(--code-deleted); background: var(--code-deleted-bg); }
.post-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 13px; }
.post-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.post-topics span { padding: 3px 10px; background: var(--surface); border-radius: 4px; font-size: 12px; }
.post-actions { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 24px; color: var(--muted); }
.post-actions a, .back-link { text-decoration: none; }
.post-actions a:hover { color: var(--ink); text-decoration: underline; }
.back-link { display: inline-block; margin-top: 22px; padding: 10px 0; color: var(--accent); }
.back-link:hover { text-decoration: underline; }
.post-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.post-pagination a { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-decoration: none; font-family: var(--reading); font-size: 15px; font-weight: 500; line-height: 1.8; }
.post-pagination a:hover { color: var(--accent); background: var(--accent-soft); }
.post-pagination a span { display: block; margin-bottom: 7px; color: var(--muted); font: 12px/1.7 var(--sans); }
.post-pagination .post-next { grid-column: 2; text-align: right; }
/* Compact article index; reading pages retain room for code and tables. */
.home-page-shell .nav, .archive-page-shell .nav { max-width: 828px; }
.home-page { max-width: 828px; padding-top: 38px; padding-bottom: 54px; }
.post-list-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.post-list-heading::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.post-list-heading h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; font-weight: 600; letter-spacing: normal; }
.post-list-heading h1 span { padding: 4px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font: 10px/1 var(--mono); }
.post-list { display: grid; gap: 18px; }
.post-entry { position: relative; min-width: 0; padding: 22px 26px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); box-shadow: var(--card-shadow); }
.post-entry:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.post-entry h2 { margin: 0 0 16px; font-family: var(--reading); font-size: 21px; font-weight: 600; line-height: 1.5; letter-spacing: 0; text-wrap: balance; }
.post-entry h2 a { color: var(--accent); text-decoration: none; }
.post-entry h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.post-entry h2 a:focus-visible { outline: none; }
.entry-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 12px; border-top: 1px solid var(--borderColor-muted); }
.entry-details { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.entry-footer .post-meta { font-size: 12px; }
.entry-footer .post-meta > * + *::before { margin-inline: 7px; }
.entry-topics { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 0; list-style: none; }
.entry-topics li { color: var(--muted); font-size: 11px; line-height: 1.8; }
.entry-topics li::before { content: "#"; margin-right: 3px; opacity: .65; }
.entry-arrow { flex: none; color: var(--muted); transition: transform .18s ease; }
.post-entry:focus-within h2 a, .post-entry:focus-within .entry-arrow { color: var(--accent); }
@media (hover: hover) {
  .post-entry:hover { border-color: var(--accent); }
  .post-entry:hover h2 a { text-decoration: underline; }
  .post-entry:hover h2 a, .post-entry:hover .entry-arrow { color: var(--accent); }
  .post-entry:hover .entry-arrow { transform: translateX(3px); }
}
.home-page-shell .site-footer { max-width: 828px; font-size: 11px; }
.page-header { margin: 22px 0 40px; }
.archive-page .page-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 8px 0 26px; }
.archive-page .page-header h1 { font-size: 30px; }
.page-header p { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.archive-year { margin-bottom: 22px; padding: 26px 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); box-shadow: var(--card-shadow); }
.archive-year h2 { margin: 0 0 28px; font-size: 24px; }
.archive-year h2 span { font-size: 12px; color: var(--muted); vertical-align: super; margin-left: 6px; font-weight: 400; }
.archive-month { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 20px; margin-bottom: 32px; }
.archive-month:last-child { margin-bottom: 0; }
.archive-entries { border-left: 1px solid var(--line); }
.archive-month h3 { margin: 2px 0 0; color: var(--muted); font-size: 15px; font-weight: 500; }
.archive-entry { position: relative; padding: 0 0 25px 23px; }
.archive-entry:last-child { padding-bottom: 0; }
.archive-entry::before { content: ""; position: absolute; top: 8px; left: -4px; width: 7px; height: 7px; border: 2px solid var(--card); border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 1px var(--line); }
.archive-entry h4 { font-family: var(--reading); font-size: 18px; font-weight: 600; line-height: 1.6; margin: 0 0 7px; }
.archive-entry h4 a { color: var(--accent); text-decoration: none; }
.archive-entry h4 a:hover { color: var(--accent); text-decoration: underline; }
.site-footer { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 6px 18px; max-width: 828px; min-height: 252px; margin: auto; padding: 176px 24px 28px; color: var(--muted); font-size: 12px; }
.footer-art { position: absolute; inset: auto 0 0; width: 100%; height: 228px; object-fit: contain; object-position: center bottom; opacity: .6; pointer-events: none; user-select: none; }
[data-color-mode="dark"] .footer-art { opacity: .5; }
.site-footer > span { position: relative; z-index: 1; }
.post-page-shell .site-footer { max-width: 1072px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.skip-link { position: fixed; top: -100px; left: 16px; background: var(--page); padding: 12px; z-index: 3; }
.skip-link:focus { top: 12px; }
.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; }
@media (max-width: 600px) {
  .nav { min-height: 70px; padding-inline: 20px; gap: 6px; }
  .logo { gap: 5px; }
  .logo > a { padding-inline: 10px; font-size: 20px; }
  .menu { gap: 3px; font-size: 12px; }
  .menu a { padding-inline: 9px; }
  .main { padding: 15px 20px 38px; }
  h1 { font-size: 28px; }
  .post-header h1 { text-wrap: pretty; }
  .post-header { margin-top: 18px; margin-bottom: 28px; padding-bottom: 22px; }
  .post-meta { font-size: 12px; }
  .post-meta > * + *::before { margin-inline: 6px; }
  .prose { font-size: 16px; line-height: 1.85; }
  .equation { font-size: 16px; margin: 22px 0; }
  .code-block { margin-block: 25px 29px; }
  .code-caption { gap: 10px; padding-inline: 14px; }
  .code-caption-text { font-size: 11px; }
  .code-language { display: none; }
  .copy-button { padding-inline: 7px; }
  .code-block pre { gap: 12px; padding: 18px 14px 20px; font-size: 13px; }
  .line-numbers { padding-right: 12px; }
  .home-page { padding-top: 26px; padding-bottom: 40px; }
  .post-list { gap: 14px; }
  .post-list-heading { margin-bottom: 18px; }
  .post-entry { padding: 19px 20px 16px; }
  .post-entry h2 { font-size: 20px; margin-bottom: 12px; }
  .entry-footer { gap: 12px; }
  .entry-details { flex-direction: column; align-items: flex-start; gap: 5px; }
  .home-page-shell .site-footer { padding-inline: 20px; gap: 5px 14px; }
  .prose h2 { font-size: 21px; }
  .prose h3 { font-size: 18px; }
  .prose h4 { font-size: 16px; }
  .prose blockquote { padding: 15px 17px; }
  .post-pagination { grid-template-columns: 1fr; }
  .post-pagination .post-next { grid-column: 1; text-align: left; }
  .archive-year { padding: 22px 20px; }
  .archive-month { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
  .archive-entry { padding-left: 17px; }
  .archive-entry h4 { font-size: 16px; }
  .site-footer, .home-page-shell .site-footer { min-height: 166px; padding-top: 88px; padding-bottom: 20px; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
  .footer-art { height: 150px; }
}
@media (max-width: 360px) {
  .nav { padding-block: 12px; }
  .menu { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .post-entry, .entry-arrow { transition: none; }
  .post-entry:hover, .post-entry:hover .entry-arrow { transform: none; }
}
@media print {
  @page { size: A4; margin: 17mm 15mm; }
  :root, :root[data-color-mode] { color-scheme: light; --page: #fff; --card: #fff; --ink: #1f2328; --muted: #59636e; --line: #d1d9e0; --surface: #f6f8fa; --accent: #0969da; }
  .site-header, .site-footer, .copy-button, .line-numbers, .post-footer, .skip-link { display: none !important; }
  .main { max-width: none; min-height: 0; margin: 0; padding: 0; }
  .post-header { margin: 0 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  h1 { font-size: 28pt; }
  .post-meta { font-size: 8pt; }
  .prose { font-size: 10.5pt; line-height: 1.8; }
  .prose p { margin-bottom: 9pt; }
  .prose li { margin-block: 4pt; }
  .equation { font-size: 10.5pt; margin: 12pt 0; padding: 4pt 0; overflow: visible; break-inside: avoid; }
  .code-block { --code-bg: #fff; --code-ink: #1f2328; --code-muted: #59636e; --code-border: #d1d9e0; --code-keyword: #cf222e; --code-string: #0a3069; --code-title: #6639ba; --code-constant: #0550ae; --code-variable: #a40e26; --code-added: #0550ae; --code-added-bg: #ddf4ff; --code-deleted: #82071e; --code-deleted-bg: #ffebe9; margin: 12pt 0; border: 1px solid var(--code-border); border-radius: 4px; box-shadow: none; break-inside: avoid; }
  .code-caption { min-height: 0; padding: 6pt 9pt; }
  .code-caption-text { font-size: 7pt; }
  .code-actions { display: none; }
  .code-block pre { display: block; padding: 8pt 9pt; overflow: visible; font-size: 7.5pt; line-height: 1.6; }
  .code-block code { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
  .code-block, code { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
