/* Docs-specific styles; inherits CSS custom props from theme.css */

.docs-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 220px;
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 780px) {
  .docs-shell { grid-template-columns: 1fr; gap: 24px; padding: 20px 16px 60px; }
  .docs-sidebar { position: static !important; max-height: 280px !important; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
  .docs-main { font-size: 15px; }
  .docs-main h1 { font-size: 28px; }
  .docs-main h2 { font-size: 20px; margin: 32px 0 12px; }
  .docs-main h3 { font-size: 16px; }
  .docs-pager { flex-direction: column; gap: 10px; }
  .docs-pager a.next { text-align: left; }
}

.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding-right: 8px;
}
.docs-sidebar::-webkit-scrollbar { width: 6px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.docs-sidebar h5 {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 20px 0 8px;
  font-weight: 500;
}
.docs-sidebar h5:first-child { margin-top: 0; }
.docs-sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: 5px;
  color: var(--fg-soft);
  line-height: 1.4;
  transition: color .12s, background .12s;
}
.docs-sidebar a:hover { color: var(--fg); background: var(--bg-soft); }
.docs-sidebar a.active {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
}
.docs-sidebar a.d-1 { padding-left: 22px; font-size: 12px; color: var(--fg-muted); }
.docs-sidebar a.d-1.active { color: var(--accent); }
.docs-sidebar a.d-2 { padding-left: 34px; font-size: 11.5px; }

/* foldable nav */
.nav-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 5px;
}
.nav-row:hover { background: var(--bg-soft); }
.nav-row.active { background: color-mix(in oklab, var(--accent) 12%, transparent); }
.nav-row a {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--fg-soft);
  line-height: 1.4;
}
.nav-row:hover a { background: transparent; }
.nav-row a.active { color: var(--accent); background: transparent; }
.nav-toggle {
  flex-shrink: 0;
  width: 18px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer;
  color: var(--fg-muted); padding: 0;
}
.nav-toggle:hover { color: var(--fg); }
.nav-toggle svg { transition: transform .15s ease; }
.nav-toggle svg.open { transform: rotate(90deg); }
.nav-toggle-spacer { flex-shrink: 0; width: 18px; }

.docs-main {
  min-width: 0;
  font-size: 17px;
  line-height: 1.72;
  color: var(--fg);
  font-family: var(--font-display);
}
.docs-main h1 {
  font-size: 40px;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin: 0 0 24px;
  font-weight: 700;
}
.docs-main h2 {
  font-size: 27px;
  letter-spacing: -0.4px;
  margin: 44px 0 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 600;
}
.docs-main h3 { font-size: 20px; margin: 28px 0 10px; font-weight: 600; }
.docs-main h4 { font-size: 16px; margin: 22px 0 8px; font-weight: 600; color: var(--fg-soft); text-transform: uppercase; letter-spacing: .08em; }
.docs-main p { margin: 0 0 14px; color: var(--fg-soft); }
.docs-main strong { color: var(--fg); }
.docs-main em { color: var(--fg); }
.docs-main a {
  color: var(--accent);
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
  transition: border-color .12s;
}
.docs-main a:hover { border-bottom-color: var(--accent); }
.docs-main ul, .docs-main ol { margin: 0 0 16px; padding-left: 22px; color: var(--fg-soft); }
.docs-main li { margin: 4px 0; }
.docs-main code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--fg);
  border: 1px solid var(--border);
}
.docs-main pre.code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 16px;
  position: relative;
}
.docs-main pre.code code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--fg);
}
.docs-main pre.code[data-lang]:not([data-lang=""])::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px; right: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.docs-main blockquote {
  border-left: 2px solid var(--accent);
  padding: 8px 14px;
  background: var(--bg-soft);
  margin: 0 0 16px;
  border-radius: 0 6px 6px 0;
  color: var(--fg-soft);
  font-size: 14.5px;
}
.docs-main blockquote p { margin: 0; color: inherit; }
.docs-main hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.docs-main table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 20px;
  font-size: 14.5px;
  font-family: var(--font-mono);
}
.docs-main th, .docs-main td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.docs-main th {
  background: var(--bg-soft);
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
}
.docs-main tr:hover td { background: var(--bg-soft); }

/* Table of contents (right rail) */
.docs-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  font-family: var(--font-mono);
  font-size: 11.5px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.docs-toc h5 {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 10px;
  font-weight: 500;
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.docs-toc li { line-height: 1.5; }
.docs-toc a {
  display: block;
  padding: 3px 10px;
  color: var(--fg-muted);
  margin-left: -1px;
}
.docs-toc a:hover { color: var(--fg); }
.docs-toc a.active { color: var(--accent); border-left: 1px solid var(--accent); margin-left: -1px; }
.docs-toc a.l-3 { padding-left: 20px; font-size: 11px; }

/* Pagination (prev/next) */
.docs-pager {
  display: flex;
  gap: 14px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.docs-pager a {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--bg-card);
  display: block;
  transition: border-color .12s, transform .12s;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border);
}
.docs-pager a:hover { border-color: var(--accent); }
.docs-pager a.next { text-align: right; }
.docs-pager small {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.docs-pager .label { color: var(--fg); font-size: 14px; }

.docs-crumbs {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.docs-crumbs a { color: var(--fg-muted); }
.docs-crumbs .sep { color: var(--border-strong); }

.docs-search {
  margin-bottom: 18px;
  position: relative;
}
.docs-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px 7px 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}
.docs-search input:focus { outline: none; border-color: var(--accent); }
.docs-search svg {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  color: var(--fg-muted);
}
.docs-search .hit {
  font-size: 10.5px;
  color: var(--fg-muted);
  margin-top: 6px;
}
