/* A book's cover (book-cover.js, frames: book-ornaments.js) — shared by the book's own page (book.html) and the
   library's cover turn (book-open-cover.js). Four colours, set per book on an ancestor (Advent.bookColour): --bk-page
   (the ground: the cover has none of its own, it lies on the page), --bk-text (the type), --bk-frame (the frame lines),
   --bk-orn (the flourishes) — as on the refs: blue frames, white flourishes, red type on pink.
   Sizes are in --u = the cover's width / 100, so the cover keeps its proportions on any screen. Flat: strokes and fills
   only, no shadows, no gradients, no pictures. */

.bk-cover { position: relative; flex: none; --u: 5px; color: var(--bk-text); }
.bk-frame { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* the frame's parts: lines in the frame colour, flourishes in their own */
.bk-frame .f { fill: none; stroke: var(--bk-frame); stroke-linejoin: miter; }
.bk-frame .f-fill { fill: var(--bk-frame); }
.bk-frame .o, .bk-div .o { fill: var(--bk-orn); }
.bk-frame .os { fill: none; stroke: var(--bk-orn); }
.bk-div .os { fill: none; stroke: var(--bk-orn); stroke-width: 1.4px; vector-effect: non-scaling-stroke; stroke-linecap: round; }

/* ── the type, a stack centred in the frame's box ── */
.bk-content { position: absolute; display: flex; flex-direction: column; justify-content: center; }
.bk-stack { display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 100%; }
/* on a tall cover the arc keeps to the frame's top and the rest stays in the middle (a blank as tall as the arc below,
   .bk-arc-pair, balances it); the auto margins never close up tighter than the arc's own gap */
.bk-stack > * { margin: 0; }
.bk-stack > .bk-arc:first-child { margin-bottom: calc(var(--u) * 1.8); }
.bk-cover[data-plaque] .bk-stack > .bk-arc:first-child { margin-bottom: calc(var(--u) * 4.2); }
.bk-stack > .bk-title { margin-top: auto !important; }
.bk-stack > .bk-date { margin-bottom: auto !important; }
.bk-arc-pair { flex: none; margin-top: calc(var(--u) * 1.8) !important; }
.bk-arc { display: block; overflow: visible; }
.bk-arc text {
  fill: var(--bk-text); font: 700 max(8.5px, calc(var(--u) * 2.15)) 'Montserrat', sans-serif; letter-spacing: 0.24em; text-transform: uppercase;
}
.bk-title {
  max-width: 100%; margin-block: calc(var(--u) * 1.8) calc(var(--u) * 2.2) !important; text-wrap: balance; overflow-wrap: normal;
  font: 400 calc(var(--u) * 10) / 0.92 'Oranienbaum', serif; text-transform: uppercase; letter-spacing: -0.005em;
}
.bk-cover[data-plaque] .bk-title { margin-block: calc(var(--u) * 4.2) calc(var(--u) * 4.4) !important; padding-inline: calc(var(--u) * 3); }
.bk-div { display: block; }
.bk-author {
  margin-top: calc(var(--u) * 2.2) !important; max-width: 100%; text-wrap: balance;
  font: 700 max(10.5px, calc(var(--u) * 2.7)) / 1.35 'Montserrat', sans-serif; letter-spacing: 0.18em; text-transform: uppercase;
}
/* «5 декабря 2026»: one plain line in the soft italic, no rules or big figures breaking it up */
.bk-date { margin-top: calc(var(--u) * 1.6) !important; font: italic 500 max(15px, calc(var(--u) * 3.4)) / 1.15 'Cormorant Garamond', serif; }

/* ── the quote sticker (book-cover.js sticker): a round sticker over the frame's lower-right corner, a little askew — a
   solid disc in the type colour, a hairline ring in the page colour inside its edge, the quote in the soft italic.
   Flat: one fill, one ring, type. ── */
.bk-sticker { position: absolute; rotate: -9deg; }
.bk-sticker-disc {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--bk-text); color: var(--bk-page);
}
.bk-sticker-disc::before {
  content: ''; position: absolute; inset: calc(var(--u) * 1.1); border-radius: 50%;
  border: max(1px, calc(var(--u) * 0.2)) solid var(--bk-page);
}
.bk-sticker-q {
  position: relative; width: 72%; margin: 0; /* width + size: book-cover.js fitSticker, so every line clears the ring */ text-align: center; text-wrap: balance; overflow-wrap: normal;
  font: italic 500 calc(var(--u) * 2.4) / 1.08 'Cormorant Garamond', serif;
}

/* ── arrival: the frame draws itself in, the flourishes and the lines of type follow; last, the sticker is slapped on ── */
.bk-sticker { animation: bk-stick 560ms cubic-bezier(0.34, 1.56, 0.64, 1) 1100ms both; }
@keyframes bk-stick { from { opacity: 0; scale: 1.45; rotate: -24deg; } }
.bk-frame .ln { stroke-dasharray: 1; stroke-dashoffset: 1; animation: bk-draw 1500ms cubic-bezier(0.45, 0, 0.2, 1) 120ms forwards; }
.bk-frame .ln:nth-of-type(2) { animation-delay: 260ms; }
.bk-frame .ln:nth-of-type(3) { animation-delay: 400ms; }
.bk-frame .ln:nth-of-type(4) { animation-delay: 520ms; }
.bk-plaque .ln { animation-delay: 700ms; }
@keyframes bk-draw { to { stroke-dashoffset: 0; } }
.bk-frame .orn, .bk-frame .f-fill { animation: bk-fade 700ms var(--ease) 900ms both; }
@keyframes bk-fade { from { opacity: 0; } }
.bk-stack > * { animation: bk-in 760ms var(--ease) both; }
.bk-stack > :nth-child(1) { animation-delay: 160ms; }
.bk-stack > :nth-child(2) { animation-delay: 220ms; }
.bk-stack > :nth-child(3) { animation-delay: 290ms; }
.bk-stack > :nth-child(4) { animation-delay: 380ms; }
.bk-stack > :nth-child(5) { animation-delay: 430ms; }
.bk-stack > :nth-child(6) { animation-delay: 480ms; }
.bk-stack > :nth-child(7) { animation-delay: 530ms; }
.bk-stack > :nth-child(8) { animation-delay: 580ms; }
@keyframes bk-in { from { opacity: 0; translate: 0 12px; } }
/* is-static: no arrival (a resize, the end of the library's cover turn, or the turn measuring the cover before it plays) */
.bk-cover.is-static *, .bk-cover.is-static .ln { animation: none !important; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) {
  .bk-cover *, .bk-frame .ln { animation: none !important; stroke-dashoffset: 0; }
}
