/* Loaded only on configured multi-page articles; both pages must opt in. */
.notebook-site #body-wrapper > .container { padding-bottom: 0; }
/* Group the bottom chapter row and dates just above the footer rule. */
.notebook-site #body-wrapper { padding-bottom: 0; }
.notebook-site .notebook-chapters + .page_footer { margin-top: 1ch; }
.notebook-site .notebook-chapters + .page_footer p { margin-bottom: 0; }
.notebook-site .notebook-chapters {
    font-family: 'TT2026 Battered', 'TT2020 Base', 'Courier New', monospace;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: baseline;
    gap: 1ch 3ch;
    clear: both;
    margin-top: 4ch;
}
.notebook-site .notebook-chapters-top { margin: 0 0 3ch; }
.notebook-site .notebook-chapters p { grid-area: 1 / 2; margin: 0; text-align: center; min-width: 0; }
.notebook-chapter-links { display: contents; }
.notebook-chapter-links a { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.notebook-chapter-links a[rel="prev"] { grid-area: 1 / 1; justify-self: start; }
.notebook-chapter-links a[rel="next"] { grid-area: 1 / 3; justify-self: end; text-align: right; }
@media (max-width: 640px) {
    .notebook-site .notebook-chapters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .notebook-site .notebook-chapters p { grid-area: 1 / 1 / auto / -1; }
    .notebook-chapter-links a[rel="prev"] { grid-area: 2 / 1; }
    .notebook-chapter-links a[rel="next"] { grid-area: 2 / 2; }
}

/* Ordinary page links still work without animation support or JavaScript. */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }

    /* Leave the header and paper still; animate just the article column. */
    :root { view-transition-name: none; }
    #body-wrapper > .container { view-transition-name: article-chapter; }
    /* Crop the snapshots to the viewport while their opacity changes. */
    ::view-transition-group(article-chapter) {
        animation: none;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    ::view-transition-image-pair(article-chapter) { height: 100%; }
    ::view-transition-old(article-chapter),
    ::view-transition-new(article-chapter) {
        height: 100%;
        object-fit: cover;
        object-position: top;
        mix-blend-mode: plus-lighter;
    }
    ::view-transition-old(article-chapter) { animation: chapter-fade-out 220ms ease-in-out both; }
    ::view-transition-new(article-chapter) { animation: chapter-fade-in 220ms ease-in-out both; }
}
@keyframes chapter-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes chapter-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@media print { .notebook-chapters { display: none; } }
