/* Gengoscript docs — a small, print-first technical book. */

:root {
    color-scheme: light dark;
    --base-font-size: 1.10rem;
    --paper: #fff;
    --ink: #111;
    --muted-ink: #555;
    --faint-ink: #777;
    --rule: #222;
    --subtle-rule: #c8c8c8;
    --code-paper: #f7f7f5;
    --link: #0056b3;
    --visited-link: #5b3f70;
    --focus: #005fcc;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #1b1a18;
        --ink: #ece8df;
        --muted-ink: #c4beb2;
        --faint-ink: #aaa397;
        --rule: #d4cec2;
        --subtle-rule: #5d5952;
        --code-paper: #25231f;
        --link: #9dc4e8;
        --visited-link: #d1b5df;
        --focus: #9dc4e8;
    }
}

body {
    font-family: Georgia, "Times New Roman", serif;
    max-width: 46em;
    margin: 0 auto;
    padding: 2.25rem 1.4rem 3rem;
    color: var(--ink);
    background: var(--paper);
    font-size: var(--base-font-size);
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

.site-footer {
    border-top: 0.08rem solid var(--rule);
    margin-top: 3.25rem;
}

.site-nav, .breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.88em;
    letter-spacing: 0.01em;
}

.doc-version {
    float: right;
    color: var(--muted-ink);
}

.breadcrumbs { color: var(--muted-ink); }

a { color: var(--link); text-decoration-thickness: 0.06em; text-underline-offset: 0.13em; }
a:visited { color: var(--visited-link); }
a:hover { text-decoration-thickness: 0.12em; }

.page-toc {
    border-top: 0.08rem solid var(--rule);
    border-bottom: 0.08rem solid var(--rule);
    padding: 0.55em 0;
    margin: 1.8rem 0;
    font-size: 0.92em;
}

.page-toc ul { margin: 0.35em 0 0 1.2em; padding: 0; }

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 1em;
    top: 1em;
    background: var(--paper);
    border: 2px solid var(--ink);
    padding: 0.5em;
    z-index: 1;
}

a:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    line-height: 1.18;
    font-weight: 600;
    page-break-after: avoid;
}

h1 { font-size: 2.05em; margin: 1.45rem 0 1.15rem; }
h2 { font-size: 1.48em; margin: 2.35rem 0 0.8rem; }
h3 { font-size: 1.18em; margin: 1.8rem 0 0.55rem; }
h4 { font-size: 1em; margin: 1.4rem 0 0.35rem; }
h5, h6 { font-size: 0.95em; margin: 1.2rem 0 0.3rem; }

p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.55em; margin: 0.65rem 0 1rem; }
li + li { margin-top: 0.2rem; }

code, pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.88em;
}

p code, li code, td code { font-size: 0.9em; }

pre {
    background: var(--code-paper);
    border-top: 0.08rem solid var(--muted-ink);
    border-bottom: 0.08rem solid var(--muted-ink);
    padding: 0.85em 1em;
    line-height: 1.38;
    overflow-x: auto;
}

/* Gengoscript code is designed to remain legible when printed in grayscale. */
code.language-gengo .tok-keyword { font-weight: bold; }
code.language-gengo .tok-string { font-style: normal; }
code.language-gengo .tok-comment { color: var(--muted-ink); font-style: italic; }

table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.45rem 0;
    font-size: 0.93em;
    line-height: 1.38;
}

th, td {
    border: 0;
    padding: 0.45em 0.7em;
    text-align: left;
    vertical-align: top;
}

th { border-bottom: 0.2rem double var(--rule); font-weight: 600; background: transparent; }
tbody tr + tr td { border-top: 0.04rem solid var(--subtle-rule); }

blockquote {
    border-left: 3px solid var(--muted-ink);
    margin: 1em 0;
    padding-left: 1em;
    color: var(--muted-ink);
}

hr { border: none; border-top: 0.08rem solid var(--muted-ink); margin: 2.5rem 0; }

img { max-width: 100%; }

footer.pagenav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1em;
    margin: 1em 0 2em;
}

footer.pagenav .prev { text-align: left; }
footer.pagenav .up { text-align: center; }
footer.pagenav .next { text-align: right; }

p.colophon {
    margin: 1em 0 0;
    font-size: 0.85em;
    color: var(--faint-ink);
    text-align: center;
}

p.doc-status {
    margin: 0.35em 0 1.5em;
    font-size: 0.78em;
    color: var(--faint-ink);
    text-align: center;
}

@media (max-width: 42rem) {
    :root { --base-font-size: 1rem; }
    body { padding: 1.25rem 1rem 2rem; }
    h1 { font-size: 1.8em; }
    table { display: block; overflow-x: auto; }
}

@media print {
    :root {
        --paper: #fff;
        --ink: #000;
        --muted-ink: #333;
        --faint-ink: #555;
        --rule: #000;
        --subtle-rule: #999;
        --code-paper: #fff;
    }
    body { max-width: none; padding: 0; font-size: 10.5pt; line-height: 1.35; }
    .site-nav, .breadcrumbs, .skip-link, footer.pagenav { display: none; }
    a { color: inherit; text-decoration: none; }
    pre { white-space: pre-wrap; }
    .page-toc { break-inside: avoid; }
    table, pre, blockquote { break-inside: avoid; }
}
