/* Native document pages: prose reflows; book spreads retain their composition. */
body.document-page-site {
    display: block;
    padding-left: 4vw;
    padding-right: 4vw;
    padding-bottom: 6rem;
}

.document-reader {
    min-width: 0;
    width: 100%;
    max-width: 96rem;
    margin: 0 auto;
}

.document-reader--text { max-width: 62rem; }
body.hero-page > .document-reader { margin-top: 5vh; width: 92%; }

.document-reader-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: .8rem;
}

.document-reader-heading h2 { margin: 0; font: inherit; }
.document-original { text-decoration: underline; text-underline-offset: .2em; }

.document-page {
    min-width: 0;
    margin: 0 0 1.75rem;
    border: 1px solid rgba(33, 33, 47, .34);
    background: white;
}

.document-page--text {
    padding: clamp(1rem, 4vw, 3.5rem);
    color: rgb(33, 33, 47);
    font-family: "Source Code Pro", monospace;
    font-size: 1rem;
    font-weight: 333;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.document-page .document-paragraph {
    margin: 0 0 1em;
    white-space: pre-wrap;
}
.document-page .document-paragraph:last-child { margin-bottom: 0; }
.document-page strong { font-weight: 700; }
.document-page u { text-underline-offset: .15em; }
.document-page sup { font-size: .7em; line-height: 0; }
.document-page .document-subheading { font-size: 1.15em; }
.document-page .document-small-text { font-size: .92em; }

.document-header {
    margin-bottom: 2rem;
    font-family: "Abel", sans-serif;
    font-size: .85rem;
    text-align: right;
    line-height: 1.4;
}
.document-header .document-paragraph { margin-bottom: .25em; }
.document-footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(33, 33, 47, .34);
    font-size: .85rem;
}
.document-footnotes [id] { scroll-margin-top: 1rem; }
.document-note-ref { text-decoration: underline; text-underline-offset: .15em; }
.document-footer { margin-top: 2rem; font-size: .8rem; }

.document-page--image { padding: 0; }
.document-page--image a { display: block; }
.document-page--image img { display: block; width: 100%; height: auto; }
.document-page-number {
    padding: .4rem .65rem;
    font-size: .7rem;
    text-align: right;
    color: rgb(80, 80, 90);
}

.document-layout--paired {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(1rem, 2vw, 2rem);
    width: 100%;
    max-width: 110rem;
    margin: 0 auto;
}

.document-layout--paired .document-reader {
    max-height: calc(100vh - var(--page-content-top, 10rem) - 4rem);
    max-height: max(14rem, calc(100svh - var(--page-content-top, 10rem) - 4rem));
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding-right: .5rem;
    scroll-padding-top: 1rem;
}

.document-layout--paired .document-page--text { padding: clamp(1rem, 2vw, 2rem); }
.document-reader:focus-visible { outline: 1px dotted currentColor; outline-offset: 4px; }
.document-page a:focus-visible { outline: 2px dotted currentColor; outline-offset: -3px; }

@media (max-width: 700px), (hover: none) and (pointer: coarse) {
    /* Mobile readers share the page's single vertical scroll surface. */
    .document-layout--paired {
        grid-template-columns: minmax(0, 1fr);
    }
    .document-layout--paired .document-reader {
        max-height: none;
        overflow: visible;
        scrollbar-gutter: auto;
        padding-right: 0;
    }
    .document-page--text { font-size: .95rem; }
}
