/* A book on a phone: one illustrated book, as the owner chose it on 18–19.11 (variant C, screens/book-beat.js). Each
   picture runs whole across the screen and carries no letters; all of a beat's words are in one paper frame under it, like
   a page of a book; each next picture melts into the one above through a ground made of both (B-1911-05). The
   book is the same by day and by night, like a webtoon or a comic: paper frames with dark ink, one accent, the pictures
   as drawn, on their own colours and tiny copies (on .art and div.ground, set by recolor). Only the app around it
   (the top row, the page) follows the theme.
   The face is the app's own files (fonts/, OFL: OFL-Literata.txt), from the @fontsource npm package, with its
   unicode-range: Literata for every age, one face on the screen and in print (the owner, 20.11). */

@font-face {
  font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/literata-cyrillic-400-normal.woff2) format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/literata-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/fonts/literata-cyrillic-600-normal.woff2) format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/fonts/literata-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap;
  src: url(/fonts/literata-cyrillic-400-italic.woff2) format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap;
  src: url(/fonts/literata-latin-400-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}


:root {
  --book-serif: 'Literata', Georgia, 'Times New Roman', serif;
  /* The book's own colours, the same by day and by night (the owner, 18.11: like a webtoon or a comic, the book does not
     change with the theme): the paper, its ink, the frame's edge and shade, and the one accent of the dashes and the drop
     cap (the day's ink blue). The frame's paper is a light cream, not white (the owner, 26.11: «чуть-чуть более бежевым,
     не сильно, чтобы это более похоже на книжку было», above all in the evening): ink on it 14.6:1, the accent 7.3:1. */
  --book-paper: var(--paper); --book-ink: var(--paper-ink); --book-edge: var(--paper-ink); --book-shade: rgba(31, 31, 38, .22);
  --book-accent: var(--paper-accent);
  --book-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.27 0 0 0 0 0.18 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* The open book's leaf (the spread, B-1911-07; the owner on 19.11: «у книги не должен быть фон белый, он немножко
     бежевый — нужен книжный лист»): warm cream book paper, one for both pages, by day and by night, with a finer grain
     than the frames'. The ink on it is 13.9:1, the accent 7.0:1, the muted ink 4.6:1 (WCAG AA and more). */
  --book-leaf: var(--paper); --book-leaf-muted: var(--paper-muted);
  --book-leaf-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.27 0 0 0 0 0.18 0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* One size for every age, as the owner said on 19.11: «по возрастам можно одинаковый размер использовать», and the layout
   should simply look good on the page. One face for every age too since 20.11: Literata, the book's serif, the same
   upright and sideways (spread.js) and in print (the owner: no more hand lettering for 3+ and 5+), so one story looks
   the same every way. 16 px: a new book's beat of up to
   34 words in two plates fits the smallest sideways page (750×342, Safari under its bars) at once, 40 words after its
   shrink steps, and upright the frames leave the pictures most of the screen. */
.scroll-view { --book-size: 16px; --book-lead: 1.45; }

/* The beats lie on the page's own ground: where a picture has no colours yet (still drawing, not loaded), the page's
   ground shows. */
.book-beats { display: flex; flex-direction: column; }
/* The view holds the reader's place itself as pictures come in (book-beat.js steady): the browser's anchoring would hold on
   to the overlapping beat above. */
.scroll-view[data-format=book] { overflow-anchor: none; }
.book-beats .beat { position: relative; }

/* ── the picture: whole, edge to edge, never lettered, as drawn by day and by night ──
   The owner, 19.11: whole pictures over crops («большая часть смыслов урезана»). Under each picture lies its own tiny copy
   (--tiny, recolor), soft from its upscaling, so wherever the picture fades it melts into itself. Its foot fades (--out,
   lay in book-beat.js) into the ground under it (div.ground), and the next picture rises over the foot of that ground by
   --lap (a negative margin at the foot of the one above) and fades in over all of it (--fade): picture into ground into
   picture, no edge and no flat band (B-1911-05). The first picture fades in at its head. The mask that fades a picture in
   is on the figure, so a narrower picture's ground beside it (a low window) melts in with it. */
.book-beats .beat { padding-bottom: var(--ground, 0px); }
.book-beats .art {
  position: relative; margin: 0;
  background: var(--tiny, none) center / 100% 100% no-repeat, linear-gradient(var(--top, transparent), var(--bot, transparent));
}
.book-beats .art img {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover;
  -webkit-mask-image: linear-gradient(transparent, #000 var(--in, 0px), #000 calc(100% - var(--out, 0px)), transparent);
  mask-image: linear-gradient(transparent, #000 var(--in, 0px), #000 calc(100% - var(--out, 0px)), transparent);
}
/* A picture that is not 2:3 takes its own shape once book-beat.js has heard it come in (.whole), not before: the place is
   held over the change there. */
.book-beats .beat.whole .art img { aspect-ratio: auto 2 / 3; object-fit: fill; }
.book-beats .beat:first-child .art img { --in: 4%; }
.book-beats .beat:not(:last-child) { margin-bottom: calc(-1 * var(--lap, 25%)); }
.scroll-view:not([data-layout=plates]) .book-beats .beat:not(:last-child) { margin-bottom: calc(-1 * var(--lap, 12.5%)); }
.book-beats .beat + .beat > .art {
  -webkit-mask-image: linear-gradient(transparent, #000 var(--fade, 16.67%)); mask-image: linear-gradient(transparent, #000 var(--fade, 16.67%));
}
/* The ground between a picture and the next (--ground tall, under the picture): a blend of their edge colours (--from,
   --to), and over it each picture's tiny copy mirrored at its edge, so the ground goes on from the picture's foot as its
   soft reflection and the next picture's head comes out of its own: this one's fading out downwards (--mine), the next
   one's fading in (--next). The last ground has only its own picture's, and runs on in its foot colour. */
.book-beats .ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--ground, 0px); overflow: hidden; pointer-events: none;
  background: linear-gradient(var(--from, transparent), var(--to, transparent));
}
.book-beats .ground::before, .book-beats .ground::after {
  content: ''; position: absolute; inset: 0; background-repeat: no-repeat; background-size: 100% auto; transform: scaleY(-1);
}
.book-beats .ground::before {
  background-image: var(--mine, none); background-position: center bottom;
  -webkit-mask-image: linear-gradient(to top, #000 15%, transparent 85%); mask-image: linear-gradient(to top, #000 15%, transparent 85%);
}
.book-beats .ground::after {
  background-image: var(--next, none); background-position: center top;
  -webkit-mask-image: linear-gradient(to top, transparent 25%, #000 90%); mask-image: linear-gradient(to top, transparent 25%, #000 90%);
}
/* A picture still drawing (or one that did not work out) keeps the 2:3 place, so nothing below moves when it comes; on the
   book's own paper colours. */
.book-beats .art .webtoon-missing { aspect-ratio: 2 / 3; background: var(--paper); color: var(--paper-muted); text-align: center; }
.book-beats .art .webtoon-missing .muted { color: var(--paper-muted); }

/* The poster (only a guest's link opens on it since 19.11): it dissolves at its foot into page 1's head colour (recolor sets
   the cover's --top, --bot and --to), the book's own colours by day and by night, so it meets page 1 with no step. */
.scroll-view[data-format=book] .webtoon-cover { background: linear-gradient(var(--top, transparent), var(--bot, transparent) 84%, var(--to, transparent)); }
.scroll-view[data-format=book] .webtoon-title:not(.signed) .webtoon-poster {
  -webkit-mask-image: linear-gradient(#000 84%, transparent); mask-image: linear-gradient(#000 84%, transparent);
}
/* The end begins on the last picture's foot colour and settles into the theme's ground. */
.scroll-view[data-format=book] .webtoon-end { background: linear-gradient(var(--endbg, transparent), transparent 240px); }

/* ── the words: one paper frame a beat, under its picture or over its calm foot ──
   The frame's top lies --frame-y below the beat's top (lay): just under its picture when the screen has room for both,
   else as high as the picture's calm foot lets it, never over a picture's action (B-1911-05); the ground under the
   picture makes the room. It is laid over the pictures (z-index 1) but under the top row. A picture that is not 2:3 (an
   old 4:3 book, the fake's squares; book-beat.js makes its beat .whole once it is in) was never drawn with a quiet foot
   for words: it is never covered (R6), its frame lies on the ground under it. */
.book-beats .beat { --frame-y: 75%; }
.book-beats .gap { position: absolute; left: 0; right: 0; top: var(--frame-y); padding: 0 14px; }
.book-beats .gap.empty { display: none; }

/* The frame: a page of a book, the spike's frame the owner saw on 18.11. Narration runs as paragraphs; a speech hangs on its
   dash in the accent, its words in one column after it; a new plate starts under a short rule. */
.book-beats .page-frame {
  position: relative; z-index: 1; padding: 11px 15px 13px;
  font: var(--book-size)/var(--book-lead) var(--book-serif); hyphens: manual; text-wrap: pretty; overflow-wrap: break-word;
  transition: box-shadow .3s ease;
}
/* The frame's paper, shared with the open book's text page (the owner, 26.11, see the end of the spread's section): the
   cream, the dark edge, the shade, and a hairline just inside the border, the printed page's own edge. */
.book-beats .page-frame, .spread-view[data-look=page] .page.text .col {
  background: var(--book-grain), var(--book-paper); color: var(--book-ink);
  border: 2px solid var(--book-edge); border-radius: 4px; box-shadow: 3px 4px 0 var(--book-shade);
  outline: 1px solid color-mix(in srgb, var(--book-edge) 22%, transparent); outline-offset: -6px;
}
.book-beats .page-frame p { margin: 0; }
.book-beats .page-frame p + p { margin-top: .35em; }
.book-beats .page-frame p.d { padding-left: 1.2em; text-indent: -1.2em; }
.book-beats .page-frame .dash { display: inline-block; width: 1.2em; text-indent: 0; color: var(--book-accent); font-weight: 600; }
/* The rule lies in the step above the plate, out of the paragraph's flow, so a speech's hanging dash keeps its place. */
.book-beats .page-frame p.plate-start { position: relative; margin-top: 1.1em; }
.book-beats .page-frame p.plate-start::before {
  content: ''; position: absolute; top: -.62em; left: 50%; width: 28px; height: 1.5px; margin-left: -14px;
  background: currentColor; opacity: .28;
}
/* The raised initial (the owner, 26.11): every beat's words open with it, on the first narration paragraph of the beat's
   first plate (a speech never gets it). It stands on the first line and is one line tall: it does not float beside two
   lines, and its line box (1.9em x .76) is no taller than a line of the text (--book-lead 1.45), so the lines keep their
   rhythm. The open book's text page sets it the same way (spread.js, the first text page of a beat; a vignette book has
   none, as upright). */
.book-beats .page-frame p.first::first-letter, .spread-view .col p.first::first-letter {
  font-weight: 600; font-size: 1.9em; line-height: .76; margin-right: .03em; color: var(--book-accent);
}

/* A window lower than 501 px and wider than tall that is still a scroll (narrower than 600 px: a book on a wider one is the
   open book, spread.js): a picture is no taller than the screen under the top row (--top-row, measured by scroll.js), 2:3
   or, .whole, in its own shape (--ratio, width to height, from book-beat.js), centred on its edge-colour ground; its place
   while it is drawing too. The frames keep the column. */
@media (orientation: landscape) and (max-height: 500px) {
  .book-beats .art :is(img, .webtoon-missing) { width: min(100%, calc((100dvh - var(--top-row, 56px)) * 2 / 3)); margin-inline: auto; }
  .book-beats .beat.whole .art img { width: min(100%, calc((100dvh - var(--top-row, 56px)) * var(--ratio, 1))); }
  /* The tiny copy under a 2:3 picture keeps its shape there, centred under it. */
  .book-beats .beat:not(.whole) .art { background-size: auto 100%, auto; }
}

/* «Слушать» (R14): the beat the voice is on has the accent edge, inside its frame (a book) or round its strip or comic page
   (screens/scroll.js puts .speaking on the beat's .gap, or on the strip). The edge eases in, at once under reduced motion. */
.book-beats .gap.speaking .page-frame { box-shadow: inset 5px 0 0 var(--book-accent), 3px 4px 0 var(--book-shade); }
.scroll-view :is(.webtoon-strip, .comic-page, .webtoon-missing)[data-beat] { transition: outline-color .3s ease; outline: 4px solid transparent; outline-offset: -4px; }
.scroll-view :is(.webtoon-strip, .comic-page, .webtoon-missing)[data-beat].speaking { outline-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .book-beats .page-frame, .scroll-view [data-beat] { transition: none; }
}

/* ── a vignette book upright: printed pages (B-1911-09, «Виньетка»; book-beat.js leafBeat) ──
   Each beat a page of the book's cream paper, one under another with no seam but the paper: the drawing whole in its own
   shape (the blank paper of its sheet left out, trimPaper) with paper round it (no taller than about half the screen, so
   its words come up under it), its paper giving way
   to the book's (darken, as on the open book: no box round it), and right under it the beat's words, set on the same paper
   with no frame, in the face and at the one size of the frames. The same by day and by night: the paper does not follow
   the theme, only the top row and the end do. The poster of a guest's link dissolves into the paper. */
.scroll-view[data-look=vignette] .book-beats { background: var(--book-leaf-grain), var(--book-leaf); color: var(--book-ink); padding-bottom: 8px; }
.book-beats .leaf { position: relative; padding: 34px 26px 26px; }
.book-beats .leaf .vignette {
  position: relative; overflow: hidden; margin: 0 auto 14px;
  width: min(100%, calc(54svh * var(--r, 2 / 3))); aspect-ratio: var(--r, 2 / 3);
  mix-blend-mode: darken;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent), linear-gradient(transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent), linear-gradient(transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.book-beats .leaf .vignette:has(> .webtoon-missing) { width: 100%; aspect-ratio: 3 / 2; mix-blend-mode: normal; -webkit-mask-image: none; mask-image: none; }
.book-beats .leaf .webtoon-missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 12%; text-align: center; border: 1px dashed rgba(74, 62, 44, .3); }
.book-beats .leaf .webtoon-missing .muted { color: var(--paper-muted); }
.book-beats .leaf .gap { position: static; padding: 0; }
.book-beats .leaf .page-frame {
  max-width: 34em; margin: 0 auto; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; outline: 0;
}
/* A new plate after a line's space, as on the open book: no rule. */
.book-beats .leaf .page-frame p.plate-start { margin-top: .9em; }
.book-beats .leaf .page-frame p.plate-start::before { content: none; }
/* «Слушать»: the beat the voice is on has the accent rule at the left of its words. */
.book-beats .leaf .gap.speaking .page-frame { box-shadow: -12px 0 0 -9px var(--book-accent); }
.scroll-view[data-look=vignette] .webtoon-cover { background: linear-gradient(var(--top, transparent), var(--bot, transparent) 84%, var(--book-leaf)); }
.scroll-view[data-look=vignette] .webtoon-end { background: linear-gradient(var(--book-leaf), transparent 240px); }

/* ── a book on a computer: an open book of spreads (screens/spread.js), as in the spread the owner approved on 16.11 ──
   The picture on one page, its words on the other in the face for the readers' age, at the one size, never smaller:
   words that do not fit go on to further spreads with the same picture (the owner, 18.11: «у некоторых страниц
   пропускаются картинки»). The book is 4:3 in a stage between the top row and the dots. (A phone turned sideways has the
   same book, laid out for its low screen: the last section.) */
#app.spread { max-width: none; padding: 0; min-height: 0; gap: 0; }
.spread-view {
  --desk: var(--day-desk); --leaf: var(--book-leaf); --leaf-ink: #26242a; --leaf-muted: var(--paper-muted);
  --size: 20px; --lead: 1.62;
  position: fixed; inset: 0; overflow: hidden; background: var(--desk); color: var(--leaf-ink);
}
:root[data-theme=evening] .spread-view { --desk: #12162e; --leaf: #1d2347; --leaf-ink: #f1e9d8; --leaf-muted: #9aa0c4; }
/* One size for every age (the owner, 19.11, as upright); on a computer it never changes to make words fit (a phone sideways
   has smaller steps). Literata for every age, as upright. */
/* The measure (spread.js): the same view, laid out but never seen. */
.spread-probe { visibility: hidden; pointer-events: none; z-index: -1; }

/* The top row lies over the desk: the reader's translucent bar (style.css), its hairline over the book's head. Upright its
   look is the pictures' blurred colours passing under it, a soft gradient; here nothing passes under it, so the same
   ground is a gradient itself, from the theme's ground touched with its ink (a lighter edge by night, a deeper one by
   day) at the top to nothing over the desk at the foot (the owner, 26.11: «если горизонтально, то градиента нету, его бы
   хорошо добавить»). The ink under the icons and «N из M» stays in the same family as upright, so they read as they do there. */
.spread-view .webtoon-top {
  position: absolute; inset: 0 0 auto; min-height: 56px; padding: 6px 28px;
  background: linear-gradient(color-mix(in srgb, var(--bg) 92%, var(--ink)), color-mix(in srgb, var(--bg) 20%, transparent));
}
.spread-view .webtoon-count { margin-inline-end: 6px; }

.spread-view .stage {
  position: absolute; inset: 56px 0 64px; display: grid; place-items: center; min-height: 0; color: inherit; font-size: inherit;
  /* One definite cell: the book's height (a share of it) never follows what is on its pages. */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.spread-view .book {
  position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr);
  height: min(100%, calc((100vw - 160px) * .75)); aspect-ratio: 4 / 3; min-width: 0; min-height: 0;
  border-radius: 4px; background: var(--book-leaf-grain), var(--book-leaf);
  box-shadow: 0 30px 60px -30px rgba(30, 25, 15, .55), 0 0 0 1px rgba(0, 0, 0, .05);
}
:root[data-theme=evening] .spread-view .book { box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8); }
/* The fold: a soft shade 56 px wide down the middle. */
.spread-view .book::after {
  content: ''; position: absolute; inset: 0 auto 0 calc(50% - 28px); width: 56px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(60, 50, 30, .10) 45%, rgba(60, 50, 30, .16) 50%, rgba(60, 50, 30, .10) 55%, transparent);
}
.spread-view .page { position: relative; overflow: hidden; min-width: 0; min-height: 0; }

/* A beat's picture on its page, printed as a European picture-book house prints it (B-1911-09, the owner's two looks of
   19.11; data-look on the view, spread.js): the page is paper and the picture, nothing else. Both pages are the one leaf
   of paper (--book-leaf, the same by day and by night, B-1911-07); the picture's side changes from spread to spread
   (data-pic on the book: 'r' puts the picture's page after the words').
   - page («Страница-картина», C: every book not drawn as vignettes): a 2:3 picture fills its page edge to edge, with no
     frame and no melting. A computer's page is 2:3 and cuts nothing of it; a phone's square page cuts only its calm top
     and bottom bands (BOOK_PAGE), an older book's only its calm foot (its action is in the upper two thirds). A picture
     of another shape (an old 4:3 book, the fake's squares; .whole, spread.js) lies whole on the paper, margins round it.
   - vignette («Виньетка», B: story.vignette): the drawing on its blank paper lies on the page's paper, whole and in its
     own shape, with generous margins. Its paper gives way to the book's: darken keeps whichever is darker, so its warm
     white becomes the cream page and no box shows round it; its edges fade out over a hair, in case that paper is a
     touch darker somewhere.
   A guest's poster across the cover spread, and page 1's picture on an opening without one, lie whole on the paper too. */
.spread-view { --margin: 8%; }
.spread-view .book[data-pic=r] > .page.pic { order: 1; }
.spread-view .page:is(.pic, .front-cover) {
  display: grid; place-items: center; container-type: size; padding: var(--margin);
  background: var(--book-leaf-grain), var(--book-leaf);
}
.spread-view .print {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--r, 2 / 3)));
  aspect-ratio: var(--r, 2 / 3);
}
.spread-view .print img { display: block; width: 100%; height: 100%; object-fit: cover; }
.spread-view .print img.whole { object-fit: contain; }
.spread-view[data-look=page] .page.pic:has(> .print > img:not(.whole)) { padding: 0; }
.spread-view[data-look=page] .page.pic > .print:has(> img:not(.whole)) { position: absolute; inset: 0; width: auto; aspect-ratio: auto; }
.spread-view[data-look=page]:not([data-layout=plates]) .page.pic img { object-position: 50% 0; }
.spread-view[data-look=vignette] .page.pic { padding: 10% 9%; }
.spread-view[data-look=vignette] .page.pic > .print {
  overflow: hidden; mix-blend-mode: darken;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent), linear-gradient(transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent), linear-gradient(transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
/* The drawing, not its sheet: the blank paper round it is left out of its box (trimPaper, book-beat.js: --tx/--ty where
   the drawing starts and --tw/--th its share of the sheet), the sheet scaled and moved so only the drawing shows. */
.spread-view[data-look=vignette] .page.pic > .print > img, .book-beats .leaf .vignette > img {
  position: absolute; max-width: none; object-fit: fill;
  left: calc(-100% * var(--tx, 0) / var(--tw, 1)); top: calc(-100% * var(--ty, 0) / var(--th, 1));
  width: calc(100% / var(--tw, 1)); height: calc(100% / var(--th, 1));
}
/* A picture still drawing (or one that did not work out) keeps its print, an empty one with a word on it. */
.spread-view .pic-missing {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12%; text-align: center;
  border: 1px dashed rgba(74, 62, 44, .3);
}
.spread-view .pic-missing .muted { color: var(--paper-muted); font-size: 16px; }

/* The words, on the facing page (B-1911-09). They are left-aligned and ragged, the lines never centred. Since 26.11 a book
   not drawn as vignettes sets them in the upright reader's paper frame, with its raised initial (the owner, 26.11: «на
   вертикальной развёртке есть заглавная буква красивая и рамочка, такое обрамление, а на горизонтальной этого нету, надо
   бы добавить, чтобы красиво было, и отцентровать»; this reverses «no folio, no drop cap, no ornament» of 19–20.11): the
   column itself is the frame (its rules are the upright frame's, above), inset from the page by a balanced margin and
   standing in the middle of the page when its words are shorter than it (a longer beat is paged on to further spreads, so
   the frame always fits; if one ever did not, it would start at the top). The first narration paragraph of a beat's first
   text page opens with the initial (spread.js); a new plate starts after a line's space, with no rule; a speech still hangs
   on its dash in the book's accent. A vignette book keeps the plain page of 19–20.11, as its upright pages have no frame:
   its words stand in the middle of the page, a little above it, level with the drawing; so does a guest's title page. The same paper by day and by night
   (the owner, 18.11). */
.spread-view .page.text {
  display: flex; flex-direction: column; justify-content: flex-start; padding: 13% 12% 9%;
  background: var(--book-leaf-grain), var(--book-leaf); color: var(--book-ink); --leaf-muted: var(--book-leaf-muted);
}
.spread-view[data-look=vignette] .page.text { justify-content: center; padding: 10% 12% 14%; }
.spread-view[data-look=page] .page.text:has(> .col) { justify-content: safe center; padding: 9%; }
.spread-view .col {
  flex: none; width: 100%;
  font: var(--size)/var(--lead) var(--book-serif); hyphens: manual; text-wrap: pretty; overflow-wrap: break-word;
}
.spread-view[data-look=page] .page.text .col { padding: .7em .95em .8em; }
/* A beat with no words yet faces a bare page: no empty frame. */
.spread-view .col:empty { display: none; }
.spread-view .col p { margin: 0; }
.spread-view .col p + p { margin-top: .5em; }
.spread-view .col p.d { padding-left: 1.2em; text-indent: -1.2em; }
.spread-view .col .dash { display: inline-block; width: 1.2em; text-indent: 0; color: var(--book-accent); font-weight: 600; }
.spread-view .col .plate + .plate.head { margin-top: 1.1em; }

/* A guest's cover (spread.js; only a shared link opens on one since 19.11, B-1911-03): the poster whole across the first
   spread, printed on the leaf as the pictures are (B-1911-07), centred, never cut, with no fold over it. Its margin is
   the pages' own: the cover is two pages wide. */
.spread-view .page.front-cover { grid-column: 1 / -1; padding: calc(var(--margin) / 2); }
.spread-view .book:has(> .page.front-cover)::after { content: none; }
/* A guest's opening without a poster: the title (and its signature) on the right page. */
.spread-view .opening .title { text-align: center; }
.spread-view .opening h1 { font: 600 40px/1.1 var(--book-serif); text-wrap: balance; }
.spread-view .opening p { margin-top: 14px; font: italic 17px/1.4 var(--book-serif); color: var(--leaf-muted); }

/* The last spread: «Конец» on the left, the end cards on the right (scrolling inside the page when they are taller). The
   line to turn the phone upright is the phone's only (the last section). */
/* «Конец» is lettered on the leaf too (B-1911-07), in the book's ink by day and by night; the end cards' page is the app's
   (its cards follow the theme). */
.spread-view .page.end {
  display: grid; background: var(--book-leaf-grain), var(--book-leaf); color: var(--book-ink);
  --ink: var(--book-ink); --ink-soft: var(--book-leaf-muted); --glow: #c38f2c;
}
.spread-view .page.end .the-end { height: 100%; }
.spread-view .page.cards { overflow-y: auto; overscroll-behavior: contain; padding: 7% 8%; color: var(--ink); background: var(--leaf); }
.spread-view .page.cards .end-cards { min-height: 100%; justify-content: center; }
.spread-view .turn-hint { display: none; }

/* The turn: the spread slides a little and fades out, the next one in from the side it was turned to. */
.spread-view .book.out { transition: opacity .18s ease, transform .18s ease; opacity: 0; transform: translateX(calc(var(--dir) * -18px)); }
.spread-view .book.in { animation: spread-in .26s ease both; }
@keyframes spread-in { from { opacity: 0; transform: translateX(calc(var(--dir) * 18px)); } }
@media (prefers-reduced-motion: reduce) { .spread-view .book.out, .spread-view .book.in { transition: none; animation: none; } }

/* A finger drawn across the book turns it (spread.js): the browser leaves sideways drags on it to the page. */
.spread-view .book { touch-action: pan-y pinch-zoom; }
/* The page edges turn it too. */
.spread-view .edge {
  position: absolute; top: 56px; bottom: 64px; z-index: 1; width: 9vw; padding: 0; border: 0; border-radius: 0;
  background: none; color: var(--leaf-ink); cursor: pointer;
}
.spread-view .edge.l { left: 0; }
.spread-view .edge.r { right: 0; }
.spread-view .edge::after { content: ''; position: absolute; top: 50%; width: 14px; height: 14px; border: solid currentColor; border-width: 0 2px 2px 0; opacity: .35; }
.spread-view .edge.l::after { left: 40%; transform: rotate(135deg); }
.spread-view .edge.r::after { right: 40%; transform: rotate(-45deg); }
.spread-view .edge:hover::after, .spread-view .edge:focus-visible::after { opacity: .8; }
.spread-view .edge[disabled] { visibility: hidden; }
/* The dots: one a spread. */
.spread-view .dots { position: absolute; bottom: 26px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.spread-view .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--leaf-ink); opacity: .2; }
.spread-view .dots i.on { opacity: .7; }

/* ── a phone turned sideways: the open book of two square pages, as the owner chose on 17.11 ──
   A window lower than 501 px (and WIDE, spread.js: a phone held sideways, 844×390 or 750×342 in Safari). The book is as
   tall as it can be, its pages square, in a stage right under a compact top row and 8 px over the foot; the dots give their
   room to it, and the edges run down to the foot. The words are in the face and at the size of the book upright, for every
   age (the owner, 19.11). Since 18.11 («у некоторых страниц пропускаются картинки») a beat's words that do not fit are
   set a step or two smaller before they go on to another spread with the picture again, each beat at its largest step that
   fits (spread.js, data-step on the column), the last step a little tighter too; measured by these same rules (the probe
   is a .spread-view too). The sides keep clear of a notch. */
@media (orientation: landscape) and (max-height: 500px) {
  .spread-view { --side: max(44px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .spread-view { --size: 16px; --lead: 1.45; }
  .spread-view .col[data-step="1"] { --size: 15px; }
  .spread-view .col[data-step="2"] { --size: 14px; --lead: 1.4; }
  /* The square page: a whole picture as large as narrower margins let it be. */
  .spread-view { --margin: 5%; }
  .spread-view[data-look=vignette] .page.pic { padding: 7% 6%; }
  .spread-view .webtoon-top { min-height: 38px; padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
  .spread-view .stage { inset: 38px var(--side) 8px; }
  .spread-view .book {
    height: min(100%, calc((100vw - 2 * var(--side)) / 2)); aspect-ratio: 2 / 1;
    box-shadow: 0 12px 24px -14px rgba(30, 25, 15, .5), 0 0 0 1px rgba(0, 0, 0, .05);
  }
  .spread-view .dots { display: none; }
  .spread-view .edge { top: 38px; bottom: 0; width: var(--side); }
  /* The small page is set closer, for the words of a beat to fit it at once: narrower margins (the frame's too, so it
     holds about as many words as the plain page did), a shorter step between paragraphs and between plates. */
  .spread-view .page.text { padding: 10% 9% 6%; }
  .spread-view[data-look=page] .page.text:has(> .col) { padding: 4% 5%; }
  .spread-view[data-look=page] .page.text .col { padding: .55em .8em .6em; }
  .spread-view[data-look=vignette] .page.text { padding: 7% 9% 11%; }
  .spread-view .col p + p { margin-top: .35em; }
  .spread-view .col .plate + .plate.head { margin-top: .7em; }
  .spread-view .opening h1 { font-size: 24px; }
  .spread-view .opening p { font-size: 14px; }
  /* The end, as the owner asked on 18.11 (scrolling down inside a sideways book is awkward): «Конец», and on the right
     only the first end card in the middle of the page, with a quiet line under it to turn the phone upright for the rest
     (the ribbon's end has them all). The page still scrolls if that card grows (the reasons after «Нет»). */
  .spread-view .page.cards { display: flex; flex-direction: column; padding: 6% 8%; }
  .spread-view .page.cards .end-cards { min-height: 0; margin-top: auto; }
  .spread-view .page.cards .end-cards > :not(:first-child) { display: none; }
  .spread-view .turn-hint {
    display: block; margin: 14px 0 auto; font-size: 12px; line-height: 1.35; text-align: center; text-wrap: balance;
    color: var(--leaf-muted);
  }
  .spread-view .turn-hint .icon { width: 15px; height: 15px; margin-inline-end: 5px; vertical-align: -3px; }
  .spread-view .turn-hint[hidden] { display: none; }
  .spread-view .page.cards:has(> .turn-hint[hidden]) .end-cards { margin-bottom: auto; }
}
