/* Token card motion — spotlight, 3D tilt, rotating rim light, breathing glow,
   entrance. Layered on top of index-*.css without touching the bundle.
   Accent stays monochrome to match the Eywa palette. */

@property --fx-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Breathing glow strength; animated as a registered property so the
   animation never fights the hover box-shadow declaration. */
@property --fx-glow {
  syntax: "<number>";
  inherits: false;
  initial-value: .1;
}

.token-card {
  --fx-accent: 255 255 255;
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --scale: 1;
  --fx-angle: 0deg;
  --fx-glow: .1;
  isolation: isolate;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift)) scale(var(--scale));
  transform-style: preserve-3d;
  will-change: transform;
  box-shadow:
    0 34px 90px -58px #000,
    0 0 46px -12px rgb(var(--fx-accent) / var(--fx-glow));
  transition:
    transform .25s cubic-bezier(.2, .7, .2, 1),
    border-color .35s,
    box-shadow .35s;
  /* `backwards` only: once the entrance ends, the normal transform above
     (tilt, lift) takes over instead of the last keyframe. */
  animation:
    fx-enter .6s cubic-bezier(.2, .7, .2, 1) .15s backwards,
    fx-breathe 4s ease-in-out 1s infinite;
}

/* Everything inside sits above the two pseudo layers; the existing blurred
   blob keeps its absolute positioning. */
.token-card > :not(.token-card-glow) {
  position: relative;
  z-index: 2;
}

.token-card-glow {
  z-index: 0;
  animation: fx-drift 9s ease-in-out infinite;
}

/* Spotlight that follows the pointer (inside the card, so overflow:hidden
   does not clip it). */
.token-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgb(var(--fx-accent) / .13),
    transparent 62%
  );
  transition: opacity .4s;
}

/* Rotating rim light: a conic gradient masked down to a 1.5px ring. */
.token-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--fx-angle),
    transparent 0deg,
    rgb(var(--fx-accent) / .85) 70deg,
    transparent 140deg,
    transparent 220deg,
    rgb(var(--fx-accent) / .55) 290deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .7;
  animation: fx-spin 6s linear infinite;
  transition: opacity .35s;
}

@media (hover: hover) {
  .token-card:hover {
    --lift: -6px;
    --scale: 1.012;
    border-color: rgb(var(--fx-accent) / .28);
    box-shadow:
      0 34px 90px -58px #000,
      0 30px 60px -28px rgb(0 0 0 / .6),
      0 0 0 1px rgb(var(--fx-accent) / .12),
      0 0 46px -8px rgb(var(--fx-accent) / calc(var(--fx-glow) + .1));
  }
  .token-card:hover::before { opacity: 1; }
  .token-card:hover::after { opacity: 1; }
}

@keyframes fx-enter {
  from { opacity: 0; transform: perspective(900px) translateY(14px) scale(.985); }
  to   { opacity: 1; transform: perspective(900px) translateY(0) scale(1); }
}

@keyframes fx-spin {
  to { --fx-angle: 360deg; }
}

@keyframes fx-breathe {
  0%, 100% { --fx-glow: .1; }
  50%      { --fx-glow: .22; }
}

@keyframes fx-drift {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-40px, 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .token-card,
  .token-card:hover {
    transform: none;
    animation: none;
  }
  .token-card::after,
  .token-card-glow {
    animation: none;
  }
  .token-card::before {
    display: none;
  }
}
