/* Documentation pages: sidebar | article | "On this page", with prev/next links.
   Uses the same tokens, header and footer as the generator. */

.docs-body { background: var(--surface); }

.docs-shell {
  display: grid; gap: var(--space-6); align-items: start;
  grid-template-columns: 232px minmax(0, 760px) 200px;
  justify-content: center;
  padding-block: var(--space-6) var(--space-6);
  min-height: calc(100dvh - var(--header-h) - 80px);
}

/* ---------- sidebar ---------- */
.docs-sidebar { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100dvh - var(--header-h) - 48px); overflow: auto; }
.docs-menu-button { display: none; }
.docs-nav-group {
  margin: 18px 0 6px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
}
.docs-nav-group:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.docs-nav a {
  display: block; padding: 6px 10px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-size: var(--text-sm);
  border-left: 2px solid transparent;
}
.docs-nav a:hover { color: var(--text); background: var(--surface-2); }
.docs-nav a[aria-current="page"] {
  color: var(--accent-text); background: var(--accent-soft); font-weight: 600;
  border-left-color: var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---------- on this page ---------- */
.docs-toc { position: sticky; top: calc(var(--header-h) + 24px); font-size: var(--text-sm); }
.docs-toc-title { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.docs-toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; color: var(--text-3); text-decoration: none; border-left: 2px solid transparent; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a[aria-current="location"] { color: var(--accent-text); border-left-color: var(--accent); }

/* ---------- article ---------- */
.docs-main { min-width: 0; }
.docs-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 8px; }
.prose { color: var(--text-2); font-size: 15.5px; line-height: 1.7; }
.prose h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin-bottom: 12px; }
.prose .lead { font-size: 18px; line-height: 1.6; color: var(--text-2); margin-bottom: 8px; max-width: 62ch; }
.prose h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); margin: 44px 0 12px; padding-top: 4px; scroll-margin-top: calc(var(--header-h) + 16px); }
.prose h3 { font-size: 17px; font-weight: 600; color: var(--text); margin: 28px 0 8px; scroll-margin-top: calc(var(--header-h) + 16px); }
.prose p { margin: 0 0 14px; max-width: 68ch; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 6px; max-width: 68ch; }
.prose li::marker { color: var(--text-3); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent-text); font-weight: 500; }
.prose code {
  font-size: 0.86em; color: var(--text); background: var(--surface-3);
  padding: 1px 6px; border-radius: var(--radius-sm); overflow-wrap: anywhere;
}
.prose pre {
  margin: 0 0 18px; padding: 14px 16px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  font: 13px/1.65 var(--font-mono); color: var(--text);
}
.prose pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.prose kbd { font-size: 12px; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.heading-link { margin-left: 6px; color: var(--text-3); text-decoration: none; font-weight: 400; opacity: 0; }
h2:hover .heading-link, h3:hover .heading-link, .heading-link:focus-visible { opacity: 1; }

.table-wrap { overflow-x: auto; margin: 0 0 18px; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: 1.55; }
.prose th, .prose td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { color: var(--text); font-weight: 600; white-space: nowrap; }
.prose td:first-child { white-space: nowrap; }
.prose td code { white-space: nowrap; overflow-wrap: normal; }
/* On small screens wide tables scroll sideways inside their own box instead of squashing. */
@media (max-width: 859px) {
  .prose table { min-width: 560px; }
}

.callout {
  margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface-2);
  font-size: var(--text-sm); color: var(--text-2);
}
.callout p:last-child { margin-bottom: 0; }
.callout strong:first-child { color: var(--text); }
.callout-warn { border-left-color: var(--danger); }

.prose figure { margin: 8px 0 24px; }
.prose figure img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.prose figcaption { margin-top: 8px; font-size: var(--text-sm); color: var(--text-3); }

.steps { counter-reset: step; list-style: none; padding-left: 0 !important; gap: 14px !important; }
.steps > li { counter-increment: step; position: relative; padding-left: 40px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px; width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font: 600 13px/1 var(--font-sans);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 8px 0 24px; }
.card {
  display: grid; gap: 4px; padding: 14px 16px; text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.card:hover { border-color: var(--brand-400); box-shadow: var(--shadow); }
.prose .card { color: var(--text-2); font-weight: 400; }
.card-title { color: var(--text); font-weight: 600; font-size: 15px; }
.card-text { font-size: var(--text-sm); line-height: 1.5; }

/* ---------- page footer: edit link + pager ---------- */
.docs-page-footer { margin-top: 48px; display: grid; gap: 20px; }
.docs-edit { font-size: var(--text-sm); color: var(--text-3); text-decoration: none; justify-self: start; }
.docs-edit:hover { color: var(--accent-text); text-decoration: underline; }
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 20px; border-top: 1px solid var(--border); }
.pager-link {
  display: grid; gap: 2px; padding: 12px 16px; text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color .12s;
}
.pager-link:hover { border-color: var(--accent); }
.pager-next { text-align: right; grid-column: 2; }
.pager-dir { font-size: var(--text-xs); color: var(--text-3); }
.pager-title { font-weight: 600; color: var(--accent-text); }
.pager-prev .pager-title::before { content: "\2190  "; }
.pager-next .pager-title::after { content: "  \2192"; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .docs-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 859px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding-block: var(--space-4) var(--space-6); }
  .docs-sidebar { position: static; max-height: none; overflow: visible; }
  .docs-menu-button { display: flex; width: 100%; justify-content: space-between; min-height: 44px; }
  .docs-menu-current { color: var(--text-3); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
  .docs-js .docs-nav { display: none; padding: 8px 4px 4px; }
  .docs-js .docs-nav.is-open { display: block; }
  .prose h1 { font-size: 28px; }
  .prose { font-size: 15px; }
  .docs-pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}
