/* Docs section. Builds on /styles.css tokens (--text, --muted, --violet, --border, --surface...). */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.docs-body .nav-links a[aria-current="page"] { color: var(--text); }

/* The docs use the whole screen: the shell and the header drop the site's 1160px container. */
.container.docs-shell, .docs-body .nav .container { width: auto; max-width: none; margin-inline: 0; padding-inline: clamp(20px, 3vw, 56px); }
.docs-shell {
  display: grid; grid-template-columns: 270px minmax(0, 1fr) 240px; gap: clamp(32px, 3vw, 64px);
  padding-top: 104px; padding-bottom: 80px; align-items: start;
}
.docs-shell-landing { grid-template-columns: 270px minmax(0, 1fr); }

/* Sidebar */
.docs-side { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.docs-mobile > summary { display: none; }
.docs-nav { display: grid; gap: 22px; font-size: 15px; }
.docs-search { position: relative; display: block; }
.docs-search input {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 36px 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.docs-search input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.docs-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 12px var(--mono);
  color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: var(--bg-2);
}
.docs-results { display: grid; gap: 4px; margin-top: -10px; }
.docs-results[hidden] { display: none; }
.docs-results a { display: block; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.docs-results a:hover, .docs-results a.sel { border-color: rgba(0, 101, 234, .5); background: var(--surface-2); }
.docs-results b { display: block; font-weight: 600; font-size: 14px; }
.docs-results span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
.docs-results mark { background: rgba(0, 101, 234, .15); color: inherit; border-radius: 3px; }
.docs-results p { color: var(--muted); font-size: 14px; padding: 4px 10px; }
.docs-home, .docs-group a { display: block; padding: 6px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; transition: color .15s, background .15s; }
.docs-home:hover, .docs-group a:hover { color: var(--text); background: var(--surface-2); }
.docs-home.on, .docs-group a.on { color: var(--violet); background: rgba(0, 101, 234, .09); }
/* A group's title is a heading, not a link: dark, bold, with a rule above; its pages sit indented under a guide line. */
.docs-group { padding-top: 18px; border-top: 1px solid var(--border); }
.docs-group p { display: flex; align-items: center; gap: 8px; font: 700 15px var(--display); letter-spacing: -.005em; color: var(--text); padding: 0 12px 8px; }
.docs-group p::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--violet); flex: none; }
.docs-group ul { display: grid; gap: 1px; margin-left: 14px; padding-left: 6px; border-left: 1px solid var(--border); }
.docs-group a { font-size: 14.5px; font-weight: 400; padding: 5px 10px; }
.docs-group a.on { font-weight: 500; }
.docs-group i { font: 500 11px var(--mono); font-style: normal; color: #9a6700; background: #fff4d6; padding: 1px 6px; border-radius: 6px; margin-left: 4px; }

/* Article */
.docs-main { min-width: 0; }
.docs-crumb { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.docs-crumb a:hover { color: var(--violet); }
.docs-main h1 { font-size: clamp(34px, 4.6vw, 52px); line-height: 1.08; margin-bottom: 16px; }
.docs-lead { font-size: 19px; line-height: 1.6; color: var(--muted); }
.docs-main > article > .docs-lead { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.docs-banner { margin: 0 0 24px; padding: 12px 16px; border-radius: 12px; background: #fff4d6; color: #7a4f00; font-size: 15px; }

.docs-content { font-size: 17px; line-height: 1.75; color: #27344f; }
.docs-content > * + * { margin-top: 16px; }
.docs-content h2 { font-size: 28px; margin-top: 52px; padding-top: 8px; line-height: 1.2; color: var(--text); }
.docs-content h3 { font-size: 21px; margin-top: 36px; line-height: 1.3; color: var(--text); }
.docs-content h4 { font-size: 17px; margin-top: 28px; color: var(--text); }
.docs-content h2 .anchor, .docs-content h3 .anchor, .docs-content h4 .anchor { margin-left: 8px; color: var(--violet); opacity: 0; font-weight: 400; transition: opacity .15s; }
.docs-content :is(h2, h3, h4):hover .anchor, .docs-content .anchor:focus { opacity: .7; }
.docs-content ul, .docs-content ol { padding-left: 24px; display: grid; gap: 8px; }
.docs-content ul { list-style: disc; }
.docs-content ol { list-style: decimal; }
.docs-content li::marker { color: var(--violet); }
.docs-content li > ul, .docs-content li > ol { margin-top: 8px; }
.docs-content a { color: var(--violet); text-decoration: underline; text-decoration-color: rgba(0, 101, 234, .3); text-underline-offset: 3px; }
.docs-content a:hover { text-decoration-color: currentColor; }
.docs-content a.anchor { text-decoration: none; }
.docs-content strong { color: var(--text); }
.docs-content hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.docs-content img { border-radius: 14px; border: 1px solid var(--border); margin-inline: auto; height: auto; }
.docs-content blockquote { margin-left: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--violet); color: var(--muted); }
.docs-content code { font: 500 .88em var(--mono); background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: #0b2a6b; overflow-wrap: anywhere; }
.docs-content .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.docs-content table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
.docs-content th { text-align: left; font: 600 13px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg-2); }
.docs-content th, .docs-content td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.docs-content td { min-width: 120px; }
.docs-content tr:last-child td { border-bottom: 0; }

.code { position: relative; }
.code pre, .docs-content pre { margin: 0; overflow-x: auto; background: #0b1530; color: #dbe6ff; border-radius: 14px; padding: 18px 20px; font: 14px/1.65 var(--mono); }
.code pre code, .docs-content pre code { background: none; border: 0; padding: 0; color: inherit; font: inherit; overflow-wrap: normal; }
.copy {
  position: absolute; top: 10px; right: 10px; font: 500 12px var(--mono); color: #b9c8ee; background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; padding: 4px 10px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { background: rgba(255, 255, 255, .16); }
pre.mermaid { background: var(--surface); color: var(--text); border: 1px solid var(--border); text-align: center; font-family: var(--font); }

.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; }
.docs-pager a { display: block; padding: 16px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-weight: 600; font-family: var(--display); transition: border-color .2s, transform .2s; }
.docs-pager a:hover { border-color: rgba(0, 101, 234, .5); transform: translateY(-2px); }
.docs-pager a span { display: block; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.docs-pager .next { text-align: right; grid-column: 2; }
.docs-pager .prev { grid-column: 1; }
.docs-source { font-size: 14px; margin-top: 28px; }
.docs-source code { font: 12px var(--mono); }

/* On this page */
.docs-toc { position: sticky; top: 96px; font-size: 14px; max-height: calc(100vh - 120px); overflow-y: auto; }
.docs-toc p { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.docs-toc ul { display: grid; gap: 2px; border-left: 1px solid var(--border); }
.docs-toc a { display: block; padding: 4px 12px; color: var(--muted); line-height: 1.4; margin-left: -1px; border-left: 2px solid transparent; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a.on { color: var(--violet); border-left-color: var(--violet); }
.docs-toc .d3 a { padding-left: 24px; font-size: 13px; }

/* Landing */
.docs-hero { padding: 8px 0 24px; }
.docs-hero h1 { font-size: clamp(36px, 5.4vw, 60px); margin: 18px 0 20px; }
.docs-hero .hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.docs-section { margin-top: 64px; }
.docs-section h2 { font-size: 30px; margin-bottom: 10px; }
.docs-section > .docs-lead { margin-bottom: 24px; font-size: 18px; }
.docs-section a { color: var(--violet); }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: s; }
.flow li { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; display: grid; gap: 6px; align-content: start; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -14px; top: 50%; transform: translateY(-50%); z-index: 1; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--violet); color: #fff; font-size: 14px; }
.flow b { font: 600 16px var(--display); color: var(--text); }
.flow span { font-size: 15px; line-height: 1.5; color: var(--muted); }
.flow code, .flow-base code { font: 500 .88em var(--mono); background: var(--bg-2); border-radius: 6px; padding: 1px 5px; }
.flow-base { margin-top: 14px; padding: 16px 20px; border-radius: 16px; color: #fff; background: var(--grad); font-size: 16px; line-height: 1.55; }
.flow-base code { background: rgba(255, 255, 255, .18); color: #fff; }
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.docs-card { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px 22px 46px; transition: transform .2s, border-color .2s, background .2s; }
.docs-card:hover { transform: translateY(-4px); border-color: rgba(0, 101, 234, .5); background: var(--surface-2); }
.docs-card h3 { font-size: 20px; margin-bottom: 8px; color: var(--text); }
.docs-card p { color: var(--muted); font-size: 15px; line-height: 1.55; }
.docs-card span { position: absolute; left: 22px; bottom: 16px; color: var(--violet); font-weight: 600; }
.docs-ideas { display: grid; gap: 12px; }
.docs-ideas li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; }
.docs-ideas .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 14px var(--mono); color: var(--violet); background: rgba(0, 101, 234, .1); }
.docs-ideas h3 { font-size: 17px; margin-bottom: 4px; }
.docs-ideas p { font-size: 15px; color: var(--muted); line-height: 1.55; }
.docs-ideas code { font: 500 .88em var(--mono); background: var(--bg-2); border-radius: 6px; padding: 1px 5px; }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-shell, .docs-shell-landing { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 92px; }
  .docs-side { position: static; max-height: none; overflow: visible; }
  .docs-mobile { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .docs-mobile > summary { display: block; cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; }
  .docs-mobile > summary::after { content: "▾"; float: right; color: var(--muted); }
  .docs-mobile[open] > summary::after { content: "▴"; }
  .docs-mobile .docs-nav { padding: 4px 14px 16px; }
  .flow { grid-template-columns: 1fr 1fr; }
  .flow li:not(:last-child)::after { display: none; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager .next, .docs-pager .prev { grid-column: 1; text-align: left; }
}
@media (max-width: 520px) { .flow { grid-template-columns: 1fr; } .docs-content { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .docs-card, .docs-pager a { transition: none; } }

.docs-body code, .docs-body pre { font-variant-ligatures: none; }
.docs-content td:first-child code { white-space: nowrap; }
@media (min-width: 861px) { .docs-side .docs-mobile { border: 0; background: none; box-shadow: none; padding: 0; margin: 0; border-radius: 0; } }
