/* ==========================================================================
   Docs page — sidebar + reading column. Builds on site.css tokens.
   ========================================================================== */

.docs-hero { position: relative; padding: 128px 0 48px; border-bottom: 1px solid var(--line); overflow: hidden; }
.docs-hero .glow { width: 520px; height: 520px; top: -260px; left: 50%; transform: translateX(-50%); background: #a855f7; opacity: .28; }
.docs-hero h1 { font-size: clamp(36px, 5vw, 60px); letter-spacing: -0.045em; line-height: 1.02; margin: 14px 0 14px; font-weight: 700; }
.docs-hero .lead { max-width: 720px; }
.docs-hero__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.docs-hero__links a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--text-2); transition: border-color .2s, color .2s; }
.docs-hero__links a:hover { border-color: rgba(168,85,247,.5); color: #fff; }
.docs-hero__links svg { width: 16px; height: 16px; color: #c084fc; }

.docs { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; padding-top: 48px; padding-bottom: 120px; }
.toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 8px; scrollbar-width: thin; }
.toc h4 { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; font-weight: 500; }
.toc h4:first-child { margin-top: 0; }
.toc a { display: block; padding: 6px 12px; margin-left: -12px; border-left: 2px solid transparent; font-size: 14.5px; color: var(--text-2); transition: color .15s, border-color .15s, background .15s; border-radius: 0 8px 8px 0; }
.toc a:hover { color: #fff; background: rgba(255,255,255,.03); }
.toc a.is-active { color: #e9d5ff; border-left-color: var(--brand); background: rgba(168,85,247,.08); }
.toc-toggle { display: none; }

.doc { min-width: 0; max-width: 800px; }
.doc section { padding-top: 8px; margin-bottom: 64px; scroll-margin-top: 90px; }
.doc h2 { font-size: 30px; letter-spacing: -0.03em; line-height: 1.15; margin: 0 0 16px; font-weight: 650; display: flex; align-items: center; gap: 12px; }
.doc h2 .num { font-family: var(--mono); font-size: 13px; color: #c084fc; padding: 4px 8px; border-radius: 8px; background: rgba(168,85,247,.12); border: 1px solid rgba(168,85,247,.25); font-weight: 500; letter-spacing: 0; }
.doc h3 { font-size: 19px; letter-spacing: -0.015em; margin: 32px 0 10px; font-weight: 620; }
.doc p, .doc li { color: var(--text-2); font-size: 16px; line-height: 1.72; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 16px; }
.doc li { margin-bottom: 6px; }
.doc li::marker { color: #a78bfa; }
.doc a:not(.btn) { color: #d8b4fe; text-decoration: underline; text-decoration-color: rgba(216,180,254,.35); text-underline-offset: 3px; }
.doc a:not(.btn):hover { text-decoration-color: #d8b4fe; }
.doc strong { color: var(--text); font-weight: 600; }
.doc code { font-family: var(--mono); font-size: .86em; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.06); border: 1px solid var(--line); color: #f0abfc; word-break: break-word; }
.doc pre { position: relative; margin: 0 0 20px; padding: 18px 20px; border-radius: 14px; background: #0b0a10; border: 1px solid var(--line-2); overflow-x: auto; }
.doc pre code { padding: 0; border: 0; background: none; color: #e4e1ec; font-size: 13.5px; line-height: 1.7; white-space: pre; word-break: normal; }
.doc pre .c { color: #6f6a82; } .doc pre .k { color: #c084fc; } .doc pre .s { color: #86efac; } .doc pre .n { color: #fde68a; }
.copy-btn { position: absolute; top: 10px; right: 10px; font-family: var(--mono); font-size: 11.5px; padding: 5px 10px; border-radius: 8px; background: rgba(255,255,255,.06); border: 1px solid var(--line-2); color: var(--text-2); opacity: 0; transition: opacity .2s, background .2s; }
.doc pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn.is-done { color: #86efac; border-color: rgba(134,239,172,.4); }
@media (hover: none) { .copy-btn { opacity: 1; } }

.callout { display: flex; gap: 14px; padding: 16px 18px; border-radius: 14px; margin: 0 0 20px; border: 1px solid; }
.callout svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 3px; }
.callout p { margin: 0; font-size: 15px; }
.callout p + p { margin-top: 8px; }
.callout--info { background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.3); }
.callout--info svg { color: #a5b4fc; }
.callout--warn { background: rgba(245,158,11,.07); border-color: rgba(245,158,11,.3); }
.callout--warn svg { color: #fcd34d; }
.callout--tip { background: rgba(34,197,94,.06); border-color: rgba(34,197,94,.28); }
.callout--tip svg { color: #86efac; }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 14px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.doc th, .doc td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.doc th { font-weight: 600; color: var(--text); background: rgba(255,255,255,.03); font-size: 13px; }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }

.steps { counter-reset: step; list-style: none; padding: 0 !important; margin: 0 0 20px; }
.steps > li { counter-increment: step; position: relative; padding-left: 46px; margin-bottom: 22px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; color: #fff; background: linear-gradient(145deg, #c084fc, #7e22ce); }
.steps > li > strong { display: block; margin-bottom: 6px; font-size: 16.5px; }

.diagram { margin: 8px 0 24px; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: radial-gradient(80% 100% at 50% 0%, rgba(168,85,247,.08), transparent 70%), rgba(255,255,255,.015); overflow-x: auto; }
.diagram svg { min-width: 640px; width: 100%; height: auto; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 20px; }
.module-grid div { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.module-grid b { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 4px; }
.module-grid b svg { width: 16px; height: 16px; color: #c084fc; }
.module-grid span { font-size: 14px; color: var(--muted); line-height: 1.55; display: block; }
@media (max-width: 640px) { .module-grid { grid-template-columns: 1fr; } }

.faq details { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--surface); }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 550; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--mono); color: #c084fc; font-size: 18px; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 18px 8px; }

@media (max-width: 960px) {
  .docs { grid-template-columns: 1fr; gap: 0; padding-top: 24px; }
  .toc {
    position: fixed; inset: 68px 0 0 0; z-index: 40; max-height: none; padding: 24px var(--gutter) 40px;
    background: rgba(7,6,12,.97); backdrop-filter: blur(18px); transform: translateX(-100%); transition: transform .3s var(--ease);
  }
  body.toc-open .toc { transform: none; }
  .toc-toggle {
    display: inline-flex; align-items: center; gap: 8px; position: sticky; top: 80px; z-index: 30; margin-bottom: 24px;
    padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(12,10,20,.9); backdrop-filter: blur(10px); font-size: 14px;
  }
  .toc-toggle svg { width: 16px; height: 16px; }
}
