/* ============================================================
   The tutorial: the chapter list beside the chapter, on the
   white ground of the sections, under the solid form of the top
   bar. Sizes are plain pixels: the page is text, and it reads at
   one size whatever the window.
   ============================================================ */
.docs-main { padding-top: var(--topbar-h); min-height: 100vh; }
.docs-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 48px 0 96px;
}

/* The chapter list keeps its place while the chapter scrolls. The
   chapter being read is lifted onto the row colour with a red edge, the
   mark the version list uses, and its sections hang under it. */
.docs-side {
  position: sticky;
  top: calc(var(--topbar-h) + 32px);
  max-height: calc(100vh - var(--topbar-h) - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.docs-side-title {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  line-height: 1.4;
  color: var(--red);
}
.docs-side-title::before { content: ""; width: 28px; height: 2px; border-radius: 2px; background: var(--red); }
html:lang(en) .docs-side-title { letter-spacing: 1.5px; text-transform: uppercase; }
.docs-chapters, .docs-sections { list-style: none; margin: 0; padding: 0; }
.docs-chapters > li + li { margin-top: 2px; }
.docs-chapters a {
  display: block;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 15px;
  color: #333333;
  transition: background .15s ease, color .15s ease;
}
.docs-chapters a:hover { background: var(--paper-grey); color: var(--ink); }
.docs-chapters > li > a[aria-current="page"] {
  position: relative;
  background: var(--row-hover);
  color: var(--ink);
  font-weight: 700;
}
.docs-chapters > li > a[aria-current="page"]::before {
  content: "";
  position: absolute; left: 4px; top: 25%;
  width: 3px; height: 50%;
  border-radius: 2px;
  background: var(--red);
}
.docs-sections { margin: 4px 0 8px 14px; padding-left: 10px; border-left: 1px solid var(--track); }
.docs-sections a { padding: 6px 12px; font-size: 13.5px; color: var(--ink-2); }

/* The chapter sets its own heading sizes: the page's h1 and h2 are set
   for the key art and the section heads. */
.docs-article {
  /* The site's red, darkened for 5:1 on white; the links in the text. */
  --link: #C8381B;
  min-width: 0;
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
}
.docs-article h1 {
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--track);
  font-size: 34px;
  line-height: 1.25;
  letter-spacing: 0;
  text-shadow: none;
}
/* A heading reached by its anchor stops clear of the fixed top bar. */
.docs-article [id] { scroll-margin-top: calc(var(--topbar-h) + 24px); }
.docs-article h2 { margin: 44px 0 14px; font-size: 24px; line-height: 1.3; }
.docs-article h3 { margin: 30px 0 10px; font-size: 19px; line-height: 1.4; }
.docs-article h4 { margin: 24px 0 8px; font-size: 16px; }
.docs-article p { margin: 0 0 16px; }
/* A link in the text is set in the darker red, a little heavier than the
   words around it, with no underline until the pointer is on it; then it
   brightens to the site's red and its underline fades in, clear of the
   descenders. */
.docs-article a {
  color: var(--link);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.docs-article a:hover, .docs-article a:focus-visible { color: var(--red); text-decoration-color: currentColor; }
.docs-article a code { color: inherit; }
.docs-article ul, .docs-article ol { margin: 0 0 16px; padding-left: 1.7em; }
.docs-article li { margin: 4px 0; }
.docs-article li > p { margin: 0; }
.docs-article pre {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--track);
  border-radius: 12px;
  background: var(--paper-grey);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
}
.docs-article pre code { padding: 0; background: none; color: var(--ink); font-size: inherit; }
.docs-article blockquote {
  margin: 0 0 18px;
  padding: 12px 18px;
  border-left: 3px solid var(--purple);
  border-radius: 0 12px 12px 0;
  background: var(--row-hover);
  color: #333333;
}
.docs-article blockquote p:last-child { margin-bottom: 0; }
/* A table sits in a frame that scrolls sideways when the table is wider
   than the column, as a code block does, so a phone shows all of it. */
.docs-article .table-wrap { margin: 0 0 18px; overflow-x: auto; scrollbar-width: thin; }
.docs-article table { width: 100%; border-collapse: collapse; font-size: 15px; }
.docs-article th, .docs-article td { padding: 10px 12px; border-bottom: 1px solid var(--track); text-align: left; vertical-align: top; }
.docs-article th { border-bottom-width: 2px; color: var(--ink-2); font-weight: 700; }
.docs-article img { margin: 20px auto; border-radius: 12px; box-shadow: var(--soft-shadow); }
.docs-article figure { margin: 20px 0; text-align: center; }
.docs-article figcaption { margin-top: -8px; font-size: 13px; color: var(--ink-3); }
.docs-article hr { margin: 32px 0; border: 0; border-top: 1px solid var(--track); }
/* A video player embedded from another site keeps a 16:9 frame and never
   grows past the text column. */
.docs-article .video {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 800px;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
}
.docs-article .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.docs-article input[type="checkbox"] { margin-right: 6px; }
.docs-article .footnote-definition { font-size: 14px; color: var(--ink-2); }
.docs-article .footnote-definition p { display: inline; }

/* The way to the chapters before and after. */
.docs-pager {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--track);
}
.docs-pager a {
  display: inline-flex; align-items: center; gap: 12px;
  max-width: 48%;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--paper-grey);
  color: var(--ink);
  text-decoration: none;
  transition: background .15s ease;
}
.docs-pager a:hover { background: var(--track); color: var(--ink); }
.docs-pager .next { margin-left: auto; text-align: right; }
.docs-pager [data-icon] { font-size: 16px; color: var(--ink-3); }
.docs-pager-label { display: block; font-size: 12px; color: var(--ink-3); }
.docs-pager b { display: block; font-size: 15px; font-weight: 700; }

/* Narrow screens: the chapters as a row of pills above the chapter, on
   the marble ground the sections use. In a column, align-items sets the
   width, so the chapter is stretched to the full width: left at the wide
   layout's start alignment it would take the width of its widest table
   and run past the edge of the page. */
@media (max-width: 900px) {
  .docs-layout { display: flex; flex-direction: column; align-items: stretch; gap: 28px; padding: 28px 0 70px; }
  .docs-side { position: static; max-height: none; overflow: visible; }
  .docs-chapters { display: flex; flex-wrap: wrap; gap: 6px; }
  .docs-chapters > li + li { margin-top: 0; }
  .docs-chapters a { padding: 7px 14px; border-radius: 999px; background: #FFFFFF; font-size: 14px; }
  .docs-chapters > li > a[aria-current="page"]::before { display: none; }
  .docs-sections { display: none; }
  .docs-article h1 { font-size: 26px; }
  .docs-article h2 { font-size: 20px; }
  .docs-pager { flex-direction: column; }
  .docs-pager a { max-width: none; }
  .docs-pager .next { margin-left: 0; }
}
