.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter) 72px;
}

/* Contents rail */

.toc {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 36px 0 24px;
  scrollbar-width: thin;
}

.toc-title {
  margin: 0 0 10px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: 5px 0 5px 14px;
  border-left: 1px solid transparent;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: color 160ms ease-out, border-color 160ms ease-out;
}

.toc a:hover {
  color: var(--ink);
}

.toc a[aria-current] {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

/* Reading column */

.doc {
  min-width: 0;
  max-width: 780px;
  padding-top: 28px;
}

.doc-head {
  padding: 8px 0 8px;
}

.doc h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 4.4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 650;
}

.doc-lede {
  margin: 0;
  color: var(--ink-2);
  font-size: 18px;
}

.doc section {
  padding-top: 44px;
  scroll-margin-top: 8px;
}

.doc h2 {
  margin: 0 0 14px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 650;
}

.doc h3 {
  margin: 34px 0 10px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 600;
  scroll-margin-top: 16px;
}

.doc h3 code {
  padding: 0;
  background: none;
  color: var(--ink);
  font-size: 0.92em;
}

.doc p,
.doc li {
  color: #2b2620;
  max-width: 70ch;
}

.doc p {
  margin: 0 0 16px;
}

.doc ul {
  margin: 0 0 18px;
  padding-left: 20px;
}

.doc li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.doc li::marker {
  color: var(--accent);
}

.doc pre {
  margin: 0 0 18px;
}

.doc pre[data-outline] {
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.doc .code {
  font-size: 12.75px;
}

.install {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 0 16px;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.install code {
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow-x: auto;
  background: none;
  color: var(--ink);
  white-space: nowrap;
  font-size: 14.5px;
  scrollbar-width: none;
}

.prompt {
  color: var(--ink-3);
  user-select: none;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
  margin: 0 0 18px;
}

.pair figure {
  min-width: 0;
  margin: 0;
}

.pair figcaption {
  margin: 0 0 6px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.pair pre[data-outline] {
  margin: 0;
}

/* Tables */

.table-wrap {
  margin: 0 0 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  scrollbar-width: thin;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

.doc th,
.doc td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.doc thead th {
  background: var(--paper);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.doc tbody tr:last-child td {
  border-bottom: 0;
}

.doc td code {
  background: var(--paper-2);
  color: #2e2924;
}

.doc td:first-child > code:only-child {
  background: var(--accent-wash);
  color: var(--accent-ink);
  white-space: nowrap;
}

.numbers td:not(:first-child),
.numbers th:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.numbers td:first-child {
  white-space: normal;
}

@media (max-width: 960px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .toc {
    position: static;
    max-height: none;
    padding: 12px 0 0;
  }

  .toc ol {
    columns: 2;
    column-gap: 16px;
  }

  .toc li {
    break-inside: avoid;
  }

  .pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .toc ol {
    columns: 1;
  }

  .doc td:first-child > code:only-child {
    white-space: normal;
  }
}
