/* MUNZ TOWN web — motion layer (load pop, scroll reveal up/down, parallax, hover tilt, page wipe)
   Uses the individual `translate` / `scale` properties so animations never fight each other's `transform`. */

/* load pop-in (stickers, hero text) */
@keyframes mzPop{0%{opacity:0;scale:.55}60%{opacity:1;scale:1.07}100%{opacity:1;scale:1}}
.pop{animation:mzPop .62s cubic-bezier(.3,1.4,.5,1) var(--d,0s) both}
.restart .pop{animation:none}

/* idle loops */
@keyframes mzFloat{0%,100%{transform:translateY(0) rotate(-1deg)}50%{transform:translateY(-10px) rotate(1deg)}}
.float{animation:mzFloat 4.2s ease-in-out infinite}
@keyframes mzBob{0%,100%{translate:-50% 0}50%{translate:-50% 6px}}
.scroll-cue.bob{transform:none;animation:mzBob 1.6s ease-in-out infinite}
@keyframes mzSpin{to{rotate:360deg}}
[data-spin]{animation:mzSpin 140s linear infinite}
@keyframes mzWig{0%,100%{rotate:-18deg}50%{rotate:-8deg}}
.wiggle-slow{animation:mzWig 2.4s ease-in-out infinite}
.sticker{transition:scale .18s cubic-bezier(.3,1.6,.5,1)}
.sticker:hover{scale:1.12}

/* scroll reveal — enters from below when scrolling down, from above when scrolling up */
.rv{--rvd:calc(var(--i,0)*70ms);opacity:0;translate:0 var(--from,42px);transition:opacity .5s ease var(--rvd),translate .62s cubic-bezier(.22,1.2,.36,1) var(--rvd)}
/* reveal + hover on the same element: stagger only the reveal, hover reacts instantly */
.rv.tilt3d,.rv.card,.rv.tier{transition:opacity .5s ease var(--rvd),translate .62s cubic-bezier(.22,1.2,.36,1) var(--rvd),transform .18s ease,background .08s,color .08s,box-shadow .08s}
.ev .row.rv{transition:opacity .5s ease var(--rvd),translate .62s cubic-bezier(.22,1.2,.36,1) var(--rvd),transform .15s}
.rv.in{opacity:1;translate:0 0}
.rv[data-from="top"]{--from:-42px}

/* hover: 3D tilt + shine (cards / panes) */
.tilt3d{position:relative;transform-style:preserve-3d;
  transform:perspective(900px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)) translateY(var(--lift,0px));
  transition:transform .18s ease,background .12s,box-shadow .12s}
.tilt3d::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity .2s;
  background:radial-gradient(circle at var(--sx,50%) var(--sy,50%),rgba(255,255,255,.28),transparent 45%)}
.tilt3d:hover{--lift:-6px}
.tilt3d:hover::after{opacity:1}
.card.tilt3d:hover{transform:perspective(900px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)) translateY(var(--lift,-6px))}
.card .thumb img{transition:scale .35s ease}
.card:hover .thumb img{scale:1.07}

/* buttons: lift + icon wiggle + squash */
@keyframes mzIcon{0%,100%{rotate:0deg}25%{rotate:-14deg}60%{rotate:10deg}}
.btn{transition:translate .14s cubic-bezier(.3,1.6,.5,1),scale .1s,background .12s}
.btn:hover{translate:0 -3px}
.btn:hover i{animation:mzIcon .5s ease}
.btn:active{scale:.96 .92}
.nudge{transition:translate .15s}
a:hover .nudge{translate:4px 0}

/* nav: lime pill slides between links */
.seg{position:relative}
.seg-pill{position:absolute;top:5px;left:0;height:38px;width:0;border-radius:10px;background:var(--lime);box-shadow:inset 0 -3px 0 var(--lime-lo),0 0 0 2px var(--ink);
  transition:translate .32s cubic-bezier(.22,.9,.24,1),width .32s cubic-bezier(.22,.9,.24,1),opacity .18s;pointer-events:none}

/* themed scrollbars (no white browser bars) */
/* scrollbars: themed in munz-web.css (::-webkit-scrollbar + Firefox fallback) */
.seg a{position:relative;z-index:1;transition:color .2s}
.seg a.on{background:transparent;box-shadow:none}
.seg a.pill-on{color:var(--ink)}
.seg a:hover{background:transparent}

/* page switch: comic panel wipe */
.wipe{position:fixed;inset:0;z-index:90;pointer-events:none;overflow:hidden}
.wipe-panel{position:absolute;top:-20%;bottom:-20%;left:-30%;width:160%;display:grid;place-items:center;translate:-110% 0;rotate:-6deg;
  background:radial-gradient(rgba(29,11,64,.1) 1.4px,transparent 2px) 0 0/16px 16px,var(--lime);box-shadow:0 0 0 6px var(--ink),18px 0 0 6px var(--ink)}
.wipe-panel img{width:min(320px,60vw);rotate:6deg;scale:.6;opacity:0;filter:drop-shadow(0 8px 0 var(--ink))}
.wipe.go{pointer-events:auto}
.wipe.go .wipe-panel{animation:mzWipe .82s cubic-bezier(.7,0,.3,1) forwards}
.wipe.go .wipe-panel img{animation:mzWipeLogo .82s ease forwards}
@keyframes mzWipe{0%{translate:-110% 0}42%,58%{translate:0 0}100%{translate:110% 0}}
@keyframes mzWipeLogo{0%,30%{scale:.6;opacity:0}45%,58%{scale:1;opacity:1}75%,100%{scale:1.1;opacity:0}}

/* page load / F5: start covered by the wipe panel, then slide it away (same look as page switch) */
.wipe.intro{pointer-events:auto}
.wipe.intro .wipe-panel{translate:0 0;animation:mzWipeOut .5s cubic-bezier(.7,0,.3,1) 3s forwards}   /* fallback if JS never runs */
.wipe.intro .wipe-panel img{scale:1;opacity:1;animation:mzIntroLogo .55s cubic-bezier(.3,1.5,.5,1) both}
.wipe.intro.out .wipe-panel{animation:mzWipeOut .52s cubic-bezier(.7,0,.3,1) forwards}
.wipe.intro.out .wipe-panel img{animation:mzWipeLogoOut .38s ease forwards}
@keyframes mzIntroLogo{from{scale:.55;opacity:0;rotate:-6deg}to{scale:1;opacity:1;rotate:6deg}}
@keyframes mzWipeOut{from{translate:0 0}to{translate:110% 0}}
@keyframes mzWipeLogoOut{to{scale:1.12;opacity:0}}
.intro-hold .pop{animation-play-state:paused}
/* arriving from an in-site link: panel already covering with the logo at rest → just wipe out (no second logo pop) */
html.mz-arrive .wipe.intro .wipe-panel img{animation:none;scale:1;opacity:1;rotate:6deg}
html.mz-arrive .wipe.intro .wipe-panel{animation:mzWipeOut .5s cubic-bezier(.7,0,.3,1) 1.5s forwards}   /* fallback */
html.mz-arrive .wipe.intro.out .wipe-panel{animation:mzWipeOut .5s cubic-bezier(.7,0,.3,1) forwards}
/* leaving to another page: slide in and hold */
.wipe.cover{pointer-events:auto}
.wipe.cover .wipe-panel{animation:mzCover .4s cubic-bezier(.7,0,.3,1) forwards}
.wipe.cover .wipe-panel img{animation:mzIntroLogo .5s cubic-bezier(.3,1.5,.5,1) .15s both}
@keyframes mzCover{from{translate:-110% 0}to{translate:0 0}}

@media (prefers-reduced-motion:reduce){
  .rv{opacity:1;translate:none}
  .pop,.float,[data-spin],.wiggle-slow,.scroll-cue.bob{animation:none}
  .wipe{display:none}
}
