/* Documentation pages: sidebar + article. */

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  padding: 40px 0 80px;
  min-width: 0;
}

.toc {
  position: sticky;
  top: 24px;
  align-self: start;
  font-family: var(--display);
  font-size: 0.92rem;
}

.toc a {
  display: block;
  text-decoration: none;
  padding: 5px 0;
  color: var(--ink-2);
}

.toc a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--red);
}

.toc a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.toc .grp {
  font-weight: 600;
  color: var(--ink);
  margin-top: 18px;
  display: block;
}

.toc .grp:first-child {
  margin-top: 0;
}

.toc .sub a {
  padding-left: 12px;
  font-size: 0.86rem;
}

article {
  min-width: 0;
}

article h1 {
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  margin-bottom: 18px;
}

article .lede {
  font-size: 1.15rem;
  color: var(--ink-2);
  margin-bottom: 8px;
}

article h2 {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

article h3 {
  margin-top: 32px;
}

article h3.endpoint,
article h3 code {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1rem;
}

article p,
article ul,
article ol {
  margin-top: 14px;
}

article ul,
article ol {
  padding-left: 20px;
  max-width: var(--measure);
}

article li + li {
  margin-top: 6px;
}

article pre {
  margin-top: 16px;
}

article table {
  margin-top: 16px;
  font-size: 0.94rem;
}

article td code {
  white-space: nowrap;
}

article figure {
  margin: 24px 0 0;
}

article figcaption {
  font-family: var(--display);
  font-size: 0.86rem;
  color: var(--ink-2);
  margin-top: 8px;
}

.m {
  font: 600 0.78rem var(--display);
  padding: 3px 7px;
  background: var(--ink);
  color: var(--sheet);
  vertical-align: middle;
  margin-right: 8px;
}

/* Callout: one hairline, no colored bar. */
.note {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--sheet);
  box-shadow: var(--shadow-sheet);
  max-width: var(--measure);
}

.note p {
  margin-top: 0;
}

.note p + p {
  margin-top: 8px;
}

/* Two-column example: Typst source next to what it produces. */
.example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 18px;
  align-items: start;
}

.example pre {
  margin: 0;
}

.example .result {
  background: var(--sheet);
  box-shadow: var(--shadow-sheet);
  padding: 18px 20px;
  font-size: 0.94rem;
}

.example .result p {
  margin-top: 0;
}

.example .result p + p {
  margin-top: 8px;
}

/* Steps: numbered because they are a real sequence. */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  max-width: none;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-top: 28px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--ink);
  font: 600 0.9rem/26px var(--display);
  text-align: center;
}

.steps h3 {
  margin-top: 0;
  line-height: 28px;
}

.next {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-family: var(--display);
}

@media (max-width: 860px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
  }
  .toc {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
  }
  .toc .grp,
  .toc .sub a {
    display: none;
  }
  .example {
    grid-template-columns: minmax(0, 1fr);
  }
  article table {
    display: block;
    overflow-x: auto;
  }
  article td code {
    white-space: normal;
  }
}
