/* Three-column documentation layout */
.docs-shell {
  max-width: 1460px;
  margin: 0 auto;
  padding: 28px 24px 72px;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 216px;
  gap: 28px;
  align-items: start;
}

.docs-mobile-bar {
  display: none;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
  align-items: center;
  justify-content: space-between;
}

.docs-mobile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* Left Sidebar */
.docs-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  max-height: calc(100vh - var(--nav-h) - 36px);
  overflow-y: auto;
  padding-right: 10px;
}

.sb-filter-wrap {
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding-bottom: 8px;
  z-index: 2;
}

.sb-filter-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--bg-code);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.sb-filter-input:focus { border-color: var(--cyan); }

/* Center Prose Column */
.docs-main {
  min-width: 0;
  max-width: 840px;
}

.breadcrumb { margin-bottom: 16px; }
.breadcrumb__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--dim);
  flex-wrap: wrap;
}
.breadcrumb__list li + li::before { content: "/"; margin-right: 8px; color: var(--dim); }
.breadcrumb__list a:hover { color: var(--cyan); }
.breadcrumb__list [aria-current="page"] { color: var(--ink); font-weight: 600; }

.doc-meta-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.class-spec-card {
  margin: 0 0 22px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.spec-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.spec-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
}

.spec-val {
  font-size: 12.8px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.formula-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(91, 192, 235, 0.08);
  border: 1px solid rgba(91, 192, 235, 0.2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: #a5f3fc;
}

.formula-inline {
  font-size: 0.88em;
}

.docs-main h1 {
  margin: 0 0 18px;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: #ffffff;
}

.docs-main h2 {
  margin: 40px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: #ffffff;
  scroll-margin-top: 86px;
}

.docs-main h3 {
  margin: 28px 0 10px;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  color: #f1f5f9;
  scroll-margin-top: 86px;
}

.docs-main h4 {
  margin: 20px 0 8px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--cyan-bright);
}

.heading-anchor {
  margin-left: 8px;
  color: var(--dim);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.docs-main h2:hover .heading-anchor,
.docs-main h3:hover .heading-anchor {
  opacity: 1;
}
.heading-anchor:hover { color: var(--cyan); }

.docs-main p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.72;
  color: #cbd5e1;
}

.docs-main ul, .docs-main ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.7;
}

.docs-main li { margin-bottom: 6px; }
.docs-main li strong, .docs-main p strong { color: #ffffff; }
.docs-main hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.docs-main a:not(.heading-anchor):not(.doc-pager-card):not(.hub-card):not(.btn) {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-color: rgba(91, 192, 235, 0.35);
  text-underline-offset: 3px;
}

.docs-main :not(pre) > code {
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(91, 192, 235, 0.1);
  border: 1px solid rgba(91, 192, 235, 0.18);
  color: #a5f3fc;
}

/* Code Shell */
.code-shell {
  margin: 16px 0 22px;
  border-radius: var(--radius-md);
  background: var(--bg-code);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.code-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0b111e;
  border-bottom: 1px solid var(--line);
}

.code-shell-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
}

.code-shell pre[class*="language-"],
.code-shell pre {
  margin: 0 !important;
  padding: 16px 18px !important;
  background: transparent !important;
  font-size: 13.2px !important;
  line-height: 1.6 !important;
  overflow-x: auto;
}

.docs-main pre:not(.mermaid-raw) {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.2px;
  line-height: 1.6;
}

.code-shell pre { border: 0 !important; }

/* Unified API Method Cards */
.api-method {
  margin: 14px 0 20px;
  border-radius: var(--radius-md);
  background: rgba(14, 21, 37, 0.42);
  border: 1px solid var(--line);
  overflow: hidden;
}

.api-method .code-shell {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.api-method-desc {
  padding: 13px 18px;
}

.api-method-desc p {
  margin: 0 0 8px;
  font-size: 14.8px;
  line-height: 1.65;
}

.api-method-desc p:last-child,
.api-method-desc ul:last-child {
  margin-bottom: 0;
}

.api-method-desc ul {
  margin: 6px 0 0;
  font-size: 14.2px;
}

/* Tables in Docs */
.doc-table-wrap {
  margin: 18px 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow-x: auto;
  background: var(--bg-card);
}

.doc-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.8px;
}

.doc-table-wrap th {
  background: #0a101d;
  color: #ffffff;
  font-weight: 700;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.doc-table-wrap td {
  padding: 11px 15px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(148, 163, 184, 0.09);
  vertical-align: top;
}

.doc-table-wrap tr:last-child td { border-bottom: 0; }

.props-table th:nth-child(1) { width: 22%; }
.props-table th:nth-child(2) { width: 13%; }
.props-table th:nth-child(3) { width: 15%; }
.props-table th:nth-child(4) { width: 50%; }

.prop-key {
  font-weight: 700;
  color: #7dd3fc !important;
  background: rgba(91, 192, 235, 0.12) !important;
  border-color: rgba(91, 192, 235, 0.25) !important;
  white-space: nowrap;
}

.prop-type {
  color: #c4b5fd !important;
  background: rgba(139, 92, 246, 0.12) !important;
  border-color: rgba(139, 92, 246, 0.25) !important;
  white-space: nowrap;
}

.prop-default {
  color: #6ee7b7 !important;
  background: rgba(56, 211, 159, 0.1) !important;
  border-color: rgba(56, 211, 159, 0.22) !important;
  white-space: nowrap;
}

.prop-none {
  color: var(--dim);
  font-family: 'JetBrains Mono', monospace;
}

/* Mermaid Diagrams */
.mermaid-frame {
  margin: 22px 0 28px;
  border-radius: var(--radius-lg);
  background: #060a13;
  border: 1px solid rgba(91, 192, 235, 0.22);
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(91, 192, 235, 0.06);
  overflow: hidden;
}

.mermaid-frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  background: #0b111e;
  border-bottom: 1px solid var(--line);
}

.mermaid-frame-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
}

.mermaid-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mermaid-zoom-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  min-width: 40px;
  text-align: center;
}

.mermaid-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 260px;
  height: 420px;
  padding: 0;
  background-color: #060a13;
  background-image: radial-gradient(rgba(91, 192, 235, 0.14) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.mermaid-wrap.is-dragging,
.mermaid-lightbox-body.is-dragging {
  cursor: grabbing;
}

.mermaid-stage {
  flex: none;
  display: block;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  will-change: transform;
}

.mermaid-wrap.is-dragging .mermaid-stage,
.mermaid-lightbox-body.is-dragging .mermaid-stage {
  transition: none;
}

.mermaid-wrap .mermaid,
.mermaid-lightbox-body .mermaid {
  display: block;
}

.mermaid-wrap svg,
.mermaid-lightbox-body svg {
  display: block;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45));
}

.mermaid-wrap .node rect,
.mermaid-wrap .node polygon,
.mermaid-wrap .node circle,
.mermaid-wrap .node path,
.mermaid-lightbox-body .node rect,
.mermaid-lightbox-body .node polygon,
.mermaid-lightbox-body .node circle,
.mermaid-lightbox-body .node path {
  stroke-width: 1.5px !important;
}

.mermaid-wrap .node rect,
.mermaid-lightbox-body .node rect {
  rx: 10px !important;
  ry: 10px !important;
}

.mermaid-wrap .cluster rect,
.mermaid-lightbox-body .cluster rect {
  fill: rgba(14, 21, 37, 0.55) !important;
  stroke: rgba(91, 192, 235, 0.28) !important;
  stroke-dasharray: 5 4 !important;
  rx: 12px !important;
  ry: 12px !important;
}

.mermaid-wrap .edgeLabel,
.mermaid-lightbox-body .edgeLabel {
  background-color: #0b111e !important;
  color: #cbd5e1 !important;
  padding: 2px 6px !important;
  border-radius: 5px !important;
}

.mermaid-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(3, 5, 10, 0.88);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.mermaid-lightbox.open { display: flex; }

.mermaid-lightbox-box {
  width: 94vw;
  max-width: 1440px;
  height: 90vh;
  background: #060a13;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mermaid-lightbox-body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background-image: radial-gradient(rgba(91, 192, 235, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Prev / Next Pager */
.doc-pager {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.doc-pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.doc-pager-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.doc-pager-card.next { text-align: right; align-items: flex-end; }
.doc-pager-dir { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--dim); text-transform: uppercase; }
.doc-pager-title { font-size: 15px; font-weight: 700; color: var(--cyan); }

/* Right TOC */
.docs-toc {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  max-height: calc(100vh - var(--nav-h) - 36px);
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid var(--line);
  padding: 0 6px 0 14px;
}

.toc-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin: 0 0 12px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toc-link {
  display: block;
  font-size: 12.4px;
  line-height: 1.42;
  color: var(--muted);
  overflow-wrap: anywhere;
  transition: color 0.12s ease;
}
.toc-link.h3 { padding-left: 12px; font-size: 12px; color: var(--dim); }
.toc-link:hover, .toc-link.active { color: var(--cyan); font-weight: 600; }

/* Documentation Hub */
.hub-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0 32px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.hub-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.hub-card-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cyan);
}

.hub-card-title { font-size: 17px; font-weight: 700; color: #ffffff; }
.hub-card-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.hub-pipeline-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0 24px;
}

.hub-step {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
}

.hub-step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 4px;
}
.hub-step strong { display: block; font-size: 15px; color: #ffffff; margin-bottom: 4px; }
.hub-step span { font-size: 12.5px; color: var(--muted); }

@media (max-width: 1240px) {
  .docs-shell { grid-template-columns: 256px minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 960px) {
  .docs-mobile-bar { display: flex; }
  .docs-shell {
    grid-template-columns: 1fr;
    padding: 20px 18px 54px;
    gap: 20px;
  }
  .docs-sidebar {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    bottom: 0;
    width: 290px;
    max-height: none;
    z-index: 60;
    background: var(--bg-elevated);
    border-right: 1px solid var(--line);
    padding: 18px;
  }
  .docs-sidebar.open { display: block; }
  .hub-grid-4, .hub-pipeline-steps, .doc-pager, .class-spec-card { grid-template-columns: 1fr; }
}
