:root {
  --paper: #f4f1e8;
  --paper-raised: #fbfaf6;
  --paper-deep: #ebe5d8;
  --soot: #0e1013;
  --iron: #262b32;
  --graphite: #343b44;
  --ink: #1a1d22;
  --ink-soft: #555b63;
  --ink-faint: #777e87;
  --line: #d6d0c3;
  --line-strong: #b9b1a2;
  --accent: #e2552b;
  --accent-deep: #9a3a1f;
  --accent-pale: #f6ded4;
  --glow: #ff9d4d;
  --molten: linear-gradient(100deg, #ffc06a 0%, #f5793a 38%, #e2552b 66%, #b8331a 100%);
  --code: #13171c;
  --sidebar-width: 19rem;
  --content-max: 54rem;
  --font-sans: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-display: 'Oswald Variable', 'Oswald', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --theme-color: var(--accent);
  --base-font-family: var(--font-sans);
  --base-font-size: 16px;
  --base-line-height: 1.7;
  --heading-font-family: var(--font-display);
  --heading-font-weight: 620;
  --heading-color: var(--ink);
  --link-color: var(--accent-deep);
  --code-font-family: var(--font-mono);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color-scheme: light;
}

body {
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 0, transparent 49.9%, rgb(32 35 31 / 0.025) 50%),
    var(--paper);
  background-size: 44px 44px;
  font-family: var(--font-sans);
  font-feature-settings: 'ss01' 1;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  content: '';
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

body::after {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1001;
  height: 3px;
  pointer-events: none;
  content: '';
  background: var(--molten);
  box-shadow: 0 0 18px -2px rgb(226 85 43 / 0.6);
}

::selection {
  color: var(--ink);
  background: #ffc19f;
}

a {
  text-underline-offset: 0.18em;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1002;
  padding: 0.65rem 0.9rem;
  color: var(--paper-raised);
  background: var(--ink);
  border-radius: 0.25rem;
  transform: translateY(-160%);
  transition: transform 180ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.loading-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 100dvh;
  padding: 2rem;
  color: var(--ink-soft);
  font: 520 0.82rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loading-mark {
  width: 1rem;
  height: 1rem;
  background: var(--accent);
  animation: loading-pulse 1.4s var(--ease) infinite alternate;
}

@keyframes loading-pulse {
  from {
    opacity: 0.4;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.app-nav {
  top: 1rem;
  right: 5.5rem;
  z-index: 12;
  margin: 0;
  padding: 0.65rem 0.8rem;
  background: rgb(14 16 19 / 0.94);
  border: 1px solid var(--graphite);
  border-radius: 0.35rem;
  box-shadow:
    inset 0 1px rgb(255 255 255 / 0.06),
    0 18px 42px -30px rgb(14 16 19 / 0.75);
  backdrop-filter: blur(14px);
}

.app-nav a {
  padding: 0.35rem 0.25rem;
  color: #a4abb4;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 520;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    color 180ms var(--ease),
    background-color 180ms var(--ease);
}

.app-nav a:hover {
  color: var(--glow);
}

.app-nav li.active > a {
  color: var(--paper-raised);
  border-bottom: 2px solid var(--accent);
}

.github-corner {
  top: 3px !important;
  z-index: 20 !important;
}

.github-corner svg {
  width: 5rem;
  height: 5rem;
  color: var(--paper-raised) !important;
  fill: var(--soot) !important;
  transition: fill 180ms var(--ease);
}

.github-corner:hover svg {
  fill: var(--iron) !important;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 1.75rem 1.35rem 2rem;
  background: rgb(235 229 216 / 0.94);
  border-right: 1px solid var(--line-strong);
}

.sidebar::before {
  display: block;
  width: 2.5rem;
  height: 0.35rem;
  margin: 0.35rem 0 2rem;
  content: '';
  background: var(--molten);
}

.sidebar .app-name {
  margin: 0 0 1.5rem;
  text-align: left;
}

.sidebar .app-name-link {
  color: var(--ink);
  font: 620 1.35rem/1 var(--font-display);
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.sidebar-nav > ul > li > p {
  margin: 1.45rem 0 0.45rem;
  color: var(--accent-deep);
  font: 620 0.7rem/1 var(--font-display);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.sidebar ul li a {
  padding: 0.28rem 0.5rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 470;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition:
    color 180ms var(--ease),
    border-color 180ms var(--ease),
    transform 180ms var(--ease);
}

.sidebar ul li a:hover {
  color: var(--ink);
  transform: translateX(2px);
}

.sidebar ul li.active > a {
  color: var(--accent-deep);
  font-weight: 620;
  border-left-color: var(--accent);
}

.sidebar .search {
  margin-bottom: 1.2rem;
  padding: 0;
  border: 0;
}

.sidebar .search input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
  background: rgb(251 250 246 / 0.7);
  border: 1px solid var(--line-strong);
  border-radius: 0.25rem;
  font: 450 0.8rem/1.2 var(--font-sans);
  transition:
    border-color 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.sidebar .search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(226 85 43 / 0.12);
}

.sidebar .search .matching-post {
  border-bottom-color: var(--line);
}

.content {
  left: var(--sidebar-width);
  padding-top: 5rem;
}

.markdown-section {
  max-width: var(--content-max);
  padding: 2.5rem 3.25rem 6rem;
  color: var(--ink-soft);
}

.markdown-section > * {
  animation: content-in 420ms var(--ease) both;
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4 {
  color: var(--ink);
  font-family: var(--font-display);
  letter-spacing: -0.035em;
}

.markdown-section h1 {
  max-width: 18ch;
  margin: 0 0 2.25rem;
  font-size: clamp(2.65rem, 6vw, 4.6rem);
  font-weight: 600;
  line-height: 0.98;
}

.markdown-section h1::after {
  display: block;
  width: 4rem;
  height: 0.35rem;
  margin-top: 1.5rem;
  content: '';
  background: var(--molten);
}

.markdown-section h2 {
  margin: 4rem 0 1.15rem;
  padding-top: 1rem;
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.15;
  border-top: 1px solid var(--line);
}

.markdown-section h3 {
  margin: 2.5rem 0 0.8rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.markdown-section h4 {
  font-size: 1rem;
  font-weight: 650;
}

.markdown-section p,
.markdown-section li {
  max-width: 68ch;
}

.markdown-section p {
  margin: 0.9rem 0;
}

.markdown-section strong {
  color: var(--ink);
  font-weight: 650;
}

.markdown-section a {
  color: var(--accent-deep);
  font-weight: 540;
  text-decoration-color: rgb(40 115 91 / 0.35);
  transition:
    color 180ms var(--ease),
    text-decoration-color 180ms var(--ease);
}

.markdown-section a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.markdown-section blockquote {
  margin: 2rem 0;
  padding: 0.9rem 1.25rem;
  color: var(--ink-soft);
  background: var(--accent-pale);
  border-left: 0.35rem solid var(--accent);
}

.markdown-section blockquote p {
  margin: 0;
}

.markdown-section table {
  display: table;
  width: 100%;
  margin: 2rem 0;
  overflow: hidden;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-collapse: collapse;
  box-shadow: 0 16px 34px -30px rgb(50 53 48 / 0.5);
}

.markdown-section th {
  color: var(--ink);
  background: var(--paper-deep);
  font: 600 0.75rem/1.3 var(--font-display);
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

.markdown-section td,
.markdown-section th {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
}

.markdown-section tr:nth-child(2n) {
  background: rgb(235 229 216 / 0.3);
}

.markdown-section code {
  margin: 0 0.06rem;
  padding: 0.14rem 0.32rem;
  color: var(--accent-deep);
  background: var(--accent-pale);
  border-radius: 0.18rem;
  font-size: 0.86em;
  font-weight: 500;
}

.markdown-section pre {
  margin: 1.5rem 0 2rem;
  padding: 1.35rem 1.5rem;
  background: var(--code);
  border: 1px solid var(--graphite);
  border-radius: 0.25rem;
  box-shadow: 0 18px 42px -32px rgb(32 35 31 / 0.8);
}

.markdown-section pre::before {
  display: block;
  width: 1.8rem;
  height: 0.22rem;
  margin-bottom: 1rem;
  content: '';
  background: var(--molten);
}

.markdown-section pre > code {
  padding: 0;
  color: #e9eee8;
  background: transparent;
  border-radius: 0;
  font-size: 0.84rem;
  line-height: 1.65;
}

.markdown-section img[src$='.svg'] {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.75rem 0 2.25rem;
  background: var(--paper-raised);
  border-radius: 0.45rem;
  box-shadow: 0 20px 44px -34px rgb(32 35 31 / 0.65);
}

.docsify-copy-code-button {
  top: 0.85rem !important;
  right: 0.85rem !important;
  padding: 0.35rem 0.55rem !important;
  color: #dfe3e8 !important;
  background: var(--iron) !important;
  border: 1px solid var(--graphite) !important;
  border-radius: 0.2rem !important;
  font: 560 0.66rem/1 var(--font-mono) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.markdown-section hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown-section ol,
.markdown-section ul {
  padding-left: 1.35rem;
}

.markdown-section li {
  margin: 0.4rem 0;
}

.markdown-section li::marker {
  color: var(--accent);
  font-weight: 700;
}

.cover {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(32 35 31 / 0.045) 1px, transparent 1px),
    linear-gradient(rgb(32 35 31 / 0.045) 1px, transparent 1px), var(--paper) !important;
  background-size: 44px 44px !important;
}

.cover::before {
  position: absolute;
  top: 0;
  right: 0;
  width: min(36vw, 32rem);
  height: 100%;
  content: '';
  background:
    radial-gradient(90% 60% at 30% 10%, rgb(226 85 43 / 0.2), transparent 58%),
    linear-gradient(150deg, var(--iron), var(--soot));
  box-shadow: inset 2px 0 0 rgb(226 85 43 / 0.5);
  clip-path: polygon(34% 0, 100% 0, 100% 100%, 0 100%);
  opacity: 1;
}

.cover .mask {
  display: none;
}

.cover .cover-main {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: start;
  width: min(100% - 3rem, 78rem);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 7rem min(8vw, 7rem) 4rem 0;
  text-align: left;
}

.cover .cover-main > p:first-of-type {
  max-width: 46rem;
  margin: 1.4rem 0 1.8rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.6;
}

.cover .cover-main h1 {
  max-width: 13ch;
  margin: 1rem 0;
  color: var(--ink);
  font-size: clamp(3.2rem, 5.2vw, 5.2rem);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.065em;
  text-align: left;
}

.cover h1 small {
  display: none;
}

.cover-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent);
  font: 600 0.74rem/1 var(--font-display);
  letter-spacing: 0.2em;
  text-align: left;
  text-transform: uppercase;
}

.cover-kicker::before {
  width: 1.6rem;
  height: 2px;
  content: '';
  background: var(--molten);
}

.cover .cover-main > p {
  text-align: left;
}

.cover .cover-main > p:last-of-type {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0;
}

.cover .cover-main > p:last-of-type a {
  display: inline-flex;
  align-items: center;
  min-height: 2.8rem;
  margin: 0;
  padding: 0.65rem 1rem;
  color: var(--paper-raised);
  background: var(--soot);
  border: 1px solid var(--soot);
  border-radius: 0.2rem;
  font-size: 0.82rem;
  font-weight: 620;
  text-decoration: none;
  transition:
    transform 180ms var(--ease),
    background-color 180ms var(--ease),
    color 180ms var(--ease);
}

.cover .cover-main > p:last-of-type a + a {
  color: var(--ink);
  background: transparent;
  border-color: var(--line-strong);
}

.cover .cover-main > p:last-of-type a:hover {
  color: var(--paper-raised);
  background: var(--iron);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.cover .cover-main > p:last-of-type a:active {
  transform: translateY(1px);
}

.cover-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 42rem);
  margin-top: 3.5rem;
  border-top: 1px solid var(--line-strong);
}

.cover-facts div {
  display: grid;
  gap: 0.15rem;
  padding: 1rem 1rem 0 0;
  text-align: left;
}

.cover-facts strong {
  color: var(--ink);
  font: 700 0.9rem/1.2 var(--font-mono);
}

.cover-facts span {
  color: var(--ink-faint);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.doc-lede {
  max-width: 46rem;
  margin: -0.75rem 0 2.5rem;
  color: var(--ink-soft);
  font-size: 1.18rem;
  line-height: 1.65;
}

.doc-index {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 2rem 0 3rem;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  box-shadow: inset 0 3px var(--accent);
}

.doc-index > div {
  padding: 1.3rem 1.4rem;
  background: var(--paper-raised);
}

/* An odd package count would otherwise leave the grid's own background showing through as a
   half-width empty cell. Let the trailing entry take the whole row instead. */
.doc-index > div:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.doc-index strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.doc-index p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.pagination-item {
  margin-top: 3rem;
  border-top-color: var(--line) !important;
}

.pagination-item-label,
.pagination-item-title {
  color: var(--ink-soft) !important;
}

@media (max-width: 900px) {
  .app-nav {
    display: none;
  }

  .content {
    left: 0;
    padding-top: 2rem;
  }

  .markdown-section {
    padding: 3rem 1.5rem 5rem;
  }

  .markdown-section h1 {
    font-size: clamp(2.35rem, 11vw, 3.8rem);
  }

  .cover::before {
    top: auto;
    bottom: 0;
    width: 100%;
    height: 1rem;
    clip-path: none;
  }

  section.cover .cover-main {
    width: calc(100% - 2rem);
    max-width: 100%;
    min-height: 100dvh;
    margin: 0 1rem;
    padding: 6rem 0 4rem;
    overflow: hidden;
  }

  section.cover .cover-main > * {
    min-width: 0;
    max-width: 100%;
  }

  section.cover .cover-main h1 {
    width: 100%;
    font-size: clamp(2.35rem, 11vw, 4.2rem);
    overflow-wrap: anywhere;
    white-space: normal;
  }

  section.cover .cover-main > p:first-of-type {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  section.cover .cover-main > p:last-of-type {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  section.cover .cover-main > p:last-of-type a {
    justify-content: center;
    width: 100%;
  }

  .cover-facts {
    grid-template-columns: 1fr;
    margin-top: 2rem;
  }

  .cover-facts div {
    grid-template-columns: 8rem 1fr;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--line);
  }

  .doc-index {
    grid-template-columns: 1fr;
  }

  body.close .sidebar {
    transform: translateX(calc(var(--sidebar-width) * -1));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
