/* Both sides belong to one board. In ordinary flow both remain readable. */
.book-ending {
  --table: radial-gradient(ellipse at 71% 18%, #f2f2eb 0%, transparent 53%),
    linear-gradient(125deg, #d7d9d4, #e8e8e1 49%, #d8d9d4);
  --stock: #e5e5dd url("assets/binding/arch-endpaper.webp") center / cover;
  position: relative;
  background: #e5e5e0;
}
.book-stage { background: var(--table); position: relative; display: flow-root; }
.book-perspective, .book-pivot, .book-board { display: contents; }
.book-block { display: none; }
.book-lining { position: relative; background: var(--stock); color: #252822; }
.book-colophon {
  box-sizing: border-box; display: flex; flex-flow: column nowrap; align-items: flex-end;
  justify-content: flex-end; gap: clamp(14px, 2.2vh, 24px);
  padding: clamp(32px, 6.7vw, 104px); margin: 0; border: 0;
  min-height: min(74svh, 42rem);
}
.book-colophon .brand {
  display: inline-block; font-weight: 600; font-size: clamp(50px, 8.5vw, 128px);
  line-height: .98; letter-spacing: -.073em;
}
.book-colophon .brand-dot { color: #293f9e; font-size: .23em; margin: .24em 0 0 .24em; }
.book-colophon .colophon-rule {
  display: flex; align-items: center; justify-content: space-between;
  width: min(100%, 26rem); gap: 16px; padding-top: 12px;
  border-top: 1px solid #96998e; color: inherit;
}
.colophon-rule p { margin: 0; font-size: clamp(12px, .95vw, 15px); line-height: 1.55; }
.book-colophon button {
  margin: 0; color: inherit; display: inline-flex; align-items: center; min-height: 44px;
  background: transparent; border: 0; padding: 6px 2px; font-size: 14px;
  text-decoration: underline; text-underline-offset: .33em; white-space: nowrap;
}
.book-colophon :is(a, button):focus-visible { outline: 2px solid #283e9c; outline-offset: 4px; }
.book-jacket {
  position: relative; width: min(72%, clamp(15rem, 48svh, 29rem)); aspect-ratio: 12 / 17;
  margin: clamp(28px, 7vh, 72px) auto;
  background: #293c94 url("assets/binding/cobalt-linen.webp") center / 100% 100%;
  color: #faf6df; container-type: inline-size;
  box-shadow: inset 1px 1px 2px #c9cdff63, inset -1px -2px 2px #0e1e539e;
}
.book-jacket::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(to left, #050f3b52, #435aa316 2.1%, #101c545e 3.9%, #8997d446 4.6%, transparent 5.8%);
}
.book-jacket h2 {
  position: absolute; top: 12%; left: 10%; right: 9%; margin: 0;
  font-size: clamp(1.3rem, 2.9vw, 2.8rem); font-size: 9.1cqi;
  line-height: 1.22; letter-spacing: -.055em; font-weight: 525; text-shadow: 0 1px 1px #1b2865;
}
.book-jacket h2 span { display: block; }
.book-imprint {
  position: absolute; bottom: 8%; left: 10%; font-size: 1rem; font-size: 5cqi;
  letter-spacing: -.065em; font-weight: 620;
}
.book-imprint span { margin-inline-start: .09em; }

@media screen and (prefers-reduced-motion: no-preference) {
  .book-ending[data-bound]::after {
    content: ""; display: block; height: calc(var(--receive-run, 0px) + var(--read-run) + var(--close-run));
  }
  [data-paper-book] .book-ending[data-bound] { --receive-run: var(--sheet-run); }
  [data-bound] .book-stage {
    position: sticky; top: 0; height: var(--open-height, 100svh); overflow: clip;
    perspective: max(1800px, 200vw); perspective-origin: 50% 50%;
  }
  [data-bound] .book-perspective {
    display: block; position: absolute; left: 0; top: 50%;
    width: var(--leaf-width, 100%); aspect-ratio: 12 / 17;
    transform: translateY(-50%); transform-style: preserve-3d;
  }
  [data-bound] :is(.book-pivot, .book-board) {
    display: block; position: absolute; inset: 0;
    transform-origin: left center; transform-style: preserve-3d;
  }
  [data-bound] .book-pivot { transform: translateX(var(--spine-x, 0px)) scale(var(--book-scale, 1)); }
  [data-bound] .book-block {
    display: block; position: absolute; inset: 0 100% 0 -100%;
    border-radius: 2px 1px 1px 3px; pointer-events: none;
    background: linear-gradient(to left, #242e3e55, transparent 10%), var(--stock);
    box-shadow: inset -2px 0 2px #7f8074, inset 1px 1px 1px #faf9ea,
      0 2px #b7b9af, 0 4px #a6a99f, 0 6px #394779, -8px 17px 25px #191e2c28;
  }
  [data-bound] .book-board { transform: translateZ(1px) rotateY(var(--board-angle, 0deg)); }
  [data-bound] :is(.book-lining, .book-jacket) {
    position: absolute; inset: 0; margin: 0; width: auto; aspect-ratio: auto;
    -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 1px 3px 3px 1px;
  }
  [data-bound] .book-lining {
    box-shadow: inset 1px 1px 2px #81847687, inset -1px 0 1px #fffff3;
  }
  [data-bound] .book-lining::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, #262e49 0%, #404962 100%); opacity: var(--board-shade, 0);
  }
  [data-bound] .book-colophon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: var(--open-width); height: var(--open-height); min-height: 0;
    padding-bottom: max(clamp(36px, 8vh, 100px), env(safe-area-inset-bottom));
  }
  [data-bound] .book-jacket { transform: rotateY(180deg); }
  [data-bound] .book-jacket h2 { font-size: clamp(9.1cqi, var(--cover-type-floor), 15cqi); }
  [data-bound] .book-stage[data-back] .book-lining { pointer-events: none; }
}
@media (max-width: 680px) {
  .book-colophon { padding-inline: 24px; }
}
