/*
Styles for the single-page edition of the book (`_out/html-single`).

The page is meant to be read top to bottom, so the site chrome (header, sidebar table of contents,
search) is hidden; the table of contents at the top of the page and the cross-references within
the text are the navigation. Text uses the system fonts (SF Pro and SF Mono on macOS).
*/

:root {
    --verso-structure-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    --verso-text-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    --verso-code-font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
    --verso-font-size: 18px;
    --verso-mobile-font-size: 17px;
    --verso-content-max-width: 40rem;
    --verso-header-height: 0px;
    --verso-text-color: #1d1d1f;
    --single-muted-color: #6e6e73;
    --single-rule-color: #e5e5ea;
    --single-code-background: #f5f5f7;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--verso-text-font-family);
    color: var(--verso-text-color);
    background: #fff;
    line-height: 1.6;
}

/******** Chrome ********/

body > header,
#toggle-toc-click,
#toc,
.toc-backdrop,
.toc-resize-handle,
#search-wrapper,
.search-box {
    display: none !important;
}

.with-toc > main {
    margin-left: 0 !important;
    margin-top: 0 !important;
}

.content-wrapper {
    max-width: var(--verso-content-max-width);
    margin: 0 auto !important;
    padding: 4rem 1.5rem 8rem;
}

main section {
    max-width: none;
}

@media screen and (max-width: 700px) {
    .content-wrapper {
        padding: 2rem 1rem 6rem;
    }
}

/******** Tables ********/

/* A table wider than the page scrolls on its own rather than widening the page */
main table.tabular {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

main table.tabular th, main table.tabular td {
    padding: 0.35rem 0.9rem 0.35rem 0;
    border-bottom: 1px solid var(--single-rule-color);
    text-align: left;
    vertical-align: top;
}

main table.tabular th {
    font-weight: 600;
}

main table.tabular p {
    margin: 0;
}

/******** Text ********/

main p, main li {
    font-family: var(--verso-text-font-family);
    hyphens: auto;
    -webkit-hyphens: auto;
}

p {
    font-feature-settings: normal;
}

main h1, main h2, main h3, main h4, main h5, main h6 {
    font-family: var(--verso-structure-font-family);
    color: var(--verso-text-color);
    letter-spacing: -0.015em;
    line-height: 1.2;
    scroll-margin-top: 1.5rem;
}

main h1 {
    font-size: 2.6rem;
    font-weight: 700;
}

main h2 {
    font-size: 2rem;
    font-weight: 700;
}

/* Each chapter starts with a clear break */
main > .content-wrapper > section > section > h2 {
    margin-top: 4rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--single-rule-color);
}

main h3 {
    font-size: 1.45rem;
    font-weight: 600;
    margin-top: 3rem;
}

main h4, main h5, main h6 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 2rem;
}

/* Section numbers are quieter than the titles they number */
main .section-number {
    color: var(--single-muted-color);
    font-weight: 500;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/******** Code ********/

code, pre, .hl.lean {
    font-family: var(--verso-code-font-family);
}

/* Verso's `.hl.lean { font-size: inherit }` would otherwise keep Lean code at the size of the text */
main code, main code.hl.lean.inline {
    font-size: 0.86em;
}

main pre code, main pre code.hl.lean {
    font-size: inherit;
}

main pre, main pre.hl.lean, main code.hl.lean.block {
    font-size: 0.82rem;
    line-height: 1.5;
}

main code:not(pre code):not(.hl.lean.block) {
    background: var(--single-code-background);
    border-radius: 4px;
    padding: 0.1em 0.3em;
}

main pre, main code.hl.lean.block {
    background: var(--single-code-background);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    overflow-x: auto;
}

main code.hl.lean.block {
    margin-left: 0;
    margin-right: 0;
}

/* A chain of evaluation steps reads as one block, with the arrows between its steps */
main .eval-steps {
    background: var(--single-code-background);
    border-radius: 8px;
    padding: 0.9rem 1rem;
}

main .eval-steps code.hl.lean.block {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* Error, warning, and information messages keep their colored rule from theme.css */
main .error pre, main .warning pre, main .information pre,
main pre.lean-output {
    border-radius: 0 8px 8px 0;
}

.permalink-widget {
    display: none !important;
}

/******** Table of contents at the top (built by single.js) ********/

main ol.single-toc, main ol.single-toc ol {
    list-style: none;
    padding-left: 0;
}

main ol.single-toc > li {
    margin: 1.1rem 0 0;
    font-weight: 600;
}

main ol.single-toc ol {
    margin: 0.35rem 0 0 1.75rem;
}

main ol.single-toc ol > li {
    font-weight: 400;
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0.2rem 0;
}

main .single-toc a {
    color: var(--verso-text-color);
}

main .single-toc a:hover {
    color: #0066cc;
    text-decoration: none;
}

main .single-toc .section-number {
    display: inline-block;
    min-width: 1.75rem;
}

main .single-toc ol .section-number {
    min-width: 2.5rem;
}

/******** Back to the contents ********/

.single-to-contents {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--single-rule-color);
    color: var(--single-muted-color);
    font-family: var(--verso-structure-font-family);
    font-size: 1.1rem;
    text-decoration: none !important;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.single-to-contents:hover {
    opacity: 1;
    color: var(--verso-text-color);
}

@media print {
    .single-to-contents {
        display: none;
    }
}
