/* The welcome book: sage cloth boards, cream paper pages and a leaf that turns about the spine (book.js). The boards
   stand 10px proud of the pages, as a hardcover's do. */
.reader{display:grid;gap:22px;justify-items:center}
.stage{width:100%;display:grid;justify-items:center;padding-block:14px}
.book{position:relative;width:min(100%,880px);aspect-ratio:1.71/1;perspective:2400px;cursor:pointer;outline-offset:16px}
.board{position:absolute;top:-10px;bottom:-10px;width:calc(50% + 10px);background:#6f8a63 url(photos/linen.jpg) 0 0/420px auto repeat;box-shadow:inset 0 0 0 1px #00000014,0 26px 40px -26px #4a3a2299}
.board.l{left:-10px;border-radius:9px 2px 2px 9px;box-shadow:inset -10px 0 14px -10px #0000003a,0 26px 40px -26px #4a3a2299}
.board.r{right:-10px;border-radius:2px 9px 9px 2px;box-shadow:inset 10px 0 14px -10px #0000003a,0 26px 40px -26px #4a3a2299}
.book.closed .board.l{opacity:0}
/* Paper: a faint grain, page edges stacked at the outer side, and the gutter shading toward the spine. */
.pg{position:absolute;top:0;bottom:0;width:50%;overflow:hidden;display:flex;flex-direction:column;
  background:#fffdf6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .28 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E")}
.pg.l{left:0;border-radius:3px 0 0 3px;box-shadow:inset -26px 0 30px -24px #5a3f1f55,-2px 0 0 #efe7d6,-3px 1px 0 #e3d8c2,-5px 2px 0 #efe7d6,-6px 3px 0 #ddd1b9}
.pg.r{right:0;border-radius:0 3px 3px 0;box-shadow:inset 26px 0 30px -24px #5a3f1f55,2px 0 0 #efe7d6,3px 1px 0 #e3d8c2,5px 2px 0 #efe7d6,6px 3px 0 #ddd1b9}
.pg.blank{background:transparent;box-shadow:none}
.pg[hidden]{display:none}
/* The turning leaf: two faces back to back. */
.turnleaf{position:absolute;top:0;bottom:0;width:50%;transform-style:preserve-3d;z-index:4;pointer-events:none}
.turnleaf[hidden]{display:none}
.turnleaf.fwd{right:0;transform-origin:0 50%}
.turnleaf.bwd{left:0;transform-origin:100% 50%}
.turnleaf .face{position:absolute;inset:0;width:auto;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.turnleaf .face.back{transform:rotateY(180deg)}
.turnleaf.fwd .face.front:not(.coverface):not(.insideface){border-radius:0 3px 3px 0}
.turnleaf .shade{position:absolute;inset:0;pointer-events:none;opacity:0;background:linear-gradient(90deg,#3a2a1499,#3a2a1400 70%);z-index:2}
.turnleaf.bwd .shade{background:linear-gradient(270deg,#3a2a1499,#3a2a1400 70%)}
/* The cover is the board itself, so it stands 10px proud like the boards; inside it, the endpaper is pasted down. */
.coverface,.insideface{top:-10px;bottom:-10px;background:#6f8a63 url(photos/linen.jpg) 0 0/420px auto repeat;box-shadow:none;padding:0}
.coverface img{width:100%;height:100%;object-fit:cover;display:block;border-radius:inherit}
.turnleaf.fwd .coverface,.turnleaf.fwd .insideface{left:0;right:-10px;border-radius:2px 9px 9px 2px}
.turnleaf.bwd .coverface,.turnleaf.bwd .insideface{left:-10px;right:0;border-radius:9px 2px 2px 9px}
.book.closed .turnleaf .coverface{box-shadow:0 30px 44px -26px #4a3a22aa,inset 6px 0 8px -6px #00000040}
.insideface .inset{position:absolute;top:10px;bottom:10px;left:10px;right:0;display:flex;flex-direction:column;box-shadow:inset -20px 0 26px -22px #5a3f1f55}
.controls{display:flex;gap:12px;align-items:center}
.controls span{min-width:11ch;text-align:center;font:800 14px/1 var(--display);color:var(--ink-soft);font-variant-numeric:tabular-nums}
.caption{max-width:62ch;text-align:center;color:var(--ink-soft);font-size:15px;min-height:3.2em}

@media (max-width:600px){
  .controls{flex-wrap:wrap;justify-content:center;max-width:100%}
  .controls span{flex-basis:100%;order:-1}
  .book{width:min(86%,400px);aspect-ratio:.855/1}
  .board.l,.pg.l{display:none}
  .board.r{left:-10px;width:auto;border-radius:9px}
  .pg.r{width:100%;border-radius:3px;box-shadow:inset 18px 0 22px -20px #5a3f1f44,2px 0 0 #efe7d6,3px 1px 0 #e3d8c2,5px 2px 0 #efe7d6}
  .turnleaf{width:100%}
}
