/* Docs pages. The same rehearsal room as the home page, quieter: the page is a sheet of paper on
   the stage floor, and a strip of spike tape marks where you are in the sidebar, as tape on a
   stage marks where a performer stands. Builds on styles.css. */

.docs-layout {
  max-width: var(--page);
  margin: 0 auto;
  padding: 8px var(--gutter) clamp(48px, 7vw, 96px);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

/* Sidebar */
.docs-nav {
  position: sticky;
  top: 24px;
  font-size: 1rem;
}

.nav-section {
  font: 800 1.3rem/1.1 var(--display);
  letter-spacing: 0.01em;
  margin: 26px 0 8px;
}

.docs-nav .nav-section:first-child,
.docs-menu .nav-section:first-child {
  margin-top: 4px;
}

.docs-nav ul,
.docs-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-nav li,
.docs-menu li {
  position: relative;
  padding: 4px 0 4px 26px;
}

.docs-nav a,
.docs-menu a {
  text-decoration: none;
  color: var(--ink-soft);
}

.docs-nav a:hover,
.docs-menu a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.docs-nav .here a,
.docs-menu .here a {
  color: var(--ink);
  font-weight: 700;
}

/* You are here. */
.here::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 18px;
  height: 8px;
  background: var(--pink);
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 88% 0, 94% 12%, 100% 4%, 100% 92%, 94% 100%, 88% 90%, 12% 100%, 6% 88%, 0 96%);
  transform: rotate(-6deg);
}

/* The same menu, folded, above the page on narrow screens. */
.docs-menu {
  display: none;
}

/* The page */
/* Not the home page's centred <main>: with auto margins a grid item sizes to its widest line of
   code instead of its column. */
.docs-page {
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0;
}

.prose {
  background: var(--paper);
  padding: clamp(24px, 4.5vw, 60px);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(20, 32, 43, 0.3);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.prose > * {
  max-width: 70ch;
}

.prose > pre,
.prose > .table-wrap {
  max-width: none;
}

.prose h1 {
  font: 900 clamp(2.6rem, 6vw, 4.25rem) / 0.95 var(--display);
  letter-spacing: -0.005em;
  margin: 0 0 24px;
  max-width: 18ch;
}

.prose h2 {
  font: 800 clamp(1.7rem, 3vw, 2.1rem) / 1.05 var(--display);
  letter-spacing: 0.005em;
  margin: 2.2em 0 0.6em;
  padding-top: 0.9em;
  border-top: 1px solid var(--line);
}

.prose h3 {
  font-size: 1.15rem;
  margin: 1.8em 0 0.4em;
}

.prose .anchor {
  text-decoration: none;
}

.prose .anchor:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose code {
  font: 400 0.9em/1.4 var(--mono);
  background: var(--floor);
  padding: 0.12em 0.36em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 0 0 1.2em;
  background: var(--ink);
  color: #e8edf2;
  padding: 18px 22px;
  overflow-x: auto;
  border-radius: 6px;
  font: 400 0.9rem/1.6 var(--mono);
}

.prose pre code {
  background: none;
  padding: 0;
  font: inherit;
  overflow-wrap: normal;
}

/* Tables scroll inside their own box on a phone. */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.4em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  line-height: 1.5;
}

.prose th {
  text-align: left;
  padding: 0 14px 8px 0;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}

.prose td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.prose td:first-child {
  white-space: nowrap;
}

/* A marked-off note, like the home page's "Not counted as bugs". */
.callout {
  border: 2px dashed var(--ink-soft);
  padding: 16px 22px;
  margin: 0 0 1.4em;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Previous and next */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
}

.pager a {
  display: grid;
  gap: 2px;
  font-weight: 700;
  text-decoration: none;
}

.pager a:hover {
  text-decoration: underline;
}

.pager span {
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.pager-next {
  text-align: right;
  margin-left: auto;
}

.edit {
  margin: 28px 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

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

  .docs-nav {
    display: none;
  }

  .docs-menu {
    display: block;
    background: var(--paper);
    box-shadow: 0 1px 0 var(--line);
  }

  .docs-menu summary {
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 700;
  }

  .docs-menu nav {
    padding: 0 18px 16px;
  }
}

@media (max-width: 560px) {
  .prose td:first-child {
    white-space: normal;
  }
}
