/* ============================================================
   Belter — docs pages
   Built on top of styles.css. Patterns specific to reference
   documentation (sidebar + scrolling content + code).
   ============================================================ */

/* ----- Layout shell ----------------------------------------- */
.docs-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 64px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 32px 96px;
}
@media (max-width: 1024px) {
  .docs-shell { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px 64px; }
}

/* Left rail */
.docs-rail {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 8px;
}
.docs-rail::-webkit-scrollbar { width: 4px; }
.docs-rail::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 999px; }
@media (max-width: 1024px) {
  .docs-rail {
    position: static;
    max-height: none;
    padding: 18px 20px;
    margin: 0 -20px 8px;
    border-bottom: 1px solid var(--border-subtle);
  }
}

.docs-rail__group { margin-bottom: 22px; }
.docs-rail__group:last-child { margin-bottom: 0; }
.docs-rail__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-grey-light);
  font-weight: 500;
  margin: 0 0 10px;
  padding-left: 10px;
}
.docs-rail__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.docs-rail__list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-grey-mid);
  text-decoration: none;
  line-height: 1.4;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.docs-rail__list a:hover {
  color: var(--text-black);
  background: var(--bg-page-muted);
}
.docs-rail__list a.is-active {
  color: var(--text-black);
  font-weight: 500;
  border-left-color: var(--brand-green);
  background: transparent;
}
.docs-rail__list a .verb {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(70,253,174,0.18);
  color: #0F7A4A;
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.docs-rail__list a .verb--get { background: rgba(133,130,199,0.18); color: #6B5BD6; }

/* ----- Page header ----------------------------------------- */
.docs-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 24px;
  margin-bottom: 40px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.docs-header h1 {
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 8px 0 8px;
}
.docs-header .sub {
  font-size: 16px;
  color: var(--text-grey-mid);
  line-height: 1.5;
  max-width: 720px;
}
.docs-header__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ----- Prose ----------------------------------------------- */
.docs-prose {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-grey-dark);
  max-width: 880px;
}
.docs-prose p { margin: 0 0 18px; }
.docs-prose strong { color: var(--text-black); font-weight: 500; }
.docs-prose a { color: var(--text-black); text-decoration: underline; text-decoration-color: var(--brand-green); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.docs-prose a:hover { text-decoration-color: var(--text-black); }
.docs-prose ul, .docs-prose ol { padding-left: 22px; margin: 0 0 18px; }
.docs-prose li { margin-bottom: 6px; }
.docs-prose hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 48px 0; }

/* Inline code (different from .code block, which is dark) */
.docs-prose code,
.docs-prose p > code,
.docs-prose li > code,
.docs-prose td > code,
.docs-prose th > code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1.5px 6px;
  background: var(--bg-page-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-black);
  white-space: nowrap;
}

/* Headings with anchor links */
.docs-h2 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 500;
  color: var(--text-black);
  margin: 56px 0 16px;
  scroll-margin-top: 100px;
  position: relative;
}
.docs-h2:first-child { margin-top: 0; }
.docs-h3 {
  font-size: 19px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text-black);
  margin: 36px 0 12px;
  scroll-margin-top: 100px;
}
.docs-h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-black);
  margin: 24px 0 8px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--text-grey-mid);
}
.docs-h2 .anchor,
.docs-h3 .anchor {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-grey-light);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity 120ms var(--ease-out);
}
.docs-h2:hover .anchor,
.docs-h3:hover .anchor { opacity: 1; }
.docs-h3 { position: relative; }

/* ----- Tables ---------------------------------------------- */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  margin: 18px 0 28px;
  font-size: 14px;
}
.docs-table th,
.docs-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  line-height: 1.5;
}
.docs-table th {
  background: var(--bg-page-muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-grey-mid);
}
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td:first-child {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-black);
  white-space: nowrap;
}
.docs-table td.req {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.docs-table td.req-yes { color: var(--brand-green); color: #0F7A4A; }
.docs-table td.req-no { color: var(--text-grey-light); }

/* Status code chips inside tables */
.docs-table .http {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 500;
  display: inline-block;
}
.docs-table .http--2xx { background: rgba(70,253,174,0.16); color: #0F7A4A; }
.docs-table .http--4xx { background: rgba(251,133,105,0.14); color: #B14622; }
.docs-table .http--5xx { background: rgba(251,133,105,0.20); color: #B14622; }

/* Verb pills in method tables */
.docs-table .verb {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: 500;
  display: inline-block;
  letter-spacing: 0.04em;
}
.docs-table .verb--post { background: rgba(70,253,174,0.18); color: #0F7A4A; }
.docs-table .verb--get { background: rgba(133,130,199,0.18); color: #6B5BD6; }

/* ----- Callouts ------------------------------------------- */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  margin: 18px 0 28px;
  border: 1px solid;
  font-size: 14.5px;
  line-height: 1.55;
}
.callout svg { flex-shrink: 0; margin-top: 2px; }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.callout--info {
  background: rgba(130,238,226,0.10);
  border-color: rgba(130,238,226,0.45);
  color: var(--text-grey-dark);
}
.callout--info svg { color: #1E8A82; }
.callout--note {
  background: var(--bg-page-muted);
  border-color: var(--border-subtle);
  color: var(--text-grey-dark);
}
.callout--note svg { color: var(--text-grey-mid); }
.callout--warn {
  background: rgba(255,217,8,0.10);
  border-color: rgba(255,217,8,0.40);
  color: var(--text-grey-dark);
}
.callout--warn svg { color: #B98C00; }
.callout--brand {
  background: linear-gradient(135deg, rgba(70,253,174,0.10), rgba(198,251,75,0.06));
  border-color: rgba(70,253,174,0.40);
  color: var(--text-grey-dark);
}
.callout--brand svg { color: #0F7A4A; }

/* ----- Endpoint card --------------------------------------- */
.endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-page-dark);
  border-radius: 12px;
  color: var(--text-on-dark);
  font-family: var(--font-mono);
  font-size: 13.5px;
  margin: 8px 0 18px;
}
.endpoint .verb {
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--brand-gradient);
  color: var(--text-black);
  font-weight: 500;
}
.endpoint .verb--get { background: rgba(133,130,199,0.85); color: var(--text-on-dark); }
.endpoint .path { color: var(--text-on-dark); }
.endpoint .scope {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

/* ----- Code blocks (override for docs) --------------------- */
.docs-prose .code-head + .code,
.docs-prose .code {
  font-size: 13px;
  line-height: 1.65;
}
.docs-prose pre.code {
  margin: 0 0 28px;
}
.docs-prose .code-head { margin-bottom: 0; }
.docs-prose .code-head + .code { margin-top: 0; margin-bottom: 28px; }

/* Code group (side-by-side or tabbed feel) */
.code-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: #061312;
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
}
.code-tab {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 7px;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  font-weight: 500;
}
.code-tab.is-active {
  background: rgba(255,255,255,0.06);
  color: var(--brand-lime);
}
.code-tabs + .code { border-radius: 0 0 14px 14px; border-top: 0; }

/* ----- FAQ ------------------------------------------------- */
.docs-faq summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text-black);
}
.docs-faq summary::-webkit-details-marker { display: none; }
.docs-faq summary::after {
  content: "+";
  font-size: 18px;
  color: var(--text-grey-mid);
  transition: transform 180ms var(--ease-out);
}
.docs-faq details {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 8px;
}
.docs-faq details[open] { border-color: var(--border-default); }
.docs-faq details[open] summary::after { content: "−"; }
.docs-faq .body {
  padding: 0 22px 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-grey-dark);
}
.docs-faq .body p { margin: 0; }
.docs-faq .body code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 1.5px 6px;
  background: var(--bg-page-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-black);
}

/* ----- Pattern cards (integration patterns section) -------- */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 28px;
}
@media (max-width: 860px) { .pattern-grid { grid-template-columns: 1fr; } }
.pattern {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pattern__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: var(--text-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pattern__icon svg { width: 18px; height: 18px; }
.pattern h4 { font-size: 15px; font-weight: 500; color: var(--text-black); margin: 6px 0 0; }
.pattern p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-grey-mid); }
.pattern .best {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-grey-light);
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  margin-top: auto;
}

/* ----- Final CTA strip ------------------------------------- */
.docs-cta {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: center;
  padding: 36px 40px;
  background: var(--bg-page-dark);
  color: var(--text-on-dark);
  border-radius: 20px;
  margin-top: 48px;
}
.docs-cta h3 { color: var(--text-on-dark); margin: 0 0 8px; font-size: 22px; font-weight: 500; line-height: 1.2; }
.docs-cta p { color: rgba(255,255,255,0.7); margin: 0; font-size: 14.5px; }
.docs-cta .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 760px) {
  .docs-cta { grid-template-columns: 1fr; padding: 28px; }
  .docs-cta .actions { justify-content: flex-start; }
}
