/* ===== DOCS LAYOUT ===== */
/* Extends styles.css. Loaded after it on docs pages. */

.docs-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 24px 80px;
  position: relative;
  z-index: 1;
}

@media (max-width: 960px) {
  .docs-shell { grid-template-columns: 1fr; gap: 24px; padding-top: 100px; }
}

/* ===== DOCS HEADER ===== */
.docs-header {
  grid-column: 1 / -1;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.docs-header-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.docs-header img { width: 48px; height: 48px; border-radius: 12px; }
.docs-header h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.docs-header h1 .gradient-text { display: inline; }
.docs-header p { color: var(--text-muted); margin-top: 8px; font-size: 1rem; }
.docs-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 16px;
}
.docs-back-link:hover { color: var(--cyan); }

/* ===== ON-THIS-PAGE TOC ===== */
.docs-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(18, 18, 26, 0.5);
  backdrop-filter: blur(10px);
  font-size: 0.85rem;
}
.docs-toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--indigo);
  margin-bottom: 12px;
}
.docs-toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.docs-toc ul ul { padding-left: 12px; margin-top: 4px; gap: 2px; }
.docs-toc a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  font-size: 0.85rem;
}
.docs-toc a.h3 { font-size: 0.78rem; padding-left: 18px; }
.docs-toc a:hover { color: #fff; background: rgba(108, 92, 231, 0.08); }
.docs-toc a.active {
  color: #fff;
  border-left-color: var(--indigo);
  background: rgba(108, 92, 231, 0.12);
}

@media (max-width: 960px) {
  .docs-toc {
    position: static;
    max-height: none;
    margin-bottom: 16px;
  }
}

/* ===== PROSE (rendered markdown) ===== */
.docs-prose {
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
}

.docs-prose > *:first-child { margin-top: 0; }

.docs-prose h1, .docs-prose h2, .docs-prose h3, .docs-prose h4 {
  color: #fff;
  scroll-margin-top: 96px;
}
.docs-prose h1 { font-size: 1.9rem; margin: 48px 0 16px; }
.docs-prose h2 {
  font-size: 1.45rem;
  margin: 56px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.docs-prose h3 { font-size: 1.15rem; margin: 32px 0 12px; }
.docs-prose h4 { font-size: 1rem; margin: 24px 0 8px; color: var(--text); }

.docs-prose h1:first-child { display: none; }       /* page already has its own header */
.docs-prose h1 + p:first-of-type,
.docs-prose h1 + p + p:first-of-type { display: none; }

.docs-prose .heading-anchor {
  margin-left: 8px;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s;
  font-weight: 400;
  font-size: 0.85em;
}
.docs-prose h2:hover .heading-anchor,
.docs-prose h3:hover .heading-anchor,
.docs-prose h4:hover .heading-anchor { opacity: 0.7; }
.docs-prose .heading-anchor:hover { opacity: 1 !important; color: var(--cyan); }

.docs-prose p { margin: 0 0 16px; }

.docs-prose a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid rgba(0, 210, 255, 0.3); }
.docs-prose a:hover { border-bottom-color: var(--cyan); }

.docs-prose strong { color: #fff; font-weight: 600; }
.docs-prose em { color: var(--text); }

.docs-prose ul, .docs-prose ol {
  padding-left: 24px;
  margin: 0 0 16px;
}
.docs-prose li { margin-bottom: 8px; }
.docs-prose li > ul, .docs-prose li > ol { margin: 8px 0 0; }
.docs-prose ul li::marker { color: var(--indigo); }
.docs-prose ol li::marker { color: var(--indigo); font-weight: 600; }

.docs-prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.docs-prose blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--indigo);
  background: rgba(108, 92, 231, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.docs-prose blockquote p:last-child { margin-bottom: 0; }

.docs-prose code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(108, 92, 231, 0.12);
  color: var(--cyan);
  border: 1px solid var(--border);
}

.docs-prose pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
}
.docs-prose pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text);
}

/* ===== TABLES ===== */
.docs-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}
.docs-prose thead { background: rgba(108, 92, 231, 0.1); }
.docs-prose th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: #fff;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.docs-prose td {
  padding: 12px 16px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.docs-prose tr:last-child td { border-bottom: none; }
.docs-prose td strong, .docs-prose th strong { color: #fff; }

/* ===== LOADING + ERROR ===== */
.docs-loading, .docs-error {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.docs-error h2 { color: #fff; margin-bottom: 16px; }

/* ===== CTA CARD ON PRODUCT PAGES ===== */
.docs-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 48px;
  padding: 24px 32px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.08), rgba(0, 210, 255, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.docs-cta-text { flex: 1; min-width: 240px; }
.docs-cta-text strong { color: #fff; display: block; margin-bottom: 4px; }
.docs-cta-text span { color: var(--text-muted); font-size: 0.9rem; }
