/* ───────────────────────────────────────────────────────────────────────────
 * docs.css — additions for the /docs user manual only.
 *
 * Loaded AFTER /styles.css, which owns the design tokens, the page chrome
 * (header / nav / footer / breadcrumbs) and the shared blocks this manual
 * reuses (.section, .seo-hero, .section-heading, .usecase-grid, .usecase-card,
 * .callout, .stat-tiles, .compare-wrap, .final-cta, .button…).
 *
 * Nothing here redefines a token or hardcodes a colour: every value below is
 * var(--…), so both themes follow whatever styles.css resolves.
 * ─────────────────────────────────────────────────────────────────────────── */

/* ── Layout: sticky chapter rail + one prose column ───────────────────────── */

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

.docs-rail {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}

.docs-rail-title {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.docs-rail-group {
  margin: 0 0 18px;
}

.docs-rail-group > p {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.docs-rail ol,
.docs-rail ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1px;
}

.docs-rail a {
  display: block;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 0.93rem;
  line-height: 1.45;
  color: var(--text-2);
  border-left: 2px solid transparent;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

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

.docs-rail a.is-current {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-muted);
}

/* Mobile: the rail collapses into a disclosure above the article. */
.docs-rail-mobile {
  display: none;
  margin-bottom: 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 0.85rem 1.1rem;
}

.docs-rail-mobile > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  list-style: none;
}

.docs-rail-mobile > summary::-webkit-details-marker {
  display: none;
}

.docs-rail-mobile > summary::after {
  content: "";
  float: right;
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.6;
}

.docs-rail-mobile[open] > summary::after {
  transform: rotate(-135deg);
}

.docs-rail-mobile .docs-rail {
  position: static;
  max-height: none;
  overflow: visible;
  margin-top: 0.9rem;
}

@media (max-width: 980px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .docs-shell > .docs-rail {
    display: none;
  }

  .docs-rail-mobile {
    display: block;
  }
}

/* ── Prose ────────────────────────────────────────────────────────────────── */

.docs-prose {
  max-width: 760px;
}

.docs-prose > h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 2.6rem 0 0.7rem;
  scroll-margin-top: 88px;
}

.docs-prose > h2:first-child {
  margin-top: 0;
}

.docs-prose h3 {
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.3;
  margin: 1.8rem 0 0.45rem;
  scroll-margin-top: 88px;
}

.docs-prose h4 {
  font-size: 1rem;
  margin: 1.3rem 0 0.35rem;
  color: var(--text);
}

.docs-prose p,
.docs-prose li {
  color: var(--text-2);
  line-height: 1.72;
}

.docs-prose p {
  margin: 0.7rem 0;
}

.docs-prose strong {
  color: var(--text);
  font-weight: 650;
}

.docs-prose ul,
.docs-prose ol {
  margin: 0.7rem 0 1.1rem;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.4rem;
}

.docs-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.docs-prose a:hover {
  color: var(--accent-hover);
}

.docs-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4rem 0;
}

/* Inline literals: a field name, a file name, a value you type. */
.docs-prose code,
.docs-lit {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.87em;
  padding: 0.12em 0.4em;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── UI-path chips: "Agents → Tools → Approval overrides" ─────────────────── */

.ui-path {
  display: inline;
  font-weight: 600;
  color: var(--text);
  white-space: normal;
}

.ui-path::before,
.ui-path::after {
  content: "";
}

/* ── Keyboard keys ────────────────────────────────────────────────────────── */

kbd,
.kbd {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.5;
  padding: 0.1em 0.45em;
  min-width: 1.5em;
  text-align: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  white-space: nowrap;
}

/* ── Callouts (extends the .callout in styles.css with two more voices) ───── */

.docs-prose .callout {
  margin: 1.6rem 0;
}

.callout.is-note {
  border-left-color: var(--info);
  background: color-mix(in srgb, var(--info) 9%, transparent);
}

.callout.is-good {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.callout > *:first-child {
  margin-top: 0;
}

.callout-label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── Step lists ───────────────────────────────────────────────────────────── */

.docs-steps {
  counter-reset: docstep;
  display: grid;
  gap: 12px;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.docs-steps > li {
  counter-increment: docstep;
  position: relative;
  padding: 1rem 1.2rem 1rem 3.1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  line-height: 1.65;
}

.docs-steps > li::before {
  content: counter(docstep);
  position: absolute;
  left: 1.1rem;
  top: 0.95rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.docs-steps > li > strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.15rem;
}

/* ── Reference tables (reuses .compare-wrap / .compare-table shell) ───────── */

.docs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: 0.95rem;
}

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

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

.docs-table tbody th {
  font-weight: 650;
  color: var(--text);
}

.docs-table td {
  color: var(--text-2);
  line-height: 1.6;
}

.docs-table tbody tr:last-child th,
.docs-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ── "On this page" ───────────────────────────────────────────────────────── */

.docs-onpage {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  padding: 1rem 1.25rem;
  margin: 0 0 2rem;
}

.docs-onpage p {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}

.docs-onpage ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
}

.docs-onpage a {
  font-size: 0.92rem;
  color: var(--text-2);
  text-decoration: none;
}

.docs-onpage a:hover {
  color: var(--accent);
}

/* ── Prev / next pager ────────────────────────────────────────────────────── */

.docs-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 3rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.docs-pager a {
  display: block;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

.docs-pager a:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.docs-pager .docs-pager-next {
  text-align: right;
}

.docs-pager span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.2rem;
}

.docs-pager strong {
  display: block;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
}

@media (max-width: 560px) {
  .docs-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-pager .docs-pager-next {
    text-align: left;
  }
}

/* ── Hub-only bits ────────────────────────────────────────────────────────── */

.docs-group-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin: 0 0 18px;
}

.docs-group-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  letter-spacing: -0.015em;
}

.docs-group-head span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.usecase-card .docs-card-index {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.docs-meta-note {
  margin: 1.4rem 0 0;
  font-size: 0.92rem;
  color: var(--text-3);
}

.docs-meta-note a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.docs-meta-note a:hover {
  color: var(--accent);
}
