/* ==========================================================================
   A ticket is solved: one of Brad's happy drawings (static/img/celebrate/,
   680x400 each) crosses the window in a random direction, off-screen to
   off-screen (static/js/celebrate.js picks the path and sets it as custom
   properties through the CSSOM). Nothing here can be clicked, focused or
   read aloud; the announcement is the server's "Ticket resolved" toast.
   ========================================================================== */
.celebrate-flyer img, .celebrate-still img { display: block; width: 100%; height: 100%; }

/* The flight. Start and end are custom properties the script sets, both
   outside the window on opposite sides. Below the topbar and its menus (30),
   the toasts (90) and any dialog; click-through wherever it passes. */
.celebrate-flyer {
  position: fixed; left: 0; top: 0; z-index: 20;
  width: var(--celebrate-width, 210px); aspect-ratio: 680 / 400;
  pointer-events: none; will-change: transform;
  transform: translate(var(--celebrate-x0, -220px), var(--celebrate-y0, 40vh));
  animation: celebrate-fly var(--celebrate-duration, 1.4s) linear forwards;
}
.celebrate-flyer img { animation: celebrate-bob .45s ease-in-out infinite alternate; }
@keyframes celebrate-fly {
  from { transform: translate(var(--celebrate-x0, -220px), var(--celebrate-y0, 40vh)); }
  to   { transform: translate(var(--celebrate-x1, 100vw), var(--celebrate-y1, 40vh)); }
}
@keyframes celebrate-bob {
  from { transform: translateY(-5px) rotate(-2deg); }
  to   { transform: translateY(5px) rotate(2deg); }
}

/* Reduced motion: no flight. The drawing fades in beside the toasts for a
   moment, then fades out; nothing moves. */
.celebrate-still {
  position: fixed; right: 1rem; bottom: 5.5rem; z-index: 20;
  width: 180px; aspect-ratio: 680 / 400; pointer-events: none;
  animation: celebrate-fade 3s ease-in-out forwards;
}
/* Spark More Joy: half again as big (the script sizes the flight itself;
   these are the still and the fallback). */
.celebrate-flyer.is-joy { width: var(--celebrate-width, 315px); }
.celebrate-still.is-joy { width: 270px; }
@keyframes celebrate-fade {
  0% { opacity: 0; } 33% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; }
}
@media (max-width: 600px) {
  /* Half again the old size, but never more than about 40% of a phone's width. */
  .celebrate-flyer { width: var(--celebrate-width, min(150px, 40vw)); }
  .celebrate-still { width: min(150px, 40vw); }
  .celebrate-flyer.is-joy { width: var(--celebrate-width, min(225px, 60vw)); }
  .celebrate-still.is-joy { width: min(225px, 60vw); }
}
@media (prefers-reduced-motion: reduce) {
  .celebrate-flyer { display: none; }
  .celebrate-flyer img { animation: none; }
}
