@charset "UTF-8";

:root {
  color-scheme: dark;
  --bg: #101013;
  --text: #eeedf1;
  --muted: #a19faa;
  --dim: #86838f;
  --line: #29272e;
  --accent: #c7b6f4;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}
::selection { background: #c7b6f433; }
.shell { max-width: 1240px; padding: 0 36px; margin: auto; }
.shell:not(.article-shell) > main { max-width: 860px; margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; max-width: 1240px; margin: 0 auto; padding: 40px 36px 0; }
.wordmark { font: 20px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -1px; }
.wordmark span { color: var(--accent); }
nav { display: flex; gap: 24px; color: var(--muted); font-size: 13px; }
nav [aria-current=page] { color: var(--text); }
.skip { position: absolute; top: -80px; left: 20px; padding: 8px; background: var(--bg); }
.skip:focus { top: 10px; }
.hero { padding: 80px 0 62px; }
h1 { font-size: 32px; font-weight: 500; line-height: 1.25; letter-spacing: -1px; margin: 0 0 14px; }
.intro { color: var(--muted); max-width: 360px; margin: 0; }
.section { padding-bottom: 64px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.section-heading h2 { font-size: 14px; font-weight: 500; margin: 0; }
.small-link { font-size: 12px; color: var(--muted); }
.empty { padding: 18px 0; color: var(--dim); font-size: 14px; }
.empty p { margin: 0; }
.empty-title { color: var(--text); }
.empty p + p { margin-top: 6px; }
footer { display: flex; justify-content: space-between; gap: 24px; padding: 20px 0 48px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.page-head { padding: 64px 0 28px; }
.page-head h1 { margin: 24px 0 12px; }
.page-head p { color: var(--muted); margin: 0; }
main:has(.page-head) { padding-bottom: 64px; }
.back { color: var(--muted); font-size: 12px; }
.label { color: var(--muted); font-size: 12px; }
.search { display: flex; align-items: center; gap: 12px; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.search span { color: var(--muted); }
.search input { min-width: 0; width: 100%; padding: 12px 0; background: none; color: var(--text); border: 0; font-size: 14px; }
.post { display: block; padding: 19px 0; border-bottom: 1px solid var(--line); }
.post-top { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.post h3 { font-size: 15px; font-weight: 400; line-height: 1.5; margin: 0; }
.post time { font-size: 11px; white-space: nowrap; color: var(--dim); }
.post p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.arrow { color: var(--dim); margin-left: 4px; }
.topics { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.tag { color: var(--dim); font-size: 11px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.tag:hover { color: var(--accent); text-decoration-color: currentColor; }
.meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); }
.copy { position: absolute; right: 12px; top: 8px; padding: 3px 8px; font-size: 11px; background: none; border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.article-bottom { padding: 20px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.not-found { padding: 80px 0; }
.not-found h1 { margin-top: 20px; }
.not-found p { color: var(--muted); }
[hidden] { display: none !important; }

@media (max-width: 540px) {
  .shell { padding: 0 24px; }
  .top { padding: 30px 24px 0; }
  .hero { padding: 60px 0 48px; }
  .post-top { flex-direction: column; gap: 4px; }
  .page-head { padding-top: 48px; }
}

/* Article layouts */
html { scroll-padding-top: 40px; scrollbar-gutter: stable; }
.article-head { max-width: 860px; padding: 58px 0 36px; }
.article-head .back { display: inline-block; margin-bottom: 30px; }
.article-head .meta { font-size: 12px; }
.article-head h1 { font-size: clamp(32px, 4vw, 46px); font-weight: 550; line-height: 1.17; letter-spacing: -1.5px; margin: 15px 0 18px; }
.article-description { max-width: 640px; margin: 0 0 18px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.article-head .topics { gap: 8px 14px; margin-top: 0; }
.article-workspace { display: grid; grid-template-columns: minmax(0, 860px) 220px; gap: 64px; align-items: start; border-top: 1px solid var(--line); padding-top: 36px; }
.article-column { grid-column: 1; grid-row: 1; min-width: 0; max-width: 100%; }
.chapter-sidebar { grid-column: 2; grid-row: 1; position: sticky; top: 32px; min-width: 0; }
.chapters { padding: 16px 0; font-size: 12px; }
.chapters summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 12px; color: var(--muted); cursor: pointer; list-style: none; font-size: 10px; font-weight: 500; letter-spacing: 1.4px; text-transform: uppercase; }
.chapters summary::-webkit-details-marker { display: none; }
.chapter-chevron { flex-shrink: 0; color: var(--dim); transition: transform .2s ease; }
.chapters[open] .chapter-chevron { transform: rotate(180deg); }
.chapters nav { display: block; max-height: calc(100dvh - 190px); overflow-y: auto; margin-top: 16px; padding-right: 4px; scrollbar-width: thin; }
.chapters ol { margin: 0; padding: 0; list-style: none; }
.chapters nav > ol { border-left: 1px solid var(--line); }
.chapters ol ol { margin: 2px 0 6px 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.chapters li { margin: 2px 0; }
.chapters nav a { position: relative; display: block; padding: 8px 12px; border-radius: 0 5px 5px 0; font-size: 12px; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; transition: color .15s ease, background .15s ease; }
.chapters nav ol ol a { font-size: 11px; padding-block: 6px; }
.chapters nav a:hover { color: var(--text); background: #ffffff05; }
.chapters nav a[aria-current=location] { color: var(--accent); background: #c7b6f40b; }
.chapters nav a[aria-current=location]::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: -1px; width: 2px; border-radius: 2px; background: var(--accent); }
.back-to-top { display: inline-block; margin: 16px 12px 0; color: var(--dim); font-size: 11px; }
.prose { min-width: 0; max-width: 100%; padding-bottom: 40px; color: #c2c0c9; overflow-wrap: anywhere; font-size: 16px; line-height: 1.85; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.prose code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.3em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { color: var(--text); font-weight: 550; line-height: 1.45; letter-spacing: -.35px; scroll-margin-top: 40px; overflow-wrap: anywhere; }
.prose h1, .prose h2 { font-size: 27px; margin: 2.5em 0 .85em; }
.prose h2:not(:first-child) { border-top: 1px solid var(--line); padding-top: 30px; }
.prose h3 { font-size: 21px; margin: 2em 0 .8em; }
.prose h4 { font-size: 17px; margin: 2.2em 0 .8em; letter-spacing: -.1px; }
.prose h5, .prose h6 { font-size: 16px; margin: 1.8em 0 .7em; }
.prose li { padding-left: 4px; margin: .4em 0; }
.prose li > p { margin: .5em 0; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 1.5em; }
.prose img { display: block; max-width: 100%; height: auto; margin: 24px auto; border: 1px solid var(--line); border-radius: 5px; }
.image-zoom { display: block; width: fit-content; max-width: 100%; margin: 26px auto; cursor: zoom-in; }
.image-zoom img { margin: 0; }
.prose pre { position: relative; display: block; width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; white-space: pre; tab-size: 4; margin: 26px 0; padding: 42px 20px 20px; background: #15141a; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; line-height: 1.8; }
.prose pre:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
.prose pre > code { display: block; width: max-content; min-width: 100%; font-size: inherit; white-space: pre; overflow-wrap: normal; word-break: normal; }
.code-block { width: 100%; min-width: 0; max-width: 100%; overflow: hidden; margin: 26px 0; background: #15141a; border: 1px solid var(--line); border-radius: 6px; }
.code-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 8px 14px; background: #1b1922; border-bottom: 1px solid var(--line); }
.code-language { font: 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.code-header .copy { position: static; margin-left: auto; padding: 2px 8px; border-radius: 3px; }
.prose .code-block pre { margin: 0; padding: 18px 20px; border: 0; border-radius: 0; }
.hljs { color: #d6d3df; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: #c7a9f4; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: #a8c99b; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #e6b58c; }
.hljs-title, .hljs-section, .hljs-title.function_, .hljs-title.class_ { color: #e3cb91; }
.hljs-built_in, .hljs-variable, .hljs-template-variable, .hljs-params { color: #9dcbd5; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-name, .hljs-selector-class { color: #a8bff1; }
.hljs-comment, .hljs-quote { color: #93909f; font-style: italic; }
.hljs-meta, .hljs-operator, .hljs-punctuation { color: #aaa4b9; }
.hljs-deletion { color: #e69baf; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }
.prose :not(pre) > code { padding: 2px 5px; border-radius: 3px; background: #201d26; font-size: .85em; }
.prose blockquote { margin: 28px 0; padding: 4px 0 4px 20px; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.prose table { display: block; overflow: auto; width: 100%; border-collapse: collapse; font-size: 14px; margin: 26px 0; }
.prose td, .prose th { border: 1px solid var(--line); padding: 8px 14px; }
.prose th { color: var(--text); font-weight: 500; background: #17161c; }
.image-dialog { position: fixed; max-width: 96vw; max-height: 96dvh; padding: 48px 16px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); overflow: auto; }
.image-dialog::backdrop { background: #000d; }
.image-dialog img { display: block; max-width: 90vw; max-height: 82dvh; width: auto; height: auto; object-fit: contain; }
.image-close { position: absolute; top: 12px; right: 16px; padding: 3px 8px; border: 0; background: none; color: var(--text); cursor: pointer; font-size: 13px; }
html:has(.image-dialog[open]) { overflow: hidden; }

@media (max-width: 1099px) {
  .article-workspace { display: flex; flex-direction: column; gap: 30px; }
  .article-column { width: 100%; max-width: 860px; }
  .chapter-sidebar { position: static; width: 100%; max-width: 860px; padding: 0 0 20px; border-bottom: 1px solid var(--line); }
  .chapters nav { max-height: 360px; }
}
@media (max-width: 540px) {
  .article-head { padding: 42px 0 28px; }
  .article-head .back { margin-bottom: 24px; }
  .article-head h1 { font-size: 32px; letter-spacing: -.9px; }
  .article-description { font-size: 15px; }
  .article-workspace { padding-top: 24px; gap: 24px; }
  .prose { font-size: 15px; }
  .prose h2 { font-size: 24px; }
  .prose h3 { font-size: 20px; }
  .prose h4 { font-size: 16px; }
  .prose pre, .prose .code-block pre { padding-inline: 14px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
