/* ================================================================
   GoMLX Docs Layout — docs.css
   Three-column: sidebar + content + TOC
   ================================================================ */

.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: 0;
  max-width: var(--container-w);
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-h));
}

/* ── Sidebar ── */
.docs-sidebar {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 32px 0 32px 28px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }

.sidebar-section { margin-bottom: 28px; }
.sidebar-section-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 12px 8px 0;
  margin-bottom: 2px;
}
.sidebar-links { display: flex; flex-direction: column; }
.sidebar-link {
  font-size: 14px;
  color: var(--text-2);
  padding: 5px 12px 5px 0;
  border-radius: 0;
  display: block;
  border-left: 2px solid transparent;
  transition: all 0.12s;
  margin-left: 0;
  padding-left: 12px;
  border-radius: var(--radius-sm);
}
.sidebar-link:hover { color: var(--text); background: var(--bg-2); }
.sidebar-link.is-active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 500;
  border-left-color: var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Docs content ── */
.docs-content {
  padding: 48px 56px;
  min-width: 0;
}
.docs-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.docs-header h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 10px;
}
.docs-header .lead {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.65;
}
.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 16px;
}
.docs-breadcrumb a { color: var(--text-3); }
.docs-breadcrumb a:hover { color: var(--accent); }
.docs-breadcrumb span { opacity: 0.5; }

/* Prose styles */
.docs-body h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  color: var(--text);
  margin: 52px 0 16px;
  padding-top: 8px;
  line-height: 1.3;
}
.docs-body h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin: 36px 0 12px;
  line-height: 1.35;
}
.docs-body h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin: 24px 0 8px;
}
.docs-body p {
  font-size: 15.5px;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 18px;
  max-width: 68ch;
}
.docs-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.docs-body a:hover { color: var(--accent-dark); }
.docs-body strong { color: var(--text); font-weight: 500; }
.docs-body em { font-style: italic; }

/* Code blocks */
.docs-body pre {
  background: var(--bg-code);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
}
.docs-body pre code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: #d4d4d4;
}
.docs-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-3);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
/* Copy button on code blocks */
.code-copy-wrap { position: relative; }
.code-copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font-sans);
  color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.14s;
  opacity: 0;
}
.code-copy-wrap:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.1); }
.code-copy-btn.copied { color: var(--accent); border-color: var(--accent); opacity: 1; }

/* Lists */
.docs-body ul, .docs-body ol {
  padding-left: 24px;
  margin-bottom: 18px;
}
.docs-body ul { list-style: disc; }
.docs-body ol { list-style: decimal; }
.docs-body li {
  font-size: 15.5px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 5px;
}

/* Callouts */
.callout {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 24px 0;
  border-left: 3px solid;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.callout-icon { flex-shrink: 0; font-size: 16px; margin-top: 1px; }
.callout--tip    { background: var(--accent-dim);       border-color: var(--accent); }
.callout--note   { background: rgba(32,112,180,0.08);   border-color: #2070B4; }
.callout--warn   { background: rgba(180,140,10,0.08);   border-color: #B4940A; }
.callout--danger { background: rgba(180,50,40,0.08);    border-color: #B43228; }
.callout p { margin: 0; font-size: 14px; }
[data-theme="dark"] .callout--note { background: rgba(32,112,180,0.12); }
[data-theme="dark"] .callout--warn { background: rgba(180,140,10,0.12); }
[data-theme="dark"] .callout--danger { background: rgba(180,50,40,0.12); }

/* Tables */
.docs-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}
.docs-body th {
  text-align: left;
  font-weight: 500;
  color: var(--text);
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-2);
  font-size: 13px;
}
.docs-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}
.docs-body tr:last-child td { border-bottom: none; }

/* Prev/Next navigation */
.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.pagination-card {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  transition: all 0.16s;
}
.pagination-card:hover { border-color: var(--accent); background: var(--accent-dim); }
.pagination-card .dir {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.pagination-card .title { font-size: 15px; font-weight: 500; color: var(--text); }
.pagination-card--next { text-align: right; }

/* ── Right TOC ── */
.docs-toc {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 40px 28px 32px 28px;
  border-left: 1px solid var(--border);
}
.docs-toc-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}
.docs-toc ul { display: flex; flex-direction: column; gap: 2px; }
.docs-toc li { list-style: none; }
.docs-toc a {
  font-size: 13px;
  color: var(--text-3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: block;
  line-height: 1.4;
  transition: all 0.12s;
  border-left: 2px solid transparent;
}
.docs-toc a:hover { color: var(--text); background: var(--bg-2); }
.docs-toc a.is-active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }
.docs-toc li.toc-h3 a { padding-left: 20px; font-size: 12px; }

/* ── Responsive docs ── */
@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
  .docs-content { padding: 40px 40px; }
}
@media (max-width: 768px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: fixed; left: -280px; top: var(--nav-h); width: 260px; z-index: 50; background: var(--bg); transition: left 0.2s; height: calc(100vh - var(--nav-h)); }
  .docs-sidebar.is-open { left: 0; }
  .docs-content { padding: 28px 20px; }
}

/* ── Source sync banner ── */
.source-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 24px;
}
.source-banner svg { flex-shrink: 0; color: var(--text-3); }
.source-banner a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ── Last updated ── */
.last-updated {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.last-updated a { color: var(--accent); }
