/* ==========================================================================
   Reader: paginated, book-like template (custom-reader.hbs)

   Standalone stylesheet: main.css is not loaded on reader pages.
   Paging rules are scoped to html.js, so without JavaScript the page is a
   plain, comfortable scrolling article.
   ========================================================================== */

/* Tokens
   ========================================================================== */

html {
    --r-bg: #fbfaf6;
    --r-text: #26231f;
    --r-muted: #8b867d;
    --r-rule: #e3dfd6;
    --r-accent: #3d8a78;
    --r-panel: #ffffff;
    --r-tint: rgba(38, 35, 31, 0.06);
    --r-shadow: rgba(40, 30, 15, 0.18);

    --r-serif: 'Literata', Georgia, 'Iowan Old Style', serif;
    --r-display: 'Cormorant Garamond', Georgia, serif;
    --r-ui: 'Lato', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;

    --r-body: var(--r-serif);
    --r-scale: 1;
    --r-size: 19px;
    --r-leading: 1.62;
    --reader-page-h: 80vh;
}

html[data-reader-theme="sepia"] {
    --r-bg: #f4ecd9;
    --r-text: #4a3b29;
    --r-muted: #9b8868;
    --r-rule: #e1d4b9;
    --r-accent: #9a5b2e;
    --r-panel: #fbf5e6;
    --r-tint: rgba(74, 59, 41, 0.08);
}

html[data-reader-theme="night"] {
    --r-bg: #121316;
    --r-text: #c9c6be;
    --r-muted: #7b7972;
    --r-rule: #2b2d32;
    --r-accent: #8fc9ba;
    --r-panel: #1c1e22;
    --r-tint: rgba(255, 255, 255, 0.07);
    --r-shadow: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

/* Cormorant has a small x-height, so it is set larger to read at the same size */
html[data-reader-font="cormorant"] {
    --r-body: var(--r-display);
    --r-scale: 1.2;
}

html[data-reader-font="lato"] {
    --r-body: var(--r-ui);
    --r-scale: 0.97;
}

/* Base
   ========================================================================== */

.reader-body,
.reader-body *,
.reader-body *:before,
.reader-body *:after {
    box-sizing: border-box;
}

html {
    background: var(--r-bg);
    -webkit-text-size-adjust: 100%;
}

.reader-body {
    margin: 0;
    background: var(--r-bg);
    color: var(--r-text);
    font-family: var(--r-ui);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.js .reader-body {
    overflow: hidden;
    overscroll-behavior: none;
}

.reader {
    max-width: 40em;
    margin: 0 auto;
    padding: 0 22px 80px;
}

.js .reader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.reader button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.reader svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

.reader :focus {
    outline: none;
}

.reader :focus-visible {
    outline: 2px solid var(--r-accent);
    outline-offset: 2px;
}

/* Bars
   ========================================================================== */

.reader-bar--top {
    display: grid;
    grid-template-columns: 1fr minmax(0, auto) 1fr;
    align-items: center;
    height: 56px;
    padding: 0 14px;
}

.js .reader-bar {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 5;
}

.js .reader-bar--top {
    top: 0;
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
}

.reader-back {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    max-width: 100%;
    min-height: 40px;
    padding: 0 10px 0 4px;
    border-radius: 6px;
    color: var(--r-muted);
    font-size: 13px;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.reader-back span {
    margin-left: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-back:hover,
.reader-icon-btn:hover {
    color: var(--r-text);
    background: var(--r-tint);
}

.reader-running-head {
    padding: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--r-muted);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-align: center;
}

.reader-actions {
    display: flex;
    justify-self: end;
}

.reader .reader-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    color: var(--r-muted);
}

.reader-aa {
    font-family: var(--r-serif);
    font-size: 18px;
}

.reader-bar--bottom,
.no-js .reader-actions {
    display: none;
}

.js .reader-bar--bottom {
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 0 24px env(safe-area-inset-bottom);
}

.reader-page-label {
    color: var(--r-muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The progress track is always there as a hairline; the thumb only shows with the controls */
.reader-scrubber {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    max-width: 640px;
    height: 20px;
    margin: 2px 0 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    --p: 0%;
}

.reader-scrubber::-webkit-slider-runnable-track {
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--r-muted) var(--p), var(--r-rule) var(--p));
}

.reader-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--r-text);
    transform: scale(0);
    transition: transform 0.18s ease;
}

.reader-scrubber::-moz-range-track {
    height: 2px;
    border-radius: 2px;
    background: var(--r-rule);
}

.reader-scrubber::-moz-range-progress {
    height: 2px;
    border-radius: 2px;
    background: var(--r-muted);
}

.reader-scrubber::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 50%;
    background: var(--r-text);
    transform: scale(0);
    transition: transform 0.18s ease;
}

/* Controls fade out while reading. On touch, tap the middle of the page to bring them
   back; with a mouse, move to the top or bottom edge. */
.js .reader-ctl {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.js .reader-scrubber {
    pointer-events: none;
}

.js .reader.is-chrome .reader-ctl,
.js .reader-bar:focus-within .reader-ctl {
    opacity: 1;
    pointer-events: auto;
}

.js .reader.is-chrome .reader-scrubber {
    pointer-events: auto;
}

.reader.is-chrome .reader-scrubber::-webkit-slider-thumb,
.reader-scrubber:focus-visible::-webkit-slider-thumb {
    transform: scale(1);
}

.reader.is-chrome .reader-scrubber::-moz-range-thumb,
.reader-scrubber:focus-visible::-moz-range-thumb {
    transform: scale(1);
}

@media (hover: hover) {
    .js .reader-bar:hover .reader-ctl {
        opacity: 1;
        pointer-events: auto;
    }

    .js .reader-bar:hover .reader-scrubber {
        pointer-events: auto;
    }

    .reader-bar:hover .reader-scrubber::-webkit-slider-thumb {
        transform: scale(1);
    }

    .reader-bar:hover .reader-scrubber::-moz-range-thumb {
        transform: scale(1);
    }
}

/* Page turn buttons (mouse users on roomy screens; touch uses tap zones and swipes) */
.reader-turn {
    display: none;
}

.js .reader .reader-turn {
    position: absolute;
    top: 56px;
    bottom: 56px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    color: var(--r-muted);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.reader-turn--prev {
    left: 0;
}

.reader-turn--next {
    right: 0;
}

.reader .reader-turn svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.2;
}

.js .reader .reader-turn:focus-visible {
    opacity: 1;
}

@media (hover: hover) and (min-width: 800px) {
    .js .reader .reader-turn {
        opacity: 0.4;
        pointer-events: auto;
    }

    .js .reader .reader-turn:hover {
        opacity: 1;
        color: var(--r-text);
    }

    .js .reader .reader-turn:disabled {
        opacity: 0.1;
        cursor: default;
    }
}

/* The page
   ========================================================================== */

.js .reader-viewport {
    position: absolute;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.js .reader:not(.is-ready) .reader-viewport {
    visibility: hidden;
}

.js .reader-flow {
    height: 100%;
    column-count: 1;
    column-fill: auto;
}

.reader-flow {
    font-family: var(--r-body);
    font-size: calc(var(--r-size) * var(--r-scale));
    line-height: var(--r-leading);
    color: var(--r-text);
    orphans: 2;
    widows: 2;
    overflow-wrap: break-word;
    font-kerning: normal;
}

.reader-flow ::selection {
    background: var(--r-accent);
    color: var(--r-bg);
}

/* Cover */
.reader-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12vh 0;
    text-align: center;
}

.js .reader-cover {
    min-height: calc(var(--reader-page-h) - 1px);
    padding: 0;
    break-after: column;
    break-inside: avoid;
}

.reader-cover__image {
    display: block;
    max-width: 78%;
    max-height: calc(var(--reader-page-h) * 0.4);
    margin-bottom: 2em;
    border-radius: 2px;
    box-shadow: 0 10px 30px -12px var(--r-shadow);
}

.reader-cover__kicker {
    margin-bottom: 1.4em;
    color: var(--r-muted);
    font-family: var(--r-ui);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.reader-cover__title {
    margin: 0;
    font-family: var(--r-display);
    font-size: calc(var(--r-size) * 2.9);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -0.005em;
    text-wrap: balance;
}

.reader-cover__excerpt {
    max-width: 26em;
    margin: 1.1em 0 0;
    color: var(--r-muted);
    font-family: var(--r-display);
    font-size: calc(var(--r-size) * 1.25);
    font-style: italic;
    line-height: 1.4;
    text-wrap: balance;
}

.reader-cover__rule {
    width: 44px;
    height: 1px;
    margin: 2.2em 0 1.6em;
    background: var(--r-muted);
    opacity: 0.6;
}

.reader-cover__author {
    font-family: var(--r-ui);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.reader-cover__meta {
    margin-top: 0.9em;
    color: var(--r-muted);
    font-family: var(--r-ui);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.reader-cover__meta span {
    padding: 0 0.4em;
}

/* Text */
.reader-content p {
    margin: 0;
    text-indent: 1.5em;
}

/* Book style: no gaps between paragraphs, indent every paragraph except the first of a run */
.reader-content > p:first-child,
.reader-content :not(p) + p,
.reader-content blockquote p,
.reader-content li p,
.reader-content td p {
    text-indent: 0;
}

html[data-reader-align="justify"] .reader-content p {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

.reader-content a {
    color: var(--r-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.reader-content h1,
.reader-content h2,
.reader-content h3,
.reader-content h4,
.reader-content h5,
.reader-content h6 {
    margin: 1.7em 0 0.6em;
    font-family: var(--r-display);
    font-weight: 500;
    line-height: 1.18;
    break-after: avoid;
    break-inside: avoid;
    text-wrap: balance;
}

.reader-content h1 { font-size: calc(var(--r-size) * 2.1); }
.reader-content h2 { font-size: calc(var(--r-size) * 1.7); }
.reader-content h3 { font-size: calc(var(--r-size) * 1.35); }

.reader-content h4,
.reader-content h5,
.reader-content h6 {
    font-size: calc(var(--r-size) * 1.15);
    font-style: italic;
}

.reader-content > :first-child {
    margin-top: 0;
}

/* Chapter openings: the script marks the top heading level and each one starts a new page */
.js .reader-content .reader-chapter {
    margin: calc(var(--reader-page-h) * 0.14) 0 1.5em;
    font-size: calc(var(--r-size) * 2.2);
    font-weight: 400;
    text-align: center;
    break-before: column;
}

/* The cover already ends its page. A second forced break right after it makes
   Safari insert an empty page, so the opening chapter does not ask for one. */
.js .reader-content > .reader-chapter:first-child {
    break-before: auto;
}

.reader-content blockquote {
    margin: 1.2em 0;
    padding: 0 0 0 1.2em;
    border-left: 2px solid var(--r-rule);
    font-style: italic;
}

.reader-content ul,
.reader-content ol {
    margin: 1em 0;
    padding: 0 0 0 1.7em;
}

.reader-content li {
    margin: 0.3em 0;
}

.reader-content hr {
    height: auto;
    margin: 1.5em 0;
    border: 0;
    color: var(--r-muted);
    text-align: center;
    line-height: 1;
}

.reader-content hr:after {
    content: "\2217\2003\2217\2003\2217";
    font-size: 0.9em;
}

.reader-content mark {
    padding: 0 0.15em;
    background: var(--r-tint);
    color: inherit;
    box-shadow: inset 0 -0.5em 0 rgba(255, 214, 92, 0.45);
}

.reader-content sup,
.reader-content sub {
    line-height: 0;
}

.reader-content figure {
    margin: 1.5em 0;
    text-align: center;
    break-inside: avoid;
}

.reader-content img,
.reader-content video {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.js .reader-content img,
.js .reader-content video {
    max-height: calc(var(--reader-page-h) - 4.5em);
}

.reader-content figcaption {
    margin-top: 0.7em;
    color: var(--r-muted);
    font-family: var(--r-ui);
    font-size: 0.7em;
    line-height: 1.45;
}

.reader-content iframe {
    max-width: 100%;
}

.reader-content iframe[src*="youtube"],
.reader-content iframe[src*="vimeo"] {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
}

.reader-content pre,
.reader-content code {
    font-family: Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}

.reader-content pre {
    margin: 1.3em 0;
    padding: 0.9em 1.1em;
    border-radius: 4px;
    background: var(--r-tint);
    font-size: 0.74em;
    line-height: 1.55;
    white-space: pre-wrap;
    text-align: left;
}

.reader-content :not(pre) > code {
    padding: 0.1em 0.35em;
    border-radius: 3px;
    background: var(--r-tint);
    font-size: 0.82em;
}

.reader-content table {
    display: block;
    max-width: 100%;
    margin: 1.4em 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-family: var(--r-ui);
    font-size: 0.8em;
    line-height: 1.4;
}

.reader-content th,
.reader-content td {
    padding: 0.5em 0.9em 0.5em 0;
    border-bottom: 1px solid var(--r-rule);
    text-align: left;
    vertical-align: top;
}

.reader-content th {
    font-weight: 700;
}

/* Ghost cards */
.reader-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
}

.reader-content .kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.reader-content .kg-gallery-row:not(:first-of-type) {
    margin-top: 0.5em;
}

.reader-content .kg-gallery-image:not(:first-of-type) {
    margin-left: 0.5em;
}

.reader-content .kg-gallery-image img {
    width: 100%;
    height: 100%;
    max-height: none;
}

.reader-content .kg-bookmark-container {
    display: flex;
    overflow: hidden;
    border: 1px solid var(--r-rule);
    border-radius: 6px;
    color: inherit;
    font-family: var(--r-ui);
    font-size: 0.74em;
    line-height: 1.45;
    text-align: left;
    text-decoration: none;
}

.reader-content .kg-bookmark-content {
    flex: 1 1 0;
    min-width: 0;
    padding: 1em 1.2em;
}

.reader-content .kg-bookmark-title {
    font-weight: 700;
}

.reader-content .kg-bookmark-description,
.reader-content .kg-bookmark-metadata {
    margin-top: 0.5em;
    color: var(--r-muted);
}

.reader-content .kg-bookmark-metadata {
    display: flex;
    align-items: center;
}

.reader-content .kg-bookmark-icon {
    width: 18px;
    height: 18px;
    margin: 0 0.5em 0 0;
}

.reader-content .kg-bookmark-author:after {
    content: "\2022";
    margin: 0 0.4em;
}

.reader-content .kg-bookmark-thumbnail {
    flex: 0 0 30%;
}

.reader-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    max-height: 9em;
    object-fit: cover;
}

/* End matter */
.reader-end {
    margin-top: 3em;
    text-align: center;
    break-inside: avoid;
}

.reader-end__mark {
    width: 44px;
    height: 1px;
    margin: 0 auto;
    background: var(--r-muted);
    opacity: 0.6;
}

.reader-end__links {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2.4em;
    font-family: var(--r-display);
    font-size: calc(var(--r-size) * 1.2);
    line-height: 1.25;
}

.reader-end__links a {
    display: block;
    max-width: 22em;
    margin-top: 1.1em;
    color: var(--r-text);
    text-decoration: none;
}

.reader-end__links a:hover {
    color: var(--r-accent);
}

.reader-end__links small {
    display: block;
    margin-bottom: 0.35em;
    color: var(--r-muted);
    font-family: var(--r-ui);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* Panels
   ========================================================================== */

.reader-scrim,
.reader-panel,
.reader-toast {
    display: none;
}

.js .reader-scrim {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 8;
    display: block;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s;
}

.js .reader-scrim.is-open {
    opacity: 1;
    visibility: visible;
}

.js .reader-panel {
    position: absolute;
    z-index: 9;
    display: block;
    background: var(--r-panel);
    color: var(--r-text);
    font-family: var(--r-ui);
    box-shadow: 0 12px 40px -8px var(--r-shadow);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.js .reader-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.reader-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 24px;
    color: var(--r-muted);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* Contents */
.js .reader-toc {
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: 88vw;
    padding-top: env(safe-area-inset-top);
    transform: translateX(-24px);
}

.reader-toc__book {
    padding: 6px 24px 18px;
    border-bottom: 1px solid var(--r-rule);
    font-family: var(--r-display);
    font-size: 26px;
    line-height: 1.15;
}

.reader-toc__list {
    flex: 1 1 auto;
    padding: 10px 0 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.reader-toc__list a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 9px 24px 9px 21px;
    border-left: 3px solid transparent;
    color: var(--r-text);
    font-size: 15px;
    line-height: 1.35;
    text-decoration: none;
}

.reader-toc__list a:hover {
    background: var(--r-tint);
}

.reader-toc__list a[data-level="1"] {
    padding-left: 39px;
    font-size: 14px;
}

.reader-toc__list a[data-level="2"] {
    padding-left: 57px;
    color: var(--r-muted);
    font-size: 13px;
}

.reader-toc__list a.is-current {
    border-left-color: var(--r-accent);
    font-weight: 700;
}

.reader-toc__page {
    flex: none;
    margin-left: 16px;
    color: var(--r-muted);
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.reader-toc__empty {
    padding: 14px 24px;
    color: var(--r-muted);
    font-size: 14px;
    line-height: 1.5;
}

/* Text settings */
.js .reader-settings {
    top: calc(58px + env(safe-area-inset-top));
    right: 14px;
    width: 328px;
    max-width: calc(100vw - 28px);
    padding: 6px 18px 18px;
    border-radius: 10px;
    transform: translateY(-8px);
}

.reader-setting__label {
    margin: 14px 0 7px;
    color: var(--r-muted);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.reader-seg {
    display: flex;
    border: 1px solid var(--r-rule);
    border-radius: 7px;
    overflow: hidden;
}

.reader .reader-seg button,
.reader-seg output {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 40px;
    font-size: 14px;
    white-space: nowrap;
}

.reader .reader-seg button + button,
.reader .reader-seg output + button,
.reader-seg output {
    border-left: 1px solid var(--r-rule);
}

.reader .reader-seg button:hover {
    background: var(--r-tint);
}

.reader .reader-seg button[aria-pressed="true"] {
    background: var(--r-text);
    color: var(--r-panel);
}

.reader .reader-seg button:disabled {
    opacity: 0.3;
    cursor: default;
}

.reader .reader-seg button:focus-visible {
    outline-offset: -3px;
}

.reader-seg output {
    color: var(--r-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.reader-seg--themes {
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.reader .reader-seg--themes .reader-swatch {
    border: 1px solid var(--r-rule);
    border-radius: 7px;
}

.reader .reader-seg--themes .reader-swatch + .reader-swatch {
    margin-left: 8px;
    border-left: 1px solid var(--r-rule);
}

.reader .reader-swatch--paper,
.reader .reader-swatch--paper:hover,
.reader .reader-swatch--paper[aria-pressed="true"] {
    background: #fbfaf6;
    color: #26231f;
}

.reader .reader-swatch--sepia,
.reader .reader-swatch--sepia:hover,
.reader .reader-swatch--sepia[aria-pressed="true"] {
    background: #f4ecd9;
    color: #4a3b29;
}

.reader .reader-swatch--night,
.reader .reader-swatch--night:hover,
.reader .reader-swatch--night[aria-pressed="true"] {
    background: #121316;
    color: #c9c6be;
}

.reader .reader-seg--themes .reader-swatch[aria-pressed="true"] {
    border-color: var(--r-accent);
    box-shadow: 0 0 0 1px var(--r-accent);
}

/* Toast */
.js .reader-toast {
    position: absolute;
    left: 50%;
    bottom: calc(68px + env(safe-area-inset-bottom));
    z-index: 7;
    display: flex;
    align-items: center;
    max-width: calc(100vw - 28px);
    padding: 4px 6px 4px 16px;
    border-radius: 999px;
    background: var(--r-text);
    color: var(--r-bg);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.js .reader-toast.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.reader .reader-toast button {
    min-height: 32px;
    margin-left: 8px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Small screens
   ========================================================================== */

@media (max-width: 639px) {
    .js .reader-bar--top {
        height: calc(48px + env(safe-area-inset-top));
        padding-left: 6px;
        padding-right: 6px;
    }

    .js .reader-bar--bottom {
        height: calc(48px + env(safe-area-inset-bottom));
    }

    .reader-back span {
        display: none;
    }

    .reader-running-head {
        font-size: 10px;
    }

    .reader-cover__title {
        font-size: calc(var(--r-size) * 2.3);
    }

    /* Text settings become a bottom sheet */
    .js .reader-settings {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: none;
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
        border-radius: 14px 14px 0 0;
        transform: translateY(16px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .reader *,
    .reader *:before,
    .reader *:after {
        transition: none !important;
    }
}

/* Print: undo paging and print the whole text
   ========================================================================== */

@media print {
    .js .reader-body {
        overflow: visible;
    }

    .js .reader,
    .js .reader-viewport {
        position: static !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        visibility: visible !important;
    }

    .js .reader-flow {
        height: auto !important;
        column-count: 1 !important;
        transform: none !important;
    }

    .reader-bar,
    .reader-turn,
    .reader-scrim,
    .reader-panel,
    .reader-toast,
    .reader-end__links {
        display: none !important;
    }

    .js .reader-cover {
        min-height: 0;
        padding: 20vh 0;
        break-after: page;
    }

    .js .reader-content .reader-chapter {
        margin-top: 15vh;
        break-before: page;
    }
}
