/* CoinParty — motion (step 4).
 *
 * The house gesture is paper, not glow: cards lift and their hard shadow grows,
 * confetti snips fall, ribbons unfurl. Everything here is decorative and every
 * rule is switched off under prefers-reduced-motion at the end of the file
 * (base.css carries a global guard as well — this file keeps its own so it can
 * be read on its own terms).
 */

/* ---------------------------------------------------------------- transitions */

.pill,
.booth,
.stall,
.route,
.voice,
.menu__link,
.menu__droplink,
.footbar__link,
.gift__day {
  transition:
    transform var(--d-fast) var(--e-out),
    box-shadow var(--d-fast) var(--e-out),
    background-color var(--d-fast) var(--e-out),
    color var(--d-fast) var(--e-out);
}

.booth:hover,
.stall:hover,
.voice:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--sh-lift);
}

.route:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--sh-1);
}

.pill--main:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--sh-2);
}

.booth__art {
  transition: transform var(--d-mid) var(--e-out);
}

.booth:hover .booth__art {
  transform: scale(1.03);
}

/* ---------------------------------------------------------------- keyframes */

@keyframes cp-pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cp-slide-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* A snip of paper falling past the element. Used on level-up and bonus claims. */
@keyframes cp-confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(-14px) rotate(0deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(46px) rotate(220deg);
  }
}

@keyframes cp-ribbon-unfurl {
  from {
    transform: scaleX(0);
    transform-origin: left center;
  }
  to {
    transform: scaleX(1);
    transform-origin: left center;
  }
}

@keyframes cp-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* The bunting sways very slightly — the only ambient motion on the site. */
@keyframes cp-sway {
  0%, 100% { background-position: 0 0; }
  50% { background-position: 28px 0; }
}

/* ---------------------------------------------------------------- applied */

.sheet[data-open='true'] .sheet__panel {
  animation: cp-pop-in var(--d-mid) var(--e-pop) both;
}

.pop {
  animation: cp-slide-up var(--d-mid) var(--e-out) both;
}

.crumbs-bar {
  animation: cp-slide-up var(--d-slow) var(--e-out) both;
}

.levelbar__fill {
  transition: width var(--d-slow) var(--e-out);
}

.levelbar--gained .levelbar__fill {
  animation: cp-ribbon-unfurl var(--d-slow) var(--e-out) both;
}

.purse--credited .purse__icon--coin {
  animation: cp-nudge var(--d-mid) var(--e-pop) 2;
}

/* Three snips of confetti, staggered, on a claimed bonus. */
.gift--claimed::before,
.gift--claimed::after {
  content: '';
  position: absolute;
  top: 0;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: cp-confetti-fall var(--d-confetti) var(--e-out) both;
}

.gift--claimed {
  position: relative;
  overflow: hidden;
}

.gift--claimed::before {
  left: 28%;
  background: var(--c-magenta);
}

.gift--claimed::after {
  left: 64%;
  background: var(--c-lime);
  animation-delay: 140ms;
}

.topbar::before {
  animation: cp-sway 9s ease-in-out infinite;
}

.wheel__dial {
  transition: transform var(--d-slow) var(--e-out);
}

/* ---------------------------------------------------------------- opt-out */

@media (prefers-reduced-motion: reduce) {
  .pill,
  .booth,
  .stall,
  .route,
  .voice,
  .booth__art,
  .menu__link,
  .menu__droplink,
  .footbar__link,
  .gift__day,
  .levelbar__fill,
  .wheel__dial {
    transition: none !important;
  }

  .booth:hover,
  .stall:hover,
  .voice:hover,
  .route:hover,
  .pill--main:hover,
  .booth:hover .booth__art {
    transform: none;
  }

  .sheet[data-open='true'] .sheet__panel,
  .pop,
  .crumbs-bar,
  .levelbar--gained .levelbar__fill,
  .purse--credited .purse__icon--coin,
  .gift--claimed::before,
  .gift--claimed::after,
  .topbar::before {
    animation: none !important;
  }

  /* The confetti still has to be invisible rather than frozen mid-fall. */
  .gift--claimed::before,
  .gift--claimed::after {
    display: none;
  }
}
