/* ---------- documentation pages (loaded after site.css: same tokens, header, buttons)
   A place to read: a left menu of pages, the text in the middle, the headings of the page
   on the right. No horizontal scrolling on phones; wide tables scroll in their own box. */
/* horizontal clipping comes from site.css (overflow-x: clip keeps the sticky header working) */
body.docs { background: var(--ground); }
.docs { --read: #333a48; }
html:has(body.docs) { scroll-padding-top: 84px; }

/* header */
.dtop .dwrap { max-width: 1320px; height: 64px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 14px; }
.dtag { padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 7px; font: 600 12.5px/1 var(--sans); color: var(--muted); text-decoration: none; }
.dsearch { position: relative; margin-left: auto; width: min(340px, 36vw); display: flex; align-items: center; }
.dsearch > svg { position: absolute; left: 12px; width: 17px; height: 17px; stroke: var(--faint); fill: none; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.dsearch input { width: 100%; height: 40px; padding: 0 40px 0 38px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--text); font: 14.5px var(--sans); outline: none; }
.dsearch input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(95, 92, 240, 0.12); }
.dsearch input::-webkit-search-cancel-button { display: none; }
.dsearch kbd { position: absolute; right: 10px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 5px; font: 12px var(--mono); color: var(--faint); background: var(--ground); }
.dresults { position: absolute; top: 46px; left: 0; right: 0; z-index: 60; max-height: min(460px, 70vh); overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 30px 60px -24px rgba(21, 24, 33, 0.4); }
.dresults a { display: block; padding: 9px 11px; border-radius: 8px; text-decoration: none; }
.dresults a:hover, .dresults a.on { background: rgba(95, 92, 240, 0.08); }
.dresults b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.dresults small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dresults mark { background: rgba(95, 92, 240, 0.16); color: inherit; border-radius: 3px; }
.dresults p { margin: 10px 12px; font-size: 14px; color: var(--muted); }

/* shell: menu · text · on this page */
.dshell { max-width: 1320px; margin: 0 auto; padding: 0 28px; display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 48px; }
.dside { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow-y: auto; padding: 30px 6px 40px 0; }
.dgroup { margin-bottom: 22px; display: flex; flex-direction: column; gap: 1px; }
.dgroup b { margin: 0 12px 6px; font: 500 11.5px/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.dgroup a { padding: 7px 12px; border-radius: 8px; font-size: 14.5px; line-height: 1.35; color: var(--muted); text-decoration: none; }
.dgroup a:hover { color: var(--text); background: var(--raised); }
.dgroup a.on { color: var(--brand); background: rgba(95, 92, 240, 0.1); font-weight: 600; }

.dmain { min-width: 0; max-width: 780px; padding: 34px 0 60px; color: var(--read); font-size: 16.5px; line-height: 1.75; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--faint); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.dmain h1 { margin-top: 10px; font-size: clamp(30px, 4vw, 40px); line-height: 1.12; font-weight: 650; color: var(--text); letter-spacing: -0.03em; }
.dlead { margin-top: 14px; font-size: 19px; line-height: 1.6; color: var(--muted); }
.dmain h2 { position: relative; margin: 52px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 26px; line-height: 1.25; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.dmain h3 { position: relative; margin: 32px 0 8px; font-size: 19px; line-height: 1.35; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.anchor { margin-left: 8px; color: var(--line-2); text-decoration: none; opacity: 0; transition: opacity 0.15s; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.dmain p { margin: 14px 0 0; }
.dmain ul, .dmain ol { margin: 14px 0 0; padding-left: 24px; }
.dmain li { margin: 6px 0; padding-left: 4px; }
.dmain li::marker { color: var(--faint); }
.dmain strong { color: var(--text); font-weight: 600; }
.dmain a { color: var(--brand); text-decoration: underline; text-decoration-color: rgba(95, 92, 240, 0.35); text-underline-offset: 3px; }
.dmain a:hover { text-decoration-color: currentColor; }
.dmain code { padding: 1px 6px; border-radius: 5px; background: rgba(21, 24, 33, 0.06); font: 0.88em var(--mono); color: var(--text); overflow-wrap: anywhere; }
kbd { display: inline-block; min-width: 22px; padding: 0 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--panel); font: 600 0.82em/1.6 var(--mono); color: var(--text); text-align: center; }

.table { margin: 18px 0 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.dmain table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.dmain th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--text); background: var(--raised); border-bottom: 1px solid var(--line); white-space: nowrap; }
.dmain td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.dmain tr:first-child td { border-top: 0; }

.callout { margin: 20px 0 0; padding: 14px 18px; display: flex; gap: 12px; border-radius: 12px; border: 1px solid; font-size: 15.5px; line-height: 1.65; }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.callout-ic { flex: none; margin-top: 3px; }
.callout-ic svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.callout.note { background: #eef2ff; border-color: #d9defc; color: #333a6b; }
.callout.note .callout-ic { color: var(--brand); }
.callout.tip { background: #ebf8f1; border-color: #cdebdb; color: #22533a; }
.callout.tip .callout-ic { color: #1e9b5a; }
.callout.warn { background: #fdf5e7; border-color: #f2e0bb; color: #6b4a12; }
.callout.warn .callout-ic { color: #c98a12; }
.callout strong { color: inherit; }

.shot { margin: 24px 0 0; }
.shot-in { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 30px 60px -36px rgba(21, 24, 33, 0.35), 0 1px 3px rgba(21, 24, 33, 0.06); }
.shot img { display: block; width: 100%; height: auto; }
.shot.narrow .shot-in { width: fit-content; max-width: min(360px, 100%); margin: 0 auto; }
.shot.narrow img { width: auto; max-width: 100%; max-height: 620px; }
.shot.half .shot-in { max-width: 560px; margin: 0 auto; }
.shot figcaption { margin-top: 10px; text-align: center; font-size: 14px; color: var(--faint); }

.pager { margin-top: 64px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.pager a:hover { border-color: var(--brand); box-shadow: 0 12px 26px -18px rgba(95, 92, 240, 0.6); }
.pager small { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--faint); }
.pager small svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.pager b { font-size: 16px; font-weight: 600; color: var(--text); }
.pager .next { text-align: right; align-items: flex-end; }
.dfoot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--faint); }
.dfoot a { color: var(--muted); text-decoration: none; }

.dtoc { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow-y: auto; padding: 38px 0 40px; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.dtoc b { margin-bottom: 8px; font: 500 11.5px/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.dtoc a { padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.4; }
.dtoc a:hover { color: var(--text); }
.dtoc a.on { border-left-color: var(--brand); color: var(--brand); font-weight: 600; }

.dscrim { display: none; }

@media (max-width: 1180px) {
  .dshell { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
  .dtoc { display: none; }
}
@media (max-width: 900px) {
  .dtop .dwrap { padding: 0 16px; gap: 10px; }
  .dshell { display: block; padding: 0 20px; }
  .dburger { display: flex; }
  .dtag, .dsearch kbd { display: none; }
  .dsearch { width: auto; flex: 1; min-width: 0; margin-left: 4px; }
  .dtop .lang { display: none; }
  .dside { position: fixed; z-index: 45; top: 64px; bottom: 0; left: 0; width: min(320px, 86vw); max-height: none; padding: 20px 14px 40px; background: var(--panel); border-right: 1px solid var(--line); box-shadow: 30px 0 60px -30px rgba(21, 24, 33, 0.35); transform: translateX(-102%); transition: transform 0.25s ease; }
  body.menu .dside { transform: none; }
  .dscrim { position: fixed; inset: 64px 0 0; z-index: 44; display: block; background: rgba(21, 24, 33, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  body.menu .dscrim { opacity: 1; pointer-events: auto; }
  body.menu { overflow: hidden; }
  .dside .lang-in { display: inline-flex; }
  .dmain { padding-top: 22px; font-size: 16px; }
}
@media (max-width: 560px) {
  .dtop .brand { font-size: 0; gap: 0; }
  .dl-top span { display: none; }
  .dtop .dl-top { width: 42px; padding: 0; }
  .pager { grid-template-columns: 1fr; }
  .dmain h2 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { .dside, .dscrim { transition: none; } }
