@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-wght-normal.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Light: black lines, no glow. */
:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #171717;
  --muted: #5b5b5b;
  --line: #171717;
  --line-faint: rgba(23, 23, 23, 0.16);
  --accent: #171717;
  --on-accent: #ffffff;
  --code-bg: #efefec;
  --glow: 0 0 0 transparent;
  --glow-strong: 0 0 0 transparent;
  --card-hover: 0 0 0 1px #171717;
  --edge-glow: none;
  --text-glow: none;
  --icon-glow: none;
  --spots: none;
  --level-0: #e6e6e3;
  --level-1: #bdbdb9;
  --level-2: #8b8b87;
  --level-3: #52524f;
  --level-4: #171717;
  --level-glow: none;
  --syntax-comment: #6f6f6f;
  --syntax-keyword: #171717;
  --syntax-string: #3f3f3f;
  --syntax-number: #3f3f3f;
}

/* Dark: purple neon; the glow is the shadow of the line itself. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0a12;
  --surface: rgba(19, 16, 31, 0.78);
  --text: #ebe8f6;
  --muted: #a49dc0;
  --line: #8b6cff;
  --line-faint: rgba(139, 108, 255, 0.34);
  --accent: #8b6cff;
  --on-accent: #0b0a12;
  --code-bg: rgba(139, 108, 255, 0.08);
  --glow: 0 0 5px rgba(139, 108, 255, 0.45), inset 0 0 5px rgba(139, 108, 255, 0.16);
  --glow-strong: 0 0 7px rgba(139, 108, 255, 0.85), 0 0 22px rgba(139, 108, 255, 0.4), inset 0 0 7px rgba(139, 108, 255, 0.3);
  --card-hover: var(--glow-strong);
  --edge-glow: -3px 0 6px -3px rgba(139, 108, 255, 0.95);
  --text-glow: 0 0 8px rgba(139, 108, 255, 0.75);
  --icon-glow: drop-shadow(0 0 3px rgba(139, 108, 255, 0.8));
  --spots:
    radial-gradient(38rem 30rem at 8% -4%, rgba(139, 108, 255, 0.13), transparent 70%),
    radial-gradient(30rem 26rem at 96% 38%, rgba(139, 108, 255, 0.08), transparent 70%),
    radial-gradient(34rem 28rem at 30% 108%, rgba(139, 108, 255, 0.09), transparent 70%);
  --level-0: rgba(139, 108, 255, 0.08);
  --level-1: rgba(139, 108, 255, 0.3);
  --level-2: rgba(139, 108, 255, 0.52);
  --level-3: rgba(139, 108, 255, 0.76);
  --level-4: #8b6cff;
  --level-glow: drop-shadow(0 0 2.5px rgba(139, 108, 255, 0.95));
  --syntax-comment: #8a83a6;
  --syntax-keyword: #a58dff;
  --syntax-string: #d4c8ff;
  --syntax-number: #c3b3ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0a12;
    --surface: rgba(19, 16, 31, 0.78);
    --text: #ebe8f6;
    --muted: #a49dc0;
    --line: #8b6cff;
    --line-faint: rgba(139, 108, 255, 0.34);
    --accent: #8b6cff;
    --on-accent: #0b0a12;
    --code-bg: rgba(139, 108, 255, 0.08);
    --glow: 0 0 5px rgba(139, 108, 255, 0.45), inset 0 0 5px rgba(139, 108, 255, 0.16);
    --glow-strong: 0 0 7px rgba(139, 108, 255, 0.85), 0 0 22px rgba(139, 108, 255, 0.4), inset 0 0 7px rgba(139, 108, 255, 0.3);
    --card-hover: var(--glow-strong);
    --edge-glow: -3px 0 6px -3px rgba(139, 108, 255, 0.95);
    --text-glow: 0 0 8px rgba(139, 108, 255, 0.75);
    --icon-glow: drop-shadow(0 0 3px rgba(139, 108, 255, 0.8));
    --spots:
      radial-gradient(38rem 30rem at 8% -4%, rgba(139, 108, 255, 0.13), transparent 70%),
      radial-gradient(30rem 26rem at 96% 38%, rgba(139, 108, 255, 0.08), transparent 70%),
      radial-gradient(34rem 28rem at 30% 108%, rgba(139, 108, 255, 0.09), transparent 70%);
    --level-0: rgba(139, 108, 255, 0.08);
    --level-1: rgba(139, 108, 255, 0.3);
    --level-2: rgba(139, 108, 255, 0.52);
    --level-3: rgba(139, 108, 255, 0.76);
    --level-4: #8b6cff;
    --level-glow: drop-shadow(0 0 2.5px rgba(139, 108, 255, 0.95));
    --syntax-comment: #8a83a6;
    --syntax-keyword: #a58dff;
    --syntax-string: #d4c8ff;
    --syntax-number: #c3b3ff;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--spots);
  pointer-events: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-color: var(--line-faint);
  text-underline-offset: 0.25em;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
  text-shadow: var(--text-glow);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 40rem) {
  .wrap {
    padding: 0 1.5rem;
  }
}

/* Header */

.site-header {
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--glow);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  min-height: 3.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand img {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: var(--glow);
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  order: 3;
  width: 100%;
  margin-left: -0.6rem;
}

.site-nav a {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-nav a[aria-current] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.45em;
  text-shadow: var(--text-glow);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  box-shadow: var(--glow);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  color: var(--accent);
  box-shadow: var(--glow-strong);
}

.theme-icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

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

  :root:not([data-theme="light"]) .theme-icon-light {
    display: block;
  }
}

/* On a phone the header scrolls away, leaving the whole screen to the page. */
@media (min-width: 40rem) {
  .site-header {
    position: sticky;
    top: 0;
  }

  .site-nav {
    order: 0;
    width: auto;
    margin-left: 1rem;
  }
}

/* Main and footer */

.site-main {
  flex: 1;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

.page-title {
  margin-bottom: 1.75rem;
  font-size: 1.75rem;
}

.site-footer {
  border-top: 1px solid var(--line-faint);
  color: var(--muted);
  font-size: 0.8125rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}

/* Shared pieces */

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--glow);
}

.button {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--glow);
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.button:hover {
  background: var(--accent);
  color: var(--on-accent);
  text-shadow: none;
  box-shadow: var(--glow-strong);
}

.button .size {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

.button:hover .size {
  color: inherit;
  opacity: 0.8;
}

.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.meta {
  color: var(--muted);
  font-size: 0.8125rem;
}

.icon {
  flex: none;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

.icon-glyph {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-linejoin: round;
  filter: var(--icon-glow);
}

.head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.description {
  max-width: 44rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--line-faint);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-weight: 600;
}

.links a {
  text-decoration-color: var(--line);
}

.lang-mark {
  display: inline-block;
  padding: 0 0.3rem;
  border: 1px solid var(--line-faint);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.screenshot {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-faint);
  border-radius: 10px;
  overflow: hidden;
  background: none;
  cursor: zoom-in;
}

.screenshot img {
  width: 100%;
  height: auto;
  transition: transform 0.3s;
}

.screenshot:hover {
  border-color: var(--line);
  box-shadow: var(--glow);
}

.screenshot:hover img {
  transform: scale(1.015);
}

/* The enlarged screenshot: a popover, so no script is needed. */

.lightbox {
  display: none;
}

.lightbox:popover-open {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(6, 5, 10, 0.88);
}

.lightbox button {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-out;
}

.lightbox img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--glow-strong);
}

/* About */

.about {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.about-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  max-width: 42rem;
}

.avatar {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: var(--glow-strong);
  object-fit: cover;
}

.about h1 {
  font-size: 2.25rem;
  text-shadow: var(--text-glow);
}

.bio {
  font-size: 1.0625rem;
}

.about .links {
  gap: 0.75rem;
  margin-top: 0.25rem;
  font-weight: 400;
}

@media (min-width: 40rem) {
  .about {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2.5rem;
    padding-top: 1.5rem;
  }

  .avatar {
    width: 11rem;
    height: 11rem;
  }

  .about h1 {
    font-size: 2.75rem;
  }
}

/* On a phone three tiles leave no room for "contributions", so each number
   gets a row of its own: the number first, its label after it. */
.stats {
  display: grid;
  gap: 0.5rem;
  margin: 2.5rem 0 0;
}

.stats div {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--glow);
}

.stats dt {
  color: var(--muted);
  font-size: 0.8125rem;
}

.stats dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: var(--text-glow);
}

@media (min-width: 40rem) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 3rem;
  }

  .stats div {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
  }

  .stats dd {
    font-size: 1.875rem;
  }
}

.activity,
.recent {
  margin-top: 3rem;
}

.activity h2,
.recent h2 {
  margin-bottom: 1rem;
  font-size: 1.0625rem;
}

/* The calendar scrolls sideways on a phone and starts at its latest week. */
.calendar-scroll {
  overflow-x: auto;
  direction: rtl;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line-faint);
  border-radius: 12px;
  background: var(--surface);
}

.calendar {
  direction: ltr;
  width: 100%;
  min-width: 44rem;
  max-width: 64rem;
  height: auto;
  margin: 0 auto;
}

.calendar-label {
  fill: var(--muted);
  font-size: 9px;
}

.calendar rect {
  shape-rendering: geometricPrecision;
}

.level-0 {
  fill: var(--level-0);
}

.level-1 {
  fill: var(--level-1);
}

.level-2 {
  fill: var(--level-2);
}

.level-3 {
  fill: var(--level-3);
}

.level-4 {
  fill: var(--level-4);
  filter: var(--level-glow);
}

.recent ol {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.15rem 0.9rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line-faint);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
}

.recent a:hover {
  border-color: var(--line);
  box-shadow: var(--glow);
  text-shadow: none;
}

.recent .icon {
  grid-row: span 2;
  width: 2rem;
  height: 2rem;
}

.recent-name {
  font-weight: 600;
}

@media (min-width: 40rem) {
  .recent a {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .recent .icon {
    grid-row: auto;
  }
}

/* Projects */

.project-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 52rem) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.project-card:hover,
.project-card:focus-within {
  box-shadow: var(--card-hover);
}

.card-shot {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line-faint);
  background: var(--code-bg);
}

.card-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform 0.3s;
}

.project-card:hover .card-shot img {
  transform: scale(1.02);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem;
}

.project-card h2 {
  font-size: 1.1875rem;
}

/* The title's link covers the whole card; the links inside stay on top. */
.card-link {
  text-decoration: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-link:focus-visible {
  outline: none;
}

.project-card:has(.card-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.project-card .links {
  margin-top: auto;
  padding-top: 0.25rem;
}

.project-card .links a {
  position: relative;
  z-index: 1;
}

/* Project page */

.project-header {
  display: grid;
  gap: 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line-faint);
}

.project-header:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.project-intro {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.project-header h1 {
  font-size: 1.75rem;
}

.project-header .icon {
  width: 3.5rem;
  height: 3.5rem;
}

@media (min-width: 60rem) {
  .project-header.has-screenshot {
    grid-template-columns: minmax(0, 1fr) 34rem;
    gap: 2.5rem;
    align-items: start;
  }
}

.project-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line-faint);
}

.project-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
}

.project-bar .icon {
  width: 2rem;
  height: 2rem;
}

/* Docs: a sidebar of documents and the document itself. */

.docs {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

.doc-sidebar {
  display: none;
}

.doc-picker {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--glow);
}

.doc-picker summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.doc-picker summary::-webkit-details-marker {
  display: none;
}

.doc-picker summary::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.doc-picker[open] summary::after {
  margin-top: 0.7rem;
  transform: rotate(-135deg);
}

.doc-picker .doc-nav {
  max-height: 70vh;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

@media (min-width: 64rem) {
  .docs {
    grid-template-columns: 16rem minmax(0, 55rem);
    gap: 3rem;
    align-items: start;
  }

  .doc-picker {
    display: none;
  }

  .doc-sidebar {
    display: block;
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 0.5rem 1rem 0;
    scrollbar-width: thin;
  }
}

.doc-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-nav li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}

.doc-nav a {
  flex: 1;
  padding: 0.3rem 0.5rem 0.3rem 0.75rem;
  border-left: 1px solid var(--line-faint);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
  text-decoration: none;
}

.doc-nav a:hover {
  border-left-color: var(--line);
  color: var(--accent);
}

.doc-nav .lang-mark {
  margin-left: 0.25rem;
}

.doc-nav .current > a {
  border-left: 2px solid var(--line);
  padding-left: calc(0.75rem - 1px);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--edge-glow);
}

.doc-nav .toc {
  flex-basis: 100%;
  margin: 0.15rem 0 0.35rem;
}

.doc-nav .toc a {
  padding-left: 1.5rem;
  font-size: 0.8125rem;
}

.doc-group {
  margin: 1.25rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-lang {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.doc-lang a {
  text-decoration: none;
}

.doc-lang a[aria-current] {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.35em;
}

.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--glow);
}

.to-top svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.to-top:hover {
  box-shadow: var(--glow-strong);
}

/* Where the browser can tie an animation to scrolling, the button appears
   only once the page has been scrolled; elsewhere it is always there. */
@supports (animation-timeline: scroll()) {
  .to-top {
    animation: to-top-appear linear both;
    animation-timeline: scroll(root);
    animation-range: 0 60vh;
  }

  @keyframes to-top-appear {
    from {
      opacity: 0;
      visibility: hidden;
    }

    to {
      opacity: 1;
      visibility: visible;
    }
  }
}

/* The rendered Markdown */

.doc {
  min-width: 0;
  max-width: 55rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.doc h1,
.doc h2,
.doc h3,
.doc h4,
.doc h5,
.doc h6 {
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
  scroll-margin-top: 1rem;
}

.doc h1 {
  margin-top: 0;
  font-size: 1.75rem;
}

.doc h2 {
  margin-top: 2.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line-faint);
  font-size: 1.3125rem;
}

.doc h3 {
  font-size: 1.125rem;
}

.doc h4,
.doc h5,
.doc h6 {
  font-size: 1rem;
}

@media (min-width: 40rem) {
  .doc h1,
  .doc h2,
  .doc h3,
  .doc h4,
  .doc h5,
  .doc h6 {
    scroll-margin-top: 5.5rem;
  }
}

.doc p,
.doc ul,
.doc ol,
.doc dl,
.doc table,
.doc blockquote,
.doc details,
.doc .highlighter-rouge,
.doc > pre {
  margin: 0 0 1rem;
}

.doc ul,
.doc ol {
  padding-left: 1.5rem;
}

.doc li + li,
.doc li > ul,
.doc li > ol {
  margin-top: 0.25rem;
}

.doc li > ul,
.doc li > ol,
.doc li > p {
  margin-bottom: 0;
}

.doc .task-list {
  padding-left: 0.25rem;
  list-style: none;
}

.doc .task-list-item-checkbox {
  margin: 0 0.5rem 0 0;
  accent-color: var(--accent);
}

.doc a {
  text-decoration-color: var(--line);
}

.doc code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--code-bg);
  font-family: inherit;
  font-size: 0.875em;
}

.doc pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--line-faint);
  border-radius: 8px;
  background: var(--code-bg);
  font-size: 0.8125rem;
  line-height: 1.55;
  tab-size: 4;
}

.doc pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* Wide tables scroll inside the column instead of widening the page. */
.doc table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
}

.doc th,
.doc td {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-faint);
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: var(--code-bg);
}

.doc blockquote {
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  box-shadow: var(--edge-glow);
}

.doc blockquote > :last-child {
  margin-bottom: 0;
}

.doc hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line-faint);
}

.doc img {
  height: auto;
}

.doc kbd {
  padding: 0.05em 0.4em;
  border: 1px solid var(--line-faint);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85em;
}

.doc summary {
  cursor: pointer;
  font-weight: 600;
}

/* Code colours (Rouge classes) */

.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs,
.highlight .cp {
  color: var(--syntax-comment);
  font-style: italic;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kr,
.highlight .kt,
.highlight .kc,
.highlight .nt,
.highlight .ow {
  color: var(--syntax-keyword);
  font-weight: 600;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .sr {
  color: var(--syntax-string);
}

.highlight .m,
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .il {
  color: var(--syntax-number);
}

/* Downloads */

.downloads {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.download {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem 1rem;
  padding: 1rem;
}

.download .icon {
  width: 2.5rem;
  height: 2.5rem;
}

.download h2 {
  font-size: 1.0625rem;
}

.download h2 a {
  text-decoration: none;
}

.download .download-buttons {
  grid-column: 1 / -1;
}

@media (min-width: 48rem) {
  .download {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 1rem 1.25rem;
  }

  .download .download-buttons {
    grid-column: auto;
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
