/* ==========================================================================
   API docs: searchable sidebar, endpoint cards, in-browser playground.
   Loaded only on the docs page.
   ========================================================================== */

/* base url / auth chips in the hero */
.api-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.api-meta-chip { display: inline-flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; box-shadow: var(--sh-xs); font-size: var(--fs-sm); }
.api-meta-chip .amk { font-weight: 700; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.api-meta-chip code { font-size: .85rem; color: var(--ink); }

/* layout: sticky sidebar + content */
.docs-section { padding-top: var(--s-6); }
.docs-layout { display: grid; grid-template-columns: 270px 1fr; gap: 48px; align-items: start; }

/* sidebar */
.docs-side { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); display: flex; flex-direction: column; }
.docs-search { position: relative; margin-bottom: 16px; }
.docs-search .ds-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; }
.docs-search .ds-ico svg { width: 17px; height: 17px; }
.docs-search input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg-alt); padding: 11px 14px 11px 38px; font-family: inherit; font-size: .92rem; color: var(--ink); }
.docs-search input:focus { outline: none; border-color: var(--brand-200); box-shadow: 0 0 0 4px rgba(27,174,99,.12); background: #fff; }

.docs-nav { overflow-y: auto; padding-right: 6px; padding-bottom: 12px; }
.docs-nav .dn-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; font-size: var(--fs-sm); font-weight: 600; color: var(--body); }
.docs-nav .dn-link:hover { background: var(--bg-alt); color: var(--brand-700); }
.docs-nav .dn-play svg { width: 15px; height: 15px; color: var(--brand-700); }
.dn-group { margin-top: 16px; }
.dn-label { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: 0 10px; margin-bottom: 6px; }
.dn-ep { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: .88rem; }
.dn-ep:hover { background: var(--bg-alt); color: var(--ink); }
.dn-ep.is-active { background: var(--brand-50); color: var(--brand-700); }
.dn-ep-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn-empty { color: var(--muted); font-size: var(--fs-sm); padding: 12px 10px; }

/* method tag */
.m-tag { flex: none; font-size: .64rem; font-weight: 800; letter-spacing: .03em; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; min-width: 48px; text-align: center; }
.m-GET { background: #e7f3ff; color: #0b66c3; }
.m-POST { background: var(--brand-50); color: var(--brand-700); }
.m-PATCH { background: #fff3e0; color: #b4690e; }
.m-PUT { background: #f3eaff; color: #7a3ec8; }
.m-DELETE { background: #ffeceb; color: #cf3b34; }

/* main content blocks */
.docs-main { min-width: 0; }
.doc-block { margin-bottom: 44px; }
.doc-block h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 14px; }
.doc-block > p { color: var(--muted); max-width: 70ch; }
.doc-list { margin: 14px 0 0; padding-left: 22px; color: var(--muted); }
.doc-list li { margin-bottom: 9px; }
.doc-list strong { color: var(--ink); }

/* code blocks */
.code-block { background: #0b140f; border: 1px solid #16261d; border-radius: 14px; padding: 18px 20px; overflow: auto; margin: 14px 0 0; }
.code-block code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.6; color: #cfe9da; white-space: pre; }

/* endpoint groups + cards */
.doc-group { margin-bottom: 52px; scroll-margin-top: calc(var(--header-h) + 20px); }
.dg-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 22px; border-bottom: 2px solid var(--line); }
.dg-head h2 { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2rem); }
.dg-scope { font-size: .82rem; color: var(--muted); }
.dg-scope code { font-size: .8rem; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); padding: 2px 8px; border-radius: 999px; }

.endpoint { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--sh-xs); scroll-margin-top: calc(var(--header-h) + 20px); }
.ep-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ep-path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; color: var(--ink); font-weight: 600; word-break: break-all; }
.ep-try { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--bg-alt); border: 1px solid var(--line); color: var(--brand-700); font: inherit; font-size: .82rem; font-weight: 700; padding: 7px 13px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.ep-try svg { width: 14px; height: 14px; transition: transform .15s; }
.ep-try:hover { background: var(--brand-50); border-color: var(--brand-200); }
.ep-try:hover svg { transform: translateX(3px); }
.ep-title { font-size: 1.08rem; margin: 14px 0 5px; }
.ep-desc { color: var(--muted); font-size: var(--fs-sm); margin: 0; line-height: 1.6; }
.ep-sample { margin-top: 14px; }
.ep-sample-label, .pg-response-head .pg-label { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }

/* playground */
.pg-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.pg-head h2 { margin: 0; }
.pg-badge { display: inline-flex; align-items: center; gap: 7px; font-size: .76rem; font-weight: 700; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); padding: 5px 12px; border-radius: 999px; }
.pg-badge svg { width: 14px; height: 14px; }
.pg { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--sh-sm); margin-top: 18px; }
.pg-field { display: block; margin-bottom: 16px; }
.pg-label { display: block; font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 7px; }
.pg input, .pg select, .pg textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg-alt); padding: 12px 14px; font-family: inherit; font-size: .92rem; color: var(--ink); }
.pg textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.55; resize: vertical; }
.pg input:focus, .pg select:focus, .pg textarea:focus { outline: none; border-color: var(--brand-200); box-shadow: 0 0 0 4px rgba(27,174,99,.12); background: #fff; }
.pg-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; }
.pg-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.pg-actions .btn svg { width: 16px; height: 16px; }
.pg-status { font-size: .85rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.pg-status.ok { color: var(--brand-700); background: var(--brand-50); }
.pg-status.err { color: #cf3b34; background: #ffeceb; }
.pg-response { margin-top: 18px; }
.pg-response-head { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  .ep-try svg { transition: none; }
}
