@charset "UTF-8";

@font-face {
  font-family: gitan;
  font-style: normal;
  font-weight: normal;
  font-stretch: normal;
  src: url("/fonts/gitan-regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: gitan;
  font-style: italic;
  font-weight: normal;
  font-stretch: normal;
  src: url("/fonts/gitan-italic.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Libertinus Math";
  src: url("/fonts/libertinus-math.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #111111;
  --paper: #fffff8;
  --fg: light-dark(var(--ink), var(--paper));
  --bg: light-dark(var(--paper), var(--ink));
  --muted: color-mix(in oklab, var(--fg) 40%, var(--bg) 60%);
  --bg-alt: light-dark(#e3dce0, #ccc);
  --accent: #c886b3;
  --accent-ink: light-dark(#84395f, var(--accent));
  --steel-blue: light-dark(#416b98, #a3bee1);
  --ochre: light-dark(#80601c, #dfc58d);
  --forest: light-dark(#347454, #a3cea8);
  --slate: light-dark(#74747c, #9aa1ad);
  --blue: light-dark(#4b69c6, #a3bee1);
  --green: light-dark(#198810, #a3be8c);
  --purple: light-dark(#8b41b1, #c3a0d7);
  --red: light-dark(#d73948, #e899a3);
  --berry: light-dark(#b60157, #d790b3);
  --cyan: light-dark(#16718d, #88c0d0);
  --teal: light-dark(#1d6c76, #8fbcbb);
  --gray: light-dark(#6b6b6f, #d8dee9);
  --maroon: light-dark(#301414, #c59b9b);
  --content-width: 55%;
  --wide-width: 90%;
  --page-indent: 12.5%;
  --page-max-width: 1400px;
  --margin-column-start: 60%;
  --margin-column-width: 27.5%;

  color-scheme: light dark;
  font-family: gitan, palatino, serif;
}
header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--bg);
  font-size: 1rem;
}

@supports (animation-timeline: scroll(root block)) {
  header {
    animation: compact-header 1s linear both;
    animation-timeline: scroll(root block);
    animation-range: 0px 80px;

    a {
      animation: mute-header-link 1s linear both;
      animation-timeline: scroll(root block);
      animation-range: 0px 80px;
    }

    a:hover,
    a:focus-visible {
      animation: none;
      opacity: 1;
    }
  }
}

header.drafts-link {
  top: auto;
  left: auto;
  right: 0;
  bottom: 0;
  font-size: 0.8rem;

  a {
    color: var(--muted);
  }

  a:hover,
  a:focus-visible {
    color: var(--accent-ink);
  }
}

@keyframes compact-header {
  to {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}

@keyframes mute-header-link {
  to {
    color: var(--muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  header,
  header a {
    animation: none;
  }
}

html {
  scroll-behavior: smooth;
  font-size: 18px;
  accent-color: var(--accent);
  text-wrap: pretty;
}

::selection {
  color: var(--bg);
  background-color: var(--accent-ink);
}

body {
  color: var(--fg);
  background: var(--bg);

  width: calc(100% - var(--page-indent));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--page-indent);
  max-width: var(--page-max-width);
}

h1 {
  font-weight: 600;
  margin-top: 4rem;
  margin-bottom: 1.5rem;
  font-size: 3.2rem;
  line-height: 1;
}

h2 {
  font-style: italic;
  font-weight: 600;
  margin-top: 2.1rem;
  margin-bottom: 1.4rem;
  font-size: 2.2rem;
  line-height: 1;
}

h3 {
  font-style: italic;
  font-weight: 600;
  font-size: 1.7rem;
  margin-top: 2rem;
  margin-bottom: 1.4rem;
  line-height: 1;
}

h1 code,
h2 code,
h3 code {
  font-size: 0.8em;
}

a,
a:hover,
a:visited {
  color: inherit;
  text-underline-offset: 0.15em;
}

a:hover,
a:focus-visible {
  color: var(--accent-ink);
}
.prose {
  :is(h1, h2, h3, h4, h5, h6) {
    position: relative;
    scroll-margin-top: 3rem;
  }

  :is(.heading-anchor, .heading-permalink) {
    text-decoration: none;
  }

  :is(h1, h2, h3, h4, h5, h6)
    > :is(.heading-anchor, .heading-permalink)::before {
    position: absolute;
    right: 100%;
    margin-right: 0.35em;
    color: var(--muted);
    font-style: normal;
  }

  h1:hover > :is(.heading-anchor, .heading-permalink)::before {
    content: "#";
  }
  h2:hover > :is(.heading-anchor, .heading-permalink)::before {
    content: "##";
  }
  h3:hover > :is(.heading-anchor, .heading-permalink)::before {
    content: "###";
  }
  h4:hover > :is(.heading-anchor, .heading-permalink)::before {
    content: "####";
  }
  h5:hover > :is(.heading-anchor, .heading-permalink)::before {
    content: "#####";
  }
  h6:hover > :is(.heading-anchor, .heading-permalink)::before {
    content: "######";
  }
}

article {
  padding: 5rem 0;
}

time {
  display: block;
  font-size: 0.875rem;
  opacity: 0.7;
}

.prose .note-date {
  color: var(--muted);
  font-size: 0.875rem;

  time {
    display: inline;
    font-size: inherit;
    opacity: 1;
  }
}

.note-list {
  list-style: none;
  padding: 0;

  li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--bg-alt);
  }
}

p,
footer,
table {
  width: var(--content-width);
}

pre {
  max-width: 100%;
  overflow-x: auto;
  font-style: normal;
}

pre > code {
  display: block;
  width: max-content;
  min-width: 100%;
}

.prose blockquote {
  box-sizing: border-box;
  width: var(--content-width);
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--accent-ink);
  font-style: italic;
  line-height: 1.5;

  &:has(> pre) {
    width: 100%;
  }
}

.prose figure.source-quote {
  box-sizing: border-box;
  width: var(--content-width);
  max-width: 100%;
  margin: 1.5rem 0;

  &:has(> blockquote > pre) {
    width: 100%;
  }

  blockquote {
    width: 100%;
    margin: 0;
  }

  pre {
    margin: 0;
  }
}

dl,
ol,
ul {
  width: 50%;
  -webkit-padding-start: 5%;
}

dt:not(:first-child),
li:not(:first-child) {
  margin-top: 0.25rem;
}

.prose :is(li, blockquote, figcaption, .sidenote, .marginnote) {
  > :is(p, ul, ol) {
    width: auto;
    margin-block: 0;
  }

  > :is(p, ul, ol) + :is(p, ul, ol) {
    margin-block-start: 0.5rem;
  }
}

img,
figure.diagram > svg {
  max-width: 100%;
  height: auto;
}

figure {
  max-width: var(--content-width);
  margin: 0 0 3em;

  &.diagram > svg {
    .fill-fg { fill: var(--fg); }
    .stroke-fg { stroke: var(--fg); }
    .fill-bg { fill: var(--bg); }
    .stroke-bg { stroke: var(--bg); }
    .fill-steel-blue { fill: var(--steel-blue); }
    .stroke-steel-blue { stroke: var(--steel-blue); }
    .fill-accent-ink { fill: var(--accent-ink); }
    .stroke-accent-ink { stroke: var(--accent-ink); }
    .fill-ochre { fill: var(--ochre); }
    .stroke-ochre { stroke: var(--ochre); }
    .fill-forest { fill: var(--forest); }
    .stroke-forest { stroke: var(--forest); }
  }

  figcaption {
    font-size: 0.8rem;
    line-height: 1.6;
  }

  &.fullwidth {
    max-width: var(--wide-width);

    figcaption {
      width: var(--content-width);
      margin: 0.5rem 0 0;
    }

    img {
      width: 100%;
    }
  }
}

.smcp {
  font-feature-settings:
    "smcp" 1,
    "c2sc" 1;
  font-variant-numeric: oldstyle-nums;
  letter-spacing: 0.06rem;
  -webkit-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

math {
  font-family: "Libertinus Math", "Cambria Math", serif;
  font-size: 1.08em;
}
math[display="block"] {
  font-size: 1.3em;
  margin-block: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
}

[role="doc-endnotes"] {
  margin-top: 3rem;
  width: var(--content-width);
  border-top: 1px solid var(--bg-alt);
  font-size: 0.875rem;
  ol {
    padding: 0;
  }
  [role="doc-backlink"] {
    color: var(--accent-ink);
    margin-right: 0.1em;
  }
}

code,
pre > code {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  line-height: 1.42;
  -webkit-text-size-adjust: 100%;
}

.prose code .syntax-comment {
  color: var(--slate);
}
.prose code .syntax-identifier {
  color: var(--blue);
}
.prose code .syntax-string {
  color: var(--green);
}
.prose code .syntax-punctuation {
  color: var(--purple);
}
.prose code .syntax-keyword {
  color: var(--red);
}
.prose code .syntax-constant {
  color: var(--berry);
}
.prose code .syntax-macro {
  color: var(--cyan);
}
.prose code .syntax-special {
  color: var(--teal);
}
.prose code .syntax-raw {
  color: var(--gray);
}
.prose code .syntax-annotation {
  color: var(--maroon);
}

.prose-section {
  position: relative;
}

.note-anchor {
  user-select: none;
}

.sidenote-number {
  color: var(--accent-ink);
  font-size: 1rem;
  text-decoration: none;
  position: relative;
  top: -0.5rem;
  left: 0.1rem;
}

.marginnote-marker {
  width: 0;
  height: 1em;
  opacity: 0;
}

.marginnote-marker:focus-visible {
  opacity: 1;
  color: var(--accent-ink);
}

.sidenote,
.marginnote {
  font-size: 0.8em;
  line-height: 1.3;
}

@media (min-width: 761px) {
  .side-notes :is(.sidenote, .marginnote),
  .prose-section figure:not(.fullwidth) > figcaption[style*="position-anchor"] {
    position: absolute;
    top: calc(anchor(top) + attr(data-offset px, 0px));
    left: var(--margin-column-start);
    width: var(--margin-column-width);
    margin: 0;
  }
}

.sidenote .note-number {
  color: var(--accent-ink);
  user-select: none;
  display: inline-block;
  margin-right: 0.2em;
  font-size: 1rem;
}

@media (max-width: 760px) {
  :root {
    --content-width: 100%;
    --page-indent: 8%;
  }

  .prose
    :is(h1, h2, h3, h4, h5, h6)
    > :is(.heading-anchor, .heading-permalink)::before {
    display: none;
  }

  @supports (animation-timeline: scroll(root block)) {
    header {
      animation-name: hide-mobile-header;
    }
  }

  @keyframes hide-mobile-header {
    to {
      opacity: 0;
      visibility: hidden;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    header {
      display: none;
    }
  }

  @supports not (animation-timeline: scroll(root block)) {
    header {
      display: none;
    }
  }

  header.drafts-link {
    display: block;
    animation: none;
    opacity: 1;
    visibility: visible;
  }

  body {
    width: calc(100% - var(--page-indent) - var(--page-indent));
    padding-right: var(--page-indent);
  }

  hr {
    width: 100%;
  }

  pre > code {
    width: 97%;
  }

  dl,
  ol,
  ul {
    width: var(--wide-width);
  }

  figure {
    max-width: var(--wide-width);
    display: flex;
    flex-direction: column;

    figcaption,
    &.fullwidth figcaption {
      order: 1;
      width: auto;
      max-width: none;
      margin: 0.5rem 0 0;
    }
  }

  .side-notes :is(.sidenote, .marginnote) {
    display: block;
    margin: 1rem 0;
  }

  div.table-wrapper,
  table {
    width: 85%;
  }

  img {
    width: 100%;
  }
}

.urgent {
  box-sizing: border-box;
  width: var(--content-width);
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  border-inline-start: 0.25rem solid var(--accent-ink);
  background: color-mix(in oklab, var(--accent) 12%, var(--bg));

  > p {
    width: auto;
    margin: 0;
  }
}
