:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --bg-sunken: #f7f7fb;
    --bg-raised: #ffffff;
    --border: #e5e4ee;
    --text: #16151f;
    --text-muted: #5f5c72;
    --accent: #4f46e5;
    --accent-strong: #4338ca;
    --accent-soft: #f0eeff;
    --code-bg: #f4f3f9;
    --shadow: 0 1px 2px rgb(20 16 50 / .05), 0 12px 32px -14px rgb(20 16 50 / .16);
    --radius: 12px;
    --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121116;
        --bg-sunken: #1a1922;
        --bg-raised: #1c1b25;
        --border: #2f2e3c;
        --text: #e9e8ef;
        --text-muted: #9c99ad;
        --accent: #8b83f7;
        --accent-strong: #a49df9;
        --accent-soft: #221f3a;
        --code-bg: #201f2b;
        --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 32px -14px rgb(0 0 0 / .6);
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

code, pre, kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

code {
    padding: 0.15em 0.4em;
    border-radius: 5px;
    background: var(--code-bg);
    font-size: 0.88em;
}

pre {
    margin: 18px 0;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--code-bg);
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.6;
}

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

kbd {
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--bg-raised);
    font-size: 0.85em;
}

img { max-width: 100%; height: auto; }

/* --- Header --- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 62px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 650;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand img { width: 28px; height: 28px; border-radius: 7px; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.site-nav a {
    padding: 7px 11px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
}

.site-nav a:hover { background: var(--bg-sunken); color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--bg-sunken); }

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-raised);
    color: var(--text);
    font-size: 15px;
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { border-color: var(--text-muted); color: var(--text); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #ffffff; }

/* --- Hero --- */

.hero { padding: 76px 0 56px; text-align: center; }

.hero h1 {
    margin: 0 0 18px;
    font-size: clamp(34px, 6vw, 56px);
    line-height: 1.07;
    letter-spacing: -0.03em;
    font-weight: 700;
}

.hero h1 em {
    font-style: normal;
    background: linear-gradient(96deg, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero .lede {
    max-width: 620px;
    margin: 0 auto 30px;
    font-size: clamp(17px, 2.2vw, 20px);
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.hero-note { font-size: 13.5px; color: var(--text-muted); }

.hero-shot {
    margin: 48px auto 0;
    width: 100%;
    max-width: 760px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: block;
    overflow: hidden;
}

/* --- Sections --- */

section { padding: 56px 0; }
section + section { border-top: 1px solid var(--border); }

h2 {
    margin: 0 0 10px;
    font-size: clamp(24px, 3.4vw, 32px);
    line-height: 1.2;
    letter-spacing: -0.022em;
    font-weight: 680;
}

.section-lede { margin: 0 0 32px; color: var(--text-muted); max-width: 640px; }

h3 { margin: 32px 0 8px; font-size: 19px; letter-spacing: -0.012em; font-weight: 640; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-raised);
}

.card h3 { margin: 0 0 6px; font-size: 16.5px; }
.card p { margin: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.6; }

.card-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 13px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
}

.card-icon svg { width: 18px; height: 18px; }

/* --- Steps --- */

.steps { counter-reset: step; display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }

.steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 15px;
    align-items: start;
}

.steps li::before {
    content: counter(step);
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font-size: 14px;
    font-weight: 650;
}

.steps li > div > strong { display: block; margin-bottom: 2px; }
.steps li p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* --- Tables --- */

.table-scroll { overflow-x: auto; margin: 20px 0; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}

th, td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th { font-weight: 620; font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); }
tbody tr:last-child td { border-bottom: 0; }

/* --- Callout --- */

.callout {
    margin: 26px 0;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    background: var(--bg-sunken);
}

.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* --- Doc pages --- */

.doc { padding: 48px 0 72px; }
.doc > .wrap { max-width: 760px; }
.doc h1 { margin: 0 0 6px; font-size: clamp(30px, 5vw, 42px); letter-spacing: -0.028em; line-height: 1.12; }
.doc .updated { margin: 0 0 36px; color: var(--text-muted); font-size: 14px; }
.doc h2 { margin: 40px 0 10px; font-size: 22px; padding-top: 0; border: 0; }
.doc h3 { margin: 28px 0 6px; font-size: 17px; }
.doc p, .doc li { color: var(--text); overflow-wrap: break-word; }
.doc a { overflow-wrap: anywhere; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc section { padding: 0; border: 0; }

.toc {
    margin: 0 0 40px;
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-sunken);
}

.toc strong { display: block; margin-bottom: 8px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 4px 0; font-size: 14.5px; }

/* --- Footer --- */

.site-footer {
    padding: 40px 0;
    border-top: 1px solid var(--border);
    background: var(--bg-sunken);
    font-size: 14px;
    color: var(--text-muted);
}

.site-footer .wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer-links { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 620px) {
    .site-header .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
    .site-nav { margin-left: 0; width: 100%; }
    .hero { padding: 48px 0 40px; }
    .footer-links { margin-left: 0; }
}
