/* panel-badge.css — the badge's stage (panel-badge.js).
 *
 * The whole panel, over everything the badge can be opened from: the rail,
 * the menus (60) and Settings (.pxpop, 70), which is where its button is.
 * Closing it lands back in Settings, focused on that button.
 * The scrim is the panel's own ground at a veil, from the theme tokens, so
 * the card hangs in front of a dimmed copy of the panel rather than in a
 * black box. The card itself brings its own colour. */

.px-badge {
  position: fixed;
  inset: 0;
  z-index: var(--z-badge);
  background:
    radial-gradient(120% 70% at 50% 18%, rgba(var(--bone-rgb), .06), transparent 60%),
    color-mix(in srgb, var(--ink) 78%, transparent);
  backdrop-filter: blur(6px) saturate(.9);
  -webkit-backdrop-filter: blur(6px) saturate(.9);
  opacity: 0;
  transition: opacity var(--dur-4) ease;
}
.px-badge[hidden] { display: none; }
.px-badge:focus:not(:focus-visible) { outline: none; }
.px-badge.is-in { opacity: 1; }
/* Out a beat after the band starts pulling, so the card is seen to leave. */
.px-badge.is-leaving { opacity: 0; transition: opacity var(--dur-5) ease .16s; }

.px-badge-mount { position: absolute; inset: 0; overflow: hidden; }
.px-badge-mount .lanyard-canvas { display: block; width: 100%; height: 100%; }

/* While the engine and the faces load: a soft pulse where the card will be. */
.px-badge.is-loading .px-badge-mount::after {
  content: "";
  position: absolute; left: 50%; top: 30%;
  width: 34%; aspect-ratio: 1.6 / 2.25; max-width: 200px;
  transform: translateX(-50%);
  border-radius: var(--r-card);
  background: rgba(var(--bone-rgb), .05);
  box-shadow: inset 0 0 0 1px var(--hair);
  animation: px-badge-wait 1.4s ease-in-out infinite;
}
@keyframes px-badge-wait { 50% { opacity: .4; } }

.px-badge-bar {
  position: absolute;
  left: 0; right: 0; bottom: 22px;
  display: flex; justify-content: center; gap: 8px;
  pointer-events: none;
}
.px-badge-bar > * { pointer-events: auto; }
/* .px-btn, so the glass paints them like every other button in the panel. */
.px-badge-close { width: var(--ctl-h); padding: 0; }

.px-badge-hint {
  position: absolute; left: 0; right: 0; bottom: 64px;
  margin: 0; text-align: center;
  font: 400 var(--fs-sm)/1 var(--mono); letter-spacing: .06em;
  color: var(--t-faint);
  opacity: 0; transition: opacity var(--dur-6) ease;
  pointer-events: none;
}
.px-badge.is-hinting .px-badge-hint { opacity: 1; }

/* No WebGL: the same faces, flat, on a CSS pendulum. */
.px-badge-flat {
  position: absolute; left: 50%; top: 12%;
  width: min(56vw, 260px); aspect-ratio: 1.6 / 2.25;
  margin-left: calc(min(56vw, 260px) / -2);
  transform-origin: 50% -40px;
  transform-style: preserve-3d;
  transition: transform var(--dur-6) var(--ease-spring);
  animation: px-badge-sway 4.8s ease-in-out infinite;
  cursor: pointer;
}
.px-badge-flat::before {             /* the strap */
  content: ""; position: absolute; left: 50%; bottom: 100%;
  width: 22px; height: 100vh; margin-left: -11px;
  background: var(--t-faint);
}
.px-badge-flat.is-turned { transform: rotateY(180deg); animation: none; }
.px-badge-face {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: var(--r-card);
  backface-visibility: hidden;
  box-shadow: var(--shadow-3);
}
.px-badge-face.is-back { transform: rotateY(180deg); }
@keyframes px-badge-sway { 50% { transform: rotate(2.4deg); } 0%, 100% { transform: rotate(-2.4deg); } }

@media (prefers-reduced-motion: reduce) {
  .px-badge, .px-badge.is-leaving { transition: none; }
  .px-badge-flat { animation: none; }
}
