html {
    --fragment-background-color: #f2f5f9;
    --fragment-foreground-color: #202b38;
    --fragment-border-color: #c2cbd7;
    --code-keyword-color: #6b21a8;
    --code-type-keyword-color: #085750;
    --code-flow-keyword-color: #8a3212;
    --code-comment-color: #4a5568;
    --code-preprocessor-color: #713c13;
    --code-string-literal-color: #326133;
    --code-char-literal-color: #326133;
    --code-link-color: #114a91;
    --api-inline-background: #e9eff6;
    --api-inline-foreground: #243550;
}

@media (prefers-color-scheme: dark) {
    html:not(.dark-mode) {
        --fragment-background-color: #151c25;
        --fragment-foreground-color: #e1e8f0;
        --fragment-border-color: #465464;
        --code-keyword-color: #dfb8fd;
        --code-type-keyword-color: #96ded6;
        --code-flow-keyword-color: #fabb88;
        --code-comment-color: #aebdcd;
        --code-preprocessor-color: #ffd481;
        --code-string-literal-color: #a7dfad;
        --code-char-literal-color: #a7dfad;
        --code-link-color: #9ecbff;
        --api-inline-background: #253143;
        --api-inline-foreground: #e3ebf6;
    }
}

.contents > .textblock {
    max-width: 84ch;
    padding-bottom: 1rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.contents > .textblock :is(h1, h2, h3, h4) {
    margin-block: 1.5em 0.5em;
    line-height: 1.25;
}

.contents > .textblock :is(ul, ol) {
    padding-inline-start: 1.5em;
}

.contents > .textblock li + li {
    margin-top: 0.45em;
}

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

.contents .markdownTable :is(th, td) {
    padding: 0.45em 0.65em;
}

.contents .markdownTable .markdownTableHeadNone {
    text-align: start;
}

.contents .fragment {
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
}

.textblock :is(pre.fragment, .fragment div.line) {
    white-space: pre;
    overflow-wrap: normal;
}

.textblock .fragment div.line {
    padding-inline-start: 0;
    text-indent: 0;
}

.fragment div.line {
    line-height: 1.45;
}

.fragment a.code {
    color: var(--code-link-color);
}

.fragment a.code:is(.hl_struct, .hl_union, .hl_enum, .hl_typedef) {
    color: var(--code-type-keyword-color);
}

.fragment a.code:is(.hl_enumvalue, .hl_define) {
    color: var(--code-preprocessor-color);
}

.contents :is(tt, code):not(.fragment *) {
    display: inline;
    padding: 0.08em 0.24em;
    border-radius: 3px;
    background: var(--api-inline-background);
    color: var(--api-inline-foreground);
    font-family: var(--font-family-monospace);
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

@media (max-width: 48rem) {
    #side-nav {
        display: none;
    }

    #doc-content {
        /* Doxygen sets the tree width as an inline margin. */
        margin-left: 0 !important;
    }
}
