/* The docs (pages.mjs docsPage): the tool's README over a few pages. On top of home.css and page.css: the front page's
   ink, type, top and foot. A column of the pages on the left, the reading in the middle at a comfortable measure;
   code in the same deep boxes as the rest of the site. Yellow only marks where you are. */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); padding-block: 40px 96px; }

/* the column of pages, and the sections of the one you are on */
.dside ul { list-style: none; margin: 0; padding: 0; }
.dside > ul { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: thin; }
.dside > ul > li > a { display: block; padding: 7px 12px; border-radius: 8px; font-size: 15px; font-weight: 500; color: var(--soft); }
.dside a:hover { color: var(--paper); }
.dside a[aria-current="page"] { color: var(--paper); background: var(--deep); box-shadow: inset 3px 0 0 var(--lit); }
.dside li ul { margin: 6px 0 12px 12px; padding-left: 12px; border-left: 1px solid var(--rule); }
.dside li ul a { display: block; padding: 4px 0; font-size: 13.5px; line-height: 1.4; color: var(--dim); }

.dmain { max-width: 760px; min-width: 0; }
.dmain .crumb { margin-bottom: 14px; }
.dmain h1 { font: 800 clamp(36px, 4.6vw, 56px)/1.02 var(--display); letter-spacing: -.04em; }

/* the reading */
.prose { margin-top: 28px; font-size: 16.5px; line-height: 1.7; color: #d4d3cd; }
.prose > * + * { margin-top: 18px; }
.prose h2, .prose h3, .prose h4 { position: relative; color: var(--paper); scroll-margin-top: 20px; }
.prose h2 { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule); font: 700 clamp(24px, 2.6vw, 30px)/1.15 var(--display); letter-spacing: -.025em; }
.prose h3 { margin-top: 36px; font: 700 20px/1.25 var(--display); letter-spacing: -.015em; }
.prose h4 { margin-top: 28px; font: 600 17px/1.3 var(--sans); }
.prose > h2:first-child { margin-top: 8px; padding-top: 0; border-top: 0; }
.prose .hash { position: absolute; left: -1.1em; width: 1em; color: var(--dim); opacity: 0; font-weight: 400; }
.prose h2 .hash { top: 28px; }
.prose > h2:first-child .hash { top: 0; }
.prose :is(h2, h3, h4):hover .hash, .prose .hash:focus-visible { opacity: 1; }
.prose a:not(.hash) { color: var(--paper); text-decoration: underline; text-decoration-color: rgb(236 235 230 / .35); text-underline-offset: 3px; }
.prose a:not(.hash):hover { text-decoration-color: var(--paper); }
.prose strong { color: var(--paper); font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--dim); }
.prose blockquote { margin-inline: 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--rule); color: var(--soft); }
.prose hr { border: 0; border-top: 1px solid var(--rule); }
.prose img { max-width: 100%; border-radius: 10px; }

/* code: inline in a small deep chip; blocks in a deep box with a copy button */
.prose code { font: .88em var(--mono); font-variant-ligatures: none; background: var(--deep); padding: .12em .38em; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--rule); color: var(--paper); overflow-wrap: anywhere; }
.prose .code { position: relative; border-radius: 12px; background: var(--deep); box-shadow: inset 0 0 0 1px var(--rule); }
.prose .code pre { margin: 0; padding: 16px 18px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; font: 400 13.5px/1.65 var(--mono); color: var(--paper); }
.prose .code pre code { font: inherit; font-variant-ligatures: none; background: none; padding: 0; box-shadow: none; overflow-wrap: normal; }
.prose .code button { position: absolute; top: 8px; right: 8px; border: 1px solid rgb(236 235 230 / .2); background: var(--deep); color: var(--soft); border-radius: 6px; padding: 3px 10px; font: 500 12px var(--sans); opacity: 0; transition: opacity .15s; }
.prose .code:hover button, .prose .code button:focus-visible { opacity: 1; }
.prose .code button:hover { color: var(--paper); border-color: var(--paper); }
@media (hover: none) { .prose .code button { opacity: 1; } }

/* tables: in a box that scrolls sideways on a phone */
.prose .table { overflow-x: auto; scrollbar-width: thin; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--rule); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 600; color: var(--paper); background: var(--deep); white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child code { white-space: nowrap; }

/* back and next, and where the words come from */
.dnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.dnext a { display: grid; gap: 2px; padding: 16px 18px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--rule); font: 600 17px/1.3 var(--display); }
.dnext a:hover { box-shadow: inset 0 0 0 1px var(--soft); }
.dnext small { font: 500 13px var(--sans); color: var(--soft); }
.dnext .next { grid-column: 2; text-align: right; }
.from { margin-top: 28px; font-size: 14px; color: var(--dim); }
.from a { color: var(--soft); text-decoration: underline; text-underline-offset: 3px; }

/* a phone: the pages become a row above the reading */
@media (max-width: 860px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 8px; }
  .dside > ul { position: static; display: flex; gap: 6px; max-height: none; overflow-x: auto; padding-bottom: 6px; margin-inline: calc(-1 * max(16px, 4vw)); padding-inline: max(16px, 4vw); }
  .dside > ul > li > a { white-space: nowrap; box-shadow: inset 0 0 0 1px var(--rule); }
  .dside a[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--lit); }
  .dside li ul { display: none; }
  .prose .hash { display: none; }
  /* a table: each row a small card, its first cell (the name) over the rest */
  .prose .table { overflow: visible; box-shadow: none; border-radius: 0; }
  .prose table, .prose tbody, .prose tr, .prose td { display: block; width: auto; }
  .prose thead { display: none; }
  .prose tr { padding: 12px 14px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--rule); }
  .prose tr + tr { margin-top: 8px; }
  .prose td { padding: 0; border: 0; }
  .prose td + td { margin-top: 6px; color: var(--soft); }
  .prose td:first-child { color: var(--paper); font-weight: 600; }
  .prose td:first-child code { white-space: normal; }
  .dnext { grid-template-columns: 1fr; }
  .dnext .next { grid-column: 1; }
}
