/* Docs page (design v3): grid header with search, sticky table of contents with a sliding marker, client
   tabs, numbered step cards with file-headed code blocks, platform guide cards with vendor logos, callouts. */

/* ---------- hero search ---------- */
.docs-hero { padding-bottom: clamp(28px, 4vw, 44px); z-index: 20; }
.docs-search { position: relative; max-width: 520px; margin-top: 8px; }
.docs-search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.docs-search-input { padding-left: 42px; padding-right: 44px; background: var(--surface-solid); }
.docs-search-input::-webkit-search-cancel-button { display: none; }
.docs-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--r-s); font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); background: var(--bg-2); pointer-events: none; }
.docs-search:focus-within .docs-kbd { opacity: 0; }
.docs-results {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow: auto;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--r-m); box-shadow: var(--shadow-2);
  --pop-origin: top center;
}
.docs-result { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 10px; border-radius: var(--r-s); cursor: pointer; }
.docs-result[aria-selected="true"] { background: var(--sunken); }
.dr-title { color: var(--text); font-weight: 500; font-size: 0.94rem; }
.dr-where { flex: none; color: var(--text-3); font-size: 0.8rem; }
.docs-result-empty { cursor: default; color: var(--text-3); font-size: 0.9rem; }

/* ---------- layout ---------- */
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding-bottom: 40px; }
.docs-layout > * { min-width: 0; }
@media (min-width: 1000px) { .docs-layout { grid-template-columns: 228px minmax(0, 1fr); gap: 56px; } }

/* ---------- table of contents ---------- */
.docs-side { position: relative; }
.docs-toc { display: none; position: relative; }
@media (min-width: 1000px) {
  .docs-side { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 104px); overflow: auto; scrollbar-width: thin; padding-bottom: 12px; }
  .docs-toc { display: block; padding-left: 14px; border-left: 1px solid var(--line); }
  .docs-toc-mobile { display: none !important; }
}
.docs-toc-title { font-size: 0.78rem; color: var(--text-3); margin: 2px 0 10px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.docs-toc ul ul { margin: 2px 0 6px 12px; }
.docs-toc a { display: block; padding: 5px 0; color: var(--text-2); text-decoration: none; font-size: 0.9rem; line-height: 1.35; transition: color 0.15s var(--ease); }
.docs-toc ul ul a { font-size: 0.86rem; color: var(--text-3); padding: 4px 0; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a[aria-current="location"], .docs-toc a.is-parent { color: var(--text); }
.docs-toc a[aria-current="location"] { font-weight: 550; }
.toc-marker { position: absolute; left: -1px; top: 0; width: 2px; height: var(--h, 0); transform: translateY(var(--y, 0)); background: var(--text); border-radius: 2px; opacity: 0; transition: transform 0.22s var(--ease), height 0.22s var(--ease), opacity 0.2s var(--ease); pointer-events: none; }
.toc-marker.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toc-marker { transition: none; } }

/* mobile: "On this page" dropdown */
.docs-toc-mobile { position: sticky; top: 72px; z-index: 30; }
.docs-toc-btn { justify-content: space-between; background: var(--surface-solid); }
.docs-toc-btn .chev { color: var(--text-3); }
.docs-toc-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 31;
  max-height: min(60vh, 440px); overflow: auto; padding: 8px;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--r-m); box-shadow: var(--shadow-2);
  --pop-origin: top center;
}
.docs-toc-menu ul { list-style: none; margin: 0; padding: 0; }
.docs-toc-menu ul ul { padding-left: 14px; }
.docs-toc-menu a { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: var(--r-s); color: var(--text); text-decoration: none; font-size: 0.95rem; }
.docs-toc-menu ul ul a { color: var(--text-2); min-height: 36px; font-size: 0.9rem; }
.docs-toc-menu a:hover, .docs-toc-menu a:focus-visible { background: var(--sunken); }

/* ---------- body ---------- */
.docs-body { color: var(--text-2); font-size: 1rem; line-height: 1.65; }
.docs-sec { padding-top: 8px; margin-bottom: clamp(48px, 7vw, 80px); scroll-margin-top: 88px; }
.docs-sec > h2 { font-family: var(--font-display); font-weight: 560; letter-spacing: -0.024em; line-height: 1.15; font-size: clamp(1.45rem, 1.2vw + 1rem, 1.9rem); color: var(--text); scroll-margin-top: 88px; }
.docs-sec > h3 { margin-top: 28px; margin-bottom: 6px; font-size: 1.05rem; font-weight: 600; color: var(--text); scroll-margin-top: 88px; }
.docs-lead { margin: 10px 0 24px; max-width: 68ch; }
.docs-body p a:not(.btn), .docs-body li a:not(.btn) { color: var(--text); }
.docs-body code:not(pre code) { font-size: 0.86em; }
.docs-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 22px; }
.docs-fine { margin-top: 16px; font-size: 0.86rem; color: var(--text-3); }
.docs-body .callout { margin-top: 18px; }
.docs-body .pg-table-wrap { margin-top: 6px; }

/* ---------- numbered step cards ---------- */
.dstep-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.dstep { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; padding: 18px 20px 20px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.dstep-n { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50%; font-family: var(--mono); font-size: 0.78rem; color: var(--text-2); background: var(--surface-solid); margin-top: 1px; }
.dstep-body { min-width: 0; display: grid; gap: 6px; }
.dstep-body h4 { font-size: 0.98rem; font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.dstep-body p { font-size: 0.95rem; line-height: 1.6; }
.dstep-body .codefile { margin-top: 6px; }

/* ---------- client tabs ---------- */
.ctabs { margin-top: 4px; }
.ctab-bar { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.ctab-bar::-webkit-scrollbar { display: none; }
.ctab { flex: none; min-height: 42px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font-weight: 500; font-size: 0.92rem; border-radius: var(--r-s) var(--r-s) 0 0; transition: color 0.15s var(--ease), background-color 0.15s var(--ease); }
.ctab:hover { color: var(--text); background: var(--sunken); }
.ctab[aria-selected="true"] { color: var(--text); }
.ctab:focus-visible { outline-offset: -2px; }
.ctab-panel { scroll-margin-top: 96px; }
.ctabs:not(.is-tabbed) .ctab-panel + .ctab-panel { margin-top: 40px; }
.ctabs.is-tabbed .ctab-panel.is-shown { animation: panel-in 0.2s var(--ease) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); filter: blur(3px); } }
@media (prefers-reduced-motion: reduce) { .ctabs.is-tabbed .ctab-panel.is-shown { animation: none; } }
.ctab-title { font-size: 1.15rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.ctabs.is-tabbed .ctab-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ctab-intro { margin-bottom: 18px; max-width: 70ch; }
.ctab-src { margin-top: 14px; font-size: 0.82rem; color: var(--text-3); }
.ctab-src a { color: var(--text-2); }

/* ---------- platform guide cards ---------- */
.guide-grid { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
@media (min-width: 760px) { .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .guide-card:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.guide-card { display: flex; flex-direction: column; gap: 10px; padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; scroll-margin-top: 96px; }
.guide-card:target { background: var(--bg-2); }
.guide-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.guide-logo { display: inline-flex; min-width: 0; }
.guide-more { flex: none; font-size: 0.82rem; color: var(--text-3); }
.guide-more:hover { color: var(--text); }
.guide-card h3 { font-size: 1.02rem; font-weight: 600; color: var(--text); }
.guide-cred { color: var(--text); font-weight: 500; font-size: 0.94rem; }
.gd-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: 0.92rem; line-height: 1.55; }
.gd-steps li::marker { color: var(--text-3); font-family: var(--mono); font-size: 0.85em; }
.guide-full { margin-top: auto; border-top: 1px solid var(--line); padding-top: 4px; }
.guide-full > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 6px; cursor: pointer; list-style: none; font-size: 0.9rem; font-weight: 500; color: var(--text); border-radius: var(--r-s); }
.guide-full > summary::-webkit-details-marker { display: none; }
.guide-full > summary .chev { color: var(--text-3); margin-right: 4px; }
.guide-md { font-size: 0.9rem; padding: 8px 0 4px; }
.guide-md > * + * { margin-top: 0.8em; }
.guide-md .guide-md-h { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-top: 1.4em; }
.guide-md table { min-width: 420px; font-size: 0.84rem; }
.guide-md .table-wrap { overflow-x: auto; border: 1px solid var(--line); }

/* ---------- troubleshooting ---------- */
.docs-faq { border-top: 1px solid var(--line); max-width: 820px; }
.docs-faq details { border-bottom: 1px solid var(--line); scroll-margin-top: 96px; }
.docs-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 6px 16px 0; cursor: pointer; list-style: none; font-weight: 500; color: var(--text); border-radius: var(--r-s); }
.docs-faq summary::-webkit-details-marker { display: none; }
.docs-faq summary .chev { color: var(--text-3); margin-right: 4px; }
.docs-faq summary:hover .chev { color: var(--text); }
.docs-faq .faq-a { padding: 0 0 18px; max-width: 70ch; }

/* roles matrix keeps its own styles (css/roles.css) */
.docs-body #roles-root { margin-top: 8px; }
.check-list { list-style: disc; padding-left: 1.3em; display: grid; gap: 8px; }
.guide-full.guide-notes { margin-top: 0; }
