/* Developer docs (REST API, MCP server): a hero, a sticky contents column, and
   prose sections built from code blocks, parameter tables and notes. */

.doc-hero { padding-block: clamp(48px, 7vw, 88px) 8px; text-align: center; }
.doc-hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); font-weight: 600; letter-spacing: -0.03em; margin: 14px 0 14px; }
.doc-hero p { max-width: 640px; margin: 0 auto; color: var(--text-2); font-size: clamp(1rem, 1.5vw, 1.12rem); }

/* REST API | MCP server: the two pages are one product, so they switch like tabs */
.doc-switch { display: inline-flex; gap: 4px; margin-top: 26px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.doc-switch a { padding: 7px 16px; border-radius: 9px; font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.doc-switch a:hover { color: var(--text); }
.doc-switch a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-2) inset; }

.doc-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 48px; padding-block: 40px 24px; align-items: start; }
.doc-toc { position: sticky; top: calc(var(--nav-h) + 24px); display: flex; flex-direction: column; gap: 2px; }
.doc-toc a { color: var(--muted); font-size: 0.88rem; padding: 7px 12px; border-radius: 9px; border-left: 2px solid transparent; }
.doc-toc a:hover, .doc-toc a.on { color: var(--text); background: var(--surface); border-left-color: var(--cyan); }
.doc-toc .sub { padding-left: 24px; font-size: 0.82rem; }

.doc section { scroll-margin-top: calc(var(--nav-h) + 20px); padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.doc section:last-child { border-bottom: 0; margin-bottom: 0; }
.doc h2 { font-size: clamp(1.45rem, 2.4vw, 1.85rem); font-weight: 600; margin: 8px 0 14px; letter-spacing: -0.02em; }
.doc h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 1.08rem; font-weight: 600; margin: 34px 0 10px; color: var(--text); scroll-margin-top: calc(var(--nav-h) + 20px); }
.doc h3 .verb { font: 600 0.72rem/1 var(--mono); letter-spacing: 0.04em; padding: 4px 7px; border-radius: 6px; color: var(--cyan); background: rgba(63, 208, 240, 0.1); border: 1px solid rgba(63, 208, 240, 0.25); }
.doc h3 .verb.get { color: var(--green); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.25); }
.doc h3 .path { font: 500 0.98rem/1.3 var(--mono); }
.doc h3 .what { font-weight: 400; color: var(--muted); font-size: 0.95rem; }
.doc h4 { font-size: 0.98rem; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
.doc p, .doc li { color: var(--text-2); font-size: 0.98rem; line-height: 1.72; }
.doc p { margin: 0 0 14px; max-width: 72ch; }
.doc ul { margin: 0 0 14px; padding-left: 22px; max-width: 72ch; }
.doc strong { color: var(--text); font-weight: 600; }
.doc a:not(.btn) { color: var(--cyan); }
.doc a:not(.btn):hover { text-decoration: underline; }
.doc :not(pre) > code { font: 500 0.86em/1 var(--mono); color: #c7cdff; background: rgba(124, 131, 255, 0.12); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.doc td code { white-space: normal; overflow-wrap: anywhere; }

/* code blocks, with a copy button added by docs.js */
.code { position: relative; margin: 12px 0 20px; }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: 14px; background: rgba(4, 7, 16, 0.75); border: 1px solid var(--line); }
.code code { font: 400 0.84rem/1.65 var(--mono); color: #dbe2f4; }
.code .copy { position: absolute; top: 8px; right: 8px; opacity: 0; }
.code:hover .copy, .code .copy:focus-visible { opacity: 1; }
@media (hover: none) { .code .copy { opacity: 1; } .code pre { padding-top: 46px; } }
.code.scrolls::after { content: ""; position: absolute; top: 1px; right: 1px; bottom: 1px; width: 36px; border-radius: 0 13px 13px 0; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(4, 7, 16, 0.95)); transition: opacity 0.2s; }
.code.scrolls.at-end::after { opacity: 0; }
.code .c { color: var(--faint); }
.code .s { color: #8fe3b5; }
.code .k { color: #9ec5ff; }
.code .n { color: #f8c58a; }

/* parameter tables scroll sideways on phones instead of crushing the text */
.table-scroll { overflow-x: auto; margin: 12px 0 22px; border: 1px solid var(--line); border-radius: 14px; }
.ptable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ptable th { text-align: left; padding: 10px 14px; font: 600 0.72rem/1.2 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ptable td { padding: 11px 14px; color: var(--text-2); border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.55; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable td:first-child { white-space: nowrap; }
.ptable.wide td:first-child { white-space: normal; }
.req { display: inline-block; font: 700 0.62rem/1.6 var(--font); letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; color: #fda4af; background: rgba(251, 113, 133, 0.1); border: 1px solid rgba(251, 113, 133, 0.3); }
.opt { display: inline-block; font: 700 0.62rem/1.6 var(--font); letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; color: var(--muted); background: var(--surface); border: 1px solid var(--line-2); }

.note { margin: 16px 0; padding: 13px 16px; border-radius: 12px; background: rgba(91, 157, 255, 0.07); border: 1px solid rgba(91, 157, 255, 0.22); color: var(--text-2); font-size: 0.92rem; line-height: 1.65; max-width: 72ch; }
.note.warn { background: rgba(251, 191, 36, 0.06); border-color: rgba(251, 191, 36, 0.28); }
.note p:last-child { margin-bottom: 0; }

/* the free key: the first thing a developer needs */
.key-card { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 16px 18px; margin: 16px 0 18px; border-radius: 16px; }
.key-card .k-label { width: 100%; font: 600 0.72rem/1 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); }
.doc .key-card code { white-space: normal; background: none; padding: 0; flex: 1 1 260px; min-width: 0; font: 500 0.86rem/1.5 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.fact { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.fact .l { font: 600 0.7rem/1.2 var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.fact .v { font-size: 1rem; font-weight: 600; color: var(--text); }

/* MCP example: a prompt and what the agent gets back */
.example { margin: 14px 0 18px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.example .prompt { padding: 14px 18px; background: var(--surface-2); color: var(--text); font-size: 0.96rem; }
.example .prompt::before { content: "You"; display: block; margin-bottom: 4px; font: 600 0.68rem/1 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--violet); }
.example pre.wrap-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.example pre { margin: 0; padding: 14px 18px; overflow-x: auto; background: rgba(4, 7, 16, 0.75); font: 400 0.82rem/1.7 var(--mono); color: #dbe2f4; }

.doc-menu { display: none; }
.to-top { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40; width: 44px; height: 44px; padding: 0; border-radius: 50%; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; background: rgba(14, 21, 38, 0.92); backdrop-filter: blur(10px); }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

@media (max-width: 860px) {
  .doc-menu { display: block; position: sticky; top: var(--nav-h); z-index: 20; margin: -28px calc(-1 * var(--gutter)) 20px; padding: 8px var(--gutter); background: rgba(6, 9, 19, 0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .doc-menu summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; cursor: pointer; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); }
  .doc-menu summary::-webkit-details-marker { display: none; }
  .doc-menu summary b { color: var(--text); font-weight: 600; }
  .doc-menu summary::after { content: "▾"; color: var(--muted); }
  .doc-menu[open] summary::after { content: "▴"; }
  .doc-menu nav { display: flex; flex-direction: column; padding: 6px 0 2px; }
  .doc-menu nav a { padding: 10px 12px; border-radius: 9px; color: var(--text-2); font-size: 0.95rem; }
  .doc-menu nav a.on { color: var(--text); background: var(--surface); }
  .doc-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding-block-start: 28px; }
  .doc-toc { display: none; }
}
/* phones: each table row becomes a block -- name and chips on top, the
   description full width beneath -- instead of a cut-off column */
@media (max-width: 640px) {
  .table-scroll { overflow: visible; border: 0; border-radius: 0; }
  .ptable, .ptable tbody { display: block; }
  .ptable tr:first-child { display: none; }
  .ptable tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .ptable td { display: inline; padding: 0; border: 0; white-space: normal; }
  .ptable td:first-child { font-weight: 600; color: var(--text); white-space: normal; }
  .ptable td[data-l]:not(.desc):not(:first-child)::before { content: attr(data-l) " "; color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
  .ptable td:not(:first-child):not(.desc) { font-size: 0.84rem; color: var(--muted); }
  .ptable td:has(.req)::before { content: none !important; }
  .ptable td.desc { flex-basis: 100%; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .fact { padding: 10px 11px; }
  .fact .l { font-size: 0.62rem; margin-bottom: 4px; }
  .fact .v { font-size: 0.86rem; }
  .doc section:last-child { padding-bottom: 8px; }
  .code .copy { top: 6px; right: 6px; }
}
@media (max-width: 520px) {
  .code pre { padding-inline: 14px; }
  .code code { font-size: 0.78rem; }
  .doc h3 .what { width: 100%; }
}
