@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-serif-regular-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-serif-regular-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-serif-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/pt-serif-italic-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-serif-bold-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-serif-bold-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-serif-bold-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/pt-serif-bold-italic-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-code-pro-regular-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-code-pro-regular-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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --background: #fff;
  --text: #202020;
  --muted: #777;
  --code-background: #ffffea;
  --code-text: #202020;
  --font-size-base: 16px;
  --font-size-heading: 32px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #202124;
  --text: #e7e7e7;
  --muted: #a2a2a2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #202124;
    --text: #e7e7e7;
    --muted: #a2a2a2;
  }
}

* { box-sizing: border-box; }

html {
  font-family: "PT Serif", serif;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-size: var(--font-size-base);
  line-height: 1.6;
}

.layout {
  min-height: 100vh;
  padding: 2rem;
}

.sidebar {
  position: fixed;
  top: 2rem;
  left: 0;
  width: 12rem;
}

.sidebar ul,
.article-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar a {
  display: block;
  padding: .4rem 1rem;
  font-size: var(--font-size-heading);
  line-height: 1.25;
  text-decoration: none;
}

.sidebar a[aria-current="page"] {
  font-weight: 700;
}

.theme-toggle {
  position: fixed;
  top: 2rem;
  right: max(2rem, calc((100vw - 86rem) / 2));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .15em;
  cursor: pointer;
}

.theme-dark { display: none; }
:root[data-theme="dark"] .theme-light { display: none; }
:root[data-theme="dark"] .theme-dark { display: inline; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light { display: none; }
  :root:not([data-theme="light"]) .theme-dark { display: inline; }
}

main {
  width: min(100%, 900px);
  min-width: 0;
  margin: 0 auto;
}

.section-page,
.article,
.not-found { padding: 0 0 5rem; }

.section-page h1,
.article-header h1,
.not-found h1 {
  margin: -.15rem 0 2rem;
  font-size: var(--font-size-heading);
  font-weight: 600;
  line-height: 1.3;
}

.article-list li + li { margin-top: .5rem; }

.article-list { font-size: var(--font-size-base); }

.article-list a {
  text-underline-offset: .15em;
}

.article-list time {
  margin-left: .35rem;
  color: #999;
  font-size: 83%;
  white-space: nowrap;
}

.article-header {
  margin-bottom: 2.5rem;
  text-align: center;
}
.article-header h1 {
  margin-bottom: .4rem;
}
.article-header time { color: var(--text); font-size: 83%; }

.prose {
  font-size: var(--font-size-base);
  line-height: 1.44;
}
.prose > * { margin-top: 0; margin-bottom: 1.35em; }
.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2em;
  margin-bottom: .6em;
  line-height: 1.3;
}
.prose h2 { font-size: var(--font-size-heading); }
.prose h3,
.prose h4 { font-size: var(--font-size-heading); }
.prose a { text-underline-offset: .15em; }
.prose img { display: block; max-width: 100%; max-height: 48rem; margin: 2rem 0; }
.prose figure {
  margin: 2rem 0;
  text-align: center;
}
.prose figure img { margin: 0 auto; }
.prose .image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 2rem;
  margin: 2rem 0;
}
.prose .image-pair figure { margin: 0; }
.prose figcaption {
  margin-top: .5rem;
  font-size: 83%;
}
.prose blockquote { margin-left: 0; color: var(--muted); font-style: italic; }
.prose code {
  font-family: "Source Code Pro", monospace;
  font-size: 80%;
}
.prose pre {
  overflow-x: auto;
  margin: 1em 4em;
  padding: .75em 1em;
  border: 1px solid #000;
  background: var(--code-background);
  color: var(--code-text);
  font-family: "Source Code Pro", monospace;
  font-size: 80%;
  font-weight: 400;
  line-height: normal;
  break-inside: avoid;
}
.prose pre code {
  font-family: inherit;
  font-size: inherit;
}
.prose .math-display {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1.5em 0;
  padding: .25em 0;
  text-align: center;
}
.prose .math-display .katex-display { margin: 0; }
.prose .katex { font-size: 1em; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th,
.prose td { padding: .5rem; text-align: left; }
.prose hr { margin: 2.5rem 0; border: 0; border-top: 1px solid var(--muted); }

.not-found a { text-underline-offset: .2em; }

@media (max-width: 1430px) {
  .layout {
    padding: 1.25rem;
  }

  .sidebar {
    position: static;
    width: min(12rem, calc(100% - 3rem));
    margin-bottom: 3rem;
    margin-left: -1.25rem;
  }

  .theme-toggle {
    top: 1.25rem;
    right: 1.25rem;
  }
}

@media (max-width: 600px) {
  .prose .image-pair {
    grid-template-columns: 1fr;
  }

  .prose pre {
    margin-right: 0;
    margin-left: 0;
  }
}

@media print {
  .sidebar,
  .theme-toggle { display: none; }
  .layout { display: block; padding: 0; }
  body { background: #fff; color: #000; }
}
