/* Completion celebration */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 10, 6, 0.62);
  backdrop-filter: blur(3px);
  animation: fade-in 0.25s ease-out;
}
.celebrate.leaving { animation: fade-out 0.25s ease-in forwards; }

.celebrate-card {
  position: relative;
  width: min(420px, 100%);
  text-align: center;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 10px 0 rgba(20, 10, 4, 0.45);
  padding: 22px 20px 24px;
  animation: pop-in 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.celebrate h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1.05;
  margin: 6px 0 6px;
  overflow-wrap: anywhere;
  outline: none;
}
.celebrate .tally { font-weight: 800; font-size: 20px; margin: 0 0 4px; }
.celebrate .quip { color: var(--muted); margin: 0 0 18px; }
.celebrate-actions { display: grid; gap: 12px; }
.celebrate .clink {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--foam);
  font-size: 18px;
  cursor: pointer;
}

/* the pint */
.pint-wrap { width: 132px; margin: 0 auto; }
.pint { width: 100%; height: auto; overflow: visible; }
.pint .beer, .pint .beer-shade {
  transform-box: fill-box;
  transform-origin: bottom;
  animation: pour 1.3s cubic-bezier(0.3, 0.7, 0.4, 1) both;
}
.pint .foam {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: foam-rise 1.6s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.pint .bubbles circle { animation: bubble 1.6s ease-in infinite; }
.pint .bubbles circle:nth-child(2) { animation-delay: 0.3s; }
.pint .bubbles circle:nth-child(3) { animation-delay: 0.7s; }
.pint .bubbles circle:nth-child(4) { animation-delay: 1s; }
.pint .bubbles circle:nth-child(5) { animation-delay: 0.5s; }

@keyframes pour { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes foam-rise {
  0%, 55% { transform: translateY(120px) scale(0.6); opacity: 0; }
  70% { opacity: 1; }
  85% { transform: translateY(-6px) scale(1.12); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes bubble { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-120px); opacity: 0; } }
@keyframes pop-in { from { transform: scale(0.6) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* unwrapping the gift */
.gift.unwrapping { animation: shake 0.45s ease-in-out; }
.gift.unwrapping .gift-lid { animation: lid-off 0.75s 0.35s cubic-bezier(0.3, 0.6, 0.4, 1) forwards; }
.gift.unwrapping .bow { animation: lid-off 0.75s 0.35s cubic-bezier(0.3, 0.6, 0.4, 1) forwards; }
.gift.unwrapping .gift-paper:not(.gift-lid .gift-paper) { animation: box-drop 0.5s 0.8s ease-in forwards; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-6deg) scale(1.03); }
  40% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-4deg) scale(1.05); }
  80% { transform: rotate(3deg); }
}
@keyframes lid-off { to { transform: translate(60px, -140px) rotate(35deg); opacity: 0; } }
@keyframes box-drop { to { transform: translateY(30px) scale(0.9); opacity: 0; } }

.reveal-in { animation: pop-in 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }

@media (prefers-reduced-motion: reduce) {
  .pint .beer, .pint .beer-shade, .pint .foam { animation: none; }
  .pint .bubbles { display: none; }
}
