/* AgentGraft docs: layout, prose and code. Loaded by templates/docs/base.html
 * on top of static/public/tokens.css and static/public/site.css.
 *
 * A quiet left rail of pages, and an article column held under 70ch. Code
 * sits on sheet panels like the plate on the landing page, with the same
 * highlighting: keywords and decorators in the field blue, strings green,
 * numbers amber, comments faint. */

/* ── Layout ──────────────────────────────────────────────────── */
.doc-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  padding: clamp(36px, 6vh, 64px) var(--edge) clamp(72px, 10vh, 120px);
}

.doc-article { min-width: 0; max-width: 760px; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.doc-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  padding-right: 8px;
  font-size: 15px;
  scrollbar-width: thin;
}

.doc-sidebar-home {
  display: block;
  padding: 2px 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hair);
  font: 450 22px/1.2 var(--display);
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}
.doc-sidebar-home.is-active { color: var(--field); }

.doc-sidebar-section + .doc-sidebar-section { margin-top: 22px; }
.doc-sidebar-section-label {
  margin-bottom: 6px;
  font: 600 13px/1.3 var(--sans);
  color: var(--ink-3);
}

.doc-sidebar-pages { list-style: none; margin: 0; padding: 0; }
.doc-sidebar-link {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.35;
}
.doc-sidebar-link:hover { color: var(--ink); border-left-color: var(--hair); }
.doc-sidebar-link.is-active { color: var(--ink); font-weight: 600; border-left-color: var(--field); }

.doc-sidebar-toc { list-style: none; margin: 4px 0 8px; padding: 0 0 0 12px; }
.doc-sidebar-toc a {
  display: block;
  padding: 3px 0 3px 12px;
  border-left: 1px solid var(--hair);
  font-size: 14px;
  color: var(--ink-3);
  text-decoration: none;
}
.doc-sidebar-toc a:hover { color: var(--ink); border-left-color: var(--field); }
.doc-sidebar-toc-l3 a { padding-left: 24px; font-size: 13.5px; }

/* ── Page head ───────────────────────────────────────────────── */
.doc-page-head { padding-bottom: 28px; margin-bottom: 36px; border-bottom: 1px solid var(--hair); }
.doc-page-section { font: 600 14px/1.3 var(--sans); color: var(--field); }
.doc-page-title {
  margin-top: 10px;
  font: 400 clamp(36px, 4.4vw, 54px)/1.02 var(--display);
  letter-spacing: -0.03em;
}
.doc-page-deck { margin-top: 16px; font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 58ch; }
.doc-page-time { margin-top: 14px; font-size: 14px; color: var(--ink-3); }

/* ── Prose ───────────────────────────────────────────────────── */
.doc-prose { font-size: 17px; line-height: 1.72; color: rgba(15, 20, 64, 0.86); }
.doc-prose > * + * { margin-top: 18px; }
.doc-prose p { max-width: 68ch; }
.doc-prose a { color: var(--field); text-decoration: underline; text-decoration-color: rgba(30, 43, 214, 0.35); text-underline-offset: 3px; }
.doc-prose a:hover { text-decoration-color: var(--field); }
.doc-prose strong { color: var(--ink); font-weight: 600; }

.doc-h2, .doc-h3 { position: relative; color: var(--ink); scroll-margin-top: 96px; }
.doc-h2 { margin-top: 56px !important; font: 450 30px/1.15 var(--display); letter-spacing: -0.025em; }
.doc-h3 { margin-top: 36px !important; font: 600 20px/1.3 var(--sans); letter-spacing: -0.01em; }
.doc-anchor {
  position: absolute; left: -1.1em; top: 0;
  color: var(--field); text-decoration: none !important;
  opacity: 0; transition: opacity 140ms ease;
}
.doc-h2:hover .doc-anchor, .doc-h3:hover .doc-anchor, .doc-anchor:focus-visible { opacity: 1; }

.doc-inline {
  font-size: 0.86em;
  color: var(--ink);
  background: rgba(30, 43, 214, 0.07);
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

/* Bullets: small squares, the same mark as the reference chips. */
.doc-bullets { list-style: none; padding: 0; }
.doc-bullets li { position: relative; padding-left: 22px; max-width: 66ch; }
.doc-bullets li + li { margin-top: 8px; }
.doc-bullets li::before {
  content: ""; position: absolute; left: 4px; top: 0.72em;
  width: 6px; height: 6px; background: var(--field);
}

/* Steps are a real sequence, so they are numbered. */
.doc-steps { list-style: none; padding: 0; border-top: 1px solid var(--hair); }
.doc-steps li {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--hair);
}
.doc-step-num { font: 300 24px/1 var(--display); color: var(--field); letter-spacing: -0.02em; }

.doc-def { padding: 14px 0; border-top: 1px solid var(--hair); }
.doc-def:last-child { border-bottom: 1px solid var(--hair); }
.doc-def-term { font-weight: 600; color: var(--ink); }
.doc-def-body { margin: 4px 0 0; color: var(--ink-2); }
.doc-def + .doc-def { margin-top: 0 !important; }

/* ── Callouts ────────────────────────────────────────────────── */
.doc-note {
  padding: 16px 20px 18px;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-left: 3px solid var(--field);
  max-width: 68ch;
}
.doc-note-warn { border-left-color: var(--num); background: #FBF7EE; }
.doc-note-info { border-left-color: var(--ink-3); }
.doc-note-title { font: 600 16px/1.35 var(--sans); color: var(--ink); }
.doc-note-body { margin-top: 6px; font-size: 16px; line-height: 1.65; color: var(--ink-2); }

/* ── Code ────────────────────────────────────────────────────── */
.doc-code { margin-left: 0; margin-right: 0; }
.doc-code-frame {
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: 14px;
  overflow: hidden;
}
.doc-code-tab {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--hair);
  font: 500 12.5px/1.3 var(--sans);
  color: var(--ink-3);
}
.doc-code-body {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
  font: 400 13.5px/1.65 var(--mono);
  color: var(--ink);
  tab-size: 4;
}
.doc-code-body code { font: inherit; }
.doc-code-caption { margin-top: 10px; font-size: 14px; color: var(--ink-3); }

/* Pygments, prefix dh- (see docs_content._PYGMENTS_FORMATTER). */
.dh-k, .dh-kc, .dh-kd, .dh-kn, .dh-kp, .dh-kr, .dh-kt, .dh-ow { color: var(--field); font-weight: 600; }
.dh-nd, .dh-nb { color: var(--field); }
.dh-nf, .dh-nc { color: var(--ink); font-weight: 600; }
.dh-nn, .dh-na { color: var(--ink); }
.dh-s, .dh-s1, .dh-s2, .dh-sb, .dh-sd, .dh-sh, .dh-si, .dh-ss, .dh-sx { color: var(--str); }
.dh-m, .dh-mf, .dh-mh, .dh-mi, .dh-mo { color: var(--num); }
.dh-c, .dh-c1, .dh-cm, .dh-cp, .dh-cs { color: var(--ink-3); }
.dh-o, .dh-p { color: var(--ink-2); }
.dh-err { color: var(--erase); }

/* ── Page foot ───────────────────────────────────────────────── */
.doc-page-foot { margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--hair); }
.doc-page-foot a { font-weight: 600; color: var(--field); text-decoration: none; }
.doc-page-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Docs home ───────────────────────────────────────────────── */
.doc-home-head { padding-bottom: 36px; border-bottom: 1px solid var(--hair); }
.doc-home-head h1 { font: 400 clamp(40px, 5vw, 64px)/1 var(--display); letter-spacing: -0.032em; }
.doc-home-head p { margin-top: 18px; font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 56ch; }
.doc-home-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.doc-home-section { margin-top: 56px; }
.doc-home-section > h2 { font: 450 28px/1.15 var(--display); letter-spacing: -0.025em; }
.doc-home-section > p { margin-top: 10px; color: var(--ink-2); max-width: 62ch; }

/* The page index: a list, like the back of a manual. */
.doc-index { margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.doc-index-group { padding: 10px 0 2px; font: 600 13px/1.3 var(--sans); color: var(--ink-3); }
.doc-index a {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; gap: 24px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--hair);
  text-decoration: none; color: var(--ink);
  transition: background-color 140ms ease;
}
.doc-index a:hover .doc-index-title { color: var(--field); }
.doc-index-title { font-weight: 600; font-size: 17px; }
.doc-index-deck { color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.doc-index-time { font-size: 14px; color: var(--ink-3); white-space: nowrap; }

.doc-agents { margin-top: 18px; }
.doc-agents pre {
  margin: 18px 0 0;
  padding: 14px 18px;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: 14px;
  font-size: 13.5px;
  overflow-x: auto;
}

.doc-principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 22px; }
.doc-principles h3 { font: 600 17px/1.35 var(--sans); color: var(--ink); }
.doc-principles p { margin-top: 8px; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.doc-principles code { font-size: 0.86em; background: rgba(30, 43, 214, 0.07); padding: 1px 5px; }

/* ── Small screens ───────────────────────────────────────────── */
@media (max-width: 960px) {
  .doc-shell { grid-template-columns: 1fr; gap: 28px; }
  /* Reading first: on a phone the page list follows the article. */
  .doc-sidebar {
    order: 2;
    position: static; max-height: none; overflow: visible;
    padding: 28px 0 0; border-top: 1px solid var(--hair);
  }
  .doc-sidebar-toc { display: none; }
  .doc-anchor { display: none; }
  .doc-principles { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 640px) {
  .doc-index a { grid-template-columns: 1fr; gap: 4px; }
  .doc-prose { font-size: 16.5px; }
}
