/* Vistapane docs
   Layout: a calm reading column between a sticky sidebar (search and every page) and an
   "On this page" rail. Same tokens as the rest of the site; the type is tuned for reading. */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav a[aria-current="page"] { color: var(--on-dark); }
.nav a[aria-current="page"]::after { transform: scaleX(1); }

.docs-page { --docs-top: 68px; }
.docs-shell {
  display: grid;
  max-width: 1360px;
  grid-template-columns: 236px minmax(0, 1fr) 196px;
  gap: clamp(28px, 3.4vw, 48px);
  align-items: start;
  padding-block: clamp(28px, 4vw, 48px) clamp(64px, 8vw, 96px);
}

/* ------------------------------------------------------------ sidebar */
.docs-side {
  position: sticky; top: calc(var(--docs-top) + 24px);
  z-index: 5;
  display: grid; gap: 22px;
}
.docs-search { position: relative; }
.docs-search input {
  width: 100%; height: 42px; padding: 0 38px 0 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface-raised) no-repeat 12px 50% / 16px 16px; color: var(--ink);
  font: 500 15px/1 var(--font-sans);
  transition: border-color .2s, box-shadow .2s;
}
.docs-search::before {
  content: ""; position: absolute; left: 13px; top: 13px; width: 11px; height: 11px;
  border: 2px solid var(--ink-muted); border-radius: 50%; pointer-events: none;
}
.docs-search::after {
  content: ""; position: absolute; left: 24px; top: 25px; width: 6px; height: 2px;
  background: var(--ink-muted); transform: rotate(45deg); transform-origin: left; border-radius: 2px; pointer-events: none;
}
.docs-search input::placeholder { color: var(--ink-muted); }
.docs-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.docs-search-key {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  min-width: 22px; height: 22px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 5px; background: var(--surface-sunken);
  font: 600 12px/1 var(--font-mono); color: var(--ink-muted); pointer-events: none;
}
.docs-search input:focus + .docs-search-key { opacity: 0; }

.docs-results {
  position: absolute; z-index: 30; left: 0; top: calc(100% + 6px);
  width: min(460px, calc(100vw - 2 * var(--gutter)));
  max-height: min(70vh, 520px); overflow-y: auto;
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.docs-results li a {
  display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-md);
  text-decoration: none; color: var(--ink);
}
.docs-results li a[aria-selected="true"], .docs-results li a:hover { background: var(--accent-soft); }
.docs-results .r-where { font: 600 12px/1.3 var(--font-sans); letter-spacing: .02em; color: var(--ink-muted); }
.docs-results .r-title { font: 600 15px/1.35 var(--font-sans); }
.docs-results .r-text { font-size: 13.5px; line-height: 1.45; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.docs-results mark { background: color-mix(in srgb, var(--sunrise) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.docs-results .r-empty { padding: 14px 12px; font-size: 14.5px; color: var(--ink-muted); }

.docs-menu-btn { display: none; }
.docs-nav {
  display: grid; gap: 20px; align-content: start;
  max-height: calc(100vh - var(--docs-top) - 130px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; padding-right: 4px;
}
.docs-group-title { font: 600 12px/1.3 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 6px; padding-left: 12px; }
.docs-nav ul { list-style: none; display: grid; gap: 1px; }
.docs-nav a {
  position: relative; display: block; padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.4;
  transition: background-color .15s, color .15s;
}
.docs-nav a:hover { background: var(--surface-sunken); }
.docs-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.docs-nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--accent);
}

/* ------------------------------------------------------------ article */
.docs-main { min-width: 0; }
.docs-main .doc { max-width: 760px; margin: 0; padding: 0; font-size: 16.5px; line-height: 1.7; }
.doc-crumb { font-size: 14px; color: var(--ink-muted); margin-bottom: 12px; }
.doc-crumb a { color: var(--ink-muted); text-decoration: none; }
.doc-crumb a:hover { color: var(--accent); text-decoration: underline; }
.doc h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.08; letter-spacing: -0.035em; }
.doc-lede { font-size: 19px; line-height: 1.55; color: var(--ink-muted); margin-top: 14px; padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }

.doc h2 { font-size: 26px; line-height: 1.2; letter-spacing: -0.025em; margin-top: 52px; margin-bottom: 14px; }
.doc h3 { font-size: 19px; line-height: 1.35; margin-top: 34px; margin-bottom: 10px; }
.doc h4 { font-size: 16.5px; margin-top: 24px; margin-bottom: 8px; }
.doc h2, .doc h3, .doc h4 { position: relative; scroll-margin-top: calc(var(--docs-top) + 24px); }
.doc .anchor {
  position: absolute; left: -1.1em; top: 0; width: 1em; text-align: center;
  color: var(--line-strong); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus-visible { opacity: 1; }
.doc h2:target, .doc h3:target { animation: target-flash 1.6s var(--ease); }
@keyframes target-flash { 0%, 40% { color: var(--accent); } 100% { color: inherit; } }

.doc p { margin-bottom: 16px; }
.doc p:last-child { margin-bottom: 0; }
.doc strong { font-weight: 650; }
.doc a { text-decoration-thickness: 1px; }
.doc a:hover { text-decoration-thickness: 2px; }

.doc ul, .doc ol { margin: 0 0 18px; padding-left: 1.4em; display: grid; gap: 8px; }
.doc li > ul, .doc li > ol { margin: 8px 0 0; }
.doc li::marker { color: var(--ink-muted); }
.doc ol { counter-reset: step; list-style: none; padding-left: 0; }
.doc ol > li { counter-increment: step; position: relative; padding-left: 40px; min-height: 28px; }
.doc ol > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 600 13.5px/1 var(--font-display);
}

.doc code {
  font-size: 0.86em; padding: .12em .38em; border-radius: 5px;
  background: var(--surface-sunken); border: 1px solid var(--line); overflow-wrap: anywhere;
}
.doc kbd {
  display: inline-block; min-width: 1.6em; padding: .05em .45em; text-align: center;
  font: 600 .8em/1.6 var(--font-mono); color: var(--ink);
  background: var(--surface-raised); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
}

.doc .code { position: relative; margin: 0 0 20px; }
.doc pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--midnight); color: var(--on-dark); border-radius: var(--radius-md);
  font: 400 14px/1.6 var(--font-mono); tab-size: 2;
}
.doc pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
.doc pre[data-lang]::before {
  content: attr(data-lang); display: block; margin-bottom: 8px;
  font: 600 11px/1 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--on-dark-muted);
}
.doc .copy {
  position: absolute; top: 8px; right: 8px;
  padding: 5px 10px; border-radius: 6px; border: 1px solid #ffffff26; background: #ffffff10;
  color: var(--on-dark); font: 600 12.5px/1 var(--font-sans); cursor: pointer;
  opacity: 0; transition: opacity .15s, background-color .15s;
}
.doc .code:hover .copy, .doc .copy:focus-visible, .doc .copy.done { opacity: 1; }
.doc .copy:hover { background: #ffffff1f; }
.doc .copy:focus-visible { box-shadow: 0 0 0 2px var(--midnight), 0 0 0 4px var(--sky); }
@media (hover: none) { .doc .copy { opacity: 1; } }

.doc .table { margin: 0 0 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc th { font: 600 13px/1.4 var(--font-sans); letter-spacing: .02em; color: var(--ink-muted); background: var(--surface-sunken); white-space: nowrap; }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; overflow-wrap: normal; }

.callout {
  margin: 0 0 22px; padding: 14px 18px 14px 46px; position: relative;
  border-radius: var(--radius-md); border: 1px solid; font-size: 15.5px; line-height: 1.6;
}
.callout::before {
  content: ""; position: absolute; left: 16px; top: 17px; width: 18px; height: 18px; border-radius: 50%;
}
.callout-label { font: 650 13px/1.4 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px !important; }
.callout p { margin-bottom: 8px; }
.callout-note { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.callout-note::before { background: var(--accent); box-shadow: inset 0 0 0 6px var(--accent-soft); }
.callout-note .callout-label { color: var(--accent); }
.callout-tip { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.callout-tip::before { background: var(--success); box-shadow: inset 0 0 0 6px var(--success-soft); }
.callout-tip .callout-label { color: var(--success); }
.callout-warning { --warn: #8A5300; --warn-soft: #FDF0D5; background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout-warning::before { background: var(--warn); box-shadow: inset 0 0 0 6px var(--warn-soft); }
.callout-warning .callout-label { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .callout-warning { --warn: #FFA94D; --warn-soft: #3D2A0E; } }
:root[data-theme="dark"] .callout-warning { --warn: #FFA94D; --warn-soft: #3D2A0E; }

/* pager and help */
.doc-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.doc-pager a {
  display: grid; gap: 2px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface-raised); color: var(--ink); text-decoration: none; font: 600 16px/1.35 var(--font-sans);
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.doc-pager a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.doc-pager a span { font: 500 13px/1.3 var(--font-sans); color: var(--ink-muted); }
.pager-next { text-align: right; grid-column: 2; }
.pager-prev span::before { content: "← "; }
.pager-next span::after { content: " →"; }
.doc-help { margin-top: 20px; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface-sunken); font-size: 15px; line-height: 1.6; color: var(--ink-muted); }
.doc-help strong { color: var(--ink); }

/* ------------------------------------------------------------ on this page */
.docs-toc { position: sticky; top: calc(var(--docs-top) + 24px); max-height: calc(100vh - var(--docs-top) - 48px); overflow-y: auto; font-size: 14px; }
.docs-toc-title { font: 600 12px/1.3 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px; }
.docs-toc ul { list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.docs-toc a {
  display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--ink-muted); text-decoration: none; line-height: 1.4; transition: color .15s, border-color .15s;
}
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; }
  .docs-side { position: static; gap: 12px; }
  .docs-nav { max-height: none; overflow: visible; }
  .docs-menu-btn {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-md);
    background: var(--surface-raised); color: var(--ink); font: 600 15px/1 var(--font-sans); cursor: pointer;
  }
  .docs-menu-btn::after {
    content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg); transition: transform .2s;
  }
  .docs-menu-btn[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
  .js .docs-nav { display: none; }
  .js .docs-nav.is-open { display: grid; padding: 14px 4px 4px; }
  .docs-main .doc { font-size: 16px; }
  .doc .anchor { display: none; }
  .doc-pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .doc h2:target, .doc h3:target { animation: none; }
  .doc-pager a, .docs-menu-btn::after { transition: none; }
}

/* The legal pages share the .doc class; undo their spacing here. */
.docs-main .doc p + p, .docs-main .doc p + ul, .docs-main .doc ul + p, .docs-main .doc p + ol, .docs-main .doc ol + p { margin-top: 0; }
