/*
 * Copyright (c) 2026 WebCpp.org
 *
 * Distributed under the Boost Software License, Version 1.0. (See
 * accompanying file LICENSE_1_0.txt or copy at
 * https://www.boost.org/LICENSE_1_0.txt)
 */

/*
 * The site's chrome: the header and the band every page shows, the libraries' pages and the docs
 * index among them, which b2 site heads with it and whose own style is Asciidoctor's. It holds the
 * theme's tokens, light, which site.css turns dark on the site's own pages, and rules that reach
 * nothing but the header and the band, so that a page of the docs keeps its look and its light
 * theme, and its header with it.
 */

:root {
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --background: #ffffff;
    --surface: #f5f5f7;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --rule: #d2d2d7;
    /* The accent, violet, as text and the mark's angle brackets: 6.65 to 1 on white, 6.11 on the surface. */
    --accent: #5b3fd9;
    /* The accent as a fill under white text: 6.65 to 1; site.css's dark theme makes it #6246ea, 5.86. */
    --accent-fill: #5b3fd9;
    --gutter: 16px;
    --measure: 1120px;
}

header.site,
header.site *,
.band,
.band * {
    box-sizing: border-box;
}

/*
 * The header: the logo, the mark and the name, then the navigation. On a phone the navigation
 * folds under the Menu, a list as wide as the header while it is open; from 768px it stands on the
 * logo's line and the Menu is gone.
 */

header.site {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 24px;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 12px var(--gutter);
    font: 17px/1.5 var(--font);
}

header.site .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 28px;
    text-decoration: none;
}

header.site img {
    display: block;
    width: 28px;
    height: 28px;
}

/* Asciidoctor's stylesheet, on a library's page, styles every details and summary; not the Menu. */
header.site .menu {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
}

header.site .menu summary::before,
header.site .menu summary::after {
    content: none;
}

header.site .menu summary {
    position: static;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 0;
    line-height: 1.5;
    letter-spacing: normal;
    color: var(--text);
    font-size: 15px;
    list-style: none;
    cursor: pointer;
}

header.site .menu summary::-webkit-details-marker {
    display: none;
}

header.site .menu svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

header.site nav {
    display: flex;
    flex-direction: column;
    flex-basis: 100%;
    padding: 8px 0 4px;
}

header.site .menu:not([open]) + nav {
    display: none;
}

header.site nav a {
    padding: 10px 0;
    color: var(--text);
    text-decoration: none;
}

header.site nav a + a {
    border-top: 1px solid var(--rule);
}

header.site nav a:hover,
header.site nav a[aria-current="page"] {
    color: var(--accent);
}

header.site a:focus-visible,
header.site summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.band {
    margin: 0;
    padding: 6px var(--gutter);
    border-block: 1px solid var(--rule);
    background: var(--surface);
    color: var(--muted);
    font: 13px/1.5 var(--font);
    text-align: center;
}

.band code {
    padding: 0;
    background: none;
    color: inherit;
    font-family: var(--mono);
    font-size: 0.88em;
}

/*
 * On a library's page and the docs index, Asciidoctor's article, the header's content lines up
 * with the page's, which tools/doc/docinfo.html centres in 66em of the page's 16px between
 * Asciidoctor's margins, and keeps the page's light theme: the logo, an image, follows the
 * color-scheme of its element, and would otherwise draw its dark theme's white on the page's
 * white.
 */
body.article > header.site {
    max-width: 66rem;
    padding-inline: 0.9375rem;
    color-scheme: light;
}

@media (min-width: 768px) {
    :root {
        --gutter: 32px;
    }

    header.site {
        flex-wrap: nowrap;
    }

    header.site .menu {
        display: none;
    }

    header.site nav,
    header.site .menu:not([open]) + nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        flex-basis: auto;
        gap: 4px 22px;
        padding: 0;
        font-size: 14px;
    }

    header.site nav a {
        padding: 0;
    }

    header.site nav a + a {
        border-top: 0;
    }
}

/*
 * Beside the table of contents a page of the docs keeps at its left, its column is too narrow for
 * the navigation on the logo's line until 1280px: the header stays as on a phone.
 */
@media (min-width: 768px) and (max-width: 1279px) {
    body.toc2 > header.site {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

/*
 * There the band still reaches the window's right edge, through the padding docinfo.html gives the
 * body at its right: 1rem from 768px, 2rem from 1280px.
 */
@media (min-width: 768px) {
    body.toc2.toc-left > .band {
        margin-right: -1rem;
    }
}

@media (min-width: 1280px) {
    body.toc2.toc-left > .band {
        margin-right: -2rem;
    }
}

@media (min-width: 1280px) {
    :root {
        --gutter: 48px;
    }
}

@media (min-width: 1440px) {
    :root {
        --measure: 1280px;
    }
}
