/* The look of the help's pages on Vovó's site (`src/docs.rs` makes the
   pages): the site's own colours and letters, light and dark by the
   browser's theme, and nothing asked of anywhere else. */
:root
{
    color-scheme: light dark;
    --bg: #FBF8F7;
    --bg-2: #F6EFEF;
    --card: #FFFFFF;
    --ink: #1D1719;
    --muted: #665A5F;
    --line: #EDE3E5;
    --line-2: #DDCFD3;
    --accent: #840926;
    --accent-ink: #840926;
    --accent-soft: #F4E3E7;
    --code-bg: #FBF7F7;
    --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
    --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark)
{
    :root
    {
        --bg: #121012;
        --bg-2: #181416;
        --card: #1C181A;
        --ink: #F2EBED;
        --muted: #B0A4A9;
        --line: #2A2225;
        --line-2: #3A2F33;
        --accent: #920A2A;
        --accent-ink: #F67895;
        --accent-soft: #2B141B;
        --code-bg: #171315;
    }
}

*
{
    box-sizing: border-box;
}

html
{
    /* A part linked to lands under the header, not behind it. */
    scroll-padding-top: 84px;
}

body
{
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.62 var(--text);
    -webkit-text-size-adjust: 100%;
}

a
{
    color: var(--accent-ink);
    text-underline-offset: 3px;
}

.top
{
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 22px;
    min-height: 60px;
    padding: 8px var(--gutter);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
}

.brand
{
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font: 700 19px/1 var(--display);
    text-decoration: none;
}

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

.help
{
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.help:hover
{
    color: var(--ink);
}

.langs
{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px 12px;
    margin-left: auto;
    font-size: 13px;
}

.langs a
{
    color: var(--muted);
    text-decoration: none;
}

.langs a:hover
{
    color: var(--ink);
}

.langs a[aria-current]
{
    color: var(--ink);
    font-weight: 650;
}

.shell
{
    display: grid;
    grid-template-columns: 230px minmax(0, 760px) 210px;
    align-items: start;
    gap: 44px;
    max-width: 1340px;
    margin: 0 auto;
    padding: 34px var(--gutter) 110px;
}

/* A page with no other beside it (the entrance, the changes) keeps to
   the middle. */
.shell > main:only-child
{
    grid-column: 1 / -1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.pages,
.parts
{
    position: sticky;
    top: 92px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 112px);
    overflow: auto;
    font-size: 14px;
}

.pages a,
.parts a
{
    padding: 6px 11px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
}

.pages a:hover,
.parts a:hover
{
    background: var(--bg-2);
    color: var(--ink);
}

.pages a[aria-current]
{
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 650;
}

.parts
{
    padding-left: 10px;
    border-left: 1px solid var(--line);
    font-size: 13px;
}

.parts a.sub
{
    padding: 3px 11px 3px 22px;
    font-size: 12.5px;
}

main
{
    min-width: 0;
    overflow-wrap: break-word;
}

main h1
{
    margin: 0 0 14px;
    font: 700 34px/1.2 var(--display);
    letter-spacing: -0.012em;
}

main h2
{
    margin: 46px 0 10px;
    font: 650 23px/1.3 var(--display);
}

main h3
{
    margin: 30px 0 6px;
    font: 650 17px/1.4 var(--text);
}

main p
{
    margin: 0 0 14px;
}

/* Chinese, Japanese and Korean keep their letters' own spacing. */
:lang(zh) h1,
:lang(ja) h1,
:lang(ko) h1
{
    letter-spacing: 0;
}

:lang(ko) main
{
    word-break: keep-all;
}

code
{
    padding: 1px 5px;
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 5px;
    font: 0.88em var(--mono);
}

h3 code
{
    font-size: 0.95em;
}

pre
{
    position: relative;
    margin: 0 0 18px;
    padding: 16px 18px;
    overflow: auto;
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    font: 13.5px/1.55 var(--mono);
    tab-size: 4;
}

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

pre button
{
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--line-2);
    border-radius: 7px;
    font: 600 12px/1.4 var(--text);
    cursor: pointer;
}

pre button:hover
{
    color: var(--ink);
    border-color: var(--accent);
}

ul.items
{
    margin: 0 0 16px;
    padding-left: 21px;
}

ul.items li
{
    margin: 7px 0;
}

ul.links
{
    display: grid;
    gap: 7px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

ul.links a,
ul.links .in-app
{
    display: block;
    padding: 10px 15px;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
}

ul.links a:hover
{
    border-color: var(--accent);
}

/* A tab of the window: its words, with nowhere to go from a page. */
ul.links .in-app
{
    color: var(--muted);
    border-style: dashed;
    font-weight: 500;
}

/* The part a link landed on, so the eye finds it. */
h2:target,
h3:target,
li:target
{
    background: var(--accent-soft);
    border-radius: 6px;
    box-shadow: 0 0 0 6px var(--accent-soft);
}

@media (max-width: 1120px)
{
    .shell
    {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .parts
    {
        display: none;
    }
}

@media (max-width: 760px)
{
    .shell
    {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
        padding-top: 20px;
    }

    .pages
    {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--line);
    }

    .langs
    {
        justify-content: flex-start;
        width: 100%;
        margin-left: 0;
    }

    main h1
    {
        font-size: 28px;
    }
}
