/* ============================================================
   Docs surface (D-38). Loaded only by _DocsLayout, so the app
   shell doesn't pay for prose styling it never renders.

   Everything here is built from the design tokens — no literal
   colours — so the docs follow the theme toggle like the rest
   of the app, including the always-dark .ds-code blocks.
   ============================================================ */

.docs {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.docs-topbar__label {
  font-family: var(--ds-font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ds-text-muted);
}

.docs-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---------- side nav ---------- */
.docs-nav {
  width: var(--ds-rail-w);
  flex: 0 0 auto;
  border-right: 1px solid var(--ds-border);
  background: var(--ds-surface-2);
  padding: var(--ds-space-4) var(--ds-space-3);
  overflow: auto;
}

.docs-nav__group {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-text-faint);
  padding: var(--ds-space-4) var(--ds-space-2) var(--ds-space-2);
}

.docs-nav__group:first-child { padding-top: 0; }

.docs-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--ds-space-2);
  border-radius: var(--ds-radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--ds-text-muted);
  text-decoration: none;
}

.docs-nav__item:hover { background: var(--ds-surface-3); color: var(--ds-text); }

.docs-nav__item.is-active {
  background: var(--ds-accent-tint);
  color: var(--ds-accent);
  font-weight: 600;
}

/* ---------- content column ---------- */
.docs-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  background: var(--ds-bg);
}

.docs-prose {
  max-width: 76ch;
  margin: 0 auto;
  padding: var(--ds-space-10) var(--ds-space-8) var(--ds-space-24);
}

.docs-prose h1 {
  font-family: var(--ds-font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--ds-space-3);
  color: var(--ds-text);
}

.docs-prose h2 {
  font-family: var(--ds-font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: var(--ds-space-12) 0 var(--ds-space-3);
  padding-top: var(--ds-space-4);
  border-top: 1px solid var(--ds-border);
  color: var(--ds-text);
}

.docs-prose h3 {
  font-size: 16px;
  font-weight: 600;
  margin: var(--ds-space-6) 0 var(--ds-space-2);
  color: var(--ds-text);
}

.docs-prose p { margin: 0 0 var(--ds-space-4); line-height: 1.65; color: var(--ds-text); }

.docs-prose ul, .docs-prose ol { margin: 0 0 var(--ds-space-4); padding-left: var(--ds-space-5); }
.docs-prose li { margin-bottom: var(--ds-space-2); line-height: 1.6; color: var(--ds-text); }

.docs-prose a { color: var(--ds-link); text-decoration: underline; text-underline-offset: 2px; }
.docs-prose a:hover { text-decoration-thickness: 2px; }

/* Inline code. The .ds-code block is always dark; inline code lives in the prose, so it
   takes the surface treatment instead — a dark chip mid-sentence reads as a mistake. */
.docs-prose :not(pre) > code {
  font-family: var(--ds-font-mono);
  font-size: 0.88em;
  background: var(--ds-surface-3);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-xs);
  padding: 1px 5px;
  color: var(--ds-text);
}

.docs-prose .ds-code { margin: 0 0 var(--ds-space-4); overflow-x: auto; }

.docs-lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ds-text-muted);
  margin: 0 0 var(--ds-space-8);
}

/* ---------- numbered steps ---------- */
.docs-step {
  position: relative;
  padding-left: 44px;
  margin-bottom: var(--ds-space-10);
}

.docs-step__n {
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--ds-radius-full);
  background: var(--ds-accent);
  color: var(--ds-text-on-accent);
  font-family: var(--ds-font-mono);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-step h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  font-size: 19px;
  line-height: 1.5;
}

/* ---------- callout ---------- */
.docs-note {
  display: flex;
  gap: 11px;
  padding: var(--ds-space-4);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  margin: 0 0 var(--ds-space-4);
  font-size: 14px;
  line-height: 1.6;
}

.docs-note p { margin: 0; font-size: 14px; }
.docs-note--warn { background: var(--ds-warn-tint); border-color: var(--ds-warn); }
.docs-note--agent { background: var(--ds-agent-tint); border-color: var(--ds-agent); }
.docs-note__icon { flex: 0 0 auto; color: var(--ds-text-muted); line-height: 1; }
.docs-note--warn .docs-note__icon { color: var(--ds-warn); }
.docs-note--agent .docs-note__icon { color: var(--ds-agent); }

/* ---------- next steps ---------- */
.docs-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ds-space-3);
  margin-top: var(--ds-space-4);
}

.docs-next__card {
  display: block;
  padding: var(--ds-space-4);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  text-decoration: none;
}

.docs-next__card:hover { border-color: var(--ds-border-strong); box-shadow: var(--ds-shadow-sm); }
.docs-next__title { font-weight: 600; color: var(--ds-text); display: flex; align-items: center; gap: 8px; }
.docs-next__body { font-size: 13.5px; color: var(--ds-text-muted); margin: 6px 0 0; line-height: 1.55; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  /* The sidebar becomes a horizontal strip above the content. Section labels are dropped
     rather than wrapped: five links fit in one scrollable row, and the groups only exist
     to organise a column. */
  .docs-body { flex-direction: column; }

  .docs-nav {
    width: auto;
    flex: 0 0 auto;
    display: flex;
    gap: var(--ds-space-1);
    border-right: none;
    border-bottom: 1px solid var(--ds-border);
    padding: var(--ds-space-2) var(--ds-space-3);
    overflow-x: auto;
  }

  .docs-nav__group { display: none; }
  .docs-nav__item { white-space: nowrap; padding: 6px 10px; }

  .docs-prose { padding: var(--ds-space-6) var(--ds-space-4) var(--ds-space-16); }
  .docs-prose h1 { font-size: 27px; }
  .docs-next { grid-template-columns: 1fr; }
}
