/* API documentation layout. Shares the design tokens from styles.css. */

.docs-header { border-bottom: 1px solid var(--border); }

.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3rem;
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: .9rem;
}
.docs-sidebar-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 .75rem;
}
.docs-nav { display: flex; flex-direction: column; gap: .15rem; }
.docs-nav a {
  color: var(--muted);
  padding: .35rem .6rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
}
.docs-nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.docs-nav a.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

.docs-main { min-width: 0; }
.docs-main h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-top: 0; }
.docs-main h2 {
  font-size: 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.docs-main h3 { margin-top: 1.75rem; scroll-margin-top: 80px; }
.docs-main p, .docs-main li { color: var(--text); }
.docs-main .muted { color: var(--muted); }

.docs-main code {
  background: var(--surface-2);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85em;
}
.docs-main pre {
  position: relative;
  margin: 1rem 0;
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.docs-main pre code {
  display: block;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: none;
  color: var(--code-text);
  font-size: .82rem;
  line-height: 1.65;
  white-space: pre;
}
.docs-main pre .copy {
  position: absolute;
  top: .5rem;
  right: .5rem;
  opacity: 0;
  transition: opacity .15s ease;
}
.docs-main pre:hover .copy, .docs-main pre .copy:focus { opacity: 1; }

.docs-main .copy {
  border: 1px solid #2a3550;
  background: #111830;
  color: var(--code-muted);
  border-radius: 6px;
  padding: .2rem .55rem;
  font: inherit;
  font-size: .72rem;
  cursor: pointer;
}
.docs-main .copy:hover { color: var(--code-text); }
.docs-main .copy.copied { color: #4ade80; border-color: #14532d; }

.endpoint {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 .5rem;
  font-family: var(--mono);
  font-size: .95rem;
}
.method {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: #fff;
  background: var(--accent);
}
.method.get { background: #0e7490; }

.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .88rem;
}
.docs-table th, .docs-table td {
  text-align: left;
  padding: .55rem .7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-table th { color: var(--muted); font-weight: 600; background: var(--surface); }
.docs-table code { white-space: nowrap; }
.docs-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  padding: .05rem .4rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}
.badge.safe { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.badge.unsafe { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }

/* Glyph marker used in the anomaly unique-safe column. */
.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .85rem;
  border: 1px solid var(--border);
}
.mark.safe { color: var(--ok); background: #f0fdf4; border-color: #bbf7d0; }
.mark.unsafe { color: var(--danger); background: var(--danger-soft); border-color: #fecaca; }

.docs-toolbar { display: flex; gap: .75rem; align-items: center; margin: 1rem 0; flex-wrap: wrap; }
.docs-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .9rem;
}
.docs-toolbar input[type="search"]:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.docs-table details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .85rem;
}
.anomaly-list {
  margin-top: .4rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .75rem;
  line-height: 1.6;
  word-break: break-word;
}

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: .85rem 1rem;
  margin: 1rem 0;
  font-size: .9rem;
}
.callout.warn { border-left-color: #d97706; }

.docs-contact { margin-top: 3rem; }

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .docs-sidebar {
    position: static;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem;
    background: var(--surface);
  }
  .docs-nav { flex-direction: row; flex-wrap: wrap; }
  .docs-nav a { border-left: 0; }
}
