/* infiniteread, version 2: one page per screen. Each page fills the screen
   and scrolls on its own; past its end the next page snaps up. Set in
   suryad's essay register (src/styles/new.css .essay): warm paper, the
   reading serif, a large title under its facts in italic, 19px text, inks
   as shares of the text colour, one hairline at 7%. Each article keeps the
   shape its site gave it (headings, pictures, quotes, lists, code, tables,
   math), set in the reader's type.

   Every colour is a token here: paper first, then suryad's night for a
   system set to dark. */

:root {
  --bg: #fafaf9;
  --text: rgb(22, 23, 26);
  --desc: color-mix(in srgb, var(--text) 55%, transparent);   /* a fact, a description */
  --rest: color-mix(in srgb, var(--text) 30%, transparent);   /* a label, an idle control */
  --hairline: color-mix(in srgb, var(--text) 7%, transparent);
  --well: color-mix(in srgb, var(--text) 4%, transparent);    /* under code, and a picture still on its way */
  --plate: transparent;             /* under a drawing: the paper by day, a sheet of it at night */
  --mark: rgba(255, 204, 0, 0.3);   /* a passage readers marked: Matter's highlighter yellow */
  --tab: #f2c200;                   /* its tab on the right edge */
  --between: #000;                  /* between two sheets in 7, reels: Reels' black */
  --desk: #efebe3;                  /* under the cards, a shade under the paper */
  --leaf: #fffefb;                  /* a card */
  --tint-1: #d6dec8;                /* a passage's card: sage, */
  --tint-2: #d7dbea;                /* blue-grey, */
  --tint-3: #e8d8cc;                /* clay, */
  --tint-4: #f1e6c2;                /* butter */
  --leaf-shade: 0 1px 1px rgb(60 45 25 / 0.07), 0 6px 16px -8px rgb(60 45 25 / 0.28);
  --leaf-lift: 0 2px 3px rgb(60 45 25 / 0.08), 0 18px 34px -14px rgb(60 45 25 / 0.36);

  --face: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --size-title: 2.25rem;
  --size-fact: 1.05rem;
  --size-text: 1.1875rem;
  --size-meta: 0.84rem;
  --leading: 1.6;
  --measure: 34rem;
  --edge: 20px;
  --top: 22vh;     /* where a page's head stands */
  --peek: 104px;   /* how much of the page below shows: its facts and its title's first line */
  --head: 22px;    /* where its facts stand in the peek */

  --data: 240ms;
  --press: 120ms;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1818;
    --text: #a2a2a2;
    --desc: color-mix(in srgb, var(--text) 75%, transparent);
    --rest: color-mix(in srgb, var(--text) 45%, transparent);
    --hairline: color-mix(in srgb, var(--text) 10%, transparent);
    --well: color-mix(in srgb, var(--text) 7%, transparent);
    --plate: #e8e6e3;
    --mark: rgba(255, 204, 0, 0.2);
    --tab: #c9a000;
    --desk: #121111;
    --leaf: #232120;
    --tint-1: #283025;
    --tint-2: #262a35;
    --tint-3: #332a25;
    --tint-4: #34301f;
    --leaf-shade: 0 1px 1px rgb(0 0 0 / 0.4), 0 8px 18px -8px rgb(0 0 0 / 0.7);
    --leaf-lift: 0 2px 3px rgb(0 0 0 / 0.45), 0 20px 36px -14px rgb(0 0 0 / 0.8);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior-x: none; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:is(a, button):focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--mark); }

/* ── The two labels over every page: the name, and what is left of the page
   in minutes. The words fade into the paper before they reach them. ── */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) var(--edge) 28px;
  font: var(--size-meta)/1.4 var(--ui); color: var(--rest); font-variant-numeric: tabular-nums;
  background: linear-gradient(to bottom, var(--bg) 0, var(--bg) 40%, color-mix(in srgb, var(--bg) 0%, transparent));
  pointer-events: none;
}
.top a { pointer-events: auto; }
.top a:hover { color: var(--desc); }
#back { margin-right: 0.9em; }
html:not(.reading) #back { display: none; }

/* ── The stream (app.js, "the stream"): The list in one column on the paper,
   scrolling as the browser scrolls. a, passages: a page's most-marked
   passage, large, in its yellow, over the page's title and facts. b, pages:
   a page's head and its gist's passages, as a folded page shows them, a
   hairline between two pages. While a page is read the stream waits,
   hidden, where it was. ── */
.stream { position: fixed; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); scrollbar-width: none; }
.stream::-webkit-scrollbar { display: none; }
html.reading .stream { visibility: hidden; }
html:not(.reading) :is(.stack, .tabs) { display: none; }
.stream-in { width: min(var(--measure), 100% - 2 * var(--edge)); margin: 0 auto; padding: var(--top) 0 0; }
.st { display: block; margin: 0 0 6rem; -webkit-tap-highlight-color: transparent; }
.st p, .st h2 { margin: 0; }
.st-facts { font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); font-variant-numeric: oldstyle-nums; }
.st .m { background: var(--mark); border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color var(--press) ease-out; }
:is(.st-a, .st-mark):active .m { background: color-mix(in srgb, var(--tab) 45%, transparent); }
@media (hover: hover) and (pointer: fine) {
  :is(.st-a, .st-mark):hover .m { background: color-mix(in srgb, var(--tab) 45%, transparent); }
  .st-a:hover .st-t, .st-head:hover .st-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
}
/* a, cards: a page as a little pile of loose leaves on a desk a shade under
   the paper, each a little turned and a little over the one above. A card
   under a pointer straightens and comes up a little; a press presses it. */
html[data-look="cards"] .stream { background: var(--desk); }
html[data-look="cards"]:not(.reading) .top { background: linear-gradient(to bottom, var(--desk) 0, var(--desk) 40%, color-mix(in srgb, var(--desk) 0%, transparent)); }
.pile { margin: 0 0 3.25rem; }
.leaf {
  position: relative; z-index: 1; display: block; width: 92%; margin-left: var(--m, 4%); padding: 22px 24px 28px; border-radius: 3px;
  background: var(--leaf); box-shadow: var(--leaf-shade); transform: rotate(var(--r, 0deg));
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}
.leaf + .leaf { margin-top: -10px; }
.leaf:active { transform: rotate(var(--r, 0deg)) scale(0.985); transition-duration: 90ms; }
@media (hover: hover) and (pointer: fine) {
  .leaf:hover { z-index: 2; transform: rotate(calc(var(--r, 0deg) * 0.3)) translateY(-3px); box-shadow: var(--leaf-lift); }
}
.leaf p, .leaf h3 { margin: 0; }
.leaf-facts { font: italic 0.95rem/1.4 var(--face); color: var(--desc); font-variant-numeric: oldstyle-nums; }
.leaf .leaf-t { margin-top: 0.4rem; font: 600 1.65rem/1.15 var(--face); letter-spacing: -0.012em; text-wrap: balance; }
.leaf .leaf-dek { margin-top: 0.6rem; font: 400 1.12rem/1.4 var(--face); color: var(--desc); text-wrap: pretty; }
.leaf-quote { padding: 24px 24px 28px; background: var(--tint); }
.leaf-q { font: 400 1.4rem/1.36 var(--face); text-wrap: pretty; hanging-punctuation: first; }
.leaf .leaf-by { margin-top: 0.9rem; font: italic 0.95rem/1.4 var(--face); color: var(--desc); }
.leaf-o { font: 400 1.02rem/1.6 var(--face); hyphens: auto; font-variant-numeric: oldstyle-nums; }
.leaf-o::first-line { font-variant-caps: all-small-caps; letter-spacing: 0.04em; }
.leaf-pic { padding: 10px 10px 14px; }
.leaf-pic img { display: block; width: 100%; height: auto; background: var(--well); }
.leaf .leaf-cap { margin: 0.6rem 4px 0; font: italic 0.92rem/1.35 var(--face); color: var(--desc); }
/* b, passages */
.st-pic { display: block; width: 100%; height: auto; margin: 0 0 1.6rem; border-radius: 2px; background: var(--well); }
.st-q { font: 400 1.6rem/1.5 var(--face); text-wrap: pretty; hanging-punctuation: first; }
.st .st-t { margin-top: 1.2rem; font: 600 var(--size-fact)/1.35 var(--face); text-wrap: balance; }
.st-a .st-facts { margin-top: 0.15rem; }
/* c, pages */
.st-b + .st-b { padding-top: 4.5rem; border-top: 1px solid var(--hairline); }
.st-b { margin-bottom: 4.5rem; }
.st-head { display: block; }
.st-b .st-facts { margin-bottom: 0.55rem; }
.st-title { font: 600 var(--size-title)/1.15 var(--face); letter-spacing: -0.015em; text-wrap: balance; }
.st .st-dek { margin-top: 0.9rem; font: 400 1.3rem/1.4 var(--face); color: var(--desc); text-wrap: pretty; }
.st .st-open { margin-top: 1.6rem; font: 400 var(--size-text)/var(--leading) var(--face); font-variant-numeric: oldstyle-nums; }
.st-mark { display: block; margin-top: 1.4em; font: 400 var(--size-text)/var(--leading) var(--face); font-variant-numeric: oldstyle-nums; hanging-punctuation: first; }
.st-r { display: block; margin-top: 0.35em; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); }
.stream-end { margin: 0 0 30vh; text-align: center; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); }
.stream-end button { text-decoration: underline; text-underline-offset: 0.18em; }

/* ── The stack of screens, and a screen. A screen is shorter than the
   window by the peek, so the page below always shows its head at the
   bottom, under one hairline (as Reels shows the next reel's top edge): the
   sign that there is more, and what it is. Past a page's end the scroll
   carries on into the stack; the next page comes up once it is past halfway
   and springs back short of that. ── */
.stack { position: fixed; inset: 0; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.stack::-webkit-scrollbar, .pg::-webkit-scrollbar { display: none; }
.pg { height: calc(100dvh - var(--peek)); scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overscroll-behavior-y: auto; scrollbar-width: none; outline: none; view-timeline: --pg block; }
.pg + .pg { border-top: 1px solid var(--hairline); }
/* A page's words fade into the paper before its edge, as they do under the
   labels at the top, so they never run into the page below. */
.pg { -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, black calc(100% - 32px), transparent); }
.pg-in { width: min(var(--measure), 100% - 2 * var(--edge)); margin: 0 auto; padding: var(--top) 0 12vh; opacity: var(--near, 1); }
/* A page in the peek wears its head high, its facts and its title's first
   line in the strip; as it comes up it settles to where a page's head
   stands, driven by the scroll (a CSS scroll-driven animation), so it moves
   only as the reader moves it. */
@supports (animation-timeline: view()) {
  .pg-in { animation: pg-rise linear both; animation-timeline: --pg; animation-range: cover var(--peek) cover 100dvh; }
}
@keyframes pg-rise { from { translate: 0 calc(var(--head) - var(--top)); } }

.pg-facts { margin: 0 0 0.55rem; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); font-variant-numeric: oldstyle-nums; }
.pg-title { margin: 0 0 2.5rem; font: 600 var(--size-title)/1.15 var(--face); letter-spacing: -0.015em; text-wrap: balance; }
.pg-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.pg-dek { margin: -1.6rem 0 2.5rem; font: 400 1.3rem/1.4 var(--face); color: var(--desc); text-wrap: pretty; }

/* ── The article, as its site set it, in the reader's type. ── */
.pg-body { font: 400 var(--size-text)/var(--leading) var(--face); font-variant-numeric: oldstyle-nums; overflow-wrap: break-word; hanging-punctuation: first; }
.pg-body p { margin: 0 0 1em; }
.pg-body a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--rest); }
.pg-body a:hover { text-decoration-color: currentColor; }
.pg-body :is(h2, h3, h4) { margin: 2.2em 0 0.6em; font-family: var(--face); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.pg-body h2 { font-size: 1.45rem; line-height: 1.25; }
.pg-body h3 { font-size: 1.2rem; line-height: 1.3; }
.pg-body h4 { font-size: 1.05rem; line-height: 1.35; }
.pg-body > :first-child { margin-top: 0; }
.pg-body img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 3px; background: var(--well); }
.pg-body figure { margin: 2em 0; }
.pg-body p > img { margin: 1.4em auto; }
.pg-body figcaption { margin-top: 0.7em; font: italic 0.95rem/1.45 var(--face); color: var(--desc); }
.pg-body blockquote { margin: 1.4em 0; padding-left: 1.1em; border-left: 2px solid var(--hairline); }
.pg-body :is(ul, ol) { margin: 0 0 1em; padding-left: 1.4em; }
.pg-body li { margin: 0.3em 0; }
.pg-body li > p { margin: 0.3em 0; }
.pg-body hr { width: 30%; margin: 2.5em auto; border: 0; border-top: 1px solid var(--hairline); }
.pg-body code { font: 0.86em/1.5 var(--mono); padding: 0.1em 0.28em; border-radius: 3px; background: var(--well); }
.pg-body pre { margin: 1.4em 0; padding: 1em 1.1em; overflow-x: auto; border-radius: 4px; background: var(--well); font: 0.82rem/1.55 var(--mono); }
.pg-body pre code { padding: 0; background: none; font-size: inherit; }
.pg-body table { display: block; max-width: 100%; overflow-x: auto; margin: 1.4em 0; border-collapse: collapse; font-size: 0.9em; line-height: 1.4; }
.pg-body :is(td, th) { padding: 0.4em 0.7em; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.pg-body math { font-family: "STIX Two Math", "Latin Modern Math", "Cambria Math", math; font-size: 1.08em; }
.pg-body math[display="block"] { display: block; margin: 1.2em 0; overflow-x: auto; font-size: 1.15em; }
.pg-body sup { line-height: 0; font-size: 0.7em; }
/* A drawing (SVG) on its own plate, so dark lines stay readable at night. */
.pg-body svg { display: block; max-width: 100%; height: auto; margin: 1.4em auto; border-radius: 3px; background: var(--plate); }
.pg-body :is(video, audio) { display: block; width: 100%; margin: 1.4em 0; border-radius: 3px; }
.pg-body video { background: var(--well); }
.pg-body details { margin: 1em 0; }
.pg-body summary { cursor: pointer; font-style: italic; color: var(--desc); }
.pg-body aside { margin: 1.4em 0; padding-left: 1.1em; border-left: 2px solid var(--hairline); color: var(--desc); font-size: 0.95em; }
.pg-body mark { background: var(--well); color: inherit; }   /* the site's own emphasis, apart from readers' yellow */
.pg-body [id] { scroll-margin-top: 88px; }   /* a footnote a link brings up lands below the labels */
/* A video player, as its still until pressed; its name and site below. */
.pg-body figure[data-embed] > a { display: block; margin-top: 0.7em; font: italic 0.95rem/1.45 var(--face); color: var(--desc); }
.embed { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 3px; background: var(--well); }
.embed img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.embed-play { position: absolute; inset: 0; display: grid; place-items: center; font: 2rem/1 var(--ui); color: var(--bg); text-shadow: 0 0 18px var(--text); transition: transform var(--press) ease-out; }
.embed:hover .embed-play { transform: scale(1.08); }
.embed:active .embed-play { transform: scale(0.96); }
.pg-body figure[data-embed] iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 3px; background: var(--well); }

.pg-body .m { background: var(--mark); border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.pg-body .m.lit { animation: pg-lit 1s ease-out; }
@keyframes pg-lit { from { background: var(--tab); } }

/* ── The marks' tabs: one small yellow tab per marked passage on the
   screen's right edge, the whole page condensed into the edge's height
   (Matter's), each where its passage falls in the page. A tab takes you to
   its passage. The button is taller and wider than the tab it draws, so a
   thin tab is still easy to press. ── */
.tabs { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 64px); bottom: calc(var(--peek) + 16px); right: 0; z-index: 3; width: 28px; pointer-events: none; }
.tab { position: absolute; right: 0; width: 28px; margin-top: -5px; padding: 5px 0; pointer-events: auto; animation: tab-in var(--data) ease-out both; }
.tab::before { content: ""; display: block; height: 100%; min-height: 3px; width: 10px; margin-left: auto; border-radius: 2px 0 0 2px; background: var(--tab); transition: width var(--press) ease-out; }
.tab:hover::before, .tab:focus-visible::before { width: 16px; }
.tab:focus-visible { outline-offset: -2px; }
@keyframes tab-in { from { opacity: 0; } }
.pg-body.arrived > * { animation: pg-in var(--data) ease-out both; }
@keyframes pg-in { from { opacity: 0; } }
.pg-note { font-style: italic; color: var(--desc); }
.pg-note a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* ── The gist (app.js, "the gist"): a long page arrives folded to its
   opening, its most-marked passages and its contents, in the page's own
   type, and unfolds where it stands. ── */
.pg.folded > .pg-in > .pg-end, html:not([data-roll]) .pg.folded .pg-body, .pg:not(.folded) .pg-gist { display: none; }
.pg-gist { font: 400 var(--size-text)/var(--leading) var(--face); font-variant-numeric: oldstyle-nums; overflow-wrap: break-word; hanging-punctuation: first; cursor: pointer; }
.pg-gist.arrived > * { animation: pg-in var(--data) ease-out both; }
.pg-gist .gist-open { margin: 0 0 1em; }
.pg-gist .gist-open a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--rest); }
.pg-gist button { display: block; width: 100%; text-align: left; }
.pg-gist .m { background: var(--mark); border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color var(--press) ease-out; }
.gist-mark { margin: 1.4em 0 0; }
.gist-r { display: block; margin-top: 0.35em; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); }
.gist-contents { margin: 1.8em 0 0; font: 400 1.05rem/1.55 var(--face); color: var(--desc); text-wrap: pretty; }
.gist-label { font-style: italic; }
.pg-gist .gist-contents button { display: inline; width: auto; color: inherit; transition: color var(--press) ease-out; }
@media (hover: hover) and (pointer: fine) {
  .gist-mark:hover .m { background: color-mix(in srgb, var(--tab) 45%, transparent); }
  .gist-contents button:hover { color: var(--text); }
}

/* Where the words will stand, before they come: static lines at 7% ink,
   each a real line's length, in the text's own line height. */
.pg-sk span { display: block; height: 0.62em; margin: 0.49em 0; border-radius: 0.31em; background: var(--hairline); }

.pg-end:not(:empty) { margin-top: 2rem; }

.pg-last { display: grid; place-items: center; height: 100dvh; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); }

.down { width: min(var(--measure), 100% - 2 * var(--edge)); margin: 22vh auto 0; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); }
.down button { text-decoration: underline; text-underline-offset: 0.18em; }

/* ── What shows of the next page: eight answers, chosen with keys 1 to 8
   (app.js NEXT; README, "What shows of the next page"). The first six keep
   the snapping stack; only the peek above is the page itself rising. The
   seventh moves the sheets itself. The eighth lays the pages side by side. ── */
.pg { position: relative; }
.pg-cue, .pg-after { display: none; }
html:not([data-next="peek"]) .pg-in { animation: none; opacity: 1; }
html[data-next="line"] { --peek: 40px; }
html[data-next="edge"] { --peek: 14px; }
html:is([data-next="end"], [data-next="top"], [data-next="none"]) { --peek: 0px; }

/* 2, one line: "Next · its title" in the facts' italic, in a 40px strip; it
   fades as its page comes up. */
html[data-next="line"] .pg-cue { position: absolute; inset: 0 0 auto; height: var(--peek); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.pg-cue span { width: min(var(--measure), 100% - 2 * var(--edge)); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); opacity: var(--near, 1); }
@supports (animation-timeline: view()) {
  .pg-cue { animation: cue-out linear both; animation-timeline: --pg; animation-range: cover var(--peek) cover calc(var(--peek) + 30dvh); }
}
@keyframes cue-out { to { opacity: 0; } }

/* 3, sheet edge: no words, the next sheet's top edge under a firmer
   hairline, with a little depth, as one sheet lies under another. */
html[data-next="edge"] .pg + .pg { border-top-color: color-mix(in srgb, var(--text) 14%, transparent); box-shadow: inset 0 10px 10px -10px color-mix(in srgb, var(--text) 14%, transparent); }

/* 4, at the end: after the article, under a hairline, "Next" and its title;
   a press brings it up. */
html[data-next="end"] .pg-after:not(:empty) { display: block; margin-top: 3.5rem; padding-top: 1.4rem; border-top: 1px solid var(--hairline); }
.pg-after button { display: block; text-align: left; }
.pg-after-label { display: block; font: italic var(--size-fact)/1.4 var(--face); color: var(--desc); }
.pg-after-title { display: block; margin-top: 0.3rem; font: 600 1.6rem/1.2 var(--face); letter-spacing: -0.01em; text-wrap: balance; }
.pg-after button:hover .pg-after-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* 5, top label: the label that told the minutes left names the next page
   in the page's last screen, and a press brings it up. */
.top [data-go] { pointer-events: auto; cursor: pointer; }
.top [data-go]:hover { color: var(--desc); }

/* 7, reels: Instagram Reels' feed (app.js, "7, reels"). Each page is a
   sheet that fills the window; between sheets is Reels' black, seen only
   while a sheet moves, with its corners rounding as it lifts (--round, set
   with the sheet's place). The pager moves the sheets (--y); the stack
   itself never scrolls. The labels' paper band rides on each sheet, so
   it moves with its page. */
html[data-next="reels"] { --peek: 0px; --gap: 16px; }
html[data-next="reels"] .stack { overflow: hidden; scroll-snap-type: none; background: var(--between); }
html[data-next="reels"] .stack > * { transform: translate3d(0, calc(var(--y, 0) * -1px), 0); }
html[data-next="reels"] .pg { margin-bottom: var(--gap); border-radius: var(--round, 0px); background: var(--bg); -webkit-mask-image: none; mask-image: none; }
html[data-next="reels"] .pg + .pg { border-top: 0; }
html[data-next="reels"] .top { background: none; }
html[data-next="reels"] .pg::before { content: ""; position: sticky; top: 0; z-index: 1; display: block; height: calc(env(safe-area-inset-top, 0px) + 63px); margin-bottom: calc(-1 * (env(safe-area-inset-top, 0px) + 63px)); background: linear-gradient(to bottom, var(--bg) 0, var(--bg) 40%, color-mix(in srgb, var(--bg) 0%, transparent)); pointer-events: none; }
/* The labels and tabs speak of the page at rest: while a sheet moves they
   step away, as the band under the labels has gone with its sheet. */
html[data-next="reels"] .top { transition: opacity var(--press) ease-out; }
html.moving .top { opacity: 0; }
html.moving .tabs { visibility: hidden; }

/* 8, pages sideways: the pages lie side by side, one a screen, and the
   stack scrolls across with the browser's snap, one page a swipe; a page
   scrolls down on its own, and a gist opens as you scroll into it (app.js,
   "8, pages sideways"). */
html[data-next="across"] { --peek: 0px; }
html[data-next="across"] .stack { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
html[data-next="across"] .pg { flex: 0 0 100%; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; }
html[data-next="across"] .pg + .pg { border-top: 0; border-left: 1px solid var(--hairline); }

@media (max-width: 600px) {
  :root { --size-title: 1.9rem; --size-text: 1.125rem; --top: 16vh; --peek: 112px; --head: 12px; }   /* the facts often take two lines here */
  .pg-dek { font-size: 1.15rem; }
  .tabs, .tab { width: var(--edge); }   /* the margin and no more, so a tab never takes a tap on the words */
  .st { margin-bottom: 4.5rem; }
  .leaf { width: 94%; margin-left: calc(var(--m, 4%) * 0.75); padding: 18px 18px 26px; }
  .leaf .leaf-t { font-size: 1.45rem; }
  .leaf-q { font-size: 1.22rem; }
  .st-q { font-size: 1.32rem; }
  .st-b + .st-b { padding-top: 3.5rem; }
  .st-b { margin-bottom: 3.5rem; }
  .st .st-dek { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-body.arrived > *, .pg-gist.arrived > *, .tab, .pg-body .m.lit { animation: none; }
  .tab::before, .embed-play, .pg-gist .m, .gist-contents button, .st .m, .leaf { transition: none; }
}

/* ── The column skin: backscroll's layout, as look b of
   docs/design/editions/wonderful.html. One 564px column on a flat ground,
   paper white by day and near-black at night; the title and every fact in
   the system sans at fixed sizes; three greys (text, a fact, the dimmest);
   hairlines in the ink at a tenth. The page's own words keep the reading
   serif. It is the default; ?skin=essay brings the essay register back. ── */
html[data-skin="column"] {
  --bg: #ffffff;
  --text: #262624;
  --strong: #262624;
  --desc: #65635e;
  --rest: #74716b;
  --hairline: rgba(38, 38, 36, 0.1);
  --well: rgba(38, 38, 36, 0.04);
  --measure: 564px;
  --edge: 18px;
  --size-title: 24px;
  --size-fact: 15px;
  --size-text: 1.125rem;
}
@media (prefers-color-scheme: dark) {
  html[data-skin="column"] {
    --bg: #0c0c0c;
    --text: #e9e7e3;
    --strong: #fdfdfd;
    --desc: #949494;
    --rest: #626262;
    --hairline: rgba(255, 255, 255, 0.1);
    --well: rgba(231, 233, 234, 0.06);
  }
}
html[data-skin="column"] .top { font: 13px/17px var(--ui); letter-spacing: -0.1px; }
html[data-skin="column"] .pg-title { margin-bottom: 1.75rem; font: 700 24px/29px var(--ui); letter-spacing: -0.4px; color: var(--strong); }
html[data-skin="column"] :is(.pg-facts, .gist-r, .pg-last, .down, .pg-cue span, .pg-after-label, .st-facts, .st-r, .stream-end) { font: 400 15px/20px var(--ui); letter-spacing: -0.15px; font-variant-numeric: normal; }
html[data-skin="column"] .pg-facts { margin-bottom: 6px; }
html[data-skin="column"] .pg-body :is(h2, h3, h4) { font-family: var(--ui); font-weight: 700; letter-spacing: -0.3px; color: var(--strong); }
html[data-skin="column"] .pg-body :is(figcaption, figure[data-embed] > a) { font: 400 13px/17px var(--ui); }

/* ── The roll (app.js, "The roll"): The list one page a screen. A page is a
   sheet: its head, and its own article in a frame that fills the screen,
   its words at the scale that fits the column into the frame (--sheet-s),
   fading into the frame's foot. Opened, the frame goes and the words grow
   to the reading size where they stand, line for line. ── */
html[data-roll] { --top: 88px; --sheet: #fbfaf7; --sheet-pad: 30px; --sheet-s: 0.8936; --open: 280ms; --ease: cubic-bezier(0.2, 0, 0, 1); }
@media (prefers-color-scheme: dark) { html[data-roll] { --sheet: #1c1c1c; } }
html[data-roll] .stream { display: none; }
html[data-roll]:not(.page-open) #back, html[data-roll].page-open #name { display: none; }
html[data-roll]:not(.page-open) .tabs { display: none; }   /* a sheet has no passages to go to yet */
html[data-roll] .pg-sheet { position: relative; border-radius: 12px; box-shadow: inset 0 0 0 1px transparent; transition: padding var(--open) var(--ease), background-color var(--open) var(--ease), box-shadow var(--open) var(--ease), transform var(--press) var(--ease); }
html[data-roll] .pg-sheet::after { content: ""; position: absolute; inset: auto 1px 1px; height: 90px; border-radius: 0 0 11px 11px; background: linear-gradient(transparent, var(--sheet)); opacity: 0; pointer-events: none; }
html[data-roll] .pg-body { width: 100%; transform-origin: 0 0; transition: transform var(--open) var(--ease), width var(--open) var(--ease); }
/* While a page is read it has the whole screen; the next page's head comes
   up under it at its end (.at-end, app.js tell). */
html[data-roll] .pg { transition: height var(--open) var(--ease); }
html[data-roll] .pg:not(.folded, .at-end, .pg-last) { height: 100dvh; }
/* The next page's head comes up into room kept for it: an open page ends on
   an empty foot as tall as the peek, and gives that foot up as the page
   shortens by the same, so no word moves. */
html[data-roll] .pg > .pg-in { transition: padding-bottom var(--open) var(--ease); }
html[data-roll] .pg:not(.folded, .at-end) > .pg-in { padding-bottom: calc(var(--peek) + 48px); }
html[data-roll] .pg.at-end:not(.folded) > .pg-in { padding-bottom: 48px; }
/* Words fade at a page's edge only while more of them are under it. */
html[data-roll] .pg:is(.folded, .at-end) { -webkit-mask-image: none; mask-image: none; }
/* A page waiting below is told from the one on screen by its grey, never by
   a dimmed ink; its title is a quiet line, lighter than the column skin's. */
html[data-roll] .pg-in { opacity: 1; }
html[data-roll] .pg-title { font: 600 20px/25px var(--ui); letter-spacing: -0.3px; color: var(--desc); transition: color var(--data) ease-out; }
html[data-roll] .pg.here .pg-title { color: var(--strong, var(--text)); }
html[data-roll] .pg.folded { overflow: hidden; }
html[data-roll] .pg.folded > .pg-in { display: flex; flex-direction: column; height: 100%; padding-bottom: 44px; }
html[data-roll] .pg.folded :is(.pg-facts, .pg-title, .pg-dek) { flex: none; }
html[data-roll] .pg.folded .pg-sheet { flex: 1; min-height: 0; overflow: hidden; padding: 26px var(--sheet-pad) 0; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); cursor: pointer; }
html[data-roll] .pg.folded .pg-sheet:active { transform: scale(0.99); }
html[data-roll] .pg.folded .pg-sheet::after { opacity: 1; }
html[data-roll] .pg.folded .pg-body { width: calc(100% + 2 * var(--sheet-pad)); transform: scale(var(--sheet-s)); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { html[data-roll] :is(.pg, .pg-sheet, .pg-body, .pg-in, .pg-title) { transition: none; } }
