/* Guide navigation: the chapters in five groups as a rail, a "Chapters"
   disclosure on phones, and the chapter's own contents on wide screens. */
.docs-layout {
  display: grid;
  grid-template-columns: var(--measure-rail) minmax(0, 1fr);
  gap: var(--space-12);
  align-items: start;
}
/* The rail scrolls on its own when it is taller than the window. */
.docs-sidebar {
  min-width: 0;
  position: sticky;
  top: var(--space-4);
  display: grid;
  gap: var(--space-3);
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-bottom: var(--space-2);
}
.docs-sidebar-title,
.docs-nav-heading,
.docs-chapters-label,
.docs-toc-title {
  font-family: var(--font-display);
  font-stretch: var(--wdth-label);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}
.docs-chapters > summary {
  display: none;
}
.docs-chapters,
.docs-nav-group {
  min-width: 0;
}
.docs-nav,
.docs-nav-group {
  grid-template-columns: minmax(0, 1fr);
}
.docs-nav {
  display: grid;
  gap: 0;
  border-left: var(--size-hairline) solid var(--color-border);
}
.docs-nav-group {
  display: grid;
}
.docs-nav-group + .docs-nav-group {
  margin-top: var(--space-3);
}
.docs-nav-heading {
  margin: 0;
  padding: var(--space-1) var(--space-3);
}
.docs-nav-link {
  min-width: 0;
  overflow-wrap: anywhere;
  margin-left: calc(-1 * var(--size-hairline));
  padding: var(--space-2) var(--space-3);
  border-left: var(--size-rule) solid transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
}
.docs-nav-link:hover {
  background: var(--color-bg-inset);
  color: var(--color-text-primary);
}
.docs-nav-link.is-current {
  border-left-color: var(--color-solar-500);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-weight: 600;
}
/* On this page: the chapter's sections, beside the article, from 1200 px
   and only while the chapter keeps a readable width. The section around
   the layout is the query container, and its width is compared in rem, so
   enlarged text (200 %) drops the column instead of squeezing the chapter
   under it: the rail, the gaps and the column take 29.5rem, which leaves
   the chapter at least 36.5rem. */
.docs-toc {
  display: none;
}
.content-section:has(> .docs-layout) {
  container: docs-layout / inline-size;
}
@media (min-width: 1200px) {
  @container docs-layout (min-width: 66rem) {
    .docs-layout.has-toc {
      grid-template-columns: var(--measure-rail) minmax(0, 1fr) var(
          --size-col-md
        );
      gap: var(--space-10);
    }
    .docs-toc {
      position: sticky;
      top: var(--space-4);
      display: grid;
      gap: var(--space-2);
      max-height: calc(100vh - var(--space-8));
      overflow-y: auto;
      scrollbar-width: thin;
    }
    .docs-toc-title {
      margin: 0;
    }
    .docs-toc ul {
      display: grid;
      gap: 0;
      margin: 0;
      padding: 0;
      list-style: none;
      border-left: var(--size-hairline) solid var(--color-border);
    }
    .docs-toc a {
      display: block;
      padding: var(--space-1) var(--space-3);
      color: var(--color-text-secondary);
      font-size: var(--text-sm);
      line-height: 1.35;
      text-decoration: none;
    }
    .docs-toc a:hover {
      color: var(--color-text-primary);
      text-decoration: underline;
    }
  }
}
/* Phones, and wide screens with enlarged text: one "Chapters" row that
   names the current chapter and opens the whole grouped list, with rows a
   thumb can hit. The page container (portal-shell-base.css) is compared in
   rem: 47.5rem is 760 px at the normal text size and grows with the text. */
@container page (max-width: 47.5rem) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }
  .docs-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: 0;
  }
  .docs-sidebar-title {
    display: none;
  }
  .docs-chapters {
    border: var(--size-hairline) solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--color-bg-surface);
  }
  .docs-chapters > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--size-control);
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    list-style: none;
  }
  .docs-chapters > summary::-webkit-details-marker {
    display: none;
  }
  .docs-chapters > summary::after {
    content: "";
    flex: 0 0 auto;
    width: var(--size-chevron);
    height: var(--size-chevron);
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.12s;
  }
  .docs-chapters[open] > summary::after {
    transform: rotate(-135deg);
  }
  .docs-chapters[open] > summary {
    border-bottom: var(--size-hairline) solid var(--color-border);
  }
  .docs-chapters-current {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--color-text-primary);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
  }
  .docs-nav {
    padding: var(--space-2) 0;
    border-left: 0;
  }
  .docs-nav-group + .docs-nav-group {
    margin-top: var(--space-2);
  }
  .docs-nav-heading {
    padding: var(--space-2) var(--space-4) var(--space-1);
  }
  .docs-nav-link {
    display: flex;
    align-items: center;
    min-height: var(--size-control);
    margin-left: 0;
    padding: var(--space-2) var(--space-4);
  }
  .docs-nav-link.is-current {
    background: var(--color-bg-inset);
  }
}
