/* The pull moment (src/pull.js): the banner over a big pull as it turns face up, the table's darkened edges while a
   Grail lies face down, the Grail's white flash, a rare finish's callout on a cheaper card, and the inks the run summary
   and the Records print a pull in. Everything here moves by transform and opacity only. */

/* The banner lives in the world frame, like #fx (scenes.css), over the juice and under the white flash. Its lines are
   placed in world pixels (ui.place) when the moment starts and shown by .on at the reveal, and sized in world pixels
   times UI Size (--ui), as words over the table are. */
#pull { position: absolute; left: var(--ox); top: var(--oy); width: calc(var(--g) * 640); height: calc(var(--g) * 360);
  --u: calc(var(--g) * var(--ui, 1)); --fu: calc(var(--u) * var(--fs)); pointer-events: none; z-index: 16; opacity: 0; visibility: hidden; }
#pull.on { opacity: 1; visibility: visible; }
#pull > div { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; text-shadow: var(--outline); line-height: 1; }
#pull .pull-title { font-size: calc(var(--fu) * 26); }
#pull.pull-secret .pull-title { font-size: calc(var(--fu) * 30); }
#pull.pull-grail .pull-title { font-size: calc(var(--fu) * 34); }
#pull .pull-title span { display: inline-block; }
#pull .pull-name { font-size: calc(var(--fu) * 13); color: #fff; }
#pull.pull-grail .pull-name { font-size: calc(var(--fu) * 15); }
#pull .pull-value { font-size: calc(var(--fu) * 12); color: var(--cash); }
#pull .pull-odds { font-size: calc(var(--fu) * 10); color: #fff1c4; }
#pull .pull-first { font-size: calc(var(--fu) * 11); color: #ffd66b; }
#pull .pull-hint { font-size: calc(var(--fu) * 8); color: #f5fdf0; opacity: 0; }
#pull > div:empty { display: none; }

/* in: the title pops with a bounce, the lines under the card rise in after it, one by one */
#pull.on .pull-title { animation: pullPop 0.5s cubic-bezier(.3, 1.8, .5, 1) both; }
#pull.on .pull-title span { animation: pullWave 0.9s ease-in-out infinite; animation-delay: calc(var(--i) * -0.08s); }
#pull.on .pull-name { animation: pullUp 0.4s ease-out 0.12s both; }
#pull.on .pull-value { animation: pullUp 0.4s ease-out 0.24s both; }
#pull.on .pull-odds { animation: pullUp 0.45s ease-out 0.4s both; }
#pull.on .pull-first { animation: pullUp 0.45s ease-out 0.6s both, pullBeat 1.2s ease-in-out 1.05s infinite; }
#pull.hint .pull-hint { animation: pullBlink 1.4s ease-in-out infinite; }
#pull.pull-grail.on .pull-title { animation-duration: 0.7s; }
@keyframes pullPop { from { transform: translate(-50%, -50%) scale(0); opacity: 0; } 30% { opacity: 1; } to { transform: translate(-50%, -50%) scale(1); } }
@keyframes pullUp { from { transform: translate(-50%, 0%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes pullWave { 50% { transform: translateY(calc(var(--u) * -3)); } }
@keyframes pullBeat { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.08); } }
@keyframes pullBlink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes pullFade { from { opacity: 0; } }

/* Motion Slow: gentler and slower. Motion Off: the banner is simply there. */
body.fx-reduced #pull.on .pull-title span { animation-duration: 1.8s; }
body.fx-reduced #pull.on .pull-first { animation: pullUp 0.45s ease-out 0.6s both; }
body.calm #pull.on > div { animation: pullFade 0.25s ease-out both !important; }
body.calm #pull.on .pull-title span { animation: none !important; }
body.calm #pull.hint .pull-hint { opacity: 0.85; }

/* A Grail lying face down: the table's edges darken, and throb on each heartbeat (pull.js edgePulse). Over the
   table, under the HUD. */
#pullEdge { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.9s ease;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 30%, rgba(6, 4, 10, 0.85) 100%); }
#pullEdge.on { opacity: 1; }
#pullEdge i { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 40%, rgba(80, 6, 20, 0.6) 100%); }
body.calm #pullEdge { transition: none; }

/* the Grail's white flash, over everything on the table (pull.js plays it, scaled by the Flash setting) */
#pullWhite { position: absolute; inset: 0; pointer-events: none; z-index: 18; background: #fff; opacity: 0; }

/* While a moment plays or waits nothing behind it takes a click (main.js hands canvas clicks to the moment). A moment
   holds the screen (all of them at home, a Secret Rare's and a Grail's in a run): the HUD steps back. */
#stage.pull-busy #hud, #stage.pull-busy #hud * { pointer-events: none !important; }
#hud { transition: opacity 0.35s ease; }
#stage.pull-hold #hud { opacity: 0; }
body.calm #hud { transition: none; }

/* A rare finish on a cheaper card: its callout's words (pull.js calloutText), over the card where it shows its finish
   (.low: under it), or over (.top) and under (.low) its showcase. Sized in em of the block, so pull.js (calloutText)
   can shrink a block wider than the screen; --k is the finish's size (FINISH_CALLOUT), and --fit how far its lines step
   down to keep clear of the HUD. The block stands on the point it is placed at (.low hangs from it), moved in from the
   screen's edge where it would cross it. pull.js pops it in and lifts it away. */
.fcall { position: absolute; translate: -50% -100%; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 2);
  white-space: nowrap; font-weight: 700; line-height: 1; text-shadow: var(--outline); pointer-events: none; font-size: calc(var(--fu) * 10); }
.fcall.low { translate: -50% 0; }
.fcall .fc-title { font-size: calc(1.5em * var(--k, 1) * var(--fit, 1)); }
.fcall.big .fc-title { font-size: calc(2.4em * var(--k, 1) * var(--fit, 1)); }
.fcall .fc-title span { display: inline-block; animation: wave 0.7s ease-in-out infinite; animation-delay: calc(var(--i) * -0.08s); }
.fcall .fc-name { font-size: calc(1em * var(--fit, 1)); color: #fff; }
.fcall.big .fc-name { font-size: calc(1.1em * var(--fit, 1)); }
.fcall .fc-value { font-size: calc(0.9em * var(--fit, 1)); color: var(--cash); }
.fcall.big .fc-value { font-size: calc(1.5em * var(--fit, 1)); }
body.calm .fcall .fc-title span { animation: none; }

/* a pull printed in its colours (pull.js pullInk): the run summary's best pull and the Records' rarest pull, in its
   rarity's colour (t-), or its finish's (f-) when the finish is the rarer part */
.pull-ink.t-common { color: #d2d4ca; }
.pull-ink.t-uncommon { color: #7bd86e; }
.pull-ink.t-rare { color: #8ff7ff; }
.pull-ink.t-super { color: #b48cff; }
.pull-ink.t-ultra { color: #ffd66b; }
.pull-ink.t-secret { color: #ff5f7e; }
.pull-ink.f-bw { color: #d8d8d0; }
.pull-ink.f-miscut { color: #f0b45a; }
.pull-ink.f-misprint { color: #ff6ec7; }
.pull-ink.f-error { color: #f16373; }
.pull-ink.f-glitch { color: #6dfff0; }
.pull-ink.t-grail, .pull-ink.f-rainbow { color: #fff1c4; animation: pullInk 2.4s linear infinite; }
@keyframes pullInk { 0%, 100% { color: #ff9de2; } 20% { color: #fff27a; } 40% { color: #99ff6d; } 60% { color: #6dd6ff; } 80% { color: #c65bf6; } }
/* printed on paper and brass (the summary's memo, the Records' plaques): the same colours, dark enough to read */
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.t-common { color: #55554e; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.t-uncommon { color: #2f6a28; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.t-rare { color: #0e6a77; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.t-super { color: #5a2fa0; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.t-ultra { color: #85570a; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.t-secret { color: #a3163a; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.f-bw { color: #4a4a44; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.f-miscut { color: #8a5310; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.f-misprint { color: #a3166e; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.f-error { color: #a3162a; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) .pull-ink.f-glitch { color: #0b6e66; }
:is(#modal.area .sm-mtext, #panel.area .tr-pv) :is(.pull-ink.t-grail, .pull-ink.f-rainbow) { color: #7a3fa0; animation-name: pullInkDark; }
@keyframes pullInkDark { 0%, 100% { color: #b01e6a; } 20% { color: #8a6200; } 40% { color: #2b7a17; } 60% { color: #155e98; } 80% { color: #6c1fa3; } }
body.calm .pull-ink { animation: none !important; }
