/* Content.

   The body of the pages, the markdown mdbook renders: text, headings, code,
   tables, notes, and the pages of the keyword reference. theme/content.js
   marks what the markdown says in words, a note, a label, the language of a
   code block, the properties of a keyword; this draws it. The rules are
   those of the body only, .content main, which the preview of the search
   shows too.

   The colors derive from those of the theme the reader picked: the text a
   little brighter than mdbook gives it on a dark theme, the headings and
   what stands out brighter still, the lines and fills a share of the text
   color over the background. */

html.navy,
html.coal,
html.ayu {
    --content-fg: color-mix(in srgb, var(--fg) 86%, white);
    --content-strong: color-mix(in srgb, var(--fg) 45%, white);
    --content-links: color-mix(in srgb, var(--links) 62%, white);
    --content-code-bg: color-mix(in srgb, var(--bg) 78%, black);
}

html.light,
html.rust {
    --content-fg: var(--fg);
    --content-strong: color-mix(in srgb, var(--fg) 70%, black);
    --content-links: var(--links);
    --content-code-bg: color-mix(in srgb, var(--fg) 4%, var(--bg));
}

.content main {
    --content-muted: color-mix(in srgb, var(--content-fg) 62%, transparent);
    --content-line: color-mix(in srgb, var(--fg) 13%, transparent);
    --content-fill: color-mix(in srgb, var(--fg) 5%, transparent);
    color: var(--content-fg);
}

/* Text: room between the lines. */
.content main p,
.content main li,
.content main dd {
    line-height: 1.7;
}

.content main li {
    margin: 0.3em 0;
}

.content main li::marker {
    color: color-mix(in srgb, var(--content-fg) 40%, transparent);
}

.content main strong {
    color: var(--content-strong);
}

/* The links of the text in the color of the links of the body, through
   the variable mdbook and the components color them with: no rule of their
   own to outweigh those of the headings, the menu of the page or the
   buttons of the page of a missing URL. The value is the one the theme gave
   the page, the variable not referring to itself. */
.content main {
    --links: var(--content-links);
}

.content main a {
    text-underline-offset: 3px;
}

.content main hr {
    margin: 2.4em 0;
    border: 0;
    border-top: 1px solid var(--content-line);
}

.content main img {
    border-radius: 8px;
}

/* Headings: a scale, the weight of each level, more room above than
   below, and a mark to link them on hover. */
.content main :is(h1, h2, h3, h4, h5, h6) {
    color: var(--content-strong);
    line-height: 1.3;
}

.content main .header:link,
.content main .header:visited {
    color: inherit;
}

.content main h1 {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.content main h2 {
    margin: 2.2em 0 0.6em;
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.015em;
}

.content main h3 {
    margin: 1.8em 0 0.5em;
    font-size: 1.65rem;
    font-weight: 600;
}

.content main h4 {
    margin: 1.6em 0 0.4em;
    font-size: 1.45rem;
    font-weight: 600;
}

.content main :is(h2, h3, h4) > a.header {
    position: relative;
}

.content main :is(h2, h3, h4) > a.header::before {
    position: absolute;
    left: -0.9em;
    content: "#";
    /* a mark to see, not a word of the heading read aloud */
    content: "#" / "";
    color: var(--content-links);
    opacity: 0;
    transition: opacity 0.15s;
}

.content main :is(h2, h3, h4):hover > a.header::before {
    opacity: 0.7;
}

/* Inline code: a light tint, not a box of the code block's color. */
.content main :not(pre) > code,
.content main :not(pre) > code.hljs {
    padding: 0.1em 0.35em;
    border: 0;
    border-radius: 4px;
    background: color-mix(in srgb, var(--fg) 9%, transparent);
    color: var(--content-strong);
    font-size: 0.86em;
}

.content main :is(h1, h2, h3, h4, h5, h6) code,
.content main :is(h1, h2, h3, h4, h5, h6) code.hljs {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: 0.95em;
}

.content main a code,
.content main a code.hljs {
    color: inherit;
}

/* Code blocks: rounded, a thin border, the language on the top right,
   where mdbook shows its copy button on hover instead. */
.content main pre {
    margin: 1.2em 0;
    border: 1px solid var(--content-line);
    border-radius: 10px;
    background: var(--content-code-bg);
    overflow: hidden;
}

.content main pre > code,
.content main pre > code.hljs {
    overflow-x: auto;
    padding: 14px 18px;
    background: var(--content-code-bg);
    font-size: 0.86em;
    line-height: 1.6;
}

.content main pre[data-lang]::after {
    position: absolute;
    top: 7px;
    right: 12px;
    content: attr(data-lang);
    color: var(--content-muted);
    font-size: 0.68em;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity 0.15s;
}

.content main pre[data-lang]:hover::after {
    opacity: 0;
}

/* The tabs of a page, CLI and API, framed as a code block is. */
.content main .tabs-ready {
    margin: 1.2em 0;
    border: 1px solid var(--content-line);
    border-radius: 10px;
    overflow: hidden;
}

.content main .tabs-ready > .tab-bar {
    border-bottom: 1px solid var(--content-line);
    background: var(--content-fill);
}

.content main .tabs-ready > .tab {
    padding: 0 12px;
}

.content main .tabs-ready > .tab > pre {
    margin: 12px 0;
}

/* Tables: the header bold on a light fill, lines between the rows only. */
.content main .table-wrapper {
    margin: 1.4em 0;
    border: 1px solid var(--content-line);
    border-radius: 10px;
    overflow-x: auto;
}

.content main table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.94em;
}

.content main table thead {
    background: var(--content-fill);
}

.content main table thead tr {
    border: 0;
}

.content main table th,
.content main table thead td {
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--content-line);
    color: var(--content-strong);
    font-weight: 600;
    text-align: left;
}

.content main table td {
    padding: 9px 14px;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--fg) 8%, transparent);
    vertical-align: top;
}

.content main table tbody tr:first-child td {
    border-top: 0;
}

.content main table tbody tr:nth-child(2n) {
    background: none;
}

/* Blockquotes, and the notes: a bar on the left, a light fill, a note the
   color of its kind and its title on top. */
.content main blockquote {
    margin: 1.4em 0;
    padding: 12px 18px;
    border: 0;
    border-left: 3px solid color-mix(in srgb, var(--fg) 25%, transparent);
    border-radius: 0 8px 8px 0;
    background: var(--content-fill);
}

.content main :is(blockquote, .callout) > :first-child {
    margin-top: 0;
}

.content main :is(blockquote, .callout) > :last-child {
    margin-bottom: 0;
}

.content main .callout {
    --accent: var(--blockquote-note-color);
    position: static;
    margin: 1.4em 0;
    padding: 12px 18px;
    border: 0;
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.content main .callout-tip {
    --accent: var(--blockquote-tip-color);
}

.content main .callout-important {
    --accent: var(--blockquote-important-color);
}

.content main .callout-warning {
    --accent: var(--blockquote-warning-color);
}

.content main .callout-caution {
    --accent: var(--blockquote-caution-color);
}

/* mdbook marks its warning with an icon in the margin. */
.content main .callout.warning::before {
    content: none;
}

.content main .callout-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.content main .callout-title svg {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The icons mdbook draws in its alerts are filled. */
.content main .blockquote-tag-title.callout-title svg {
    fill: currentColor;
    stroke: none;
}

/* Labels: a paragraph of a bold word and a colon names what follows. */
.content main p.label {
    margin: 1.6em 0 0.5em;
    color: var(--content-muted);
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.content main p.label strong {
    color: inherit;
}

.content main p.label + :is(pre, ul, ol, .table-wrapper) {
    margin-top: 0;
}

/* The keyword reference: what a heading is apart from its name, a line
   between the keywords, the keywords of a driver as links, the properties
   of a keyword as tags. */
.content main .ref-kind {
    display: inline-block;
    margin-right: 0.6em;
    padding: 0.2em 0.6em;
    border-radius: 6px;
    background: color-mix(in srgb, var(--content-links) 16%, transparent);
    color: var(--content-links);
    font-family: var(--font, inherit);
    font-size: 0.45em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: 0.35em;
}

.content main h2 .ref-kind {
    font-size: 0.5em;
    vertical-align: 0.25em;
}

.content main.reference h2 {
    margin-top: 1.8em;
    padding-top: 1.2em;
    border-top: 1px solid var(--content-line);
}

/* A keyword alone, as the preview of the search shows it, has nothing
   above it to be set apart from. */
.content main.reference > h2:first-child {
    margin-top: 14px;
    padding-top: 0;
    border-top: 0;
}

.content main ul.kw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0 16px;
    padding: 0;
    list-style: none;
}

.content main ul.kw-grid li {
    margin: 0;
    overflow: hidden;
    font-family: var(--mono-font, monospace);
    font-size: 0.86em;
    line-height: 1.9;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content main .kw-props {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0.4em 0 1.2em;
}

.content main .kw-prop {
    display: inline-flex;
    max-width: 100%;
    border: 1px solid var(--content-line);
    border-radius: 6px;
    font-family: var(--mono-font, monospace);
    font-size: 0.8em;
    overflow: hidden;
}

.content main .kw-prop .k {
    flex: none;
    padding: 2px 8px;
    background: var(--content-fill);
    color: var(--content-muted);
}

.content main .kw-prop .v {
    padding: 2px 8px;
    color: var(--content-strong);
}

.content main .kw-prop[data-k="required"][data-v="true"] {
    border-color: color-mix(in srgb, var(--blockquote-warning-color) 50%, transparent);
}

.content main .kw-prop[data-k="required"][data-v="true"] .v {
    color: var(--blockquote-warning-color);
}
