@font-face {
  font-family: 'Paper Mono';
  src: url('../fonts/PaperMono.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* madoromi winter (fuyu): a ground, an ink, wisteria (fuji) and cherry (sakura) for code.
   Every other tone is mixed from them, as web/src/app.css does. */
:root {
  color-scheme: dark;
  --ground: #1c1e2a;
  --ink: #d2d6eb;
  --fuji: #bbb8ff;
  --sakura: #ffc5da;
  --hi: color-mix(in oklab, var(--ink), #fff 55%);
  --mono: 'Paper Mono', ui-monospace, monospace;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ground: #f0f1f8;
    --ink: #4a4e63;
    --fuji: #5e21b0;
    --sakura: #aa6e89;
    --hi: color-mix(in oklab, var(--ink), #000 38%);
  }
}
:root {
  --muted: color-mix(in oklab, var(--ink), var(--ground) 30%);
  --faint: color-mix(in oklab, var(--ink), var(--ground) 52%);
  --ghost: color-mix(in oklab, var(--ink), var(--ground) 82%);
  --sel: color-mix(in oklab, var(--fuji) 22%, transparent);
  --shiki-foreground: var(--ink);
  --shiki-background: transparent;
  --shiki-token-keyword: var(--fuji);
  --shiki-token-string: var(--sakura);
  --shiki-token-string-expression: var(--sakura);
  --shiki-token-constant: var(--sakura);
  --shiki-token-comment: var(--faint);
  --shiki-token-function: var(--hi);
  --shiki-token-parameter: var(--ink);
  --shiki-token-punctuation: var(--muted);
  --shiki-token-link: var(--fuji);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--ground);
}
body {
  color: var(--ink);
  font: 400 16.5px/1.72 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: var(--sel);
}
a {
  color: inherit;
  text-decoration: none;
}
/* The background docs-lake.js draws, in canvas pixels two CSS pixels wide. */
#lake {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}
.page {
  position: relative;
  display: grid;
  grid-template-columns: 200px minmax(0, 66ch) 190px;
  column-gap: clamp(32px, 5vw, 96px);
  justify-content: center;
  padding: 0 clamp(20px, 4vw, 56px);
}
.top {
  grid-column: 1/-1;
  padding: 30px 0 0;
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
}
.search {
  display: none;
  align-items: baseline;
  gap: 0.8em;
  color: var(--faint);
}
.js .search {
  display: flex;
}
.search input {
  all: unset;
  flex: 1;
  min-width: 0;
  font: 400 15px var(--sans);
  color: var(--hi);
  padding: 0.2em 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.search input::placeholder {
  color: var(--faint);
}
.search input:focus {
  border-bottom-color: var(--ghost);
}
.search input::-webkit-search-cancel-button {
  display: none;
}
.search kbd {
  font: 12px var(--mono);
  color: var(--ghost);
}
.search input:focus + kbd {
  opacity: 0;
}
.results {
  display: none;
}
.searching > * {
  display: none;
}
.searching > .results {
  display: block;
}
.page:has(.searching) .toc {
  visibility: hidden;
}
.count {
  color: var(--muted);
  margin-bottom: 2.4em;
}
.hit {
  margin-bottom: 2.2em;
}
.hit .title {
  display: block;
  font: 500 17px/1.4 var(--mono);
  color: var(--hi) !important;
  text-decoration: none !important;
  margin-bottom: 0.5em;
}
.hit .part {
  display: block;
  color: var(--muted) !important;
  text-decoration: none !important;
  margin: 0 0 0.7em;
  transition: color 0.2s;
}
.hit a.part:hover {
  color: var(--ink) !important;
}
.hit .part span {
  color: var(--fuji);
  margin-right: 0.6em;
}
mark {
  background: none;
  color: var(--hi);
  font-weight: 500;
}
.mark {
  font: 500 15px var(--mono);
  color: var(--hi);
}
.mark a + a {
  color: var(--faint);
}
.mark a:hover {
  color: var(--fuji);
}
.navline {
  display: none;
}

.site,
.toc {
  position: sticky;
  top: 0;
  align-self: start;
  padding: 94px 0 40px;
  font-size: 14.5px;
  max-height: 100vh;
  overflow: auto;
  scrollbar-width: none;
}
.site a,
.toc a {
  display: block;
  color: var(--muted);
  padding: 0.24em 0;
  transition: color 0.2s;
}
.site a:hover,
.toc a:hover {
  color: var(--hi);
}
.site a[aria-current],
.toc a.on {
  color: var(--fuji);
}
.site i {
  font-style: normal;
  color: var(--faint);
}
.grp {
  font: 500 11px var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.55em;
}
.site .grp ~ .grp {
  margin-top: 1.7em;
}

article {
  padding: 90px 0 180px;
  min-width: 0;
}
h1,
h2,
h3 {
  color: var(--hi);
  margin: 0;
  position: relative;
  scroll-margin-top: 40px;
}
h1 {
  font: 400 clamp(32px, 3.8vw, 44px)/1.1 var(--mono);
  letter-spacing: -0.03em;
  margin-bottom: 0.75em;
  text-wrap: balance;
}
h1 + p {
  font-size: 19px;
  line-height: 1.62;
}
.tocline {
  display: none;
}
h2 {
  font: 500 19px/1.3 var(--mono);
  letter-spacing: -0.01em;
  margin: 3.4em 0 1em;
}
h3 {
  font: 600 16.5px/1.4 var(--sans);
  margin: 2.4em 0 0.7em;
}
.anchor {
  position: absolute;
  left: -1.3em;
  color: var(--ghost);
  opacity: 0;
  transition:
    opacity 0.2s,
    color 0.2s;
  font-weight: 400;
}
h2:hover .anchor,
h3:hover .anchor {
  opacity: 1;
}
.anchor:hover {
  color: var(--fuji);
}
p {
  margin: 0 0 1.15em;
}
strong {
  font-weight: 600;
  color: var(--hi);
}
article a:not(.anchor) {
  color: var(--fuji);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in oklab, var(--fuji) 35%, transparent);
  transition: text-decoration-color 0.2s;
}
article a:not(.anchor):hover {
  text-decoration-color: var(--fuji);
}
code {
  font: 0.86em var(--mono);
  color: var(--sakura);
}
p code,
li code {
  white-space: nowrap;
}
ol,
ul {
  padding-left: 1.4em;
  margin: 0 0 1.15em;
}
li {
  margin: 0 0 0.6em;
}
li > ul,
li > ol {
  margin: 0.6em 0 0;
}
li::marker {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.85em;
}
ul > li::marker {
  content: '–  ';
}
pre {
  margin: 1.7em 0 1.9em 1.4em;
  overflow-x: auto;
  scrollbar-width: thin;
}
pre code {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre;
}
article img {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.7em 0 1.9em;
  border: 1px solid var(--ghost);
  border-radius: 10px;
}
blockquote {
  margin: 0 0 1.15em;
  padding-left: 1.4em;
  color: var(--fuji);
}
blockquote p:last-child {
  margin-bottom: 0;
}
hr {
  border: 0;
  height: 2.4em;
}
.table {
  overflow-x: auto;
  margin: 1.6em 0 1.9em;
}
table {
  border-collapse: collapse;
  font-size: 15px;
  width: 100%;
}
th {
  font: 500 11px var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  padding: 0 1.6em 0.7em 0;
  white-space: nowrap;
}
td {
  padding: 0.42em 1.6em 0.42em 0;
  vertical-align: baseline;
}
td code {
  white-space: normal;
}
td:last-child,
th:last-child {
  padding-right: 0;
}
.pager {
  margin-top: 4em;
  color: var(--muted);
}
.pager span {
  font: 11px var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  margin-right: 0.7em;
}
.pager a {
  margin-right: 2.4em;
}

@media (max-width: 1100px) {
  .page {
    grid-template-columns: 200px minmax(0, 66ch);
  }
  .toc {
    display: none;
  }
  .tocline {
    display: block;
    color: var(--muted);
  }
}
@media (max-width: 760px) {
  .page {
    display: block;
    padding: 0 22px;
  }
  .site {
    display: none;
  }
  .top {
    padding-top: 24px;
  }
  .top {
    display: block;
  }
  .navline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2em 1.1em;
    margin: 14px 0 0;
    font-size: 14.5px;
    color: var(--muted);
  }
  .js .search {
    margin-top: 18px;
  }
  .search kbd {
    display: none;
  }
  .navline a[aria-current] {
    color: var(--fuji);
  }
  article {
    padding: 52px 0 140px;
  }
  .anchor {
    display: none;
  }
  p code,
  li code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  pre,
  blockquote {
    margin-left: 0;
    padding-left: 0;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
  }
  thead {
    display: none;
  }
  tr {
    margin-bottom: 1.1em;
  }
  td {
    padding: 0;
  }
  td:first-child {
    color: var(--hi);
  }
  td[data-label]:not(:first-child)::before {
    content: attr(data-label) '  ';
    font: 500 10.5px var(--mono);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--faint);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
