:root {
    color-scheme: light dark;
    --bg: #fbfbfa;
    --fg: #14161a;
    --muted: #5c6066;
    --border: #d6d8db;
    --code-bg: #f0f1f2;
    --link: #0b5fff;
    --max: 46rem;
    --font: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --fg: #e4e6e9;
        --muted: #9aa0a6;
        --border: #30343a;
        --code-bg: #1d2025;
        --link: #6ea8fe;
    }
}

* {
    box-sizing: border-box;
}

html {
    font-size: 17px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--fg);
}

body {
    margin: 0;
    font-family: var(--font);
}

header.doc-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

header.doc-header a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

header.doc-header a:hover {
    color: var(--fg);
    text-decoration: underline;
}

main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

h1,
h2,
h3,
h4 {
    line-height: 1.25;
    margin: 1.75rem 0 0.75rem;
}

h1 {
    font-size: 1.85rem;
    margin-top: 0.5rem;
}

h2 {
    font-size: 1.35rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
}

h3 {
    font-size: 1.15rem;
}

p,
ul,
ol,
table,
pre,
figure {
    margin: 0.85rem 0;
}

ul,
ol {
    padding-left: 1.4rem;
}

li + li {
    margin-top: 0.25rem;
}

/* An ordered list whose items hold blocks (render.mjs adds the class): each step gets a
   numbered circle, and a line down the left joins them so step boundaries read at a glance. */
ol.steps {
    list-style: none;
    counter-reset: step;
    padding-left: 0;
    margin: 1.25rem 0;
}

ol.steps > li {
    counter-increment: step;
    position: relative;
    padding: 0 0 1.25rem 3rem;
    margin: 0;
}

ol.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--link);
    color: var(--bg);
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1rem;
    line-height: 2rem;
    text-align: center;
}

ol.steps > li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: calc(1rem - 1px);
    top: 2.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--border);
}

/* Line the first paragraph up with the middle of the circle. */
ol.steps > li > p:first-child {
    margin-top: 0.2rem;
}

ol.steps > li > :last-child {
    margin-bottom: 0;
}

a {
    color: var(--link);
}

code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.9rem 1rem;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.82rem;
    line-height: 1.45;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th,
td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.6rem;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--code-bg);
}

figure {
    margin: 1.25rem 0;
}

figure img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #ffffff;
}

figcaption {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.4rem;
}

.figures-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin: 1.25rem 0;
}

/* Shrink-wrap: these are small UI screenshots that must not be upscaled, so the figure
   tracks the image's natural width instead of growing into a half-empty column. */
.figures-row figure {
    flex: 0 1 auto;
    max-width: 100%;
    margin: 0;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.doc-index ul {
    list-style: none;
    padding: 0;
}

.doc-index li {
    margin: 0.75rem 0;
}

.doc-index a {
    font-size: 1.15rem;
    font-weight: 600;
    text-decoration: none;
}

.doc-index a:hover {
    text-decoration: underline;
}

.doc-index p {
    color: var(--muted);
    margin: 0.2rem 0 0;
}
