/* Jarlings motion, part two: the big moments (see js/motion-moments.js). Only transform and opacity animate. Every
   rule hangs off html.mx, which the script sets only when motion is allowed. */

/* one-off effect layers */
.mx-stage { position: fixed; inset: 0; pointer-events: none; z-index: 9000; overflow: hidden; contain: strict; }
.mx-ov { position: fixed; pointer-events: none; }
.mx-msheet { position: fixed; inset: 0; pointer-events: none; overflow: hidden; contain: strict; }
.mx-mback { z-index: 0; } .mx-mfront { z-index: 3; }
.mx-msheet .mx-ov { position: absolute; }
.mx-flash { inset: 0; z-index: 3; opacity: 0; will-change: opacity; }
.mx-ring { z-index: 3; border: 3px solid #fff; border-radius: 50%; opacity: 0; will-change: transform, opacity; box-sizing: border-box; }
.mx-boxflash { z-index: 3; border-radius: 3px; opacity: 0; }
.mx-rays { left: 50%; top: 50%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; z-index: 0; opacity: 0; border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, #000 0, rgba(0,0,0,.6) 22%, transparent 62%); mask-image: radial-gradient(circle, #000 0, rgba(0,0,0,.6) 22%, transparent 62%); will-change: transform, opacity; }
.mx-tapebar { left: -10vw; width: 120vw; height: 46px; z-index: 0; overflow: hidden; opacity: 0; border-block: 3px solid #000;
  background: repeating-linear-gradient(-45deg, var(--hazard, #f2c230) 0 14px, #18181a 14px 28px); box-shadow: 0 10px 30px rgba(0,0,0,.5); will-change: transform, opacity; }
.mx-tape-a { top: 9vh; } .mx-tape-b { bottom: 9vh; }
.mx-tapetrack { display: flex; width: max-content; height: 100%; align-items: center; will-change: transform; }
.mx-tapetrack span { display: block; white-space: nowrap; padding: 0 10px; margin: 0 6px; background: #0b0e0d; color: #f2c230; font: 22px/30px var(--pixel, monospace); letter-spacing: .12em; }
.mx-tapebar.gold .mx-tapetrack span { color: #ffd23f; text-shadow: 0 0 10px rgba(255,210,63,.6); }
.mx-tapebar.amber .mx-tapetrack span { color: #ffcf7a; }
@media (max-width: 600px) { .mx-tapebar { height: 34px; } .mx-tapetrack span { font-size: 16px; line-height: 24px; } .mx-tape-a { top: 4vh; } .mx-tape-b { bottom: 4vh; } }

/* the moment card sits above its own effects */
html.mx .moment-card.mx-card { position: relative; z-index: 1; }
.mx-cardtape { position: absolute; left: 0; right: 0; top: -4px; height: 4px; pointer-events: none; transform-origin: 0 50%;
  background: repeating-linear-gradient(-45deg, var(--hazard, #f2c230) 0 6px, #18181a 6px 12px); animation: mx-tapewipe 1.3s cubic-bezier(.2,.8,.2,1) both; }
@keyframes mx-tapewipe { 0% { transform: scaleX(0); opacity: 1; } 40% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
html.mx .moment-card.mx-card::after { content: ''; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s; }
html.mx .moment-card.mx-legend::after { opacity: 1; box-shadow: 0 0 0 2px #ffd23f, 0 0 34px 6px rgba(255,210,63,.45), 0 0 80px 12px rgba(255,154,213,.25); animation: mx-glowpulse 1.4s ease-in-out infinite alternate; }
html.mx .moment-card.mx-extinct::after { opacity: 1; box-shadow: 0 0 0 2px #e0a040, 0 0 30px 6px rgba(224,160,64,.4); animation: mx-glowpulse 1.4s ease-in-out infinite alternate; }
@keyframes mx-glowpulse { from { opacity: 1; } to { opacity: .45; } }

/* the smash game: the jar quivers once it's ready to burst, with a hazard ring around it */
html.mx .mx-armed .scene-wrap.smash { animation: mx-quiver .09s steps(2) infinite; }
html.mx .mx-armed .scene-wrap.smash::after { content: ''; position: absolute; inset: -5px; border-radius: 4px; pointer-events: none;
  background: repeating-linear-gradient(-45deg, var(--hazard, #f2c230) 0 8px, #18181a 8px 16px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); padding: 4px;
  animation: mx-blink .3s ease-in-out infinite alternate; }
@keyframes mx-quiver { 0% { transform: translate(-1px, 0) rotate(-.3deg); } 100% { transform: translate(1px, -1px) rotate(.3deg); } }
@keyframes mx-blink { from { opacity: 1; } to { opacity: .35; } }

/* working scenes: furnace heat (or a coloured glow) breathing over the scene, lighting it from the fire */
html.mx .scene-wrap.mx-heat { position: relative; }
html.mx .scene-wrap.mx-heat::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; mix-blend-mode: screen;
  background: radial-gradient(circle at 15% 72%, rgba(255,150,50,.55), rgba(255,90,20,.18) 28%, transparent 52%); animation: mx-heat 1.1s ease-in-out infinite alternate; }
html.mx .scene-wrap.mx-heat-violet::after { background: radial-gradient(circle at 50% 70%, rgba(200,120,255,.45), rgba(184,146,255,.12) 30%, transparent 55%); }
html.mx .scene-wrap.mx-heat-pink::after { background: radial-gradient(circle at 50% 62%, rgba(255,140,210,.45), rgba(255,154,213,.12) 30%, transparent 55%); }
html.mx .scene-wrap.mx-heat-green::after { background: radial-gradient(circle at 50% 62%, rgba(79,227,154,.4), rgba(79,227,154,.1) 30%, transparent 55%); }
html.mx .scene-wrap.mx-heat-amber::after { background: radial-gradient(circle at 50% 55%, rgba(255,190,90,.45), rgba(224,160,64,.12) 30%, transparent 55%); }
html.mx .scene-wrap.mx-heat.mx-cool::after { animation: mx-cool 1.6s ease-out both; }
@keyframes mx-heat { 0% { opacity: .45; } 35% { opacity: .95; } 55% { opacity: .7; } 100% { opacity: 1; } }
@keyframes mx-cool { 0% { opacity: 1; } 100% { opacity: 0; } }

/* what you got */
html.mx .moment .loot figure.mx-loot .cubby { animation: mx-lootbob .5s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes mx-lootbob { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-8px) scale(1.12); } 100% { transform: none; } }
html.mx .first-banner.mx-stamp { animation: mx-stamp .5s cubic-bezier(.2,1.4,.4,1) .15s both; }
@keyframes mx-stamp { 0% { opacity: 0; transform: scale(1.6) rotate(-6deg); } 60% { opacity: 1; transform: scale(.96) rotate(1deg); } 100% { opacity: 1; transform: none; } }
html.mx .treasure-note.mx-shine { position: relative; overflow: hidden; animation: mx-stamp .5s cubic-bezier(.2,1.4,.4,1) both; }
html.mx .treasure-note.mx-shine::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255,240,180,.55) 50%, transparent 65%);
  transform: translateX(-110%); animation: mx-sweep 1.1s ease-in-out .5s 2; }
@keyframes mx-sweep { to { transform: translateX(110%); } }
html.mx .legend-kicker.mx-kick, html.mx .extinct-kicker.mx-kick { animation: mx-kick .6s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes mx-kick { 0% { opacity: 0; transform: scale(2.2); } 100% { opacity: 1; transform: none; } }

/* page changes: a loading strip under the hazard tape, then the page settles in, section by section */
.mx-route { position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, var(--accent, #4fe39a), var(--accent-text, #7dffb0)); box-shadow: 0 0 10px var(--accent, #4fe39a); opacity: 0; }
html.mx .page.mx-enter > .wrap > * { animation: mx-pagein .5s cubic-bezier(.2,.8,.2,1) both; }
html.mx .page.mx-enter > .wrap > *:nth-child(2) { animation-delay: .05s; }
html.mx .page.mx-enter > .wrap > *:nth-child(3) { animation-delay: .1s; }
html.mx .page.mx-enter > .wrap > *:nth-child(4) { animation-delay: .15s; }
html.mx .page.mx-enter > .wrap > *:nth-child(5) { animation-delay: .2s; }
html.mx .page.mx-enter > .wrap > *:nth-child(n+6) { animation-delay: .25s; }
@keyframes mx-pagein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* cards and panels pop in as they scroll into view */
html.mx .mx-cardwait { opacity: 0; }
html.mx .mx-cardin { animation: mx-cardin .46s cubic-bezier(.2,1.2,.4,1) var(--mxd, 0ms) both; }
@keyframes mx-cardin { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }

/* microinteractions */
html.mx .card .cubby img { transition: box-shadow .15s, transform .18s cubic-bezier(.3,1.6,.5,1); }
html.mx .card:hover .cubby img { transform: translateY(-4px); }
html.mx .card:active .cubby img { transform: translateY(1px) scale(.98); transition-duration: .05s; }
html.mx .btn { transition: transform .08s ease-out, filter .15s, background .15s; }
html.mx .btn:hover:not(:active):not([disabled]) { transform: translateY(-1px); }
html.mx .inv-item img { transition: transform .2s cubic-bezier(.3,1.6,.5,1); }
html.mx .inv-item:hover img { transform: rotate(-8deg) scale(1.12); }
html.mx .nav a { transition: transform .12s; }
html.mx .nav a:hover { transform: translateY(-1px); }
html.mx .slot[aria-pressed='true'] .ph-plus { display: inline-block; animation: mx-plus 1s ease-in-out infinite alternate; }
@keyframes mx-plus { to { transform: scale(1.18); } }
html.mx .dur, html.mx [data-dest], html.mx [data-m] { transition: transform .15s cubic-bezier(.3,1.6,.5,1); }
html.mx .dur:hover, html.mx [data-dest]:hover { transform: translateY(-2px); }

/* buttons that are waiting for you (ready to unseal, ready to claim, breed) */
html.mx .mx-ready, html.mx #go:not([disabled]) { position: relative; }
html.mx .mx-ready::after, html.mx #go:not([disabled])::after { content: ''; position: absolute; inset: -4px; border-radius: 5px; pointer-events: none; box-shadow: 0 0 0 2px var(--accent, #4fe39a), 0 0 14px rgba(79,227,154,.5);
  animation: mx-readyring 1.6s ease-out infinite; }
@keyframes mx-readyring { 0% { opacity: .9; transform: scale(.96); } 70%, 100% { opacity: 0; transform: scale(1.12); } }

/* duel hits */
html.mx .bcard .mx-hit { position: absolute; inset: 0; border-radius: 4px; pointer-events: none; z-index: 4; opacity: 0; }
.mx-hit.down { background: radial-gradient(circle, rgba(255,90,60,.8), rgba(255,60,40,.3) 70%); }
.mx-hit.up { background: radial-gradient(circle, rgba(125,255,176,.7), rgba(79,227,154,.2) 70%); }
.mx-hit.blk { background: radial-gradient(circle, rgba(223,231,227,.7), transparent 70%); }

/* the mining page: pause decoration while the machine is hashing; a hazard banner when something rolls out */
html.mx-hashing .mx-tape i, html.mx-hashing .mx-ready::after { animation-play-state: paused !important; }
.mx-found { position: fixed; left: 0; right: 0; top: 18vh; z-index: 70; pointer-events: none; display: grid; place-items: center; opacity: 0; }
.mx-found .mx-tapebar { position: absolute; top: 50%; margin-top: -23px; opacity: 1; }
.mx-found b { position: relative; z-index: 1; display: block; padding: 8px 18px; background: #0b0e0d; color: var(--accent-text, #7dffb0); font: 26px/1.1 var(--pixel, monospace); letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--hazard, #f2c230), 0 12px 30px rgba(0,0,0,.6); max-width: 90vw; text-align: center; }
.mx-found.crate b { color: #ffd23f; }

@media (prefers-reduced-motion: reduce) {
  .mx-stage, .mx-ov, .mx-cardtape, .mx-route, .mx-found { display: none !important; }
  html.mx [class*='mx-'], html.mx [class*='mx-']::before, html.mx [class*='mx-']::after { animation: none !important; }
  html.mx .mx-cardwait { opacity: 1; }
}

/* mining page extras */
.mx-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: 0; box-shadow: inset 0 0 120px 30px rgba(79,227,154,.35); }
html.mx .modes a { transition: transform .12s; }
html.mx .modes a:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .mx-vignette { display: none !important; } }
