/* Pop-up book in style 22-1 "aura starry night": tokens, fonts and bokeh come from ../css/style.css */
html,body{height:100%}
body{padding:0;overflow:hidden}

/* splash exit: the two words part to the sides and fade, the subtitle fades first */
.word{display:flex;gap:.28em;background:none;filter:none}
.word span{display:inline-block;background:linear-gradient(180deg,#fff 10%,#b9b6c4 55%,#6d6a78 100%);-webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 6px 30px rgba(255,255,255,.18));transition:transform 1.1s cubic-bezier(.65,0,.35,1),opacity 1.1s ease-in,filter 1.1s}
.intro.out{opacity:1;filter:none;transform:none;visibility:hidden;transition:visibility 0s 1.1s}
.intro.out .w1{transform:translateX(-55vw);opacity:0;filter:blur(8px)}
.intro.out .w2{transform:translateX(55vw);opacity:0;filter:blur(8px)}
.intro.out .by,.intro.out small{opacity:0;transition:opacity .35s}

/* ---- 3D stage: the book lies on a dark table in the middle of the screen ---- */
.stage{--W:min(69vw,1200px,102vh);--H:calc(var(--W) * 9 / 16);--T:calc(var(--W) * .028);
  /* lift so the book itself (cover, pages, paper block; not the cut-outs) is centred on screen, measured in Chrome */
  --oy-open:calc(var(--H) * -.06);--oy-closed:calc(var(--H) * -.014);position:fixed;inset:0;z-index:1;
  display:grid;place-items:center;perspective:1800px;perspective-origin:50% 30%;user-select:none;-webkit-user-select:none;touch-action:none}
.table-glow{position:absolute;left:50%;top:58%;width:calc(var(--W) * 1.15);height:calc(var(--H) * .75);transform:translate(-50%,-50%);
  background:radial-gradient(closest-side,rgba(169,107,255,.22),rgba(255,110,199,.08) 55%,transparent);filter:blur(20px);pointer-events:none}

.book{position:relative;width:var(--W);height:var(--H);transform-style:preserve-3d;cursor:grab;
  transform:translateY(var(--oy-open,0px)) rotateX(54deg) translateX(0);transition:transform .9s var(--ease)}
.book.closed{transform:translateY(var(--oy-closed,0px)) rotateX(54deg) translateX(-25%)}
.book.grabbing{cursor:grabbing}
/* entrance. Never fade the book element itself: opacity (or filter) below 1 on a preserve-3d element flattens it,
   so the thick book would arrive flat and pop into depth. --fade is applied to the flat leaf surfaces instead,
   and the 3D shape is already built while the splash is on screen. */
@property --fade{syntax:'<number>';inherits:true;initial-value:1}
.book.closed.hidden{--fade:0;transform:translateY(var(--oy-closed,0px)) rotateX(54deg) translateX(-25%) translateZ(-260px)}
.book.entering{transition:transform 1s var(--spring),--fade .7s var(--ease)}
.book .seg,.book .stack i,.book .fan i,.book .board .bh{opacity:var(--fade)}

/* open book = a V, like a real book lying open (Rowan 2026-11-28): each half (cover board, paper block, page) is hinged on
   the spine and tilted up by --tilt, so the outer edges rise; book.js sets --tilt (0 when shut, ramps while the cover
   turns) and adds the same rise under the cut-outs' feet. The pages also curve down into the gutter (book.js g(u)). */
.book{--tilt:0deg}
.book > .pg.l,.book > .stack.l{transform-origin:100% 50%;transform:rotateY(var(--tilt))}
.book > .pg.r,.book > .stack.r{transform-origin:0 50%;transform:rotateY(calc(var(--tilt) * -1))}

/* inside of the leather covers, under the paper: two halves hinged on the spine; it reaches further at the head so it
   still shows past the raised paper */
.board{position:absolute;left:calc(-1.2% - var(--T) * 1.6);right:calc(-1.2% - var(--T) * 1.6);bottom:-1.4%;top:calc(-1.4% - var(--T) * 1.6);
  transform:translateZ(-1px);transform-style:preserve-3d;pointer-events:none}
.bh{position:absolute;top:0;bottom:0;background:linear-gradient(150deg,#2e2040,#1a1226 60%,#2a1a2e);
  box-shadow:0 40px 80px -20px rgba(0,0,0,.9),0 0 60px -10px rgba(169,107,255,.45)}
.bh.l{left:0;width:calc(50% + 1px);border-radius:10px 0 0 10px;transform-origin:calc(100% - 1px) 50%;transform:rotateY(var(--tilt))}
.bh.r{left:calc(50% - 1px);width:calc(50% + 1px);border-radius:0 10px 10px 0;transform-origin:1px 50%;transform:rotateY(calc(var(--tilt) * -1))}
/* shut, or while the cover turns: only the back board lies on the table (the front board rides on the cover leaf) */
/* shut: no fanned paper, so the board only reaches 1.2% past the block on the right */
.book.closed .bh.l,.book.cover-turn .bh.l{visibility:hidden}
.book.closed .bh.r{width:calc(50% + 1px - var(--T) * 1.6)}
/* gold hairline + travelling border light of style 22 'aura glow bento' (.lit in its reference file, KH vec_525db987485b),
   drawn by book.js as SVG paths along the outer three sides of each half (the light can then follow the V). A pink >
   lilac > violet streak runs clockwise: along the right half in the first 3.5s, the left half in the next. */
.bh .lt{position:absolute;left:0;top:0;overflow:visible;pointer-events:none}
.bh .lt path{fill:none;stroke-linecap:round;stroke-linejoin:round}
.bh .lt .gold{stroke:rgba(214,180,110,.45);stroke-width:1}
.bh .lt .run{stroke-dasharray:var(--len) calc(2000 - var(--len));animation:edge-run 7s linear infinite}
.bh.l .lt .run{animation-delay:-3.5s}
@keyframes edge-run{from{stroke-dashoffset:calc(var(--s) * -1)}to{stroke-dashoffset:calc(var(--s) * -1 - 2000)}}
@media (prefers-reduced-motion:reduce){.bh .lt .run{animation:none;stroke-dashoffset:-300}}
.book.cover-turn > .stack.l{visibility:hidden}
/* inside of the front cover, carried by the cover leaf; same overhang as the board */
.cover-inside{position:absolute;top:calc(-1.4% - var(--T) * 1.6);bottom:-1.4%;backface-visibility:hidden;border-radius:10px;
  background:linear-gradient(150deg,#2e2040,#1a1226 60%,#2a1a2e);box-shadow:0 0 0 1px rgba(214,180,110,.35)}
.leaf.fwd .cover-inside{left:0;right:calc(-2.4% - var(--T) * 1.6)}
.leaf.bwd .cover-inside{left:calc(-2.4% - var(--T) * 1.6);right:0}
.stack.mini{left:0;top:0;width:100%;height:100%}
.board .edge{position:absolute;left:0;right:0;top:calc(100% - 1px);height:7px;transform-origin:top;transform:rotateX(-90deg);
  background:linear-gradient(180deg,#3a2850,#1a1226);border-radius:0 0 6px 6px}

/* ---- curved pages: each surface (half page, or a face of the turning leaf) is a row of thin strips that JS
   bends into the open-book profile: dips into the spine, bulges just beside it, flattens toward the outer edge ---- */
.pg,.leaf .face{position:absolute;transform-style:preserve-3d}
.pg{top:0;width:50%;height:100%}
.pg.l{left:0}.pg.r{right:0}
.book.closed .pg.l{visibility:hidden}
.seg{position:absolute;top:0;height:100%;overflow:hidden;backface-visibility:hidden}
.seg .inner{position:absolute;top:0;height:100%;background-color:#0b0a10;background-repeat:no-repeat}
.seg .ov{position:absolute;inset:0;background:#05030a;opacity:0;pointer-events:none}

/* leather cover: a little bigger than the paper block, like a real binding (the spine side stays flush) */
.pg.r.is-cover{top:-2.25%;height:104.5%;right:-1.5%;width:51.5%}
.leaf .face.front.is-cover{top:-2.25%;bottom:-2.25%;left:0;right:-3%}
.leaf .face.back.is-cover{top:-2.25%;bottom:-2.25%;left:-3%;right:0}
/* title gold-stamped into the empty cartouche of the cover art (19.7%..30.1% high, 26%..78% wide) */
.cover-title{position:absolute;left:26%;width:52%;top:19.7%;height:10.4%;display:flex;align-items:center;justify-content:center;
  font:700 calc(var(--W) * .03)/1 'Palatino Linotype','Book Antiqua',Palatino,serif;font-variant:small-caps;letter-spacing:.06em;
  background:linear-gradient(180deg,#fff3c4 0%,#e9c46a 38%,#b8862f 62%,#f6dc8c 100%);-webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 1px 0 rgba(0,0,0,.65)) drop-shadow(0 0 6px rgba(233,196,106,.35))}

/* story text printed in the dark corner of the left page */
.print{position:absolute;left:6%;bottom:6%;width:62%}
.print h2{margin:0 0 .35em;font-weight:800;font-size:calc(var(--W) * .024);letter-spacing:-.02em;line-height:1.15;
  background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(0 0 8px rgba(255,110,199,.35))}
.print p{margin:0;color:#e6e2ee;font-size:calc(var(--W) * .0125);line-height:1.55;text-shadow:0 1px 6px rgba(0,0,0,.8)}

/* ---- paper blocks under each page; JS sets their height and cuts the front edge to the page curve ---- */
.stack{position:absolute;top:0;width:50%;height:100%;transform-style:preserve-3d;pointer-events:none}
.stack.l{left:0}.stack.r{left:50%}
.stack i{position:absolute}
.stack .near,.stack .side{background:repeating-linear-gradient(var(--dir),#f1e8d2 0 1px,#cbbd9b 1px 2px),#e6dbbf;box-shadow:inset 0 0 12px rgba(60,40,20,.35)}
.stack .near{left:0;right:0;top:calc(100% - 1px);transform-origin:top;--dir:0deg;
  background-image:repeating-linear-gradient(0deg,#f1e8d2 0 1px,#cbbd9b 1px 2px),linear-gradient(90deg,rgba(0,0,0,.25),transparent 8%,transparent 92%,rgba(0,0,0,.25))}
.stack.l .side{top:.6%;bottom:.6%;right:calc(100% - 1px);transform-origin:right;--dir:90deg}
.stack.r .side{top:.6%;bottom:.6%;left:calc(100% - 1px);transform-origin:left;--dir:90deg}
/* leather spine, only seen when the book is shut */
.stack.r .spine{top:-1.4%;bottom:-1.4%;right:calc(100% - 1px);transform-origin:right;
  background:linear-gradient(90deg,#1a1226,#3a2850 30%,#2a1d3c 60%,#140d1e);border-radius:4px;opacity:0;transition:opacity .4s}
.book.closed .stack.r .spine{opacity:var(--fade)}

/* turning leaf, hinged on the spine; JS sets its transform and bends its faces */
.leaf{position:absolute;top:0;width:50%;height:100%;transform-style:preserve-3d;z-index:5;pointer-events:none}
.leaf.fwd{left:50%;transform-origin:0 50%}
.leaf.bwd{left:0;transform-origin:100% 50%}
.leaf .face{inset:0}
.leaf .face.back{transform:rotateY(180deg)}

/* ---- paper cut-outs: --rise 0 = lying flat, 1 = standing; JS drives --rise from the page angle and --pz
   (height of the page under the cut-out's foot). --d staggers each cut-out a little inside the range ---- */
.pieces{position:absolute;inset:0;transform-style:preserve-3d;pointer-events:none;--rise:0}
.leaf .pieces.back{transform:rotateY(180deg)}
.piece,.shadow{--r:clamp(0, (var(--rise) - var(--d, 0)) / (1 - var(--d, 0)), 1)}
.piece{position:absolute;transform-style:preserve-3d;transform-origin:50% 100%;
  transform:translate(-50%,-100%) translateZ(calc(var(--pz, 0px) + 2px)) rotateX(calc(-88deg * var(--r)))}
.piece img{display:block;width:100%;height:auto;filter:drop-shadow(0 0 1px rgba(255,255,255,.35))}
.piece img.mirror{transform:scaleX(-1)}
.piece.glow img{filter:drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 18px rgba(255,110,199,.35))}
.shadow{position:absolute;transform:translate(-50%,-60%) translateZ(calc(var(--pz, 0px) + 1px));height:9%;border-radius:50%;
  background:radial-gradient(closest-side,rgba(0,0,0,.6),transparent);opacity:var(--r)}

/* ---- life on the page (Rowan 2026-11-28): the wind sways the trees from their foot, the mascots breathe, the lantern,
   the moon and the house windows flicker; book.js tags the cut-outs by their picture (KIND in book.js). Each cut-out gets
   its own timing (--sw, --sd) so nothing moves in step. ---- */
.piece.sway img{transform-origin:50% 100%;animation:sway var(--sw,5s) ease-in-out var(--sd,0s) infinite alternate}
@keyframes sway{from{rotate:-1.8deg}to{rotate:1.4deg}}
.piece.breathe img{transform-origin:50% 100%;animation:breathe var(--sw,3.8s) ease-in-out var(--sd,0s) infinite}
@keyframes breathe{0%,100%{scale:1 1}50%{scale:1.008 1.022}}
.piece.glow img{animation:flicker var(--sw,3s) ease-in-out var(--sd,0s) infinite}
@keyframes flicker{0%,100%{filter:drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 14px rgba(255,110,199,.3))}
  45%{filter:drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 26px rgba(255,190,120,.6))}
  60%{filter:drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 20px rgba(255,150,170,.45))}}
.piece.warm img{animation:warm var(--sw,4.5s) ease-in-out var(--sd,0s) infinite}
@keyframes warm{0%,100%{filter:drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 6px rgba(255,170,120,.15))}
  50%{filter:drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 22px rgba(255,170,120,.45))}}

/* fireflies over the open spread: book.js spreads them over the page and lifts each one above the page under it; each
   drifts on its own slow loop (--dx/--dy/--dz) and blinks. The glow dot is turned to face the viewer (the book lies at
   54deg). Hidden while the book is shut. */
.flies{position:absolute;inset:0;transform-style:preserve-3d;pointer-events:none}
.book.closed .flies,.book.cover-turn .flies{visibility:hidden}
.flies i{position:absolute;width:0;height:0;transform-style:preserve-3d;transform:translateZ(var(--z));
  animation:fly var(--fd,9s) ease-in-out var(--fdl,0s) infinite alternate}
@keyframes fly{0%{transform:translateZ(var(--z))}
  35%{transform:translate3d(calc(var(--dx) * .6),calc(var(--dy) * -.4),calc(var(--z) + var(--dz)))}
  70%{transform:translate3d(calc(var(--dx) * -.3),var(--dy),calc(var(--z) + var(--dz) * .4))}
  100%{transform:translate3d(var(--dx),calc(var(--dy) * .3),calc(var(--z) + var(--dz) * -.5))}}
.flies i::after{content:"";position:absolute;left:-4px;top:-4px;width:8px;height:8px;border-radius:50%;
  background:radial-gradient(circle,#fffbe0 0 30%,#e8ff8a 55%,rgba(200,255,106,0) 72%);
  box-shadow:0 0 12px 4px rgba(214,255,120,.6),0 0 30px 11px rgba(214,255,120,.2);
  transform:rotateX(-54deg) scale(var(--fs,1));animation:blink var(--bd,2.6s) ease-in-out var(--bdl,0s) infinite}
@keyframes blink{0%,100%{opacity:.15}40%{opacity:1}55%{opacity:.85}}
@media (prefers-reduced-motion:reduce){.piece img,.flies i,.flies i::after{animation:none!important}}

.hint{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);z-index:5;color:var(--muted);font-size:11px;letter-spacing:.22em;text-transform:uppercase;
  pointer-events:none;transition:opacity 1s;animation:blurIn 1s 1s var(--ease) both}
.hint.gone{opacity:0}

/* antialiasing under 3D transforms: a 1px transparent border keeps each visible edge inside the layer's texture,
   so the GPU filters it instead of drawing a hard stair-stepped edge */
.seg{border:1px solid transparent;top:-1px}
.stack .near,.stack .side,.stack .spine,.bh,.cover-inside{border:1px solid transparent;background-clip:padding-box}

/* fanned pages on the open book's outer sides: stepped sheets of aged paper, each a little shorter than the one
   under it, with a soft shadow where the sheet above lies on it and a darker cut edge */
.fan{position:absolute;inset:0;transform-style:preserve-3d;pointer-events:none}
.fan i{position:absolute;border:1px solid transparent;background-clip:padding-box;border-radius:2px;
  background:linear-gradient(var(--fd),rgba(70,50,30,.45),rgba(70,50,30,0) 38%),
    linear-gradient(var(--fd),hsl(42 45% calc(84% + var(--tone) * 6%)),hsl(38 40% calc(74% + var(--tone) * 6%)));
  box-shadow:inset var(--fx) 0 0 rgba(110,85,55,.55)}
.stack.r .fan i{left:calc(100% - 1px);--fd:90deg;--fx:-1px}
.stack.l .fan i{right:calc(100% - 1px);--fd:270deg;--fx:1px}

/* button under the book: opens the Desktop Mascot home (style 22 gradient pill with glow) */
.cta-home{position:absolute;left:50%;top:calc(50% + var(--H) * .43);transform:translateX(-50%);z-index:6;padding:12px 26px;border-radius:999px;
  color:#fff;font-weight:700;font-size:14px;letter-spacing:.02em;text-decoration:none;background:var(--grad);
  box-shadow:0 10px 28px -8px rgba(255,110,199,.7),0 0 0 1px rgba(255,255,255,.12) inset;
  transition:transform .3s var(--spring),box-shadow .3s,opacity .8s}
.cta-home:hover{transform:translateX(-50%) scale(1.06);box-shadow:0 14px 34px -8px rgba(169,107,255,.8),0 0 0 1px rgba(255,255,255,.18) inset}
.cta-home:focus-visible{outline:2px solid var(--pink);outline-offset:3px}
.cta-home.gone{opacity:0;pointer-events:none}

/* language picker, top right: small frosted pill (style 22) */
.lang-pick{position:fixed;top:16px;right:18px;z-index:30;display:flex;align-items:center;gap:6px;padding:5px 10px 5px 11px;border-radius:999px;
  border:1px solid var(--edge);background:rgba(18,18,22,.55);backdrop-filter:blur(8px);color:var(--muted);font-size:12px;
  transition:border-color .2s,color .2s}
.lang-pick:hover,.lang-pick:focus-within{border-color:rgba(255,110,199,.5);color:var(--ink)}
.lang-pick select{appearance:none;-webkit-appearance:none;border:0;background:transparent;color:var(--ink);font:600 12.5px 'Inter','Segoe UI',sans-serif;
  padding:2px 16px 2px 2px;cursor:pointer;outline:none;
  background-image:linear-gradient(45deg,transparent 50%,var(--pink) 50%),linear-gradient(135deg,var(--pink) 50%,transparent 50%);
  background-position:calc(100% - 7px) 55%,calc(100% - 3px) 55%;background-size:4px 4px;background-repeat:no-repeat}
.lang-pick option{background:#121216;color:var(--ink)}

/* coming-soon modal (style 22: dark glass, breathing pink/violet glow, gradient pill button) */
.soon{width:min(420px,calc(100% - 32px));padding:30px 28px 24px;border:1px solid var(--edge);border-radius:26px;text-align:center;color:var(--ink);
  background:linear-gradient(160deg,#1a1428,var(--card) 45%,#1c1220);box-shadow:0 0 70px -18px rgba(255,110,199,.55)}
.soon[open]{animation:soonPop .6s var(--spring),soonBreathe 4s ease-in-out infinite}
@keyframes soonPop{from{opacity:0;transform:translateY(20px) scale(.96);filter:blur(8px)}}
@keyframes soonBreathe{50%{box-shadow:0 0 90px -12px rgba(169,107,255,.65)}}
.soon::backdrop{background:rgba(5,5,7,.6);backdrop-filter:blur(6px)}
.soon-orb{width:84px;height:84px;margin:0 auto 14px;border-radius:50%;
  background:radial-gradient(circle,rgba(255,255,255,.4),rgba(255,110,199,.25) 40%,rgba(169,107,255,.12) 62%,transparent 72%);animation:soonPulse 3s ease-in-out infinite}
@keyframes soonPulse{50%{transform:scale(1.12);opacity:.75}}
.soon h2{margin:0 0 8px;font-size:26px;font-weight:800;letter-spacing:-.025em;background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
.soon p{margin:0 0 20px;color:#d6d2e0;line-height:1.6}
.soon-ok{border:0;border-radius:999px;padding:10px 26px;color:#fff;font:700 13.5px 'Inter','Segoe UI',sans-serif;background:var(--grad);cursor:pointer;
  box-shadow:0 8px 22px -6px rgba(255,110,199,.6);transition:transform .3s var(--spring)}
.soon-ok:hover{transform:scale(1.05)}
.soon-ok:focus-visible{outline:2px solid var(--pink);outline-offset:3px}
