/* ============================================================================
   EVIO API — docs page
   --------------------------------------------------------------------------
   Single-page custom docs at /api/docs/. Layered on api.css (portal aesthetic).
   Two-column layout: sticky TOC sidebar + main content. Mobile collapses to
   stacked.
   ========================================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  width: min(1200px, calc(100vw - 3.5rem));
  margin: 0 auto;
  padding: 5.5rem 0 5rem;
  position: relative;
  z-index: 1;
}

/* ── Sticky TOC sidebar ────────────────────────────────────────────────── */
.docs-toc {
  position: sticky;
  top: 120px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(82, 183, 136, 0.3) transparent;
}
.docs-toc::-webkit-scrollbar { width: 6px; }
.docs-toc::-webkit-scrollbar-thumb { background: rgba(82, 183, 136, 0.3); }

.docs-toc h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--evio-green-bright);
  margin: 1.5rem 0 0.5rem;
  padding: 0;
}
.docs-toc h4:first-of-type { margin-top: 0; }

.docs-toc a {
  display: block;
  padding: 0.35rem 0.6rem 0.35rem 0.6rem;
  color: var(--api-text-soft);
  border-left: 2px solid transparent;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.docs-toc a:hover {
  color: var(--evio-green-lime);
  background: rgba(82, 183, 136, 0.04);
}
.docs-toc a.active {
  color: var(--evio-green-lime);
  border-left-color: var(--evio-green-bright);
  background: rgba(82, 183, 136, 0.08);
}

/* ── Main content column ────────────────────────────────────────────────── */
.docs-content {
  min-width: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

.docs-content h1 {
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1.08;
  margin: 0 0 1.2rem;
  padding-bottom: 0.08em;
  background: linear-gradient(180deg, #FFFFFF 0%, #C7DACE 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.docs-content h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  line-height: 1.16;
  margin: 3.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--api-border);
  color: var(--api-text);
  background: none;
  -webkit-text-fill-color: var(--api-text);
}
.docs-content h3 {
  font-size: 1.4rem;
  line-height: 1.2;
  margin: 2.2rem 0 0.7rem;
  color: var(--api-text);
}
.docs-content h4 {
  font-size: 1.05rem;
  margin: 1.6rem 0 0.5rem;
  color: var(--api-text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
}

.docs-content h2:target,
.docs-content h3:target {
  scroll-margin-top: 100px;
}
.docs-section {
  scroll-margin-top: 100px;
}

.docs-content p {
  color: var(--api-text-soft);
  font-size: 1rem;
  line-height: 1.72;
  margin: 0 0 1rem;
}
.docs-content a:not(.btn):not(.docs-anchor) {
  color: var(--evio-green-lime);
  border-bottom: 1px dashed var(--api-border-hi);
}
.docs-content a:not(.btn):not(.docs-anchor):hover {
  color: var(--evio-green-bright);
  border-bottom-color: var(--evio-green-bright);
}

.docs-content ul, .docs-content ol {
  color: var(--api-text-soft);
  font-size: 1rem;
  line-height: 1.72;
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}
.docs-content li { margin-bottom: 0.4rem; }
.docs-content li code,
.docs-content p code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9em;
  color: var(--evio-green-lime);
  background: rgba(82, 183, 136, 0.06);
  padding: 1px 6px;
  border: 1px solid var(--api-border);
}

/* ── Hero / intro ──────────────────────────────────────────────────────── */
.docs-hero {
  padding: 6rem 0 1rem;
  border-bottom: 1px solid var(--api-border);
  position: relative;
}
.docs-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% 35%, rgba(82, 183, 136, 0.16), transparent 70%);
}
.docs-hero > * { position: relative; z-index: 1; }

.docs-hero .breadcrumb { margin-bottom: 0.9rem; }
.docs-hero h1 { margin-bottom: 1.2rem; }
.docs-hero p {
  font-size: 1.15rem;
  max-width: 64ch;
  color: var(--api-text-soft);
}

/* ── Action bar (Copy markdown, Open OpenAPI, etc.) ─────────────────────── */
.docs-actionbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}
.docs-actionbar .btn { padding: 0.7rem 1.1rem; font-size: 11px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}
.docs-content th, .docs-content td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--api-border);
  text-align: left;
  vertical-align: top;
  color: var(--api-text-soft);
}
.docs-content thead th {
  background: var(--api-surface-2);
  color: var(--evio-green-bright);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--api-border-hi);
}
.docs-content tr:nth-child(even) td { background: rgba(82, 183, 136, 0.012); }

/* ── Code blocks ────────────────────────────────────────────────────────── */
.docs-content pre {
  background: #04080A;
  border: 1px solid var(--api-border);
  padding: 1.05rem 1.2rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: #D7E5DC;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.65;
  margin: 0 0 1rem;
}
.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.code-tabs {
  margin: 1rem 0;
}
.code-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  background: var(--api-surface-2);
  border: 1px solid var(--api-border);
  border-bottom: 0;
  padding: 0.3rem 0.4rem 0;
}
.code-tabs-bar button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--api-text-soft);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.code-tabs-bar button:hover { color: var(--api-text); }
.code-tabs-bar button.active {
  color: var(--evio-green-bright);
  border-bottom-color: var(--evio-green-bright);
}
.code-tabs-panel { display: none; }
.code-tabs-panel.active { display: block; }
.code-tabs-panel pre { margin-top: 0; }

/* ── Endpoint sections ──────────────────────────────────────────────────── */
.docs-endpoint {
  margin-top: 2.2rem;
  padding: 1.6rem 1.6rem 1.4rem;
  border: 1px solid var(--api-border);
  background: var(--api-surface);
}
.docs-endpoint .endpoint-meta-row { margin-bottom: 0.4rem; }
.docs-endpoint h3 {
  margin-top: 0.4rem;
  margin-bottom: 0.6rem;
  font-size: 1.6rem;
}
.docs-endpoint .mcp-tool {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--evio-green-lime);
  display: block;
  margin-bottom: 0.7rem;
}

/* ── Callout boxes ──────────────────────────────────────────────────────── */
.docs-callout {
  border-left: 3px solid var(--evio-green-bright);
  background: rgba(82, 183, 136, 0.05);
  padding: 0.95rem 1.2rem;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}
.docs-callout.warn {
  border-left-color: var(--evio-gold);
  background: rgba(201, 168, 76, 0.06);
}
.docs-callout p:last-child { margin-bottom: 0; }
.docs-callout strong { color: var(--api-text); }

/* ── Anchor link icon on hover (humans clicking section headers) ────────── */
.docs-content h2 .docs-anchor,
.docs-content h3 .docs-anchor {
  opacity: 0;
  margin-left: 0.4rem;
  font-size: 0.7em;
  color: var(--evio-green-bright);
  transition: opacity 150ms ease;
  text-decoration: none;
  border: none !important;
}
.docs-content h2:hover .docs-anchor,
.docs-content h3:hover .docs-anchor {
  opacity: 1;
}

/* ── Toast (copy confirmation) — already in api.css, just make sure
       it works on docs page too ─────────────────────────────────────────── */

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 4rem 0 3rem;
    width: min(1200px, calc(100vw - 2rem));
  }
  .docs-toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 1rem;
    border: 1px solid var(--api-border);
    background: var(--api-surface);
    margin-bottom: 0.8rem;
  }
  .docs-toc h4:first-of-type { margin-top: 0; }
  .docs-hero { padding: 4rem 0 1rem; }
  .docs-content h2 { margin-top: 2.6rem; }
}
