/* ── Reset & Variables ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d3a;
    --accent: #4f8ef7;
    --accent-dim: #2a4a8a;
    --text: #e2e4ed;
    --muted: #7a7f99;
    --code-bg: #13151f;
    --radius: 8px;
    --warn: #d97706;
    --warn-dim: #451a03;
    --success: #22c55e;
    --success-dim: #14532d;
    --danger: #ef4444;
    --danger-dim: #450a0a;
    --method-get: #22c55e;
    --method-put: #f59e0b;
    --method-post: #3b82f6;
    --method-delete: #ef4444;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 15px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Layout ── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
nav {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

nav .logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 2rem;
    text-decoration: none;
}

nav .logo span {
    color: var(--accent);
}

nav ul {
    list-style: none;
}

nav ul li {
    margin-bottom: 0.1rem;
}

nav ul li a {
    display: block;
    padding: 0.35rem 0.6rem;
    border-radius: 5px;
    color: var(--muted);
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

nav ul li a:hover {
    background: rgba(79, 142, 247, 0.12);
    color: var(--text);
}

/* in-page section currently in view */
nav ul li a.active {
    background: rgba(79, 142, 247, 0.1);
    color: var(--accent);
}

nav ul li a.active:hover {
    background: rgba(79, 142, 247, 0.18);
    color: var(--accent);
}

/* current page */
nav ul li a.page-active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
    border-left: 2px solid var(--accent);
    padding-left: calc(0.6rem - 2px);
}

nav .section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 1rem 0.6rem 0.3rem;
}

nav .section-label-active {
    color: var(--accent);
}


nav .section-label-link {
    padding: 0;
}

nav .section-label-link > a {
    display: block;
    padding: 1rem 0.6rem 0.3rem;
    border-radius: 5px;
    color: var(--muted);
    text-decoration: none;
    font: inherit;
    transition: background 0.15s, color 0.15s;
}

nav .section-label-link > a:hover {
    background: rgba(79, 142, 247, 0.12);
    color: var(--text);
}

nav .section-label-active.section-label-link > a {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
    border-left: 2px solid var(--accent);
    padding-left: calc(0.6rem - 2px);
}

nav .section-label-active.section-label-link > a:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── Main Content ── */
main {
    flex: 1;
    padding: 3rem 4rem;
    max-width: 900px;
}

/* ── Hero ── */
.hero {
    margin-bottom: 3.5rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero h1 span {
    color: var(--accent);
}

.hero p {
    color: var(--muted);
    max-width: 600px;
}

.badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

/* ── Sections ── */
section {
    margin-bottom: 3.5rem;
}

h2 {
    font-size: 1.25rem;
    font-weight: 700;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.75rem 0 0.75rem;
    color: var(--text);
}

h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
    color: var(--muted);
}

p {
    margin-bottom: 0.75rem;
    color: var(--text);
}

code {
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    color: #c9d1d9;
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    margin: 0.75rem 0 1.25rem;
    font-size: 0.83rem;
    line-height: 1.6;
}

pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: #c9d1d9;
}

ul,
ol {
    margin: 0.5rem 0 1rem 1.25rem;
}

li {
    margin-bottom: 0.3rem;
}

/* ── Cards ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}

.card h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.card p {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0;
}

/* ── Callouts ── */
.note,
.warning,
.tip {
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.note {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--muted);
}

.warning {
    background: var(--warn-dim);
    border-color: var(--warn);
    color: #fde68a;
}

.tip {
    background: var(--success-dim);
    border-color: var(--success);
    color: #bbf7d0;
}

.note strong,
.warning strong,
.tip strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

th,
td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 600;
    background: var(--surface);
}

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

/* ── API Reference ── */
.api-ref {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.api-ref .api-method {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.api-ref .api-method.get {
    background: #14532d;
    color: var(--method-get);
}

.api-ref .api-method.post {
    background: #1e3a5f;
    color: var(--method-post);
}

.api-ref .api-method.put {
    background: #451a03;
    color: #fbbf24;
}

.api-ref .api-method.delete {
    background: #450a0a;
    color: var(--method-delete);
}

.api-ref .api-path {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    color: var(--text);
    font-size: 0.82rem;
}

.api-ref .api-version {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--bg);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

/* ── Step list ── */
.steps {
    counter-reset: step-counter;
    list-style: none;
    margin: 0.5rem 0 1.25rem 0;
}

.steps li {
    counter-increment: step-counter;
    padding: 0.6rem 0 0.6rem 2.5rem;
    position: relative;
    border-left: 2px solid var(--border);
    margin-left: 0.75rem;
    margin-bottom: 0;
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: -1rem;
    top: 0.55rem;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ── Inline value list ── */
.val-list {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0.25rem 0 0.75rem;
}

.val {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.45em;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.8rem;
    color: #c9d1d9;
}

.val.default {
    border-color: var(--accent-dim);
    color: var(--accent);
}

/* ── Entity header row ── */
.entity-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.platform-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--code-bg);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    nav {
        display: none;
    }

    main {
        padding: 2rem 1.25rem;
    }
}
