/* ─────────────────────────────────────────────────────────────────
   x402 Agentic · docs.css
   Shared layout for all /docs pages
   Requires: main.css loaded first (via ../assets/css/main.css)
───────────────────────────────────────────────────────────────── */

/* ── DOCS LAYOUT ─────────────────────────────────────────────────
   Three-column:  [sidebar] [content] [on-this-page]
   Collapses to single column on mobile
────────────────────────────────────────────────────────────────── */
:root {
  --sidebar-w:   240px;
  --toc-w:       200px;
  --docs-gap:    40px;
}

.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
  grid-template-rows: auto;
  gap: 0 var(--docs-gap);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: calc(100vh - var(--nav-h));
  position: relative;
  z-index: 1;
}

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.docs-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  height: fit-content;
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow-y: auto;
  padding: 32px 0 32px;
  overscroll-behavior: contain;
}

.docs-sidebar::-webkit-scrollbar { width: 3px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

.docs-sidebar-section {
  margin-bottom: 28px;
}
.docs-sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 12px;
}
.docs-sidebar-links {
  list-style: none;
}
.docs-sidebar-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.18s;
  line-height: 1.4;
}
.docs-sidebar-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.docs-sidebar-links a.active {
  color: var(--teal);
  background: rgba(0,255,194,0.06);
  border-left-color: var(--teal);
}
.docs-sidebar-links a .badge {
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.badge-soon   { background: rgba(61,90,120,0.3);  color: var(--text-dim); }
.badge-new    { background: rgba(0,255,194,0.12); color: var(--teal); }
.badge-beta   { background: rgba(245,200,66,0.12); color: var(--gold); }

.docs-sidebar-divider {
  height: 1px;
  background: var(--border2);
  margin: 16px 12px;
}

/* ── DOCS CONTENT ────────────────────────────────────────────── */
.docs-content {
  padding: 32px 0 80px;
  min-width: 0; /* prevent grid blowout */
}

/* Breadcrumb */
.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 28px;
}
.docs-breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.docs-breadcrumb a:hover { color: var(--teal); }
.docs-breadcrumb span   { color: var(--text-dim); }
.docs-breadcrumb .current { color: var(--text-muted); }

/* Page header */
.docs-page-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.docs-page-h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 14px;
}
.docs-page-lead {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 620px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border2);
  padding-bottom: 32px;
}

/* Prose headings */
.docs-content h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 44px 0 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border2);
  color: var(--text);
}
.docs-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text);
}
.docs-content p {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 16px;
}
.docs-content p strong { color: var(--text); font-weight: 600; }
.docs-content ul,
.docs-content ol {
  padding-left: 22px;
  margin-bottom: 16px;
}
.docs-content li {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 6px;
}
.docs-content a {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,255,194,0.25);
  transition: border-color 0.2s;
}
.docs-content a:hover { border-bottom-color: var(--teal); }

/* Inline code */
.docs-content code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--teal);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Code blocks */
.docs-pre {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
}
.docs-pre-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border2);
  background: var(--bg3);
}
.docs-pre-lang {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.docs-pre-filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.copy-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}
.copy-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.docs-pre code {
  display: block;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
  color: var(--text);
  background: none;
  border: none;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

/* Syntax colours */
.s-cm  { color: #4A7A5A; }   /* comment */
.s-kw  { color: var(--violet); }  /* keyword */
.s-st  { color: var(--teal); }    /* string */
.s-nu  { color: var(--gold); }    /* number */
.s-fn  { color: #4B9EFF; }        /* function */
.s-op  { color: var(--text-muted); } /* operator */
.s-tx  { color: var(--text); }    /* plain */
.s-ok  { color: #28C840; }        /* success */
.s-er  { color: var(--red); }     /* error */
.s-dm  { color: var(--text-dim); }/* dim */

/* Callout boxes */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  margin: 24px 0;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.7;
}
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.callout-body { color: var(--text-muted); }
.callout-body strong { color: var(--text); display: block; margin-bottom: 3px; }
.callout-info    { background: rgba(43,127,255,0.07);  border-color: rgba(43,127,255,0.2);  }
.callout-tip     { background: rgba(0,255,194,0.06);   border-color: rgba(0,255,194,0.18);  }
.callout-warning { background: rgba(245,200,66,0.07);  border-color: rgba(245,200,66,0.2);  }
.callout-note    { background: rgba(123,97,255,0.07);  border-color: rgba(123,97,255,0.2);  }

/* Step list */
.steps-list { list-style: none; padding: 0; margin: 24px 0; }
.steps-list li {
  display: flex;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border2);
  align-items: flex-start;
}
.steps-list li:last-child { border-bottom: none; }
.step-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
  min-width: 28px; height: 28px;
  border: 1px solid rgba(0,255,194,0.3);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(0,255,194,0.05);
  margin-top: 1px;
}
.step-body h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text);
}
.step-body p {
  margin-bottom: 0;
}

/* Prop / param table */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13.5px;
}
.docs-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
}
.docs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
  color: var(--text-muted);
  vertical-align: top;
  line-height: 1.6;
}
.docs-table tr:hover td { background: rgba(255,255,255,0.02); }
.docs-table code {
  font-size: 12px;
  color: var(--teal);
}
.td-required {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red);
  background: rgba(255,95,87,0.1);
  border: 1px solid rgba(255,95,87,0.2);
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.td-optional {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(61,90,120,0.2);
  border: 1px solid rgba(61,90,120,0.3);
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Inline status badges */
.status-live    { color: #28C840; font-family: var(--font-mono); font-size: 11px; }
.status-soon    { color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
.status-beta    { color: var(--gold);  font-family: var(--font-mono); font-size: 11px; }

/* ── TABLE OF CONTENTS (right column) ───────────────────────── */
.docs-toc {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  height: fit-content;
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow-y: auto;
  padding: 32px 0 32px;
}
.docs-toc-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.docs-toc-links { list-style: none; }
.docs-toc-links a {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--border2);
  transition: all 0.18s;
  line-height: 1.5;
}
.docs-toc-links a:hover  { color: var(--text-muted); border-left-color: var(--text-dim); }
.docs-toc-links a.active { color: var(--teal); border-left-color: var(--teal); }
.docs-toc-links .toc-h3 { padding-left: 22px; font-size: 11px; }

/* ── PREV / NEXT NAV ─────────────────────────────────────────── */
.docs-page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border2);
}
.docs-page-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s;
  flex: 1;
  max-width: 280px;
}
.docs-page-nav a:hover { border-color: var(--teal); transform: translateY(-2px); }
.docs-page-nav a.prev { align-items: flex-start; }
.docs-page-nav a.next { align-items: flex-end; margin-left: auto; }
.docs-nav-dir {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.docs-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: var(--sidebar-w) 1fr; }
  .docs-toc   { display: none; }
}
@media (max-width: 768px) {
  .docs-shell {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
  .docs-sidebar {
    position: static;
    padding: 16px 0 0;
    max-height: none;
    border-bottom: 1px solid var(--border2);
    margin-bottom: 24px;
  }
  /* Sidebar collapses into a scrollable horizontal strip on mobile */
  .docs-sidebar-section { margin-bottom: 0; }
  .docs-sidebar-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0 16px;
  }
  .docs-sidebar-links a {
    border-left: none;
    border: 1px solid var(--border2);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
  }
  .docs-sidebar-links a.active {
    border-color: var(--teal);
    background: rgba(0,255,194,0.08);
  }
  .docs-sidebar-label  { display: none; }
  .docs-sidebar-divider { display: none; }
  .docs-page-nav { flex-direction: column; }
  .docs-page-nav a { max-width: 100%; }
  .docs-pre code  { font-size: 12px; }
}
