/* LND-221 / WIZ-116: the first two pictures open as a book. One file for the
   home page and /new (static/preview-book.js). The home page loads no
   theme.css, so every colour here carries its own fallback. */
.pb{--pb-paper:#FBF6EA;--pb-ink:#2A2A22;--pb-green:var(--green-800,#414E26);--pb-green-500:var(--green-500,#677E32);
  --pb-line:var(--line,#E6E8DF);--pb-ease:cubic-bezier(.3,.7,.3,1);
  container-type:inline-size;position:relative;display:grid;gap:10px;min-width:0}
.pb-in{position:relative;perspective:1500px;perspective-origin:50% 30%}
.pb-vp{position:relative;overflow:hidden;border-radius:6px 14px 14px 6px;background:var(--pb-paper);
  box-shadow:0 1px 0 #e9e1cb,0 14px 30px rgba(65,78,38,.18)}
.pb-track{display:flex;transition:transform .55s var(--pb-ease);touch-action:pan-y}
.pb-leaf{flex:0 0 100%;min-width:0;display:flex;flex-direction:column}
.pb-art{aspect-ratio:11/8.5;overflow:hidden;background:#EDF1DE}
.pb-art img{width:100%;height:100%;object-fit:cover;object-position:50% 58%;display:block;user-select:none;-webkit-user-drag:none}
/* LND-255: a fixed height, so every page (and the wait's empty page) is one size; the verse shrinks to fit */
.pb-words{flex:0 0 auto;height:clamp(150px,46cqw,196px);min-height:0;box-sizing:border-box;overflow:hidden;padding:16px 8% 20px;background:var(--pb-paper);display:grid;place-items:center}
.pb-verse{margin:0;text-align:center;color:var(--pb-ink);font:400 19px/1.36 'Gochi Hand','Comic Sans MS','Chalkboard SE',cursive}
.pb-verse span{display:block;text-wrap:balance;opacity:0;transform:translateY(5px);transition:opacity .6s,transform .6s var(--pb-ease)}
.pb-leaf.read .pb-verse span{opacity:1;transform:none}
.pb-leaf.now .pb-verse span{transition:none}

/* the page that holds the rest of the story */
.pb-wait{flex:1;display:grid;grid-template-columns:minmax(0,1fr);min-width:0;place-items:center;padding:14px;background:var(--pb-paper)}
.pb-wait-in{width:100%;height:100%;border:2px dashed #d9cfb2;border-radius:12px;display:grid;align-content:center;justify-items:center;
  gap:12px;padding:20px 16px;text-align:center}
.pb-wait .owl{--s:60px}
.pb-wait h4{margin:0;font:400 28px/1.05 'Mouse Memoirs','Luckiest Guy','Arial Narrow',sans-serif;letter-spacing:.02em;color:var(--pb-green);text-wrap:balance}
.pb-wait p{margin:0;color:#6a634f;font-size:14px;line-height:1.45;max-width:30ch}
.pb-wait button{max-width:300px;width:100%;white-space:normal;line-height:1.25;text-wrap:balance}   /* LND-243: never wider than the page */

/* the closed book: a hardcover with thickness, tilted a little, alone. Its
   inside shows only where the open book really is (LND-221). */
.pb[data-state="closed"] .pb-vp,.pb[data-state="flat"] .pb-vp{opacity:0}
.pb.opening .pb-vp{transition:opacity 0s .5s}
.pb-bk{--T:15px;position:absolute;z-index:3;top:0;bottom:0;left:0;width:100%;transform-style:preserve-3d;pointer-events:none;
  transform:rotateX(8deg) rotateY(16deg) rotateZ(-1deg) scale(.93);transition:transform .7s var(--pb-ease)}
.pb[data-state="wait"] .pb-bk,.pb[data-state="still"] .pb-bk,.pb[data-state="wait"] .pb-sit,.pb[data-state="still"] .pb-sit{display:none}
.pb[data-state="flat"] .pb-bk{transform:none}
.pb[data-state="closed"] .pb-bk{animation:pb-rise .7s var(--pb-ease)}
@keyframes pb-rise{from{opacity:0}to{opacity:1}}
.pb[data-state="open"] .pb-bk{transform:none}
.pb.landed .pb-bk{visibility:hidden}
.pb-bk > div{position:absolute}
.pb-back{inset:0;border-radius:3px 9px 9px 3px;background:#26391a;transform:translateZ(calc(var(--T) * -1));box-shadow:-22px 30px 34px rgba(30,40,15,.3)}
.pb-edge.r{top:4px;bottom:4px;left:calc(100% - 4px);width:var(--T);transform-origin:0 50%;transform:rotateY(90deg);
  background:repeating-linear-gradient(90deg,#fbf5e4 0 1.6px,#ddd0ab 1.6px 2.4px)}
.pb-edge.b{left:5px;right:4px;top:calc(100% - 4px);height:var(--T);transform-origin:50% 0;transform:rotateX(-90deg);
  background:repeating-linear-gradient(180deg,#fbf5e4 0 1.6px,#ddd0ab 1.6px 2.4px)}
.pb-front{inset:0;transform-style:preserve-3d;transform-origin:0 50%;transition:transform 1.15s cubic-bezier(.55,.06,.25,1) .5s}
.pb[data-state="open"] .pb-front{transform:rotateY(-180deg)}
.pb-face{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:3px 9px 9px 3px;overflow:hidden}
.pb-face.front{display:flex;flex-direction:column;background:#FFF7E3}
.pb-cv-art{flex:1;min-height:0;overflow:hidden}
.pb-cv-art img{width:100%;height:100%;object-fit:cover;object-position:50% 40%;display:block}
.pb-cv-band{flex:0 0 27%;display:grid;align-content:center;justify-items:center;gap:2px;padding:4px 10% 6px 14%;text-align:center;
  background:#FFF7E3;border-top:3px solid var(--pb-green-500);overflow:hidden}
.pb-cv-band b{display:block;font:400 20px/1.05 'Titan One','Arial Black',sans-serif;color:#3d5d1c;letter-spacing:.01em;text-wrap:balance}
.pb-cv-band small{display:block;font:600 9px/1.2 system-ui,sans-serif;letter-spacing:.16em;text-transform:uppercase;color:#8a7a52}
.pb-face.front::before{content:"";position:absolute;z-index:2;inset:0 auto 0 0;width:8%;
  background:linear-gradient(90deg,rgba(0,0,0,.32),rgba(0,0,0,.08) 70%,rgba(255,255,255,.18) 86%,rgba(0,0,0,.18))}
.pb-face.front::after{content:"";position:absolute;z-index:2;inset:0;pointer-events:none;
  background:linear-gradient(118deg,rgba(255,255,255,.28),rgba(255,255,255,0) 32%,rgba(255,255,255,0) 72%,rgba(255,255,255,.1));
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.18),inset -2px -2px 0 rgba(0,0,0,.12)}
.pb-face.back{transform:rotateY(180deg);background:var(--pb-paper);border-radius:6px 0 0 6px}
.pb-sit{position:absolute;z-index:4;right:-6px;top:-34px;--s:48px;transition:right .55s var(--pb-ease),top .55s var(--pb-ease),opacity .3s}
.pb[data-state="closed"] .pb-sit,.pb[data-state="flat"] .pb-sit{top:-14px;right:2%}
.pb.done .pb-sit{opacity:0}

/* a puff of paper leaves as the cover lifts */
.pb-puff{position:absolute;left:10%;top:40%;width:0;height:0;z-index:5;pointer-events:none}
.pb-puff i{position:absolute;width:10px;height:10px;border-radius:0 100% 0 100%;opacity:0;animation:pb-puff 1.4s var(--pb-ease) forwards}
@keyframes pb-puff{0%{opacity:0;transform:translate(0,0) rotate(0) scale(.4)}15%{opacity:1}
  100%{opacity:0;transform:translate(var(--dx),var(--dy)) rotate(var(--r)) scale(1)}}

/* turning the pages */
.pb-pager{display:flex;align-items:center;justify-content:center;gap:14px;opacity:0;transition:opacity .4s}
.pb.landed .pb-pager{opacity:1}
.pb-pager button{border:1px solid var(--pb-line);background:#fff;width:44px;height:44px;border-radius:50%;cursor:pointer;
  display:grid;place-items:center;color:var(--pb-green);padding:0}
.pb-pager button:disabled{opacity:.35;cursor:default}
.pb-pager button svg{width:18px;height:18px}
.pb-pager button.nudge{animation:pb-nudge 1.6s ease-in-out infinite;border-color:#B4C979}
@keyframes pb-nudge{0%,100%{transform:none}50%{transform:translateX(4px)}}
.pb-dots{display:flex;gap:6px}
.pb-dots i{width:7px;height:7px;border-radius:50%;background:var(--pb-line);transition:background .3s,width .3s}
.pb-dots i.on{background:var(--pb-green-500);width:18px;border-radius:4px}

/* wide: a real spread, words left, picture right (the printed book's order) */
@container (min-width: 480px){
  .pb-vp{border-radius:6px}
  .pb-leaf{display:grid;grid-template-columns:1fr 1fr;aspect-ratio:22/8.5;overflow:hidden}
  .pb-leaf .pb-words{order:-1;min-height:0;height:auto;padding:8% 9%;border-right:1px solid #eee3c8;box-shadow:inset -18px 0 22px -18px rgba(90,70,30,.18)}
  .pb-leaf .pb-art{aspect-ratio:auto;height:100%}
  /* LND-243: the page after the pictures is a spread like them, Pip's words
     on the left page and the button on the right one, so nothing in it can
     run past the page's bottom (it was one column, sliced at the button) */
  .pb-wait{grid-column:1 / -1;padding:0;display:block;min-height:0}
  .pb-wait-in{height:100%;border:0;border-radius:0;padding:0;gap:6px 0;
    grid-template-columns:1fr 1fr;grid-template-rows:1fr auto auto 1fr;align-content:stretch}
  .pb-wait-in::before{content:"";grid-column:1;grid-row:1 / -1;justify-self:stretch;align-self:stretch;border-right:1px solid #eee3c8;
    box-shadow:inset -18px 0 22px -18px rgba(90,70,30,.18)}
  .pb-wait-in::after{content:"";grid-column:2;grid-row:1 / -1;justify-self:stretch;align-self:stretch;margin:7% 8%;border:2px dashed #d9cfb2;border-radius:12px;
    background:repeating-linear-gradient(135deg,transparent 0 14px,rgba(217,207,178,.16) 14px 16px)}
  .pb-wait-in > *{grid-column:1;padding-inline:9%}
  .pb-wait .owl{--s:min(44px,13cqw);grid-row:1;align-self:end;padding:0}
  .pb-wait h4{grid-row:2;font-size:clamp(19px,4.6cqw,25px)}
  .pb-wait p{grid-row:3;align-self:start;font-size:clamp(12.5px,2.6cqw,14px)}
  .pb-wait-in > .pb-whole{grid-column:2;grid-row:1 / -1;align-self:center;justify-self:center;z-index:1;width:auto;max-width:76%;
    padding-inline:20px;white-space:normal;line-height:1.25;text-wrap:balance}
  .pb-bk{left:50%;width:50%;bottom:auto;aspect-ratio:11/8.5;--T:18px}   /* LND-255: the right page, where it opens from; it never slides */
  .pb[data-state="closed"] .pb-in::before,.pb[data-state="flat"] .pb-in::before{content:"";position:absolute;inset:0 50% 0 0;
    border:2px dashed rgba(65,78,38,.12);border-right:0;border-radius:6px 0 0 6px}
  .pb.opening .pb-vp{clip-path:inset(0 0 0 50%)}
  .pb-sit{right:-12px}
  .pb-puff{left:50%;top:30%}
}
@media (prefers-reduced-motion: reduce){
  .pb-track,.pb-bk,.pb-front,.pb-verse span{transition:none}
  .pb-pager button.nudge{animation:none}
}

/* LND-254 / WIZ-120: one status line over one box, for the whole wait.
   Its rows keep their room in every phase, so the box never moves. */
.pb-status{display:grid;gap:7px;min-width:0}
.pb-status[hidden]{display:none}
.pb-st-row{display:flex;align-items:center;gap:8px;min-width:0}
.pb-slot{position:relative;flex:none;width:46px;height:32px;box-sizing:border-box;border-radius:6px;border:1.5px dashed #c9cdb8;
  background:#F1F3E6;display:grid;place-items:center;overflow:visible}
.pb-slot b{font:700 12px/1 'Inter Tight',system-ui,sans-serif;color:#8E957D}
.pb-slot.now{border:1.5px solid var(--pb-green-500);background:#F4F6EA;animation:pb-breathe 1.2s ease-in-out infinite alternate}
@keyframes pb-breathe{from{box-shadow:0 0 0 0 rgba(103,126,50,0)}to{box-shadow:0 0 0 4px rgba(103,126,50,.2)}}
.pb-slot.done{border:0;background:none}
.pb-slot img{width:100%;height:100%;object-fit:cover;border-radius:6px;display:block;animation:pb-land .5s cubic-bezier(.3,1.6,.5,1)}
@keyframes pb-land{from{transform:scale(.3);opacity:0}}
.pb-tick{position:absolute;right:-4px;bottom:-4px;width:15px;height:15px;border-radius:50%;background:var(--pb-green-500);
  display:grid;place-items:center;box-shadow:0 0 0 2px #fff}
.pb-tick svg{width:9px;height:9px}
.pb-st-txt{margin:0;flex:1;min-width:0;display:grid;gap:1px}
/* one line each, so the line (and the box under it) never changes height */
.pb-st-label,.pb-st-left{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pb-st-label{font:700 14px/18px 'Inter Tight',system-ui,sans-serif;color:var(--pb-green)}
.pb-st-left{font:500 12.5px/16px 'Inter Tight',system-ui,sans-serif;color:#5F6455;font-variant-numeric:tabular-nums}
.pb-st-left:empty::before{content:"\00a0"}
.pb-st-row2{display:flex;align-items:center;gap:10px}
.pb-st-bar{flex:1;height:5px;border-radius:999px;background:rgba(65,78,38,.13);overflow:hidden}
.pb-st-bar i{display:block;height:100%;width:0;background:var(--pb-green-500);border-radius:inherit;transition:width .4s linear}
.pb-stop{display:inline-flex;align-items:center;gap:7px;flex:none;height:36px;padding:0 14px;border-radius:999px;
  border:1.5px solid #B9BFA8;background:#fff;color:#1F2418;cursor:pointer;font:600 13px/1 'Inter Tight',system-ui,sans-serif}
.pb-stop i{width:8px;height:8px;border-radius:2px;background:#C8390D;flex:none}
.pb-stop:hover{border-color:#8E957D}
.pb-stop:focus-visible{outline:3px solid #B4C979;outline-offset:1px}
.pb-stop:disabled{opacity:.55;cursor:default}
@media (pointer:coarse){.pb-stop{height:44px;padding:0 16px;font-size:14px}}
/* the book is ready: the bar and Stop go, their room stays */
.pb[data-phase="ready"] .pb-st-bar,.pb-stop.off{visibility:hidden}
/* the wait's box: the game plays over an empty page; with reduced motion
   (no game) the still painting owl sits in it */
.pb[data-state="wait"] .pb-vp,.pb[data-state="still"] .pb-vp{background:var(--pb-paper);
  background-image:radial-gradient(rgba(65,78,38,.05) 1px,transparent 1px);background-size:14px 14px}
.pb-ghost .pb-art{background:none}
.pb-ghost .pb-words{background:none}
.pb-quiet{position:absolute;inset:0;display:none;place-items:center;pointer-events:none}
.pb-quiet .owl{--s:72px}
.pb[data-state="wait"] .pb-vp:not(.catching) .pb-quiet{display:grid}
.pb[data-state="still"] .pb-ghost .pb-art{background:#EDF1DE}
.pb[data-state="still"] .pb-ghost .pb-words{background:var(--pb-paper)}
