@font-face {
  font-family: 'Source Serif'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('./fonts/source-serif-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Source Serif'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('./fonts/source-serif-cyrillic.woff2') format('woff2');
  unicode-range: U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Open Sans'; font-style: normal; font-weight: 300 800;
  font-display: swap; src: url('./fonts/open-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Open Sans'; font-style: normal; font-weight: 300 800;
  font-display: swap; src: url('./fonts/open-sans-cyrillic.woff2') format('woff2');
  unicode-range: U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
:root {
  font-size: 90%;
  color-scheme: dark;
  --ground: #503a2f;
  --surface: #3c2c23;
  --deep: #2d201a;
  --text: #ffd4a7;
  --muted: #e0a785;
  --coral: #ffa36b;
  --coral-strong: #ff8c59;
  --highlight: #a8bdbe;
  --rule: #714c3a;
  --serif: 'Source Serif', Georgia, serif;
  --sans: 'Open Sans', sans-serif;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
}
* { box-sizing: border-box; }
body {
  max-inline-size: 65rem;
  min-block-size: 100vh;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}
::selection { background: var(--highlight); color: var(--deep); }
a { color: var(--coral); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--coral-strong); }
a:focus-visible { outline: 2px solid var(--highlight); outline-offset: 5px; }
.skip-link { position: fixed; top: -8rem; left: 1rem; z-index: 1; background: var(--deep); padding: .75rem; }
.skip-link:focus { top: 1rem; }
.site-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; padding: 2.3rem 0 1.6rem; }
.site-name { color: var(--coral-strong); font-family: var(--serif); font-size: clamp(3rem, 7vw, 4.3rem); font-weight: 600; line-height: 1.1; letter-spacing: -.06em; text-decoration: none; }
.site-name:hover { color: var(--coral); }
.external-link { color: var(--highlight); font-size: .85rem; white-space: nowrap; text-decoration: none; }
.external-link:hover { color: var(--text); }
.external-link span[aria-hidden] { color: inherit; margin-inline-start: .25rem; }
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
main { min-inline-size: 0; background: var(--surface); border-top: 2px solid var(--highlight); padding: 2rem clamp(1.25rem, 4vw, 3rem) 3.5rem; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.2; }
h1 { color: var(--highlight); font-size:clamp(1.875rem, 3.375vw, 2.7rem); letter-spacing: -.035em; margin: 0 0 1rem; }
h2 { color: var(--highlight); font-size: 1.9rem; letter-spacing: -.025em; margin: 1.9em 0 .65em; }
h3 { color: var(--text); font-size: 1.45rem; margin: 1.6em 0 .65em; }
p { margin: 0 0 1.1em; }
.index-context { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.post-year + .post-year { margin-top: 2.5rem; }
.post-year > h2 { margin: 0 0 .65rem; color: var(--text); font-size: 2rem; font-weight: 400; letter-spacing: -.03em; }
.index-context:empty { display: none; }
.post-list { width: 100%; border-collapse: collapse; text-align: start; }
.post-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.post-list tbody { border-top: 1px solid var(--rule); }
.post-list td { padding: .7rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.post-list td:first-child { width: 5.8rem; padding-inline-end: 1.2rem; }
.post-list time, .post-meta time { color: var(--muted); font-family: var(--serif); font-size: .95rem; font-weight: 600; letter-spacing: .025em; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.post-title { display: inline; color: var(--coral); font-family: var(--serif); font-size: 1.08rem; font-weight: 600; line-height: 1.4; letter-spacing: -.015em; text-decoration: none; overflow-wrap: anywhere; }
.post-title:hover { text-decoration: underline; }
.post-description { color: var(--text); font-size: .88rem; line-height: 1.45; margin: .15rem 0 0; }
.tag-section { margin-top: 2.5rem; }
.tag-section h2 { font-family: var(--sans); color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .025em; margin: 0 0 .65rem; }
.tag-list, .tags { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.tag.tag-with-count { display: inline-flex; align-items: baseline; column-gap: .6rem; }
.tag-count { color: var(--muted); font-size: .7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; color: var(--coral); background: #4a3225; border: 1px solid #834f37; border-radius: .3rem; padding: .12rem .55rem; font-size: .75rem; line-height: 1.65; text-decoration: none; }
.tag:hover { background: #573929; border-color: var(--coral); }
.post-tags { margin-top: 2.5rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.post-tags:has(.tags:empty) { display: none; }
.post > header { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1.5rem; align-items: baseline; margin-bottom: 2rem; padding-bottom: 1.3rem; border-bottom: 1px solid var(--rule); }
.post > header h1 { grid-column: 1 / -1; margin-bottom: .7rem; }
.description { color: var(--muted); font-size: 1rem; margin-bottom: 0; }
.post-meta time { font-family: var(--sans); font-size: .78rem; font-weight: 400; letter-spacing: .015em; }
.post-meta { justify-self: end; text-align: right; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.3rem; margin-bottom: 0; font-size: .75rem; }
.content { font-size: .98rem; overflow-wrap: break-word; }
.content h1 { font-size: clamp(1.8rem, 2.5vw, 2.1rem); letter-spacing: -.025em; margin: 1.6em 0 .65em; }
.content > h1:first-child { margin-top: 0; }
.content h2 {
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.3;
  margin: 1.7em 0 .6em;
}
.content ul, .content ol { margin: .75em 0; padding-inline-start: 1.5em; }
.content ul { list-style-type: square; }
.content li { padding-inline-start: .15em; }
.content li + li { margin-block-start: .15em; }
/* Markdown loose lists wrap each item in a paragraph; keep their spacing
   identical to tight lists without flattening multiple paragraphs in an item. */
.content li > p { margin-block: 0; }
.content li > p + p { margin-block-start: .45em; }
.content li > ul, .content li > ol { margin-block: .25em; }
.content li::marker { color: var(--highlight); }
.post img { max-inline-size: 100%; block-size: auto; }
.post img[width="800"] { inline-size: 50rem; }
figure { margin: 1.8rem 0; background: var(--deep); text-align: center; }
/* Figures group content and captions; each example owns its own frame. */
figure:not(.chart) {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
}
figure:not(.chart) > * { margin-block: 0; }
figure:not(.chart) > img { align-self: center; }
figure:not(.chart) > :is(blockquote, pre, .post-aside) { text-align: start; }
figure img { vertical-align: middle; }
figcaption { color: var(--muted); font-size: .8rem; line-height: 1.55; margin-top: .8rem; }
blockquote { margin: 1.4rem 0; padding: .85rem 1.1rem; border: 1px solid var(--rule); border-inline-start: 2px solid var(--highlight); background: var(--deep); color: var(--text); }
blockquote > :first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }
pre { font-size: .95em; max-inline-size: 100%; overflow-x: auto; padding: 1rem; background: var(--deep); border-inline-start: 2px solid var(--rule); }
code { font-family: ui-monospace, monospace; font-size: .95em; line-height: inherit; vertical-align: baseline; }
:not(pre) > code { background: #5e3d2b; padding: .04em .25em; }
hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2rem; }
@media (max-width: 37.8rem) {
  body { padding: 0 .8rem 1rem; }
  .site-header { padding: 1.3rem .4rem 1.1rem; }
  main { padding: 1.5rem 1.1rem 2.5rem; }
  .post-list td:first-child { width: 4.7rem; padding-inline-end: .8rem; }
  .post-list time { font-size: .83rem; }
  .post-title { font-size: 1.05rem; }
  .post > header { display: block; }
  .post-meta { justify-content: flex-end; margin-top: .75rem; }
  .post-description { font-size: .85rem; }
  .content { font-size: .95rem; }
}

.post-meta { flex-direction: column; align-items: flex-end; gap: .15rem; }

.code-sample { position: relative; margin-block: 1.1rem; background: var(--deep); border: 1px solid var(--rule); }
.code-language { position: absolute; inset-block-start: .65rem; inset-inline-end: .75rem; padding: .1rem .3rem; color: var(--muted); background: var(--deep); font: .65rem var(--sans); line-height: 1.4; pointer-events: none; user-select: none; }
.code-sample pre { margin: 0; border: 0; padding: .75rem 5.25rem .75rem .75rem; font-size: .95em; line-height: 1.5; tab-size: 4; }
.code-sample code { font-size: .95em; color: var(--text); }

.post-aside {
  --aside-accent: #ffb87a;
  --aside-icon: url('./icons/aside.svg');
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 1.75rem 0;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(110deg, color-mix(in srgb, var(--aside-accent) 7%, transparent), transparent), var(--deep);
  border: 1px solid color-mix(in srgb, var(--aside-accent) 35%, var(--deep));
  border-radius: .45rem;
}
.aside-note { --aside-accent: #a8bdbe; --aside-icon: url('./icons/note.svg'); }
.aside-tip { --aside-accent: #d5ce84; --aside-icon: url('./icons/tip.svg'); }
.aside-warning { --aside-accent: #ff937c; --aside-icon: url('./icons/warning.svg'); }
.aside-caution { --aside-accent: #ff9694; --aside-icon: url('./icons/caution.svg'); }
.post-aside::after {
  content: '';
  position: absolute;
  inset-inline-end: -.5rem;
  inset-block-end: -.8rem;
  inline-size: 7rem;
  block-size: 7rem;
  background: var(--aside-accent);
  mask: var(--aside-icon) center / contain no-repeat;
  opacity: .075;
  pointer-events: none;
  z-index: 0;
}
.post-aside > * { position: relative; z-index: 1; }
.post-aside .aside-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--aside-accent);
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 600;
  margin: 0 0 .6rem;
  line-height: 1.4;
}
.aside-title::before {
  content: '';
  flex: 0 0 1.1rem;
  block-size: 1.1rem;
  background: var(--aside-accent);
  mask: var(--aside-icon) center / contain no-repeat;
}
.aside-body { font-size: .9rem; color: var(--text); }
.aside-body > :last-child { margin-bottom: 0; }
.feed-links { display: flex; gap: 1rem; margin-top: 2.5rem; padding-top: .65rem; border-top: 1px solid var(--rule); font-size: .7rem; }
.feed-links a { color: var(--muted); text-decoration: none; }
.feed-links a:hover { color: var(--coral); }
@media (max-width: 37.8rem) { .post-aside { margin-inline-start: 0; } }

/* Keep section navigation beside the reading column when space permits. */
.post-layout { position: relative; }
.content :is(h1, h2, h3, h4, h5, h6) { scroll-margin-block-start: 1.5rem; }
.post-toc { margin-block-end: 1.8rem; font-size: .8rem; line-height: 1.5; }
.post-toc details { border: 1px solid var(--rule); padding: .8rem 1rem; }
.post-toc summary { color: var(--muted); cursor: pointer; font-weight: 600; }
.post-toc ol { list-style: none; margin: .7rem 0 0; padding: 0; }
.post-toc li + li { margin-block-start: .35rem; }
.post-toc a { display: block; text-decoration: none; overflow-wrap: anywhere; }
.post-toc a:hover { text-decoration: underline; }
.post-toc .toc-depth-2 { padding-inline-start: .7rem; }
.post-toc .toc-depth-3 { padding-inline-start: 1.4rem; }
@media (min-width: 90rem) {
  .post-toc {
    position: absolute;
    inset-block: 0;
    inset-inline-end: calc(100% + 4.5rem);
    inline-size: 14rem;
    margin: 0;
  }
  .post-toc details {
    position: sticky;
    top: 1.5rem;
    max-block-size: calc(100vh - 3rem);
    overflow-y: auto;
    background: var(--ground);
  }
}

/* Figure captions stay centered while code retains its original alignment. */
figure .code-sample { text-align: start; margin-block: 0; }

/* Tables share a quiet frame; numeric columns retain Markdown alignment. */
.content table {
  inline-size: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: .88rem;
  line-height: 1.45;
  font-variant-numeric: lining-nums tabular-nums;
}
.content th, .content td {
  padding: .5rem .7rem;
  border-block-end: 1px solid var(--rule);
  vertical-align: top;
}
.content th { color: var(--muted); font-weight: 600; }
.content thead { border-block-end: 2px solid var(--rule); }
.content caption { text-align: start; margin-block-end: .65rem; }
.prose-table-scroll { max-inline-size: 100%; overflow-x: auto; margin-block: 1.5rem; }
.prose-table-scroll:focus-visible {
  outline: 2px solid var(--highlight); outline-offset: 3px;
}
.prose-table tbody tr:nth-child(even) { background: var(--deep); }
.prose-table [style*="text-align: right"] { white-space: nowrap; }
.prose-table code { white-space: nowrap; }
