@font-face {
  font-family: Manrope;
  src: url("../fonts/manrope-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light;
  --canvas: #ffffff;
  --paper: #fafafa;
  --rail: #f5f5f5;
  --feature: #f2f2f2;
  --ink: #202020;
  --muted: #626262;
  --line: #d8d8d8;
  --boundary: #858585;
  --diagram-filter: none;
  --reading-width: 704px;
  --column-gap: 40px;
  --toc-width: clamp(160px, calc((100vw - var(--reading-width)) / 2 - var(--column-gap) - 24px), 320px);
  --code-bg: #f6f7f9;
  --code-top: #eef0f3;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --display: Manrope, var(--sans);
  --serif: "Source Serif 4", "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #151515;
  --paper: #1b1b1b;
  --rail: #1d1d1d;
  --feature: #242424;
  --ink: #eeeeee;
  --muted: #b0b0b0;
  --line: #414141;
  --diagram-filter: invert(1);
  --code-bg: #1b1d22;
  --code-top: #202329;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --canvas: #151515;
    --paper: #1b1b1b;
    --rail: #1d1d1d;
    --feature: #242424;
    --ink: #eeeeee;
    --muted: #b0b0b0;
    --line: #414141;
    --diagram-filter: invert(1);
    --code-bg: #1b1d22;
    --code-top: #202329;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 2rem; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 1rem/1.75 var(--sans); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, summary { cursor: pointer; }
button { color: inherit; font: inherit; }
button, input { accent-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; border-radius: 2px; }
::selection { color: var(--ink); background: var(--selection); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
h1, h2, h3, p { margin: 0; }
img, video { max-width: 100%; height: auto; }
main:focus { outline: none; }
/* Mark the skip destination without drawing a frame around the entire page. */
main:focus-visible :is(.home-heading, .page-heading, .article-heading, .about-header) h1 { text-decoration: underline var(--accent); text-underline-offset: .15em; }
time, .eyebrow, .topic-count, .pagination { font-variant-numeric: tabular-nums; }
time { color: var(--muted); font: .75rem/1.6 var(--mono); }
.eyebrow { font-size: .7rem; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.muted { color: var(--muted); }
.skip-link { position: fixed; top: 12px; left: 12px; padding: 12px 20px; background: var(--ink); color: var(--canvas); z-index: 20; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.site-surface { width: min(var(--reading-width), calc(100% - 48px)); margin: 0 auto; padding: 48px 0 0; }
main, .site-footer { width: 100%; margin-inline: auto; }
main { min-height: calc(100svh - 220px); }
.page-caption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px 24px; }
.page-heading > p:last-child, .page-caption p { color: var(--muted); }
.page-caption a, .section-heading > a { font-size: .8rem; text-decoration: none; }
.page-heading > p:last-child, .page-caption { font-size: .9375rem; line-height: 1.75; }
.entry h2 a, .idea-entry h2 a { text-decoration: none; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.section-heading h2 { font-size: .95rem; }
.tag-links { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; list-style: none; margin: 0; }
.tag-links a, .tag-links li > span { display: flex; align-items: center; min-width: 24px; min-height: 24px; font-size: .7rem; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.tag-links li > span { color: var(--muted); }
.more-projects { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0; font-size: .8125rem; border: 0; color: var(--accent); text-decoration: none; }
.project-arrow { display: inline-block; color: var(--muted); font: 400 .875rem var(--sans); }
.about-page { padding-top: 8px; }
.about-header .eyebrow { font-size: .625rem; letter-spacing: .12em; }
.about-header h1 { font-size: 1.5rem; line-height: 1.75; margin: 8px 0 0; }
.about-story { margin-top: 26px; }
.post-content.about-story h2 { font-size: 1.17rem; margin: 28px 0 10px; }
.about-story > p:first-child { font-size: 1.25rem; line-height: 1.75; font-weight: 500; margin-bottom: 22px; }
.about-story p + p { margin-top: 1.25em; }
.about-works { margin-top: 32px; }
.about-works > .section-heading { margin-bottom: 14px; }
.about-works > .section-heading h2 { font: 600 1rem/1.75 var(--sans); }
.about-page .article-end { margin: 28px 0 42px; }
.page-heading { margin: 12px 0 32px; }
.page-heading > .eyebrow { color: var(--muted); }
.page-heading h1 { font-size: 2rem; line-height: 1.3; margin: 12px 0 16px; }
.heading-dot { color: var(--accent); }
.page-heading h1.topic-heading { font-size: 1.75rem; margin-top: 20px; }
.entry { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); align-items: baseline; }
.entry-copy { min-width: 0; }
.entry h2 { font-size: 1.375rem; line-height: 1.6; margin-bottom: 6px; }
.entry h2 a { display: block; }
.blog-heading h1 { font-size: 1.5rem; line-height: 1.4; }
.blog-heading .page-caption { font-size: .875rem; }
.entry-list--described .entry h2 { font-size: 1rem; line-height: 1.7; }
.entry-description { margin: 0 0 8px; color: var(--muted); font-size: .875rem; line-height: 1.8; overflow-wrap: anywhere; }
.entry-arrow { display: inline-block; margin-left: 5px; font-size: .875rem; color: var(--accent); }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-top: 32px; font-size: .8rem; }
.pagination a { padding-block: 14px; text-decoration: none; }
.pagination > :last-child { justify-self: end; }
.pagination > span { color: var(--muted); }
.empty-state { padding: 28px; background: var(--feature); border-radius: 12px 12px 64px 12px; }
.empty-mark { display: block; color: var(--accent); font: 700 3rem/1 var(--display); margin-bottom: 28px; }
.empty-state h2 { font-size: 1.5rem; margin-bottom: 12px; }
.empty-state p { color: var(--muted); }
.empty-state .read-link { width: fit-content; margin-top: 24px; }
.idea-list { max-width: 760px; }
.idea-entry { padding: 28px 0; border-top: 1px solid var(--line); }
.idea-entry h2 { font-size: 1.5rem; margin: 12px 0; }
.idea-entry > p { color: var(--muted); }
.breadcrumb { display: inline-flex; align-items: center; min-height: 36px; font-size: .8rem; text-decoration: none; color: var(--muted); }
.article-heading { margin: 0 0 30px; }
.article-heading h1 { font-size: 1.5rem; line-height: 1.75; letter-spacing: normal; word-spacing: 0; text-wrap: wrap; overflow-wrap: break-word; margin: 18px 0; }
.article-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 24px; font-size: .75rem; color: var(--muted); margin-bottom: 10px; }
.article-meta a { text-decoration: none; }
.reading-layout { display: grid; grid-template-columns: minmax(0, var(--reading-width)) var(--toc-width); width: calc(100% + var(--column-gap) + var(--toc-width)); align-items: start; gap: var(--column-gap); }
.reading-main { min-width: 0; }
.reading-margin { position: sticky; top: 48px; width: var(--toc-width); min-width: 0; }
.reading-margin.toc-long { position: static; }
.toc { font-size: .75rem; }
.toc summary { font-weight: 600; min-height: 40px; padding-bottom: 8px; }
.toc nav { padding: 4px 0; }
.toc a { display: block; padding: 5px 0; text-decoration: none; color: var(--muted); line-height: 1.6; overflow-wrap: break-word; }
.toc a[data-level="3"] { padding-left: 14px; font-size: .72rem; }
.toc a[aria-current="location"] { color: var(--accent); font-weight: 600; }
.post-content { font: 400 1rem/1.75 var(--sans); letter-spacing: normal; word-spacing: 0; overflow-wrap: anywhere; }
.post-content > * + * { margin-top: 1.46em; }
.post-content strong { font-weight: 600; }
.post-content h1, .post-content h2 { font: 700 1.5rem/1.75 var(--display); margin: 1.8em 0 .7em; }
.post-content h3 { font: 700 1.17rem/1.75 var(--display); margin: 1.6em 0 .6em; }
.post-content h4, .post-content h5, .post-content h6 { font: 700 1rem/1.75 var(--display); }
.post-content > :first-child { margin-top: 0; }
.post-content [id] { scroll-margin-top: 24px; }
.post-content a { color: var(--accent); }
.post-content p, .post-content li { text-wrap: wrap; }
.post-content ul, .post-content ol { padding-left: 1.5em; }
.post-content li + li { margin-top: .45em; }
.post-content li > p + p { margin-top: .7em; }
.post-content blockquote { border: 0; margin-inline: 0; padding: 16px 20px; background: var(--paper); border-radius: 6px; }
.post-content blockquote p + p { margin-top: 1em; }
.post-content img { display: block; border-radius: 6px; background: var(--paper); }
.post-content figure { margin-inline: 0; }
.post-content figcaption { color: var(--muted); font: .8rem/1.6 var(--sans); margin-top: 12px; }
.post-content hr { border: 0; width: 48px; height: 2px; background: var(--line); margin: 3em auto; }
.post-content code { font: .875em/1.7 var(--mono); background: var(--code-bg); padding: .15em .35em; border-radius: 3px; }
.post-content pre { --scroll-thumb: #8c8c8c; max-width: 100%; overflow-x: auto; background: var(--code-bg); padding: 16px 20px 20px; border-radius: 6px; font: .875rem/1.7 var(--mono); white-space: pre; overflow-wrap: normal; tab-size: 4; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.post-content pre code { font: inherit; background: none; padding: 0; }
.code-block { min-width: 0; background: var(--code-bg); border-radius: 8px; margin-block: 1.46em; }
.code-block pre { margin: 0; background: none; }
.code-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 0 10px 0 20px; min-height: 44px; background: var(--code-top); border-radius: 8px 8px 0 0; }
.code-language { font: .75rem/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.copy-code { max-width: 100%; border: 0; background: none; border-radius: 4px; padding: 6px 10px; min-width: 88px; min-height: 44px; font: .75rem/1.5 var(--sans); color: var(--muted); }
.copy-code:hover { color: var(--accent); }
:root[data-theme="dark"] .post-content pre { --scroll-thumb: #6e7681; }
.post-content pre:is(:hover, :focus-visible) { --scroll-thumb: #666; }
:root[data-theme="dark"] .post-content pre:is(:hover, :focus-visible) { --scroll-thumb: #9da7b3; }
/* Native scrolling; older Safari/WebKit gets a 6px fallback, never a custom scroller. */
.post-content pre::-webkit-scrollbar { height: 6px; background: transparent; }
.post-content pre::-webkit-scrollbar-track { background: transparent; }
.post-content pre::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; }
.post-content pre::-webkit-scrollbar-button { display: none; }
.post-content pre::-webkit-scrollbar-corner { background: transparent; }
.post-content table { display: block; max-width: 100%; overflow-x: auto; overflow-wrap: normal; border-collapse: collapse; font: .875rem/1.75 var(--sans); white-space: normal; }
.post-content th, .post-content td { padding: 8px 10px; border: 1px solid var(--boundary); min-width: 120px; }
.post-content th { background: var(--code-top); text-align: left; font-weight: 600; }
.post-content td { background: var(--paper); }
.post-content pre.mermaid { background: var(--paper); white-space: normal; text-align: center; }
/* Fixed neutral SVG colors invert with the page, without rerendering or changing the shared loader. */
.post-content pre.mermaid svg { width: max(100%, 560px); max-width: 100%; height: auto; filter: var(--diagram-filter); }
/* Override Mermaid's ID-scoped #999 node strokes: both polarities must meet 3:1. */
.post-content pre.mermaid .node :is(rect, circle, ellipse, polygon, path) { stroke: #777 !important; }
.post-content input[type="checkbox"] { width: 1em; height: 1em; }
.article-end { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 56px 0; color: var(--muted); font-size: .8rem; }
.article-end > a + a:last-child:not([rel]),
.article-end > a[rel="next"] { margin-left: auto; }
.comments-section { border-top: 1px solid var(--line); padding-top: 28px; }
.comments-section > p { font-size: .8rem; margin-top: 14px; }
#comments-container { min-height: 140px; margin-top: 24px; max-width: 100%; }
#comments-container iframe { border: 0; width: 100%; }
.comments-loading { display: none; }
.js .comments-loading { display: block; }
.comments-loading, .comments-error { padding: 20px; background: var(--paper); border-radius: 6px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.site-footer { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 24px; border-top: 1px solid var(--line); margin-top: 56px; padding: 28px 0 36px; font-size: .75rem; }
.site-footer > div { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer span { color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.site-footer a { text-decoration: none; color: var(--muted); }
/* The article contents list moves above the text on narrower screens. */
@media (max-width: 1160px) {
  .site-surface { padding-top: 24px; }
  .reading-layout { width: 100%; grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .reading-margin { position: static; width: auto; grid-row: 1; }
  .toc { background: var(--paper); padding: 10px 16px; border-radius: 6px; }
  .toc summary { padding-block: 8px; }
}
@media screen and (scripting: enabled) and (max-width: 1160px) {
  /* Reserve the closed disclosure's natural size, without exposing an empty control. */
  .reading-layout:has(> .reading-main > .post-content :is(h1, h2, h3)) > .reading-margin[hidden] { display: block !important; visibility: hidden; }
}
@media (max-width: 760px) {
  .home .site-surface { padding-top: 32px; }
  .page-heading { margin: 8px 0 26px; }
  .entry { grid-template-columns: 1fr; gap: 6px; padding-block: 20px; }
  .entry h2 { font-size: 1.25rem; }
  .article-heading h1 { margin: 16px 0; }
  .article-meta { gap: 8px 16px; }
  .about-header h1 { font-size: 1.375rem; }
  .about-story > p:first-child { font-size: 1.125rem; }
}
@media (max-width: 360px) {
  .site-surface { width: calc(100% - 36px); }
  .about-header h1 { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: color .16s ease, background-color .16s ease; }
}
@media print {
  :root, :root:not([data-theme]), :root[data-theme="dark"] { color-scheme: light; --canvas: white; --paper: white; --ink: black; --muted: black; --rail: white; --feature: white; --accent: black; --line: #858585; --boundary: #858585; --diagram-filter: none; --code-bg: white; --code-top: white; }
  .site-header, .home-tools, .home-light, .site-footer, .reading-margin, .comments-section, .code-tools, .article-end, .skip-link { display: none !important; }
  .site-surface, .home .site-surface { width: 100%; margin: 0; padding: 0; }
  .reading-layout { display: block; width: 100%; }
  main { min-height: 0; }
  .post-content { font-size: 11pt; }
  .post-content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .post-content .syntax span { color: inherit !important; background: transparent !important; }
  .post-content table { display: table; table-layout: fixed; width: 100%; overflow-wrap: anywhere; font-size: 9pt; }
  .post-content th, .post-content td { min-width: 0; }
  .post-content img, .post-content blockquote { break-inside: avoid; }
  .post-content h2, .post-content h3 { break-after: avoid; }
}
