/* ════════════════════════════════════════════════════════════════════
   Docs: layout, reading styles, search and print.
   Colours, fonts, nav, buttons and footer come from /css/site.css.
   ════════════════════════════════════════════════════════════════════ */

/* Pages crossfade into each other, and the sidebar stays put */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

:root {
  --docs-top: calc(60px + env(safe-area-inset-top, 0px));  /* height of the site nav */
  --docs-bar: 0px;                                         /* the phone bar under it */
  --side-w: 264px;
  --toc-w: 232px;
  --read-w: 740px;
}
html { scroll-padding-top: calc(var(--docs-top) + var(--docs-bar) + 24px); }

.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip {
  position: fixed; z-index: 1000; top: 8px; left: 8px;
  padding: 10px 14px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500; text-decoration: none;
  transform: translateY(-160%); transition: transform .15s;
}
.skip:focus-visible { transform: none; }
.dmain:focus, #doc:focus { outline: none; }

kbd {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); color: var(--text-dim);
  font: 500 11.5px/1 var(--mono-font);
}

/* Small buttons used across the docs */
.dbtn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.dbtn i { font-size: 16px; color: var(--text-dim); }
.dbtn:hover { background: var(--hover); color: var(--text-strong); }
.dbtn-icon { width: 32px; padding: 0; justify-content: center; }
.dbtn.is-done i { color: var(--link); }

/* ════════════════════════════════════════════════════════════════════
   Layout: sidebar, article, "On this page"
   ════════════════════════════════════════════════════════════════════ */
.docs {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w);
  gap: 0 clamp(32px, 4vw, 64px);
  width: min(1440px, 100% - 48px);
  margin-inline: auto;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.dside {
  position: sticky; top: var(--docs-top);
  height: calc(100dvh - var(--docs-top));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 20px 48px 0;
  border-right: 1px solid var(--border);
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  view-transition-name: docs-sidebar;
}
.dside-search {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 40px; padding: 0 8px 0 12px; margin-bottom: 22px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--input-bg); color: var(--label);
  font: inherit; font-size: 14px; text-align: left;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.dside-search i { font-size: 17px; }
.dside-search span { flex: 1; }
.dside-search:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--border-strong)); color: var(--text-dim); }

.dside-nav { display: flex; flex-direction: column; gap: 18px; font-size: 14px; }
.dside-home {
  display: flex; align-items: center; gap: 9px;
  height: 34px; padding: 0 10px; margin: 0 -2px;
  border-radius: 8px;
  color: var(--text-dim); font-weight: 500; text-decoration: none;
  transition: background-color .12s, color .12s;
}
.dside-home i { font-size: 17px; color: var(--label); }
.dside-home:hover { background: var(--hover); color: var(--text-strong); }
.dside-home[aria-current="page"] { background: var(--active); color: var(--text-strong); }

.dside-group summary {
  display: flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 8px;
  border-radius: 8px;
  color: var(--text-strong); font-size: 13px; font-weight: 600;
  list-style: none; cursor: pointer;
  user-select: none;
}
.dside-group summary::-webkit-details-marker { display: none; }
.dside-group summary i:first-child { font-size: 17px; color: var(--link); }
.dside-group summary span { flex: 1; }
.dside-group summary:hover { background: var(--hover); }
.dside-chev { color: var(--label); font-size: 15px; transition: transform .2s; }
.dside-group:not([open]) .dside-chev { transform: rotate(-90deg); }
.dside-group ul { list-style: none; margin: 4px 0 0 17px; padding: 0; border-left: 1px solid var(--border); }
.dside-group a {
  position: relative;
  display: block;
  padding: 6px 10px 6px 16px;
  color: var(--text-dim); text-decoration: none; line-height: 1.4;
  transition: color .12s;
}
.dside-group a::before {
  content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px;
  border-radius: 2px; background: transparent;
  transition: background-color .15s;
}
.dside-group a:hover { color: var(--text-strong); }
.dside-group a:hover::before { background: var(--border-strong); }
.dside-group a[aria-current="page"] { color: var(--text-strong); font-weight: 500; }
.dside-group a[aria-current="page"]::before { background: var(--accent); }

/* ── Article ─────────────────────────────────────────────────────── */
.dmain { min-width: 0; padding: clamp(36px, 5vw, 64px) 0 96px; }
.doc { max-width: var(--read-w); }

.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 18px; padding: 0; list-style: none; font-size: 13px; }
.crumbs li { display: inline-flex; align-items: center; gap: 4px; color: var(--label); }
.crumbs li + li::before { content: "/"; margin-right: 2px; color: var(--border-strong); }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current] { color: var(--text); }

.doc-head h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(36px, 5vw, 56px); font-weight: 600; line-height: 1.02; letter-spacing: -.045em;
  text-wrap: balance;
}
.doc-lead { margin: 16px 0 0; max-width: 58ch; color: var(--text-dim); font-size: 17.5px; line-height: 1.55; text-wrap: pretty; }
.doc-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  margin-top: 26px; padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-size: 13.5px;
}
.doc-meta-item { display: inline-flex; align-items: center; gap: 7px; }
.doc-meta-item i { color: var(--label); font-size: 16px; }
.doc-actions { display: flex; gap: 6px; margin-left: auto; }

/* The "more" menu uses the Popover API; docs.js positions it under its button */
.dmenu {
  inset: auto; margin: 0;
  min-width: 232px; padding: 5px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .6);
}
.dmenu:popover-open { display: flex; flex-direction: column; }
.dmenu a, .dmenu button {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 13.5px; text-align: left; text-decoration: none;
  cursor: pointer;
}
.dmenu i { font-size: 17px; color: var(--label); }
.dmenu a:hover, .dmenu button:hover, .dmenu a:focus-visible, .dmenu button:focus-visible { background: var(--hover); color: var(--text-strong); outline: none; }

/* The short version, above the text */
.summary {
  position: relative;
  margin: 32px 0 0; padding: 22px 24px 18px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.summary::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--line-1), var(--line-2), var(--line-3));
}
.summary-title { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; color: var(--text-strong); font-size: 15px; font-weight: 600; }
.summary-title i { color: var(--link); font-size: 18px; }
.summary ul { list-style: none; margin: 0; padding: 0; }
.summary li { position: relative; padding: 9px 0 9px 22px; border-top: 1px solid var(--border); color: var(--text); font-size: 14.5px; line-height: 1.55; }
.summary li:first-child { border-top: 0; }
.summary li::before { content: ""; position: absolute; left: 3px; top: 17px; width: 6px; height: 6px; border-radius: 50%; background: var(--link); }
.summary a { color: var(--link); font-size: 13px; white-space: nowrap; text-decoration: none; margin-left: 4px; }
.summary a:hover { text-decoration: underline; text-underline-offset: 3px; }
.summary-note { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--label); font-size: 12.5px; }

/* "On this page" for narrower screens, above the text */
.toc-mobile { display: none; margin: 24px 0 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.toc-mobile summary {
  display: flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 16px;
  color: var(--text-strong); font-size: 14px; font-weight: 500;
  list-style: none; cursor: pointer;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary i { color: var(--label); font-size: 17px; }
.toc-mobile-chev { margin-left: auto; transition: transform .2s; }
.toc-mobile[open] .toc-mobile-chev { transform: rotate(180deg); }
.toc-mobile .toc { padding: 4px 16px 14px; border-top: 1px solid var(--border); max-height: 50vh; overflow-y: auto; }

/* ════════════════════════════════════════════════════════════════════
   Reading styles
   ════════════════════════════════════════════════════════════════════ */
.prose { margin-top: 40px; color: var(--text); font-size: 16px; line-height: 1.75; text-wrap: pretty; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose .callout, .prose .code-block, .prose .table-wrap, .prose .conspicuous { margin: 0 0 1.15em; }

/* Headings, with a link that appears on hover */
.hwrap { display: flex; align-items: baseline; gap: 10px; }
.hwrap-2 { margin: 52px 0 14px; padding-top: 40px; border-top: 1px solid var(--border); }
.prose > .hwrap-2:first-child { padding-top: 0; border-top: 0; }
.hwrap-3 { margin: 34px 0 10px; }
.hwrap-4, .hwrap-5, .hwrap-6 { margin: 26px 0 8px; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin: 0; color: var(--text-strong); font-weight: 600; text-wrap: balance; }
.prose h2 { font-size: clamp(22px, 2.2vw, 26px); line-height: 1.2; letter-spacing: -.028em; }
.prose h3 { font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
.prose h4 { font-size: 16px; }
.hnum { color: var(--label); font-weight: 500; font-variant-numeric: tabular-nums; }
.anchor {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  color: var(--label); font-size: 16px; text-decoration: none;
  opacity: 0;
  transition: opacity .15s, background-color .12s, color .12s;
}
.hwrap:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { background: var(--hover); color: var(--link); }
@media (hover: none) { .anchor { opacity: .5; } }

/* Where a link lands, flash once */
.prose h2:target, .prose h3:target, .prose h4:target { animation: landed 1.8s ease-out; border-radius: 6px; }
@keyframes landed {
  0%, 30% { background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}

.prose a { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .12s; }
.prose a:hover { text-decoration-color: var(--link); }
.prose .ext { font-size: .8em; margin-left: 1px; vertical-align: .05em; }
.prose strong { color: var(--text-strong); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose li > ul, .prose li > ol { margin: .4em 0 0; }
.prose li::marker { color: var(--label); }
.prose ol > li::marker { font-variant-numeric: tabular-nums; }
.prose hr { margin: 2.2em 0; border: 0; border-top: 1px solid var(--border); }

.prose code {
  padding: .12em .38em;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--raised); color: var(--text-strong);
  font: .88em var(--mono-font);
}
.code-block { position: relative; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.code-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.65 var(--mono-font); }
.code-block pre code { padding: 0; border: 0; background: none; font: inherit; }
.code-lang { position: absolute; top: 8px; right: 46px; color: var(--label); font: 11.5px var(--mono-font); }
.code-copy {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text-dim); font-size: 15px;
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }

.prose blockquote { padding: 2px 0 2px 18px; border-left: 3px solid var(--border-strong); color: var(--text-dim); }
.prose blockquote > :last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--surface); color: var(--text-strong); font-weight: 600; font-size: 13.5px; }
.prose tr:last-child td { border-bottom: 0; }

/* Callouts: > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] */
.callout {
  --cc: var(--link);
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--cc) 35%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--cc) 7%, var(--surface));
}
.callout-tip { --cc: #3fb984; }
.callout-important { --cc: #8b7cf6; }
.callout-warning { --cc: #d9a21b; }
.callout-caution { --cc: #e5534b; }
.callout-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px !important; color: var(--text-strong); font-size: 14px; font-weight: 600; }
.callout-title i { color: var(--cc); font-size: 17px; }
.callout > :last-child { margin-bottom: 0; }

/* Legal text in capitals stays in capitals, but gets a calmer block */
.prose .conspicuous {
  padding: 16px 18px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface);
  color: var(--text-strong);
  font-size: 13.5px; line-height: 1.75; letter-spacing: .015em;
}

/* Search matches, from ?hl= (CSS Custom Highlight API) */
::highlight(docs-search) { background-color: color-mix(in srgb, var(--accent) 38%, transparent); color: var(--text-strong); }
.dhl {
  position: fixed; z-index: 60; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font-size: 13.5px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
  transform: translateX(-50%);
}
.dhl mark { background: none; color: var(--text-strong); font-weight: 600; }

/* ── Page footer ─────────────────────────────────────────────────── */
.doc-foot { margin-top: 64px; }
.doc-help {
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 16px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-size: 14px;
}
.doc-help i { color: var(--label); font-size: 18px; }
.doc-help a { color: var(--text-strong); text-decoration: underline; text-decoration-color: var(--link); text-underline-offset: 3px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.pager a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border); border-radius: 12px;
  text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.pager a:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--surface); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-label { display: inline-flex; align-items: center; gap: 6px; color: var(--label); font-size: 12.5px; }
.pager-title { color: var(--text-strong); font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }

/* ── On this page ────────────────────────────────────────────────── */
.dtoc {
  position: sticky; top: var(--docs-top);
  max-height: calc(100dvh - var(--docs-top));
  overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(36px, 5vw, 64px) 0 40px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  view-transition-name: docs-toc;
}
.dtoc-title { margin: 0 0 10px; color: var(--text-strong); font-size: 13px; font-weight: 600; }
.dtoc-progress { display: none; height: 2px; margin: 0 0 12px; border-radius: 2px; background: var(--border); overflow: hidden; }
.dtoc-progress span { display: block; height: 100%; background: var(--accent); transform-origin: left; }
@supports (animation-timeline: scroll()) {
  .dtoc-progress { display: block; }
  .dtoc-progress span { animation: read-progress linear both; animation-timeline: scroll(root block); }
  @keyframes read-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
.toc { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.4; }
.dtoc .toc { border-left: 1px solid var(--border); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  margin-left: -1px; padding: 5px 0 5px 13px;
  border-left: 1px solid transparent;
  color: var(--text-dim); text-decoration: none;
  transition: color .12s, border-color .12s;
}
.toc ul a { padding-left: 25px; font-size: 12.5px; }
.toc a:hover { color: var(--text-strong); }
.toc a.is-active { color: var(--text-strong); border-left-color: var(--accent); }
.toc-mobile .toc a { border-left: 0; padding-left: 0; }
.toc-mobile .toc ul a { padding-left: 14px; }
.dtoc-top { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; color: var(--label); font-size: 12.5px; text-decoration: none; }
.dtoc-top:hover { color: var(--text-strong); }

/* ════════════════════════════════════════════════════════════════════
   Phones and tablets
   ════════════════════════════════════════════════════════════════════ */
.dbar { display: none; }

@media (max-width: 1200px) {
  .docs { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .dtoc { display: none; }
  .toc-mobile { display: block; }
}
@media (max-width: 900px) {
  :root { --docs-bar: 48px; }
  .docs { grid-template-columns: minmax(0, 1fr); width: min(100% - 40px, var(--read-w)); }
  .dside { display: none; }
  .dmain { padding-top: 28px; }
  .dbar {
    position: sticky; z-index: 40; top: var(--docs-top);
    display: flex; align-items: center; gap: 4px;
    height: var(--docs-bar); padding: 0 8px 0 12px;
    background: var(--nav-bg, var(--bg));
    -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .dbar-menu {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 8px;
    border: 0; border-radius: 8px; background: none;
    color: var(--text-dim); font: inherit; font-size: 13.5px; text-align: left;
    cursor: pointer;
  }
  .dbar-menu > i:first-child { font-size: 18px; color: var(--text-dim); }
  .dbar-sep { font-size: 13px; color: var(--label); }
  .dbar-title { overflow: hidden; color: var(--text-strong); font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
  .dbar-menu:hover { background: var(--hover); }
  .dbar-search { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
  .dbar-search:hover { background: var(--hover); color: var(--text-strong); }
  .doc-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .dbar-section, .dbar-sep { display: none; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { text-align: left; align-items: flex-start; }
  .summary { padding: 18px 18px 14px; }
  .hwrap-2 { margin-top: 40px; padding-top: 32px; }
}

/* The sidebar as a drawer */
.ddrawer {
  inset: 0 auto 0 0; margin: 0;
  width: min(320px, 86vw); height: 100dvh; max-height: 100dvh;
  padding: 12px 16px 32px calc(16px + env(safe-area-inset-left, 0px));
  border: 0; border-right: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  overflow-y: auto;
}
.ddrawer[open] { animation: drawer-in .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes drawer-in { from { transform: translateX(-100%); } }
.ddrawer::backdrop { background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.ddrawer-head { display: flex; align-items: center; justify-content: space-between; height: 44px; margin-bottom: 12px; color: var(--text-strong); font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   Search (⌘K)
   ════════════════════════════════════════════════════════════════════ */
.dsearch {
  width: min(660px, 100% - 32px); max-width: none;
  max-height: min(580px, 100dvh - 96px);
  margin: 11vh auto auto; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 16px;
  background: var(--bg); color: var(--text);
  box-shadow: 0 50px 120px -40px rgba(0, 0, 0, .8);
  overflow: hidden;
}
.dsearch[open] { display: flex; flex-direction: column; animation: search-in .16s ease-out; }
@keyframes search-in { from { opacity: 0; transform: translateY(-6px) scale(.99); } }
.dsearch::backdrop { background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@media (prefers-color-scheme: light) { .dsearch::backdrop, .ddrawer::backdrop { background: rgba(10, 20, 40, .3); } }
.dsearch-head { flex: none; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--border); }
.dsearch-head > i { color: var(--label); font-size: 20px; }
.dsearch-head input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--text-strong); font: inherit; font-size: 17px; }
.dsearch-head input::placeholder { color: var(--label); }
.dsearch-head input::-webkit-search-cancel-button { display: none; }
.dsearch-close { height: 26px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 7px; background: none; color: var(--text-dim); font: 500 11.5px var(--mono-font); cursor: pointer; }
.dsearch-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.dsearch-results { list-style: none; margin: 0; padding: 0; }
.dsearch-group { padding: 12px 10px 6px; color: var(--label); font-size: 12px; font-weight: 600; }
.dsearch-item a {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; gap: 2px 10px; align-items: center;
  padding: 10px 10px;
  border-radius: 10px;
  color: inherit; text-decoration: none;
}
.dsearch-item .ico { grid-row: span 2; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--raised); color: var(--label); font-size: 16px; }
.dsearch-item .h { color: var(--text-strong); font-size: 14.5px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dsearch-item .x { grid-column: 2; color: var(--text-dim); font-size: 13px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dsearch-item .go { grid-row: 1 / span 2; grid-column: 3; color: var(--label); font-size: 16px; opacity: 0; }
.dsearch-item[aria-selected="true"] a { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.dsearch-item[aria-selected="true"] .ico { background: var(--accent); color: #fff; }
.dsearch-item[aria-selected="true"] .go { opacity: 1; }
.dsearch-item mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text-strong); border-radius: 3px; padding: 0 1px; }
.dsearch-status { margin: 0; padding: 28px 16px; color: var(--text-dim); font-size: 14px; text-align: center; }
.dsearch-status:empty { display: none; }
.dsearch-foot { flex: none; display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface); color: var(--label); font-size: 12px; }
.dsearch-foot span { display: inline-flex; align-items: center; gap: 5px; }
.dsearch-foot kbd { min-width: 20px; height: 20px; font-size: 11px; }
@media (max-width: 600px) {
  .dsearch { width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .dsearch-foot { display: none; }
}

/* Toast */
.dtoast {
  position: fixed; z-index: 70; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text-strong); color: var(--bg);
  font-size: 13.5px; font-weight: 500;
  pointer-events: none;
  opacity: 0; transform: translate(-50%, 8px);
  transition: opacity .18s, transform .18s;
}
.dtoast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ════════════════════════════════════════════════════════════════════
   Docs home
   ════════════════════════════════════════════════════════════════════ */
.dhero { position: relative; isolation: isolate; padding: clamp(64px, 9vw, 112px) 0 clamp(48px, 6vw, 72px); text-align: center; overflow: hidden; }
.dhero > .wrap { display: flex; flex-direction: column; align-items: center; }
.dhero h1 { margin: 0; color: var(--text-strong); font-size: clamp(42px, 6.4vw, 84px); font-weight: 600; line-height: 1; letter-spacing: -.045em; text-wrap: balance; }
.dhero-lead { margin: 18px auto 0; max-width: 52ch; color: var(--text-dim); font-size: clamp(15.5px, 1.4vw, 17.5px); line-height: 1.55; }
.dhero-zone { position: relative; width: min(620px, 100%); margin-top: 38px; isolation: isolate; }
.dhero-lines { position: absolute; z-index: -1; left: calc(50% - 50vw); top: -46px; width: 100vw; height: calc(100% + 92px); pointer-events: none; }
.dhero-lines path { fill: none; vector-effect: non-scaling-stroke; stroke-dasharray: 6000; stroke-dashoffset: 6000; animation: draw 3.2s cubic-bezier(.2, .7, .2, 1) .15s forwards; }
.dhero-lines .hl-1 { stroke: var(--line-1); stroke-width: 1.5; }
.dhero-lines .hl-2 { stroke: var(--line-2); stroke-width: 1.25; animation-delay: .3s; }
.dhero-lines .hl-3 { stroke: var(--line-3); stroke-width: 1; animation-delay: .45s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .dhero-lines path { stroke-dashoffset: 0; animation: none; } }
.dhero-search {
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 58px; padding: 0 14px 0 20px;
  border: 1px solid var(--border-strong); border-radius: 16px;
  background: var(--input-bg); color: var(--label);
  font: inherit; font-size: 16px; text-align: left;
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, .75);
  cursor: pointer;
  transition: border-color .15s;
}
.dhero-search i { font-size: 20px; }
.dhero-search span { flex: 1; }
.dhero-search:hover { border-color: var(--accent); }

.dhome-body { padding-bottom: clamp(80px, 10vw, 130px); }
.dpane {
  max-width: 880px; margin: 0 auto 28px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  scroll-margin-top: calc(var(--docs-top) + 24px);
}
.dpane-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.dpane-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text-strong); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.dpane-head h2 i { color: var(--link); font-size: 21px; }
.dpane-head p { margin: 6px 0 0; color: var(--text-dim); font-size: 14.5px; }
.dpane-list { list-style: none; margin: 0; padding: 6px; }
.dpane-list a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; gap: 2px 16px; align-items: center;
  padding: 14px 16px 14px 18px;
  border-radius: 10px;
  color: inherit; text-decoration: none;
  transition: background-color .12s;
}
.dpane-list a:hover { background: var(--hover); }
.dpane-title { color: var(--text-strong); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.dpane-desc { grid-column: 1; color: var(--text-dim); font-size: 14px; }
.dpane-meta { grid-column: 2; grid-row: 1 / span 2; color: var(--label); font-size: 12.5px; white-space: nowrap; }
.dpane-go { grid-column: 3; grid-row: 1 / span 2; color: var(--label); font-size: 17px; transition: transform .15s, color .15s; }
.dpane-list a:hover .dpane-go { transform: translateX(3px); color: var(--text-strong); }
.dhome-help { display: flex; justify-content: center; align-items: center; gap: 10px; max-width: 880px; margin: 40px auto 0; color: var(--text-dim); font-size: 14px; text-align: center; }
.dhome-help i { color: var(--label); font-size: 18px; }
.dhome-help a { color: var(--text-strong); text-decoration: underline; text-decoration-color: var(--link); text-underline-offset: 3px; }
@media (max-width: 600px) {
  .dpane-list a { grid-template-columns: minmax(0, 1fr) 20px; }
  .dpane-meta { grid-column: 1; grid-row: auto; }
  .dpane-go { grid-column: 2; grid-row: 1 / span 3; }
  .dhero-search kbd { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   Print: just the document
   ════════════════════════════════════════════════════════════════════ */
@media print {
  @page { margin: 18mm 16mm; }
  .nav, .footer, .dside, .dtoc, .dbar, .doc-actions, .toc-mobile, .pager, .doc-help, .anchor, .skip, .dsearch, .ddrawer, .dtoast, .dhl, .code-copy { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .docs { display: block; width: auto; }
  .dmain { padding: 0; }
  .doc { max-width: none; }
  .doc-head h1 { color: #000; font-size: 26pt; }
  .doc-lead, .doc-meta { color: #333; }
  .doc-meta { border-color: #ccc; }
  .summary { border-color: #ccc; background: none; break-inside: avoid; }
  .summary::before { display: none; }
  .prose { color: #000; font-size: 10.5pt; line-height: 1.55; }
  .prose h2, .prose h3, .summary-title, .prose strong { color: #000; }
  .hwrap { break-after: avoid; }
  .hwrap-2 { border-color: #ccc; }
  .prose a { color: #000; text-decoration: underline; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #444; }
  .prose .ext { display: none; }
  .prose .conspicuous { background: none; border-color: #999; color: #000; }
  .prose li, .prose p { orphans: 3; widows: 3; }
}
