/* House of Jenny v10.2 · the physical lavender book (closed tome, opening, reader materials)
   Sources: v8 library 03_BOOK (exact 346×394 cutout), 04_READER/LIVE_PAGE_MATERIALS, PAGE_CORNERS, TABS,
   06_MOTION/GOLD_ORBIT. Geometry (book units): board 640×700 hinged at the gutter (x 620, y −20); spine 144.4 deep.
   The board and spine are mapped from the same cutout, so at the closed turn (36.15°) they project onto the art. */

/* ---------- closed: the exact cutout, flat, pixel-identical (drawn over the tome while the book is shut) */
.hj-closed{position:absolute;left:0;top:0;width:0;height:0;z-index:12;cursor:pointer;opacity:0;pointer-events:none;
  background:url(../assets/scene/book-closed-lavender.webp?v=10.0) 0 0/100% 100% no-repeat;
  filter:drop-shadow(0 22px 18px rgba(96,62,74,.26)) drop-shadow(0 4px 6px rgba(96,62,74,.16))}
#fit:has(#book[data-state=closed]) .hj-closed{opacity:1;pointer-events:auto}
.single .hj-closed,.single .hj-orbit,.single .hj-glow{display:none}

/* ---------- the tome: board (cover) + spine plane, hidden behind the flat cutout until the opening starts */
body:not(.single) .cover{left:620px;top:-20px;width:640px;height:700px}
body:not(.single) .cover-front{border-radius:0 3px 3px 0;filter:none;
  background:url(../assets/scene/book-closed-lavender.webp?v=10.0) -105.5px 0/745.5px 700px no-repeat}
body:not(.single) .cover-front:hover{filter:none}
body:not(.single) .cover-spine{display:block;position:absolute;left:475.6px;top:-20px;width:144.4px;height:700px;
  transform-origin:100% 50%;transform:rotateY(-90deg);backface-visibility:hidden;-webkit-backface-visibility:hidden;
  background:url(../assets/scene/book-closed-lavender.webp?v=10.0) 0 0/1020px 700px no-repeat}
body:not(.single) .book[data-state=closed] .cover,body:not(.single) .book[data-state=closed] .cover-spine{visibility:hidden}
.book[data-state=open] .cover-spine{visibility:hidden}
/* inside of the board: lavender turn-in, ivory pastedown, a gilt hairline (no separate back art exists: v8 matrix) */
.cover-back{border-radius:3px 0 0 3px;background:url(../assets/scene/reader/cloth-lavender.webp?v=10.2) 0 0/108px 128px,#D3ACB7!important}
.hj-pastedown{position:absolute;left:18px;top:18px;right:6px;bottom:18px;
  background:url(../assets/scene/reader/paper-left.webp?v=10.2) center/100% 100%,#F7ECE4;
  box-shadow:inset 0 0 0 1px rgba(169,132,63,.35),inset -14px 0 22px -10px rgba(110,74,60,.18)}

/* ---------- opening states (js: cinematicOpen) */
.book.hj-op::before{clip-path:inset(0 0 0 50%)}                 /* only the back board until the front board lands */
.book.hj-op.hj-op-landed::before{clip-path:none}
.book.hj-op .spread.on .page.left{animation:none!important;opacity:0}
.book.hj-op.hj-op-left .spread.on .page.left{opacity:1}
.book.hj-op .tabs,.book.hj-op .corner,.book.hj-op .block-left{opacity:0!important;transition:opacity .45s var(--ease)}
.book.hj-op.hj-op-tabs .tabs,.book.hj-op.hj-op-tabs .block-left{opacity:1!important}
.book.hj-op::after{opacity:0}
.hj-oleaves .leaf .face{background:none}
.hj-paper{position:absolute;inset:0}
.hj-paper.r{background:url(../assets/scene/reader/paper-right.webp?v=10.2) 0 0/100% 100%,#F7ECE4}
.hj-paper.l{background:url(../assets/scene/reader/paper-left.webp?v=10.2) 0 0/100% 100%,#F7ECE4}
/* v10.5 bending leaves: three hinged strips per leaf, each face windows a full-size page holder */
.hj-oleaves .hj-bleaf{width:620px}
.hj-lseg{position:absolute;top:0;height:660px;transform-style:preserve-3d;transform-origin:0 50%;will-change:transform}
.hj-lseg>.face{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;overflow:hidden;background:none}
.hj-lseg>.face.back{transform:rotateY(180deg)}
.hj-lhold{position:absolute;left:0;top:0;width:620px;height:660px}
.hj-lhold>.page{left:0!important}
.hj-lshade{position:absolute;left:620px;top:0;width:620px;height:660px;pointer-events:none;opacity:0;transform:translateZ(1px);
  background:linear-gradient(90deg,rgba(84,58,70,.34),rgba(84,58,70,.12) 38%,rgba(84,58,70,0) 75%)}
.hj-flycrest{position:absolute;left:50%;top:41%;--mono-h:118px;transform:translate(-50%,-50%);opacity:.92}

/* ---------- gold orbit (registered 1280×860 frames; centred on the book by js) + warm spine light */
.hj-orbit{position:absolute;left:0;top:0;width:0;aspect-ratio:1280/860;z-index:13;pointer-events:none;opacity:0;will-change:transform,opacity;
  filter:brightness(1.18) drop-shadow(0 0 3px rgba(255,222,150,.95)) drop-shadow(0 0 10px rgba(255,204,120,.75))}
.hj-orbit img{position:absolute;inset:0;width:100%;height:100%;opacity:0}
.hj-glow{position:absolute;left:0;top:0;width:0;height:0;z-index:11;pointer-events:none;opacity:0;mix-blend-mode:screen;
  background:radial-gradient(closest-side,rgba(255,232,176,.95),rgba(255,200,118,.52) 44%,rgba(255,190,100,0) 80%);filter:blur(4px)}

/* ---------- reading: the same pedestal, pushed past by the camera, shows only its rim under the book */
[data-scene=reading] .hj-pedestal{opacity:1!important;top:var(--ped-r-top);width:var(--ped-r-w)}
[data-scene=reading] .hj-contact{opacity:0}

/* ================= reader: the SAME lavender book (v8 04_READER materials on the live DOM) ================= */
/* boards: lavender cloth sampled from the cover itself, 20 units of overhang all round (= the cover board), gilt hairline */
body:not(.single) .book::before{inset:-20px;border-radius:5px 7px 7px 5px;
  background:url(../assets/scene/reader/cloth-lavender.webp?v=10.2) 0 0/108px 128px,linear-gradient(180deg,#D7B2BF,#C9A1B1);
  box-shadow:0 46px 60px -36px rgba(80,44,62,.55),0 10px 20px -10px rgba(80,44,62,.3),inset 0 0 0 1px rgba(201,165,90,.75),inset 0 0 0 3px rgba(255,240,230,.18),inset 0 0 18px rgba(90,50,70,.22)}
/* curved ivory paper (material slices of the approved open book) under the live page content */
body:not(.single) .page.left{background-image:url(../assets/scene/reader/paper-left.webp?v=10.2)!important;background-size:100% 100%!important;background-color:#F7ECE4!important}
body:not(.single) .page.right{background-image:url(../assets/scene/reader/paper-right.webp?v=10.2)!important;background-size:100% 100%!important;background-color:#F7ECE4!important}
/* centre binding: the gutter of the same book */
body:not(.single) .spine-shade{left:590px;width:60px;opacity:1;background:linear-gradient(90deg,rgba(90,56,48,0),rgba(90,56,48,.07) 30%,rgba(90,56,48,.2) 47%,rgba(60,36,30,.32) 50%,rgba(90,56,48,.2) 53%,rgba(90,56,48,.07) 70%,rgba(90,56,48,0))!important}
/* the sewn binding itself: a thin slice of the approved book's gutter, centred on the spine */
body:not(.single) .spine-shade::after{content:"";position:absolute;left:21px;width:18px;top:0;bottom:0;opacity:.55;background:url(../assets/scene/reader/binding.webp?v=10.2) center/100% 100% no-repeat}
/* thick gilded page edges (fore-edges), width still follows reading progress */
body:not(.single) .block-edge{background:url(../assets/scene/reader/gilt-edge-left.webp?v=10.2) center/100% 100% no-repeat;box-shadow:0 2px 3px rgba(80,44,62,.18);top:-2px;bottom:-4px}
body:not(.single) .block-right{background-image:url(../assets/scene/reader/gilt-edge-right.webp?v=10.2);--w:calc(var(--rw,10px) + 9px)}
body:not(.single) .block-left{--w:calc(var(--lw,4px) + 9px)}

/* chapter tabs: see css/hoj-v11-nav.css (v11.0, one definition) */

/* small gold arrows in the bottom outer page corners (v8 PAGE_CORNERS art); the destination stays in the accessible name */
body:not(.single) .book .corner{width:74px;height:64px;max-width:none;padding:0!important;bottom:0;
  background:url(../assets/scene/reader/corner-next.webp?v=10.2) right bottom/100% 100% no-repeat;transition:transform .2s var(--ease),filter .2s var(--ease)}
body:not(.single) .book .corner-prev{left:0;background-image:url(../assets/scene/reader/corner-prev.webp?v=10.2);background-position:left bottom}
body:not(.single) .book .corner-next{right:0}
body:not(.single) .book .corner::before{content:none!important;animation:none!important}
body:not(.single) .book .corner span{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
body:not(.single) .book .corner:hover,body:not(.single) .book .corner:focus-visible{filter:brightness(1.06) drop-shadow(0 0 6px rgba(201,165,90,.55));transform:translateY(-2px)}

/* the paper's foot margin: the live text keeps its position; the bottom padding only had 3–4 px of slack on About */
body:not(.single) .page{padding-bottom:58px!important}

/* phones / single page: the same lavender boards frame the page */
.single .book::before{background:url(../assets/scene/reader/cloth-lavender.webp?v=10.2) 0 0/108px 128px,linear-gradient(180deg,#D7B2BF,#C9A1B1)!important;
  box-shadow:0 18px 30px -18px rgba(80,44,62,.45),inset 0 0 0 1px rgba(201,165,90,.75)!important;border-radius:6px}

/* ================= v10.4 · the closed book settles with a light sweep on its gold (approved board, step 02) ======== */
.hj-closed::after{content:"";position:absolute;inset:0;pointer-events:none;mix-blend-mode:screen;
  -webkit-mask:url(../assets/scene/book-closed-lavender.webp?v=10.0) 0 0/100% 100% no-repeat;mask:url(../assets/scene/book-closed-lavender.webp?v=10.0) 0 0/100% 100% no-repeat;
  background:linear-gradient(110deg,rgba(255,236,190,0) 40%,rgba(255,240,205,.55) 47%,rgba(255,226,160,.85) 50%,rgba(255,240,205,.55) 53%,rgba(255,236,190,0) 60%) 130% 0/300% 100% no-repeat;opacity:0}
.world[data-scene=enter] .hj-closed::after,.world[data-scene=book] .hj-closed::after{animation:hjSweep .85s cubic-bezier(.4,0,.2,1) .85s 1 both}
@keyframes hjSweep{0%{opacity:0;background-position:130% 0}15%{opacity:1}85%{opacity:1}100%{opacity:0;background-position:-30% 0}}
/* golden dust rising from the spine while the board opens */
.hj-glow i{position:absolute;left:50%;bottom:30%;width:3px;height:3px;border-radius:50%;background:#FFE7B0;box-shadow:0 0 6px 2px rgba(255,214,140,.85);opacity:0;
  animation:hjDust 1.3s ease-out infinite}
.hj-glow i:nth-child(2){left:42%;animation-delay:.15s;animation-duration:1.5s}.hj-glow i:nth-child(3){left:58%;animation-delay:.3s}
.hj-glow i:nth-child(4){left:46%;animation-delay:.45s;animation-duration:1.1s}.hj-glow i:nth-child(5){left:54%;animation-delay:.6s;animation-duration:1.4s}
.hj-glow i:nth-child(6){left:38%;animation-delay:.2s}.hj-glow i:nth-child(7){left:62%;animation-delay:.5s;animation-duration:1.6s}
.hj-glow i:nth-child(8){left:50%;animation-delay:.75s}.hj-glow i:nth-child(9){left:44%;animation-delay:.9s;animation-duration:1.2s}
@keyframes hjDust{0%{opacity:0;transform:translate(0,0) scale(.6)}20%{opacity:1}100%{opacity:0;transform:translate(var(--dx,6px),-34vh) scale(1)}}
.hj-glow i:nth-child(odd){--dx:-8px}
