/* Documentation browser — same design system, denser reading layout. */

.docs-page { background: #060910; }
.docs-page #dotfield { opacity: .28; }

.docs-bar {
  position: sticky;
  top: 70px;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 16, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.docs-bar-inner { display: flex; align-items: center; gap: 16px; min-height: 45px; }
.docs-menu {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 8.5px;
  cursor: pointer;
}
.docs-menu svg { width: 13px; height: 13px; }
.docs-crumbs { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font-family: var(--mono); font-size: 8.5px; }
.docs-crumbs a { color: var(--text-2); }
.docs-crumbs a:hover { color: var(--text); }
.docs-crumbs span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-sync { display: flex; align-items: center; gap: 15px; margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.docs-live { display: inline-flex; align-items: center; gap: 5px; color: var(--good); }
.docs-live i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.docs-sync a { color: var(--muted); }
.docs-sync a:hover { color: var(--text); }

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 170px;
  gap: clamp(24px, 3.4vw, 42px);
  padding-block: 38px 76px;
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: 136px;
  max-height: calc(100vh - 158px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(154,176,220,.2) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 5px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(154,176,220,.18); border-radius: 4px; }
.docs-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 17px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.02);
  color: var(--muted);
}
.docs-search svg { width: 13px; height: 13px; flex-shrink: 0; }
.docs-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
  font-size: 9px;
}
.docs-search input::placeholder { color: var(--muted); }
.docs-group { margin-bottom: 19px; }
.docs-group strong {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.docs-group a {
  display: block;
  padding: 5px 8px;
  border-left: 1px solid transparent;
  border-radius: 0 5px 5px 0;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.4;
  transition: color .15s, background .15s, border-color .15s;
}
.docs-group a:hover { color: var(--text); background: rgba(255,255,255,.035); }
.docs-group a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(var(--accent-rgb), .075);
}
.docs-side-foot { padding: 15px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 8px; line-height: 1.7; }
.docs-side-foot code { color: var(--text-2); }
.docs-side-foot a { display: block; margin-top: 4px; color: var(--accent); }

.docs-main { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 34px; align-items: start; }
.docs-article { min-width: 0; max-width: 760px; }
.docs-toc { position: sticky; top: 142px; max-height: calc(100vh - 160px); overflow-y: auto; padding-left: 13px; border-left: 1px solid var(--line); }
.docs-toc > strong { display: block; margin-bottom: 9px; color: var(--muted); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.docs-toc a { display: block; padding: 3px 0; color: var(--muted); font-size: 10.5px; line-height: 1.35; transition: color .15s; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a.toc-sub { padding-left: 8px; font-size: 9.5px; }
.docs-toc:empty::after { content: "No sections"; color: var(--muted); font-family: var(--mono); font-size: 8px; }

.docs-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 360px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.012); color: var(--muted); text-align: center; }
.docs-loading strong { color: var(--text-2); font-size: 14px; font-weight: 600; }
.docs-loading small { font-family: var(--mono); font-size: 8.5px; }
.docs-loading code { color: var(--accent); }
.docs-loading-dots { display: flex; gap: 5px; margin-bottom: 5px; }
.docs-loading-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: docsBounce 1.1s ease-in-out infinite; }
.docs-loading-dots i:nth-child(2) { animation-delay: .12s; background: var(--accent-2); }
.docs-loading-dots i:nth-child(3) { animation-delay: .24s; background: var(--good); }
@keyframes docsBounce { 0%,100% { transform: translateY(0); opacity: .35; } 50% { transform: translateY(-4px); opacity: 1; } }

.docs-error { padding: 28px; border: 1px solid rgba(255,125,141,.28); border-radius: 14px; background: rgba(255,125,141,.045); }
.docs-error strong { display: block; margin-bottom: 7px; color: var(--bad); }
.docs-error p { margin: 0 0 13px; color: var(--text-2); font-size: 13px; }
.docs-error code { color: var(--accent); font-family: var(--mono); font-size: 10px; }

/* ------------------------------ markdown ------------------------------ */

.markdown-body {
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.72;
}
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body h1 {
  margin: 0 0 22px;
  color: var(--text);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 680;
}
.markdown-body h2 {
  margin: 43px 0 14px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: clamp(21px, 2.6vw, 28px);
  line-height: 1.18;
  letter-spacing: -.03em;
}
.markdown-body h3 { margin: 30px 0 10px; color: var(--text); font-size: 18px; line-height: 1.3; letter-spacing: -.02em; }
.markdown-body h4 { margin: 24px 0 8px; color: var(--text); font-size: 15px; }
.markdown-body h2, .markdown-body h3, .markdown-body h4 { scroll-margin-top: 130px; }
.markdown-body p { margin: 0 0 16px; }
.markdown-body strong { color: var(--text); font-weight: 650; }
.markdown-body a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(var(--accent-rgb), .32); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
.markdown-body a:hover { color: var(--text); text-decoration-color: var(--accent); }
.markdown-body ul, .markdown-body ol { margin: 0 0 17px; padding-left: 22px; }
.markdown-body li { margin-bottom: 5px; }
.markdown-body li > p { margin-bottom: 7px; }
.markdown-body li::marker { color: var(--accent); }
.markdown-body blockquote {
  margin: 21px 0;
  padding: 12px 16px;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(var(--accent-rgb), .055);
  color: var(--text-2);
}
.markdown-body blockquote p:last-child { margin-bottom: 0; }
.markdown-body code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,.04);
  color: #dce7fa;
  font-family: var(--mono);
  font-size: .84em;
}
.markdown-body pre {
  margin: 18px 0 22px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #080d16;
  overflow-x: auto;
  line-height: 1.65;
  scrollbar-width: thin;
}
.markdown-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: #c7d4e8;
  font-size: 11px;
  white-space: pre;
}
.markdown-body hr { height: 1px; margin: 32px 0; border: 0; background: var(--line); }
.markdown-body img { display: block; max-width: 100%; height: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: 9px; }
.markdown-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 20px 0 24px;
  border-collapse: collapse;
  overflow-x: auto;
  font-size: 12px;
  white-space: nowrap;
}
.markdown-body th, .markdown-body td { padding: 8px 11px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-body th { background: rgba(255,255,255,.035); color: var(--text); font-weight: 650; }
.markdown-body tr:nth-child(even) td { background: rgba(255,255,255,.012); }
.markdown-body details { margin: 17px 0; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.015); }
.markdown-body summary { color: var(--text); font-weight: 600; cursor: pointer; }
.markdown-body input[type="checkbox"] { width: 13px; height: 13px; margin-right: 5px; accent-color: var(--accent); }
.markdown-body .anchor {
  margin-left: 7px;
  color: var(--muted);
  font-size: .65em;
  opacity: 0;
  text-decoration: none;
  transition: opacity .15s, color .15s;
}
.markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor, .markdown-body h4:hover .anchor { opacity: 1; }
.markdown-body .anchor:hover { color: var(--accent); }

.docs-footer { margin-top: 0; }
.docs-footer .footer-bottom { border-top: 0; }
.docs-footer a { color: var(--text-2); }

@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .docs-toc { display: none; }
  .docs-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .docs-bar { top: 70px; }
  .docs-menu { display: inline-flex; }
  .docs-sync .docs-live { display: none; }
  .docs-layout { display: block; padding-top: 22px; }
  .docs-sidebar {
    position: fixed;
    inset: 116px 14px auto 14px;
    z-index: 25;
    display: none;
    max-height: calc(100vh - 136px);
    padding: 15px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgba(9,15,25,.98);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
  }
  .docs-sidebar.open { display: block; }
  .docs-main { display: block; }
  .docs-article { max-width: none; }
  .docs-crumbs { font-size: 0; gap: 0; }
  .docs-crumbs a:first-child, .docs-crumbs span:nth-child(2) { display: none; }
  .docs-crumbs span:last-child { font-size: 8.5px; max-width: 180px; }
}
@media (max-width: 560px) {
  .docs-bar-inner { gap: 9px; }
  .docs-sync { display: none; }
  .docs-crumbs span:last-child { max-width: 140px; }
  .markdown-body { font-size: 13.5px; }
  .markdown-body pre { margin-left: -8px; margin-right: -8px; border-radius: 7px; }
  .markdown-body table { font-size: 11px; }
}
