/* Easter egg, from the first Digipals site: a small wireframe cube at the bottom left, sitting on the ruler.
   Click it and the characters film opens in a dark pop-up; inside, a bigger cube rolls after the cursor. */

.egg{position:fixed;left:calc(var(--gutter) + 8px);bottom:calc(var(--gutter) + 8px);z-index:60;width:24px;height:24px;display:grid;place-items:center;
  padding:0;border:0;background:none;color:rgba(255,255,255,.55);cursor:pointer;transition:color .25s}
.egg:hover,.egg:focus-visible{color:#fff}
.egg svg{display:block;overflow:visible}

.cube-wrap{perspective:120px;display:grid;place-items:center}
.cube{position:relative;width:var(--cs,11px);height:var(--cs,11px);transform-style:preserve-3d;transform:rotateX(var(--crx,-24deg)) rotateY(var(--cry,0deg))}
.egg .cube{animation:cube-spin 9s linear infinite}
@keyframes cube-spin{from{--cry:0deg}to{--cry:360deg}}
@property --cry{syntax:'<angle>';inherits:false;initial-value:0deg}
.cube i{--z:calc(var(--cs,11px) / 2);position:absolute;inset:0;border:1.2px solid currentColor}
.cube i:nth-child(1){transform:translateZ(var(--z))}
.cube i:nth-child(2){transform:rotateY(180deg) translateZ(var(--z))}
.cube i:nth-child(3){transform:rotateY(90deg) translateZ(var(--z))}
.cube i:nth-child(4){transform:rotateY(-90deg) translateZ(var(--z))}
.cube i:nth-child(5){transform:rotateX(90deg) translateZ(var(--z))}
.cube i:nth-child(6){transform:rotateX(-90deg) translateZ(var(--z))}
.egg.is-pressed{animation:egg-press .32s var(--ease)}
@keyframes egg-press{40%{scale:1.35}}

/* the bigger cube that follows the cursor inside the pop-up */
.egg-follow{display:none}
@media (hover:hover) and (pointer:fine){
  .egg-follow{display:block;position:fixed;left:0;top:0;width:0;height:0;z-index:8600;pointer-events:none;color:#f2f2f2;opacity:0;transition:opacity .25s}
  html.egg-mode .egg-follow{opacity:1}
  .egg-follow .art{position:absolute;left:0;top:0;translate:-50% -50%;display:grid;place-items:center}
  .egg-follow .cube{--cs:22px}
}

/* the pop-up: near-black canvas, faint grain, orbit lines, selection handles around the film */
.vmodal{position:fixed;inset:0;z-index:8500;display:grid;place-items:center;padding:var(--gutter)}
.vmodal[hidden]{display:none}
.vmodal-backdrop{position:absolute;inset:0;border:0;padding:0;overflow:hidden;background:#0c0c0d;opacity:0;transition:opacity .35s var(--ease)}
.vmodal-backdrop::before{content:"";position:absolute;inset:0;background:url("../assets/grain.webp") 0 0 / 760px 760px repeat;filter:invert(1);mix-blend-mode:screen;opacity:.1}
.vmodal-orbits{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;stroke:rgba(255,255,255,.11);stroke-width:1;fill:none;opacity:0;transition:opacity .6s var(--ease) .15s}
.vmodal-orbits .axis{stroke-dasharray:3 5;stroke:rgba(255,255,255,.15)}
.vmodal.is-open .vmodal-orbits,.vmodal.is-open .vmodal-backdrop{opacity:1}
.vmodal-hud{--h:8px;position:absolute;inset:-14px;pointer-events:none;
  background:linear-gradient(#eee,#eee) left top / var(--h) var(--h) no-repeat,linear-gradient(#eee,#eee) right top / var(--h) var(--h) no-repeat,
             linear-gradient(#eee,#eee) left bottom / var(--h) var(--h) no-repeat,linear-gradient(#eee,#eee) right bottom / var(--h) var(--h) no-repeat}
.vmodal-caption{position:absolute;left:0;top:calc(100% + 10px);font:400 clamp(13px,1vw,17px)/1 var(--sans);color:#8b8b8b;white-space:nowrap}
.vmodal-box{position:relative;max-width:100%;opacity:0;scale:.94;translate:0 16px;transition:opacity .35s var(--ease),scale .5s var(--ease),translate .5s var(--ease)}
.vmodal.is-open .vmodal-box{opacity:1;scale:1;translate:0 0}
.vmodal-frame{position:relative;margin:0;height:min(80svh,1080px);aspect-ratio:608 / 1080;max-width:100%;border-radius:var(--radius);overflow:hidden;background:#000;box-shadow:0 24px 70px -20px rgba(0,0,0,.8)}
html.sq .vmodal-frame{border-radius:0}
.vmodal-frame video{display:block;width:100%;height:100%;object-fit:contain;background:#000}
@media (max-width:640px){.vmodal-box{width:100%}.vmodal-frame{height:auto;width:100%;max-height:80svh}}
@media (prefers-reduced-motion:reduce){.egg .cube,.egg.is-pressed{animation:none}.vmodal-backdrop,.vmodal-box{transition:none}}
/* phones: still bottom left, lifted just above the bottom panel (its Face bar fills the bottom edge there); --egg-lift is set by egg.js */
@media (max-width:760px){.egg{bottom:var(--egg-lift,calc(var(--gutter) + 8px))}}
.egg{bottom:var(--egg-lift,calc(var(--gutter) + 8px))}   /* desktop too: centred on the bottom line (client) */

/* sound button under the film, right side (opposite the caption); the film starts muted */
.vmodal-sound{position:absolute;right:0;top:calc(100% + 6px);display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:999px;border:1px solid rgba(255,255,255,.35);background:rgba(255,255,255,.08);color:#eee;font:600 11px/1 var(--sans);letter-spacing:.12em;text-transform:uppercase;cursor:pointer;transition:background .2s,color .2s}
.vmodal-sound::before{content:"";width:7px;height:7px;border-radius:50%;background:rgba(255,255,255,.4)}
.vmodal-sound[aria-pressed="true"]{background:#fff;color:#111}
.vmodal-sound[aria-pressed="true"]::before{background:#3bd16f}
.vmodal-sound:hover{background:rgba(255,255,255,.18)}
.vmodal-sound[aria-pressed="true"]:hover{background:#fff}
