/* ─── /docs/api — Stripe-style two-column reference ────────────────────────
 *
 * Layout, top-to-bottom on a 1200px container:
 *
 *   [ TOC sticky 200px ][        main 1fr                ]
 *                       [ prose 1fr ][ code 1fr ]
 *
 * Below 1080px the code rail collapses under the prose; below 760px the TOC
 * collapses into a <details> at the top.
 */

.docs-wrap {
    --docs-toc-w:   220px;
    --docs-gap:     40px;
    --docs-radius:  10px;
    --docs-code-bg: #0e0d0c;
    --docs-code-fg: #f3eee7;
    --docs-code-mute: #9c958a;
}

/* ─── Layout shell ─────────────────────────────────────────────────────── */
.docs-shell {
    display: grid;
    grid-template-columns: var(--docs-toc-w) 1fr;
    gap: var(--docs-gap);
    align-items: start;
    padding-block: 24px 96px;
}

.docs-hero {
    padding-block: 32px 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}
.docs-hero h1 {
    margin: 8px 0 12px;
    font-size: 2rem;
    letter-spacing: -0.02em;
}
.docs-hero .lead { margin: 0; max-width: 60ch; }

/* ─── TOC sidebar ──────────────────────────────────────────────────────── */
.docs-toc {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    padding-right: 8px;
    font-size: 0.875rem;
}
.docs-toc-group { margin-bottom: 20px; }
.docs-toc-title {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fg-muted);
    margin: 0 0 8px;
    padding-left: 10px;
}
.docs-toc-list { list-style: none; margin: 0; padding: 0; }
.docs-toc-list a {
    display: block;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--fg-muted);
    text-decoration: none;
    line-height: 1.4;
    transition: background var(--transition), color var(--transition);
}
.docs-toc-list a:hover { background: var(--bg-elev); color: var(--fg); }
.docs-toc-list a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}
.docs-toc-method {
    display: inline-block;
    width: 32px;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin-right: 6px;
}
.docs-toc-list a.is-active .docs-toc-method { color: var(--accent); }

/* Mobile TOC: <details> at top */
.docs-toc-mobile {
    display: none;
    margin-bottom: 24px;
}
.docs-toc-mobile > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--docs-radius);
    background: var(--bg-elev);
    font-weight: 600;
    font-size: 0.9375rem;
}
.docs-toc-mobile > summary::-webkit-details-marker { display: none; }
.docs-toc-mobile[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.docs-toc-mobile-body {
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 var(--docs-radius) var(--docs-radius);
    padding: 12px 14px;
}

/* ─── Main column ──────────────────────────────────────────────────────── */
.docs-main { min-width: 0; }
.docs-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--docs-gap);
    padding-block: 48px;
    border-top: 1px solid var(--line);
    scroll-margin-top: 88px;
}
.docs-section:first-of-type { border-top: 0; padding-top: 24px; }
.docs-section.is-full { grid-template-columns: 1fr; }
.docs-section.is-full .docs-prose { max-width: 76ch; }

.docs-prose { min-width: 0; }
.docs-prose h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.docs-prose h2 code,
.docs-prose h2 .docs-path {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 500;
    background: none;
    border: 0;
    padding: 0;
    color: var(--fg);
}
.docs-prose h3 {
    margin: 24px 0 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-muted);
}
.docs-prose p { margin: 0 0 12px; color: var(--fg-muted); line-height: 1.55; }
.docs-prose p strong { color: var(--fg); font-weight: 600; }
.docs-prose ul { color: var(--fg-muted); padding-left: 20px; margin: 0 0 12px; }

/* ─── HTTP method badges ───────────────────────────────────────────────── */
.http-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 4px;
    line-height: 1.6;
}
.http-get    { background: rgba(74, 222, 128, 0.14); color: var(--success); border: 1px solid rgba(74, 222, 128, 0.32); }
.http-post   { background: var(--accent-soft);       color: var(--accent);  border: 1px solid var(--accent-line); }

/* ─── Param list (definition-list style) ───────────────────────────────── */
.docs-params {
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}
.docs-params > li {
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.docs-params > li:last-child { border-bottom: 1px solid var(--line); }
.docs-param-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.docs-param-name {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
}
.docs-param-type {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--fg-muted);
}
.docs-param-flag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 4px;
}
.docs-param-flag.is-required { color: var(--danger); background: rgba(255, 79, 79, 0.10); }
.docs-param-flag.is-optional { color: var(--fg-muted); background: var(--bg-elev); }
.docs-param-desc { color: var(--fg-muted); font-size: 0.9375rem; line-height: 1.5; margin: 0; }
.docs-param-desc code { font-size: 0.8125rem; }

/* ─── Returns list (response headers) ──────────────────────────────────── */
.docs-returns {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9375rem;
}
.docs-returns > div {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.docs-returns > div:last-child { border-bottom: 1px solid var(--line); }
.docs-returns dt {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--fg);
}
.docs-returns dd { margin: 0; color: var(--fg-muted); }

/* ─── Code rail (right column) ─────────────────────────────────────────── */
.docs-code { position: sticky; top: 88px; align-self: start; min-width: 0; }
.docs-code-block {
    background: var(--docs-code-bg);
    color: var(--docs-code-fg);
    border-radius: var(--docs-radius);
    border: 1px solid rgba(243, 238, 231, 0.08);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}
.docs-code-block + .docs-code-block { margin-top: 16px; }
.docs-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(243, 238, 231, 0.08);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--docs-code-mute);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.docs-code-block pre {
    margin: 0;
    padding: 14px 16px;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--docs-code-fg);
    font-size: 0.8125rem;
    line-height: 1.55;
    overflow-x: auto;
}
.docs-code-block pre code { background: none; border: 0; padding: 0; color: inherit; }

/* Inline kbd-style for endpoint pill in section headers */
.docs-endpoint-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    padding: 6px 12px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* ─── Inline summary table (overview & formats) ───────────────────────── */
.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    margin-top: 12px;
}
.docs-table th, .docs-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}
.docs-table th {
    font-weight: 600;
    color: var(--fg-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.docs-table tbody tr:hover { background: var(--bg-elev); }
.docs-table code { font-size: 0.8125rem; }

/* ─── Responsive collapses ─────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .docs-section { grid-template-columns: 1fr; }
    .docs-code { position: static; }
}
@media (max-width: 760px) {
    .docs-shell { grid-template-columns: 1fr; gap: 0; padding-block: 8px 64px; }
    .docs-toc { display: none; }
    .docs-toc-mobile { display: block; }
    .docs-returns > div { grid-template-columns: 1fr; gap: 4px; }
    .docs-hero h1 { font-size: 1.625rem; }
}
