/* ═══════════════════════════════════════════════════════
   Docs micro-layout for /ccm/* - uses same tokens
   as main site (indigo/slate), adds docs-specific UI
   ═══════════════════════════════════════════════════════ */

/* ── Two-column docs grid ── */
.docs-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 44px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px;
}
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; padding: 20px 16px; gap: 0; }
  .docs-sidebar { display: none; }
}

/* ── Left sidebar (nav) ── */
.docs-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  align-self: start;
  font-size: 13.5px;
  padding-right: 8px;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 4px;
}
.docs-sidebar h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(99, 102, 241, 0.85);
  margin: 16px 0 8px 8px;
}
.dark .docs-sidebar h4 { color: rgba(129, 140, 248, 0.85); }
.docs-sidebar a {
  display: block;
  padding: 6px 10px;
  margin: 1px 0;
  color: #4b5563;
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 150ms ease;
}
.dark .docs-sidebar a { color: #94a3b8; }
.docs-sidebar a:hover {
  background: rgba(99, 102, 241, 0.06);
  color: #4f46e5;
}
.dark .docs-sidebar a:hover {
  background: rgba(129, 140, 248, 0.08);
  color: #a78bfa;
}
.docs-sidebar a.active {
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.08);
  border-left-color: #4f46e5;
  font-weight: 600;
}
.dark .docs-sidebar a.active {
  color: #a78bfa;
  background: rgba(129, 140, 248, 0.1);
  border-left-color: #a78bfa;
}

/* ── Right TOC (on-page anchors) ── */
.docs-toc {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  align-self: start;
  font-size: 12.5px;
  padding-left: 16px;
  border-left: 1px solid rgba(229, 231, 235, 0.6);
}
.dark .docs-toc { border-left-color: rgba(30, 41, 59, 0.6); }
.docs-toc h5 {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  margin: 0 0 12px 0;
}
.dark .docs-toc h5 { color: #94a3b8; }
.docs-toc a {
  display: block;
  padding: 5px 0;
  color: #6b7280;
  text-decoration: none;
  transition: color 150ms ease;
  line-height: 1.4;
}
.dark .docs-toc a { color: #94a3b8; }
.docs-toc a:hover { color: #4f46e5; }
.dark .docs-toc a:hover { color: #a78bfa; }
.docs-toc a.active {
  color: #4f46e5;
  font-weight: 600;
}
.dark .docs-toc a.active { color: #a78bfa; }

/* ── Content body ── */
.docs-content {
  min-width: 0;
  padding: 8px 0 80px;
}
.docs-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 16px;
  line-height: 1.1;
}
.dark .docs-content h1 { color: #f8fafc; }
.docs-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
  margin: 56px 0 16px;
  padding-top: 12px;
  scroll-margin-top: 100px;
}
.dark .docs-content h2 { color: #f1f5f9; }
.docs-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 36px 0 12px;
  scroll-margin-top: 100px;
}
.dark .docs-content h3 { color: #e2e8f0; }
.docs-content h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin: 24px 0 8px;
}
.dark .docs-content h4 { color: #cbd5e1; }
.docs-content p {
  font-size: 15px;
  line-height: 1.7;
  color: #4b5563;
  margin: 12px 0;
}
.dark .docs-content p { color: #cbd5e1; }
.docs-content :where(p, li, td, dd) a {
  color: #4f46e5;
  text-decoration: none;
  border-bottom: 1px dashed rgba(79, 70, 229, 0.4);
  transition: all 150ms ease;
}
.docs-content :where(p, li, td, dd) a:hover { border-bottom-style: solid; }
.dark .docs-content :where(p, li, td, dd) a {
  color: #a78bfa;
  border-bottom-color: rgba(167, 139, 250, 0.4);
}
/* Defensive reset: standalone CTA buttons inside docs-content keep their Tailwind colors */
.docs-content a[class*="rounded-xl"],
.docs-content a[class*="rounded-lg"] {
  border-bottom: 0 !important;
}
.docs-content a[class*="bg-indigo"] { color: #fff !important; }
.dark .docs-content a[class*="bg-indigo"] { color: rgb(2 6 23) !important; }
.docs-content ul, .docs-content ol {
  font-size: 15px;
  line-height: 1.7;
  color: #4b5563;
  margin: 12px 0;
  padding-left: 24px;
}
.dark .docs-content ul, .dark .docs-content ol { color: #cbd5e1; }
.docs-content li { margin: 6px 0; }
.docs-content li::marker { color: #6366f1; }
.dark .docs-content li::marker { color: #818cf8; }

/* ── Inline code ── */
.docs-content code:not(pre code) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  background: rgba(99, 102, 241, 0.08);
  color: #4338ca;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  white-space: nowrap;
}
.dark .docs-content code:not(pre code) {
  background: rgba(129, 140, 248, 0.12);
  color: #c4b5fd;
  border-color: rgba(129, 140, 248, 0.2);
}

/* ── Code blocks ── */
.code-block {
  position: relative;
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0b1224;
  border: 1px solid rgba(30, 41, 59, 0.5);
  font-size: 13px;
}
.code-block .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
}
.code-block .code-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.code-block .code-copy {
  background: transparent;
  border: 0;
  color: #94a3b8;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 5px;
  transition: all 150ms ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.code-block .code-copy:hover { background: rgba(99, 102, 241, 0.15); color: #c7d2fe; }
.code-block .code-copy.copied { color: #34d399; }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: transparent;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.65;
}
.code-block pre::-webkit-scrollbar { height: 6px; }
.code-block pre::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 4px; }
.code-block .tok-key { color: #c7d2fe; }
.code-block .tok-val { color: #fde68a; }
.code-block .tok-str { color: #fde68a; }
.code-block .tok-com { color: #64748b; font-style: italic; }
.code-block .tok-fn { color: #c4b5fd; }
.code-block .tok-num { color: #fca5a5; }

/* ── Tables ── */
.docs-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(229, 231, 235, 1);
  -webkit-overflow-scrolling: touch;
}
.docs-content table::-webkit-scrollbar { height: 6px; }
.docs-content table::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.25); border-radius: 4px; }
.docs-content table > thead,
.docs-content table > tbody { display: table; width: 100%; table-layout: auto; }
.dark .docs-content table {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(30, 41, 59, 1);
}
.docs-content thead {
  background: rgba(99, 102, 241, 0.04);
}
.dark .docs-content thead { background: rgba(99, 102, 241, 0.08); }
.docs-content th {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4338ca;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(229, 231, 235, 1);
  white-space: nowrap;
}
.dark .docs-content th {
  color: #a5b4fc;
  border-bottom-color: rgba(30, 41, 59, 1);
}
.docs-content td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.6);
  color: #4b5563;
  vertical-align: top;
  line-height: 1.6;
  overflow-wrap: break-word;
}
.dark .docs-content td {
  color: #cbd5e1;
  border-bottom-color: rgba(30, 41, 59, 0.5);
}
.docs-content tr:last-child td { border-bottom: 0; }
.docs-content tr:hover { background: rgba(99, 102, 241, 0.02); }
.dark .docs-content tr:hover { background: rgba(99, 102, 241, 0.05); }
/* Inline code chips inside table cells stay intact (no mid-identifier wrap).
   If a cell can't fit them, the table scrolls horizontally instead. */
.docs-content td code:not(pre code),
.docs-content th code:not(pre code) { white-space: nowrap; }
/* Identifier-style first column gets a touch of breathing room */
.docs-content td:first-child { white-space: nowrap; }
.docs-content td:last-child { min-width: 220px; white-space: normal; }

/* ── Callouts ── */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin: 20px 0;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.6;
}
.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.callout-body { flex: 1; }
.callout-body strong { color: inherit; font-weight: 700; }
.callout-info {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
  color: #4338ca;
}
.dark .callout-info {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
}
.callout-warn {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.25);
  color: #b45309;
}
.dark .callout-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}
.callout-tip {
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
  color: #047857;
}
.dark .callout-tip {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}
.callout-danger {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}
.dark .callout-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ── Heading anchor link ── */
.docs-content h2 .anchor,
.docs-content h3 .anchor {
  opacity: 0;
  margin-left: 8px;
  color: rgba(99, 102, 241, 0.6);
  text-decoration: none;
  border: 0;
  font-weight: 400;
  transition: opacity 150ms ease;
}
.docs-content h2:hover .anchor,
.docs-content h3:hover .anchor { opacity: 1; }

/* ── Badge pills (for required/optional markers) ── */
.pill {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}
.pill-required {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.dark .pill-required {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.pill-optional {
  background: rgba(148, 163, 184, 0.12);
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.dark .pill-optional {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.3);
}
.pill-new {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.dark .pill-new {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

/* ── Mobile sidebar trigger ── */
.docs-mobile-bar {
  display: none;
  position: sticky;
  top: 72px;
  z-index: 30;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.7);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #4338ca;
}
.dark .docs-mobile-bar {
  background: rgba(2, 6, 23, 0.85);
  border-bottom-color: rgba(30, 41, 59, 0.6);
  color: #a5b4fc;
}
@media (max-width: 900px) {
  .docs-mobile-bar { display: flex; align-items: center; gap: 8px; }
}
