/*
  Docs pages (generated into site/docs/ by tools/build-docs). Loaded after site.css and reuses
  its design tokens. Wide screens: a list of pages on the left, the page beside it. Phones:
  the list stacks above the page. The screencast takes the full width of the page column.
*/

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding-top: 56px;
  align-items: start;
}

/* ---- the list of pages ----------------------------------------------------------------- */

.docs-nav {
  position: sticky;
  top: 88px;
  font-size: 0.95rem;
}

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

.docs-nav a {
  display: block;
  padding: 6px 12px;
  border-left: 3px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}

.docs-nav a:hover {
  color: var(--text);
  border-left-color: var(--border-strong);
}

/* The current page carries the same coloured rail the bar's workspace rows have. */
.docs-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  border-left-color: var(--rail-violet);
  background: var(--surface);
}

/* ---- the page -------------------------------------------------------------------------- */

.docs-page {
  max-width: 760px;
  min-width: 0;
}

.docs-page h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
}

.docs-page .lead {
  color: var(--muted);
  font-size: 1.15rem;
  margin-bottom: 28px;
}

.docs-page h2 {
  font-size: 1.4rem;
  font-weight: 650;
  margin: 44px 0 12px;
  padding-left: 16px;
  border-left: 4px solid var(--rail-violet);
}

.docs-page h3 {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 28px 0 8px;
}

.docs-page p,
.docs-page li {
  color: var(--muted);
}

.docs-page strong {
  color: var(--text);
  font-weight: 600;
}

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

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

.docs-page pre {
  overflow-x: auto;
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.docs-page pre code {
  background: none;
  border: 0;
  padding: 0;
}

.docs-page table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 1.4em;
}

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

.docs-page th {
  color: var(--text);
  font-weight: 600;
}

.docs-page blockquote {
  margin: 0 0 1em;
  padding: 2px 16px;
  border-left: 3px solid var(--border-strong);
}

/* ---- the screencast -------------------------------------------------------------------- */

.clip {
  margin: 0 0 32px;
}

.clip video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

/* ---- the index page -------------------------------------------------------------------- */

.docs-page .docs-index {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
}

.docs-index li {
  display: grid;
  gap: 2px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.docs-index a {
  font: 600 1.1rem/1.3 var(--font-display);
}

.docs-index span {
  color: var(--muted);
}

/* ---- phones ---------------------------------------------------------------------------- */

@media (max-width: 820px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-top: 32px;
  }

  /* The page comes first on a phone; the list of pages follows it. */
  .docs-nav {
    position: static;
    order: 2;
  }

  /* The list wraps into a row of pills instead of taking a screen of its own. */
  .docs-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .docs-nav a {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
  }

  .docs-nav a[aria-current="page"] {
    border-color: var(--rail-violet);
  }
}
