/******************************************************************************
* MODULE     : manual-web.css
* DESCRIPTION: Extra style sheet for the static TeXmacs manual web site
* COPYRIGHT  : (C) 2026  The TeXmacs authors
*******************************************************************************
* This software falls under the GNU general public license version 3 or later.
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
******************************************************************************/

/* -------------------------------------------------------------------------
 * Layout: keep the classic tmdoc.css look, but add a site navigation bar and
 * make the page usable on narrow screens.
 * ------------------------------------------------------------------------- */

html {
    background: #e7e7e7;
}

body {
    margin: 0;
    padding: 0 0 3em 0;
    border: none;
    background: #e7e7e7;
}

/* Navigation bar, injected as the first child of <body>.  The negative
 * margins compensate for the body margin of tmdoc.css so that the bar spans
 * the whole window width. */
body > .tmweb-nav {
    margin: 0 0 20px 0;
    padding: 0.55em 1.25em;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1em;
    background: #3b2a1e;
    color: #f7efe6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
                 Arial, sans-serif;
    font-size: 0.88em;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    position: sticky;
    top: 0;
    z-index: 20;
}

body > .tmweb-nav a {
    color: #ffd8ae;
    text-decoration: none;
}

body > .tmweb-nav a:hover {
    color: #ffffff;
    text-decoration: underline;
}

body > .tmweb-nav .tmweb-brand {
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #ffffff;
}

body > .tmweb-nav .tmweb-grow {
    flex: 1 1 auto;
}

body > .tmweb-nav .tmweb-lang {
    display: flex;
    align-items: center;
    gap: 0.45em;
    font-size: 0.95em;
}

body > .tmweb-nav .tmweb-lang a.current {
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid #ffd8ae;
}

body > .tmweb-nav .tmweb-lang .dot {
    opacity: 0.45;
}

/* The content column is centred and framed like on the TeXmacs web site. */
body > .tmdoc-body {
    max-width: 64em;
    margin: 0 auto;
    padding-left: 2.2em;
    padding-right: 2.2em;
    border-left: 1px solid #000000;
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
    box-sizing: border-box;
}

.tmdoc-title-1 {
    margin-left: -2.2em;
    margin-right: -2.2em;
    margin-top: -1px;
}

.tmdoc-copyright,
.tmdoc-license {
    margin-left: -2.2em;
    margin-right: -2.2em;
}

.tmdoc-license {
    border: 1px solid #e7e7e7;
    margin-bottom: -1px;
}

/* -------------------------------------------------------------------------
 * Typography and small fixes
 * ------------------------------------------------------------------------- */

p {
    line-height: 1.45;
}

pre,
code,
tt,
kbd,
samp {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono",
                 monospace;
}

pre {
    overflow-x: auto;
    padding: 0.6em 0.8em;
    background: #f6f6f6;
    border: 1px solid #e2e2e2;
    border-radius: 3px;
}

img {
    max-width: 100%;
}

/* Keep the flags of the title bar at their natural size: a percentage
 * max-width inside the title table makes them collapse in Chrome. */
.tmdoc-title-1 img,
.tmdoc-title-2 img,
.tmdoc-title-3 img {
    max-width: none;
}

a {
    color: #2b4f9e;
}

a:visited {
    color: #6b3fa0;
}

table {
    max-width: 100%;
}

/* Some generated pages contain stray <p> wrappers around block elements;
 * browsers close them automatically, but do not add extra vertical space. */
p:empty {
    display: none;
}

/* -------------------------------------------------------------------------
 * Site index page
 * ------------------------------------------------------------------------- */

body.tmweb-index-page {
    margin: 0;
    background: #e7e7e7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
                 Arial, sans-serif;
    color: #191919;
}

.tmweb-index {
    max-width: 64em;
    margin: 0 auto;
    padding: 0 2.2em 3em 2.2em;
    background: #ffffff;
    border-left: 1px solid #000000;
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
    box-sizing: border-box;
}

.tmweb-index h1 {
    border: 1px solid #000000;
    border-top: none;
    background: #ffffbf;
    margin: 0 -2.2em 1.4em -2.2em;
    padding: 1.1em 2.2em;
    font-size: 1.7em;
}

.tmweb-index h2 {
    border: 1px solid #000000;
    background: #fcfce7;
    font-size: 1.15em;
    margin: 2em -2.2em 0.8em -2.2em;
    padding: 0.45em 2.2em;
}

.tmweb-index p.lead {
    color: #444444;
    margin-bottom: 1.6em;
}

.tmweb-index ul.manuals {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
    gap: 0.9em;
}

.tmweb-index ul.manuals li {
    border: 1px solid #d6d6d6;
    border-radius: 4px;
    padding: 0.9em 1em;
    background: #fafafa;
}

.tmweb-index ul.manuals a {
    font-weight: 600;
    font-size: 1.05em;
    text-decoration: none;
}

.tmweb-index ul.manuals span {
    display: block;
    margin-top: 0.35em;
    color: #666666;
    font-size: 0.88em;
}

.tmweb-index .lang-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 1em;
    margin: 0.4em 0 1.2em 0;
    font-size: 0.95em;
}

.tmweb-index details {
    margin: 0.5em 0;
}

.tmweb-index details > summary {
    cursor: pointer;
    font-weight: 600;
    color: #3b2a1e;
}

.tmweb-index ul.pages {
    margin: 0.4em 0 0.8em 1.2em;
    padding: 0;
    columns: 2;
    column-gap: 2em;
    font-size: 0.92em;
}

.tmweb-index ul.pages li {
    margin: 0.15em 0;
    break-inside: avoid;
}

.tmweb-footer {
    max-width: 64em;
    margin: 0 auto;
    padding: 1.2em 2.2em;
    color: #777777;
    font-size: 0.82em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* -------------------------------------------------------------------------
 * Narrow screens
 * ------------------------------------------------------------------------- */

@media (max-width: 720px) {
    body > .tmdoc-body {
        padding-left: 1em;
        padding-right: 1em;
        border-left: none;
        border-right: none;
    }

    .tmdoc-title-1,
    .tmdoc-copyright,
    .tmdoc-license {
        margin-left: -1em;
        margin-right: -1em;
    }

    body > .tmweb-nav {
        position: static;
        gap: 0.6em;
        font-size: 0.84em;
    }

    .tmweb-index {
        padding-left: 1em;
        padding-right: 1em;
        border-left: none;
        border-right: none;
    }

    .tmweb-index h1,
    .tmweb-index h2 {
        margin-left: -1em;
        margin-right: -1em;
        padding-left: 1em;
        padding-right: 1em;
    }

    .tmweb-index ul.pages {
        columns: 1;
    }
}

@media print {
    body > .tmweb-nav {
        display: none;
    }

    body > .tmdoc-body {
        max-width: none;
        border: none;
        padding: 0;
    }

    .tmdoc-title-1,
    .tmdoc-copyright,
    .tmdoc-license {
        margin-left: 0;
        margin-right: 0;
    }
}

/* The exporter wraps descriptions in <p> elements that contain only a spacer;
 * these show up as large empty paragraphs. */
.tmdoc-body p:has(> span[style*="margin-left"]:only-child) {
    display: none;
}
