/* Documentation layout and prose. Loaded after site.css on /docs pages. */
.docs-shell { padding-top: var(--header); }
.docs { display: grid; grid-template-columns: 232px minmax(0, 1fr) 208px; gap: clamp(28px, 4vw, 64px); align-items: start; }

/* Left nav */
.docs-nav { position: sticky; top: calc(var(--header) + 8px); max-height: calc(100vh - var(--header) - 16px); overflow-y: auto; padding: 32px 4px 40px 0; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.docs-nav-group + .docs-nav-group { margin-top: 26px; }
.docs-nav h4 { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.docs-nav a { display: block; padding: 6px 12px; margin-left: -12px; border-radius: 8px; color: var(--dim); text-decoration: none; font-size: 14.5px; line-height: 1.35; transition: color .15s, background-color .15s; }
.docs-nav a:hover { color: var(--fg); background: var(--raised); }
.docs-nav a[aria-current] { color: var(--fg); background: var(--raised); box-shadow: inset 2px 0 0 var(--accent); }
.docs-access { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.docs-access p { font-size: 13.5px; color: var(--faint); margin-bottom: 10px; }
.docs-access .link-arrow { font-size: 14px; margin: 0; padding: 0 0 3px; }
.docs-access .link-arrow:hover { background: none; }

/* Right "on this page" */
.docs-toc { position: sticky; top: calc(var(--header) + 8px); padding: 36px 0 40px; max-height: calc(100vh - var(--header) - 16px); overflow-y: auto; }
.docs-toc h4 { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.docs-toc a { display: block; padding: 5px 0 5px 14px; border-left: 1px solid var(--line); color: var(--faint); text-decoration: none; font-size: 13.5px; line-height: 1.35; transition: color .15s, border-color .15s; }
.docs-toc a:hover { color: var(--fg); }
.docs-toc a.active { color: var(--fg); border-left-color: var(--accent-text); }

/* Mobile bar */
.docs-bar { display: none; position: sticky; top: var(--header); z-index: 40; background: rgb(9 12 19 / .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.docs-menu { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px var(--gutter); background: none; border: 0; color: var(--dim); font: 14px var(--sans); cursor: pointer; text-align: left; }

@media (max-width: 1180px) { .docs { grid-template-columns: 220px minmax(0, 1fr); } .docs-toc { display: none; } }
@media (max-width: 860px) {
    .docs-bar { display: block; }
    .docs { grid-template-columns: minmax(0, 1fr); }
    .docs-nav { display: none; position: fixed; inset: calc(var(--header) + 46px) 0 0 0; z-index: 45; max-height: none; background: var(--canvas); padding: 20px var(--gutter) 40px; }
    .docs-nav.open { display: block; }
}

/* ---------- Prose ---------- */
.docs-main { min-width: 0; max-width: 760px; padding: 40px 0 72px; }
.prose > h1 { font-family: var(--display); font-weight: 600; font-size: clamp(44px, 5vw, 68px); line-height: 1; letter-spacing: -0.02em; margin: 16px 0 0; }
.docs-lede { font-size: 19.5px; line-height: 1.55; color: var(--dim); margin-top: 20px; max-width: 38em; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 3vw, 38px); line-height: 1.05; letter-spacing: -0.01em; margin: 64px 0 16px; padding-top: 28px; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header) + 24px); }
.prose h3 { font-size: 18.5px; font-weight: 600; letter-spacing: -0.01em; margin: 36px 0 10px; scroll-margin-top: calc(var(--header) + 24px); }
.prose p, .prose li { color: var(--dim); font-size: 16.5px; line-height: 1.7; }
.prose p + p { margin-top: 14px; }
.prose b, .prose strong { color: var(--fg); font-weight: 600; }
.prose em { color: var(--fg); font-style: normal; }
.prose a:not(.link-arrow):not(.doc-card):not(.prev):not(.next) { color: var(--fg); text-decoration-color: var(--accent-text); }
.prose a:not(.link-arrow):not(.doc-card):not(.prev):not(.next):hover { color: var(--accent-text); }
.prose ul, .prose ol { margin: 14px 0; padding-left: 22px; display: grid; gap: 8px; }
.prose ul li::marker { color: var(--faint); }
.prose ol li::marker { color: var(--faint); font-family: var(--mono); font-size: 13px; }
.prose code { font-size: 0.86em; color: var(--fg); background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.38em; overflow-wrap: anywhere; }
.prose kbd { font-size: 12px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--fg); background: var(--raised); }

.prose pre { position: relative; margin: 18px 0; padding: 18px 20px; border-radius: 12px; border: 1px solid var(--line); background: #07090c; overflow-x: auto; font-size: 13.5px; line-height: 1.75; color: var(--fg); }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; white-space: pre; }
.prose pre .p { color: var(--accent-text); user-select: none; }
.prose pre .c { color: var(--faint); }
.copy { position: absolute; top: 10px; right: 10px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--dim); font: 500 12px var(--sans); cursor: pointer; opacity: 0; transition: opacity .2s, color .2s, border-color .2s; }
.prose pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--fg); border-color: var(--fg); }
@media (hover: none) { .copy { opacity: 1; } }

/* Tables */
.table-wrap { margin: 20px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th { text-align: left; font: 500 11px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--faint); padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; }
.prose td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--dim); line-height: 1.55; }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--fg); }
.prose td code { white-space: nowrap; }

/* Callouts */
.note { display: grid; grid-template-columns: 22px 1fr; gap: 12px; margin: 22px 0; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.note > .i { color: var(--dim); margin-top: 3px; }
.note p { font-size: 15.5px; }
.note.warn { border-color: rgb(31 102 255 / .35); background: linear-gradient(90deg, rgb(31 102 255 / .07), transparent 70%), var(--surface); }
.note.warn > .i { color: var(--accent-text); }
.note.access { border-color: var(--line-strong); }
.note.access > .i { color: var(--accent-text); }

/* Numbered procedures */
.doc-steps { list-style: none; padding: 0 !important; margin: 20px 0 !important; counter-reset: st; gap: 0 !important; }
.doc-steps > li { counter-increment: st; position: relative; padding: 0 0 26px 52px; }
.doc-steps > li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font: 500 13px var(--mono); color: var(--accent-text); background: var(--canvas); z-index: 1; }
.doc-steps > li::after { content: ''; position: absolute; left: 15px; top: 30px; bottom: 0; width: 1px; background: var(--line); }
.doc-steps > li:last-child::after { display: none; }
.doc-steps > li > strong { display: block; color: var(--fg); font-size: 17px; font-weight: 600; padding-top: 3px; margin-bottom: 6px; }

/* Screenshots */
.shot { margin: 28px 0; }
.shot-frame { border-radius: 12px; padding: 6px; border: 1px solid var(--line-strong); background: linear-gradient(160deg, #1d222c, #11141a 50%); box-shadow: 0 30px 60px -30px #000; }
.shot img { width: 100%; height: auto; border-radius: 7px; }
.shot figcaption { margin-top: 10px; font: 12px var(--mono); color: var(--faint); letter-spacing: .02em; }

/* Overview cards */
.doc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 32px 0 8px; }
.doc-card { display: block; padding: 20px 20px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; transition: border-color .2s, background-color .2s, transform .2s var(--ease); }
.doc-card:hover { border-color: var(--line-strong); background: var(--raised); transform: translateY(-2px); }
.doc-card.wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; }
.doc-card .label { color: var(--accent-text); }
.doc-card b { display: block; font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.1; color: var(--fg); margin-top: 8px; }
.doc-card span:not(.label) { display: block; color: var(--dim); font-size: 14.5px; margin-top: 6px; line-height: 1.5; }
@media (max-width: 640px) { .doc-cards { grid-template-columns: 1fr; } }

.badge { display: inline-flex; align-items: center; vertical-align: middle; font: 500 11px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--accent-text); border: 1px solid rgb(31 102 255 / .35); padding: 3px 8px; border-radius: 999px; margin-left: 10px; }

/* Architecture diagram */
.diagram { margin: 24px 0; padding: 20px; border-radius: 14px; border: 1px solid var(--line); background: #07090c; overflow-x: auto; }
.diagram svg { min-width: 620px; width: 100%; height: auto; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none; transition: border-color .2s; }
.pager a:hover { border-color: var(--fg); }
.pager .next { text-align: right; }
.pager small { display: block; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.pager b { display: block; font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--fg); margin-top: 4px; }
.prose p.label { font-size: 11.5px; line-height: 1.4; color: var(--faint); }
