/* ── page layout ── */
.api-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 4rem;
    align-items: start;
}

/* ── sidebar ── */
.api-sidebar {
    position: sticky;
    top: 5rem;
    padding: 2rem 1.5rem 2rem 0;
    border-right: 1px solid #e2e8f0;
    min-height: calc(100vh - 6rem);
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: block;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 4px;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
    margin-bottom: 1px;
}

.sidebar-link:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.sidebar-link.active {
    color: #3b82f6;
    border-left-color: #3b82f6;
    background: #eff6ff;
    font-weight: 500;
}

/* ── main content ── */
.api-content {
    padding: 2rem 0 2rem 2.5rem;
    min-width: 0;
}

.api-section {
    margin-bottom: 3.5rem;
    scroll-margin-top: 5.5rem;
}

.api-section h2 {
    font-size: 1.5rem;
    color: #0f172a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.api-section h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin: 1.5rem 0 0.75rem;
}

.api-section p {
    color: #475569;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

/* ── hero ── */
.api-hero {
    padding: 2.5rem 0 2rem;
    margin-bottom: 0.5rem;
}

.api-hero h1 {
    font-size: 2rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.api-hero p {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.base-url-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0f172a;
    color: #94a3b8;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.9rem;
}

.base-url-pill span.host {
    color: #e2e8f0;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.badge-get    { background: #dcfce7; color: #15803d; }
.badge-200    { background: #dcfce7; color: #15803d; }
.badge-400    { background: #fef9c3; color: #854d0e; }
.badge-404    { background: #fee2e2; color: #b91c1c; }
.badge-429    { background: #fce7f3; color: #9d174d; }
.badge-png    { background: #ede9fe; color: #6d28d9; }
.badge-json   { background: #dbeafe; color: #1d4ed8; }

/* ── endpoint block ── */
.endpoint-block {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.endpoint-path {
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-size: 0.95rem;
    color: #0f172a;
    font-weight: 600;
}

.endpoint-desc {
    margin-left: auto;
    font-size: 0.8rem;
    color: #94a3b8;
}

.endpoint-body {
    padding: 1.25rem;
}

/* ── terminal / code block ── */
.terminal {
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    margin: 0.75rem 0;
    font-size: 0.83rem;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red    { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green  { background: #10b981; }

.terminal-title {
    margin-left: 0.5rem;
    font-size: 0.72rem;
    color: #64748b;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
}

.terminal-copy {
    margin-left: auto;
    background: none;
    border: 1px solid #334155;
    color: #64748b;
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.terminal-copy:hover {
    color: #e2e8f0;
    border-color: #475569;
}

.terminal-body {
    padding: 1rem 1.1rem;
    overflow-x: auto;
}

.terminal-body pre {
    margin: 0;
    white-space: pre;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    line-height: 1.6;
}

/* cli syntax colours */
.c-cmd   { color: #7dd3fc; }   /* command keyword */
.c-url   { color: #86efac; }   /* url */
.c-flag  { color: #fbbf24; }   /* -H, -o flags */
.c-str   { color: #f9a8d4; }   /* string value */
.c-cmt   { color: #475569; }   /* comment */
.c-dim   { color: #64748b; }

/* json syntax colours */
.j-key   { color: #7dd3fc; }
.j-str   { color: #86efac; }
.j-num   { color: #fbbf24; }
.j-bool  { color: #f9a8d4; }
.j-null  { color: #94a3b8; }
.j-pun   { color: #cbd5e1; }

/* http response colours */
.h-ver   { color: #94a3b8; }
.h-2xx   { color: #4ade80; font-weight: 600; }
.h-4xx   { color: #f87171; font-weight: 600; }
.h-hname { color: #7dd3fc; }
.h-hval  { color: #e2e8f0; }

/* ── tabs ── */
.tab-group {
    margin: 0.75rem 0;
}

.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #334155;
    background: #1e293b;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.tab-btn {
    background: none;
    border: none;
    color: #64748b;
    padding: 0.55rem 1rem;
    font-size: 0.78rem;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover { color: #cbd5e1; }
.tab-btn.active { color: #7dd3fc; border-bottom-color: #7dd3fc; background: #0f172a; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-panel .terminal {
    border-radius: 0 0 8px 8px;
}

.tab-panel .terminal-bar {
    display: none;
}

/* ── tables ── */
.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 0.5rem 0 1rem;
}

.ref-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.ref-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: top;
}

.ref-table tr:last-child td { border-bottom: none; }

.ref-table td code {
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-size: 0.8rem;
    background: #f1f5f9;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: #6d28d9;
}

.ref-table td.muted { color: #94a3b8; font-size: 0.82rem; }

/* ── callout ── */
.callout {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0.75rem 0;
}

.callout-info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.callout-warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.callout-tip   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }

/* ── inline code ── */
p code, li code {
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-size: 0.83em;
    background: #f1f5f9;
    color: #6d28d9;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

ul.api-list {
    padding-left: 0;
    list-style: none;
    margin-bottom: 0.75rem;
}

ul.api-list li {
    padding: 0.2rem 0;
    color: #475569;
    font-size: 0.9rem;
}

ul.api-list li::before {
    content: '→ ';
    color: #94a3b8;
    font-size: 0.8rem;
}

/* ── copy toast ── */
#copyToast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(2rem);
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: 'SFMono-Regular', monospace;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 2000;
}

#copyToast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── mobile ── */
@media (max-width: 768px) {
    .api-layout {
        grid-template-columns: 1fr;
    }

    .api-sidebar {
        display: none;
    }

    .api-content {
        padding: 1rem 0;
    }

    .api-hero h1 { font-size: 1.5rem; }
}
