/* The pages written from the documents (tools/pages.mjs), on top of site.css: the contents at the side, the text in a
   column that reads well, and code and tables that scroll on their own when they are wider. */
.topbar {
  --bar-width: 1200px;
}

.docs {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 48px;
  box-sizing: border-box;
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.contents ul {
  position: sticky;
  top: 72px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 1.4;
}

.contents li + li {
  margin-top: 8px;
}

.contents a {
  color: #444;
  text-decoration: none;
}

.contents a:hover {
  color: #0b5cad;
  text-decoration: underline;
}

.doc {
  min-width: 0;
  max-width: 80ch;
  color: #1f2937;
}

.doc h1,
.doc h2,
.doc h3 {
  color: #14213d;
  line-height: 1.2;
}

.doc h1 {
  margin: 0 0 16px;
  font-size: 34px;
}

.doc h2 {
  margin: 48px 0 12px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 24px;
}

.doc h3 {
  margin: 32px 0 8px;
  font-size: 19px;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 16px;
}

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

.doc strong {
  color: #14213d;
}

.doc code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #eef1f5;
  font: 0.88em/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
  overflow-wrap: anywhere;
}

.doc pre {
  margin: 0 0 20px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f6f8fa;
}

.doc pre code {
  padding: 0;
  background: none;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: normal;
}

.doc .table {
  margin: 0 0 20px;
  overflow-x: auto;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.doc th,
.doc td {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: #f6f8fa;
  color: #14213d;
}

/* A name in a table keeps whole: the column takes its width, and a table wider than the text scrolls. */
.doc th code,
.doc td code {
  overflow-wrap: normal;
}

.doc pre:focus-visible,
.doc .table:focus-visible {
  outline: 2px solid #0b5cad;
  outline-offset: 2px;
}

/* On a narrow window the contents go above the text. */
@media (width < 860px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .contents ul {
    position: static;
    columns: 2;
  }
}
