/* The documentation pages. Colours and the top bar come from styles.css. */

/* Pages run to thousands of pixels: an animated jump there only makes the reader wait. */
html {
  scroll-behavior: auto;
}

.docs-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  padding-block: clamp(16px, 3vw, 32px) clamp(48px, 7vw, 96px);
}

/* The sidebar comes last in the source, so a phone reads the page first. */
.docs-nav {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  font-size: 1rem;
}

.doc {
  grid-column: 2;
  grid-row: 1;
  max-width: 46rem;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.docs-jump {
  display: none;
}

.docs-group {
  margin: 0 0 4px;
  font-weight: 600;
}

.docs-group a {
  display: block;
  padding: 6px 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
}

.docs-nav ul {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.docs-nav li a {
  display: block;
  padding: 6px 10px 6px 22px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
}

.docs-nav a:hover {
  color: var(--ink);
  background: var(--tint);
}

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

.bar nav a[aria-current="true"] {
  font-weight: 600;
}

.doc h1 {
  margin-bottom: 20px;
  font-size: clamp(2.125rem, 4.4vw, 2.875rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.doc h2 {
  margin: 44px 0 12px;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.018em;
  scroll-margin-top: 16px;
}

.doc h3 {
  margin: 32px 0 8px;
  scroll-margin-top: 16px;
}

.doc p,
.doc ul,
.doc ol,
.doc pre,
.doc .table-scroll {
  margin-block: 0 14px;
}

.doc ul,
.doc ol {
  padding-left: 1.3em;
}

.doc li + li {
  margin-top: 6px;
}

.doc li > ul,
.doc li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}

.doc code {
  padding: 0.1em 0.32em;
  background: var(--tint);
  border-radius: 5px;
  /* break-word, not anywhere: a table column stays as wide as its longest name. */
  overflow-wrap: break-word;
}

.doc pre {
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--tint);
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.doc pre code {
  padding: 0;
  background: none;
  overflow-wrap: normal;
}

.table-scroll {
  overflow-x: auto;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

.doc th,
.doc td {
  padding: 8px 16px 8px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.doc th {
  font-weight: 600;
}

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

  .doc,
  .docs-nav {
    grid-column: 1;
    grid-row: auto;
  }

  .docs-nav {
    position: static;
    max-height: none;
    margin-top: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--rule);
  }

  .docs-jump {
    display: block;
    font-size: 1rem;
  }
}
