/* Documentation page for the cldapi theme. */

.public-docs-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-10);
}

.docs-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: start;
}

.docs-toc {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.docs-toc-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: var(--sp-3);
}

.docs-toc a {
  display: block;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.35;
}

.docs-toc a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.docs-toc a.active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--blue);
}

.docs-content {
  min-width: 0;
}

.docs-hero {
  padding: var(--sp-8) 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-7);
}

.docs-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: var(--r-full);
  padding: 5px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  margin-bottom: var(--sp-4);
}

.docs-title {
  margin: 0;
  max-width: 880px;
  font-size: 40px;
  line-height: 1.08;
  font-weight: 800;
  color: var(--text);
}

.docs-lede {
  max-width: 880px;
  margin: var(--sp-4) 0 0;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.75;
}

.docs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.docs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.docs-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.docs-section {
  scroll-margin-top: 92px;
  padding: var(--sp-7) 0;
  border-bottom: 1px solid var(--border);
}

.docs-section:last-child {
  border-bottom: none;
}

.docs-section h2 {
  margin: 0 0 var(--sp-3);
  color: var(--text);
  font-size: var(--text-2xl);
  line-height: 1.25;
}

.docs-section h3 {
  margin: var(--sp-5) 0 var(--sp-2);
  color: var(--text);
  font-size: var(--text-lg);
  line-height: 1.35;
}

.docs-section p,
.docs-section li {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.78;
}

.docs-section ul,
.docs-section ol {
  margin: var(--sp-3) 0;
  padding-left: 22px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.docs-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.docs-panel {
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.docs-panel h3 {
  margin-top: 0;
}

.docs-quick-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.docs-card-kicker {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 3px 8px;
  color: var(--subtle);
  background: var(--surface-2);
  font-size: var(--text-xs);
  font-weight: 700;
}

.docs-panel p:last-child,
.docs-panel ul:last-child,
.docs-panel ol:last-child {
  margin-bottom: 0;
}

.docs-callout {
  margin: var(--sp-5) 0;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: var(--text);
}

.docs-callout.info {
  background: var(--surface-2);
  border-color: var(--border);
}

.docs-callout.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.docs-callout.success {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.docs-callout strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.docs-callout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

.docs-callout code,
.docs-panel code,
.docs-table code,
.docs-compact-list code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--text);
}

.docs-steps {
  display: grid;
  gap: var(--sp-4);
  margin: var(--sp-5) 0;
  counter-reset: docs-step;
}

.docs-steps-inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.docs-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  counter-increment: docs-step;
}

.docs-step::before {
  content: counter(docs-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 800;
  font-size: var(--text-sm);
}

.docs-step h3,
.docs-tool-card h3 {
  margin-top: 0;
}

.docs-step p:last-child {
  margin-bottom: 0;
}

.docs-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.docs-tool-card {
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.docs-tool-card p {
  margin-bottom: var(--sp-3);
}

.docs-mini-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: var(--sp-3) 0;
}

.docs-mini-tabs .tab-item {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  margin-bottom: 0;
  font-size: var(--text-xs);
}

.docs-mini-tabs .tab-item.active {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.docs-code {
  position: relative;
  overflow: auto;
  margin: var(--sp-4) 0;
  padding: var(--sp-4);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  white-space: pre;
}

.docs-code.has-copy,
.code-block.has-copy {
  padding-top: calc(var(--sp-4) + 26px);
}

.code-block.has-copy {
  position: relative;
}

.docs-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  min-width: 62px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}

.docs-copy-btn:hover {
  background: var(--surface-2);
  border-color: var(--blue-border);
  color: var(--blue);
}

.code-block .docs-copy-btn {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
}

.code-block .docs-copy-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.34);
  color: #fff;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-4) 0;
  font-size: var(--text-sm);
}

.docs-table th,
.docs-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.docs-table th {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 700;
}

.docs-table td {
  color: var(--muted);
}

.docs-table-compact th,
.docs-table-compact td {
  padding: 9px 10px;
}

.docs-compact-list {
  display: grid;
  gap: var(--sp-2);
  padding-left: 0 !important;
  list-style: none !important;
}

.docs-compact-list li {
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.docs-section ul:not(.checklist):not(.docs-compact-list) {
  list-style: disc;
}

.docs-section ol {
  list-style: decimal;
}

.agent-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}

.agent-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.agent-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.agent-tag {
  flex-shrink: 0;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  padding: 3px 8px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
}

.agent-card p {
  margin: 0;
}

.endpoint-list {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.endpoint {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.method.get { background: var(--success-bg); color: var(--success); }
.method.post { background: var(--blue-bg); color: var(--blue); }
.method.put { background: var(--warning-bg); color: var(--warning); }
.method.delete { background: var(--danger-bg); color: var(--danger); }

.endpoint-path {
  margin: 2px 0 4px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text);
  word-break: break-all;
}

.endpoint-desc {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.6;
}

.checklist {
  list-style: none;
  padding-left: 0 !important;
}

.checklist li {
  position: relative;
  padding-left: 28px;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.docs-footer-note {
  margin-top: var(--sp-8);
  padding: var(--sp-5) 0;
  color: var(--subtle);
  font-size: var(--text-xs);
  border-top: 1px solid var(--border);
}

@media (max-width: 1080px) {
  .public-docs-main {
    padding: var(--sp-6) var(--sp-4) var(--sp-8);
  }

  .docs-shell {
    grid-template-columns: 1fr;
  }

  .docs-toc {
    position: static;
    max-height: none;
  }

  .docs-grid,
  .docs-grid.three,
  .docs-steps-inline,
  .docs-tool-grid,
  .agent-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .docs-title {
    font-size: 30px;
  }

  .docs-lede {
    font-size: var(--text-base);
  }

  .endpoint {
    grid-template-columns: 1fr;
  }

  .docs-step {
    grid-template-columns: 1fr;
  }

  .docs-hero-actions .btn {
    width: 100%;
  }
}
