/* The documentation's layout on the site's system: the page's .wrap, a list of chapters down the
   left, the chapter in one readable column, and the chapter's own headings down the right on wide
   screens. Every colour, size and radius is the system's token, so the docs read as the site does. */
.docs { padding-top: calc(var(--nav) + var(--s-8)); padding-bottom: var(--s-10); }
.docs__grid { display: grid; grid-template-columns: 232px minmax(0, 1fr) 200px; gap: var(--s-8); align-items: start; }
@media (max-width: 1199px) { .docs__grid { grid-template-columns: 220px minmax(0, 1fr); } .docs__toc { display: none; } }
@media (max-width: 899px) { .docs__grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); } }

/* the chapters */
.docs__side { position: sticky; top: calc(var(--nav) + var(--s-6)); max-height: calc(100vh - var(--nav) - var(--s-8)); overflow: auto; padding-right: var(--s-2); }
.docs__side p { font-size: 13px; font-weight: 500; color: var(--muted); margin: var(--s-6) 0 var(--s-2); }
.docs__side p:first-child { margin-top: 0; }
.docs__side ul { list-style: none; margin: 0; padding: 0; }
.docs__side a { display: block; padding: 7px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-size: 15px; line-height: 1.4; }
.docs__side a:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 6%, transparent); }
.docs__side a[aria-current="page"] { color: var(--p-accent); background: #203b38; }
/* On a phone the side list gives way to one row that opens the chapters (.docs__pick). */
.docs__pick { display: none; }
@media (max-width: 899px) {
  .docs__side { display: none; }
  .docs__pick { display: block; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--p-surface); }
  .docs__pick summary { display: flex; align-items: center; gap: var(--s-3); min-height: 48px; padding: 0 var(--s-4); cursor: pointer; font-weight: 500; list-style: none; }
  .docs__pick summary::-webkit-details-marker { display: none; }
  .docs__pick summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
  .docs__pick[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
  .docs__pick summary span { font-size: 13px; font-weight: 500; color: var(--muted); }
  .docs__pick p { font-size: 13px; font-weight: 500; color: var(--muted); margin: var(--s-4) var(--s-4) var(--s-1); }
  .docs__pick ul { list-style: none; margin: 0; padding: 0 var(--s-2) var(--s-2); }
  .docs__pick a { display: block; padding: 10px var(--s-2); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
  .docs__pick a[aria-current="page"] { color: var(--p-accent); background: #203b38; }
}

/* the chapter */
.prose { max-width: 72ch; font-size: 17px; line-height: 1.7; }
.prose > * + * { margin-top: var(--s-4); }
.prose h1 { font: var(--display-weight) clamp(34px, 2vw + 20px, 48px)/1.1 var(--font-display); letter-spacing: var(--display-tracking); margin: 0 0 var(--s-4); }
.prose .lede { font-size: 20px; line-height: 1.6; color: var(--muted); margin-bottom: var(--s-8); }
.prose h2 { font: 500 28px/1.25 var(--font-display); letter-spacing: -0.015em; margin-top: var(--s-9); padding-top: var(--s-6); border-top: 1px solid var(--line); scroll-margin-top: calc(var(--nav) + var(--s-6)); }
.prose h3 { font: 500 20px/1.35 var(--font-text); margin-top: var(--s-7); scroll-margin-top: calc(var(--nav) + var(--s-6)); }
.prose p, .prose li { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: var(--s-2); }
.prose a { color: var(--p-accent); text-underline-offset: 3px; }
.prose code, .prose kbd { font: 14px/1 var(--font-mono); }
.prose kbd { display: inline-block; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--p-surface); color: var(--ink); white-space: nowrap; }
.prose code { padding: 2px 6px; border-radius: 6px; background: var(--p-surface); }
.prose figure { margin: var(--s-6) 0; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid #2f3133; }
.prose figcaption { margin-top: var(--s-2); font-size: 14px; line-height: 1.5; color: var(--muted); }
/* One panel cut from the screen keeps its own width beside its caption, as it reads in the app. */
.prose figure.fig--panel { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: var(--s-5); align-items: end; }
@media (max-width: 640px) { .prose figure.fig--panel { grid-template-columns: minmax(0, 1fr); } .prose figure.fig--panel img { max-width: 320px; } }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; margin-top: var(--s-5); }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 500; color: var(--muted); font-size: 13px; }
.prose td:first-child { white-space: nowrap; }
.prose pre { overflow-x: auto; padding: var(--s-4); border-radius: var(--r-md); background: var(--p-surface); font-size: 14px; line-height: 1.55; }
.prose pre code { padding: 0; background: none; }
.prose code { overflow-wrap: anywhere; }
/* A table on a phone: each row a small card of its cells, each cell led by its column's heading. */
@media (max-width: 640px) {
  .prose { font-size: 16px; }
  .prose .lede { font-size: 18px; }
  .prose table.stack thead { display: none; }
  .prose table.stack, .prose table.stack tbody, .prose table.stack tr { display: block; width: 100%; }
  .prose table.stack tr { padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
  .prose table.stack td { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: var(--s-3); padding: 3px 0; border: 0; white-space: normal; }
  .prose table.stack td::before { content: attr(data-l); color: var(--muted); font-size: 13px; line-height: 1.6; }
  .prose table.stack td:first-child { font-weight: 500; }
  .prose table.stack td:empty { display: none; }
  .docs__next { flex-direction: column; }
  .docs__next a:last-child { margin-left: 0; }
}
.prose .note { border-left: 2px solid var(--p-accent); padding: var(--s-3) var(--s-5); background: color-mix(in oklab, var(--p-accent) 6%, transparent); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.prose .where { font-size: 14px; color: var(--muted); }
.docs__next { display: flex; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-9); padding-top: var(--s-6); border-top: 1px solid var(--line); }
.docs__next a { display: grid; gap: 2px; padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); min-width: 0; }
.docs__next a:hover { border-color: var(--line-strong); }
.docs__next span { font-size: 13px; color: var(--muted); }
.docs__next a:last-child { text-align: right; margin-left: auto; }

/* the chapter's headings */
.docs__toc { position: sticky; top: calc(var(--nav) + var(--s-6)); font-size: 14px; }
.docs__toc p { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 var(--s-2); }
.docs__toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.docs__toc a { display: block; padding: 5px 0 5px 14px; color: var(--muted); text-decoration: none; line-height: 1.4; }
.docs__toc a:hover { color: var(--ink); }

/* the index's chapter cards */
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s-4); margin-top: var(--s-6); max-width: none; }
.chapters a { display: grid; gap: var(--s-2); padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--p-surface); text-decoration: none; color: var(--ink); transition: transform .2s, border-color .2s; }
.chapters a:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.chapters b { font-weight: 500; font-size: 18px; }
.chapters span { color: var(--muted); font-size: 15px; line-height: 1.5; }
.prose .chapters + h2 { margin-top: var(--s-8); }
