/* ==========================================================================
   TUMAN PANEL — PALLI ANIMATION MOTION LAYER
   Ambient background, hero treatment and micro-interactions.

   Performance contract for everything in this file:
     - animate opacity / transform only (never width, height, top, left)
     - each animated layer is composited and isolated (contain + will-change)
     - all of it is decorative, so it collapses to a static state under
       prefers-reduced-motion or when the device reports low capability
   ========================================================================== */

/* ==========================================================================
   1. AURORA — the ambient gradient field behind the page
   ========================================================================== */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--surface-0);
  contain: strict;
}

/* Two slow-drifting violet/gold blooms. Blur is baked into the gradient stops
   rather than a filter, which keeps this off the paint-heavy path. */
.aurora::before,
.aurora::after {
  content: '';
  position: absolute;
  width: 65vmax;
  height: 65vmax;
  border-radius: 50%;
  will-change: transform;
}
.aurora::before {
  top: -22vmax;
  left: -14vmax;
  background: radial-gradient(circle at center,
              rgba(124, 58, 237, .28) 0%,
              rgba(124, 58, 237, .10) 42%,
              transparent 68%);
  animation: aurora-drift-a 26s var(--ease) infinite alternate;
}
.aurora::after {
  right: -20vmax;
  bottom: -26vmax;
  background: radial-gradient(circle at center,
              rgba(245, 158, 11, .16) 0%,
              rgba(217, 119, 6, .07) 40%,
              transparent 66%);
  animation: aurora-drift-b 34s var(--ease) infinite alternate;
}

/* Fine grid, anchored to the top of the page — reads as "technical panel"
   without the noise of a full-page pattern. */
.aurora-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, .055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, .055) 1px, transparent 1px);
  background-size: 3.5rem 3.5rem;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 60%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 60%);
}

@keyframes aurora-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}
@keyframes aurora-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.08); }
  to   { transform: translate3d(-5vmax, -3vmax, 0) scale(1); }
}

/* ==========================================================================
   2. PARTICLES — canvas layer, drawn by assets/js/main.js
   ========================================================================== */
.particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .55;
}

/* ==========================================================================
   3. HERO
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-12) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(124, 58, 237, .22) 0%, transparent 55%),
    radial-gradient(90% 120% at 95% 100%, rgba(245, 158, 11, .12) 0%, transparent 50%),
    var(--surface-1);
}
@media (min-width: 768px) { .hero { padding: var(--space-16) var(--space-10); } }

/* Hairline highlight along the top edge — the "light source" of the panel */
.hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, .55), transparent);
}
.hero-inner { position: relative; max-width: 42rem; }
.hero-title {
  font-size: var(--text-2xl);
  line-height: 1.1;
  letter-spacing: .01em;
  text-transform: uppercase;
}
@media (min-width: 768px) { .hero-title { font-size: var(--text-4xl); } }
.hero-text {
  margin-top: var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-md);
  max-width: 34rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.hero-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hero-stat-label {
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ==========================================================================
   4. MICRO-INTERACTIONS
   ========================================================================== */

/* Pointer spotlight. JS writes --mx/--my; without JS the layer stays hidden. */
.spotlight { position: relative; isolation: isolate; }
.spotlight::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(18rem circle at var(--mx, 50%) var(--my, 0%), rgba(124, 58, 237, .16), transparent 65%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.spotlight:hover::before { opacity: 1; }

/* Sheen sweep on the primary CTA — one pass on hover, not a loop */
.sheen { position: relative; overflow: hidden; }
.sheen::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  transform: skewX(-18deg);
  opacity: 0;
}
.sheen:hover::before { animation: sheen-sweep var(--dur-slower) var(--ease-out) both; }
@keyframes sheen-sweep {
  from { opacity: 1; transform: translate3d(0, 0, 0) skewX(-18deg); }
  to   { opacity: 0; transform: translate3d(380%, 0, 0) skewX(-18deg); }
}

/* Live indicator for the public order feed */
.live-dot {
  display: inline-block;
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .5);
  animation: live-ping 2.4s var(--ease-out) infinite;
}
@keyframes live-ping {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); }
  70%  { box-shadow: 0 0 0 .55rem rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Value flash when a balance or counter updates */
.flash-update { animation: flash-update var(--dur-slower) var(--ease-out) both; }
@keyframes flash-update {
  0%   { color: var(--gold-300); transform: scale(1.04); }
  100% { color: inherit; transform: none; }
}

/* Border-light trace for the one "featured" card per view */
.card-featured {
  position: relative;
  border-color: transparent;
  background:
    linear-gradient(var(--surface-1), var(--surface-1)) padding-box,
    linear-gradient(120deg, var(--purple-600), var(--gold-500), var(--purple-700)) border-box;
  border: 1px solid transparent;
}

/* ==========================================================================
   5. DEGRADATION
   Two escape hatches: the OS reduced-motion setting, and .low-motion which
   main.js adds when the device reports few cores / little memory or when the
   tab is backgrounded.
   ========================================================================== */
.low-motion .aurora::before,
.low-motion .aurora::after { animation: none !important; }
.low-motion .particles { display: none !important; }
.low-motion .live-dot { animation: none !important; }
.low-motion .sheen::before { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .aurora::before,
  .aurora::after,
  .live-dot,
  .sheen::before { animation: none !important; }
  .particles { display: none !important; }
  .spotlight::before { display: none !important; }
  .flash-update { animation: none !important; }
}

/* Small screens: the gradient field stays, the canvas does not. It costs
   battery for something largely hidden behind content on a phone. */
@media (max-width: 640px) {
  .particles { display: none; }
  .aurora-grid { background-size: 2.5rem 2.5rem; }
}

/* Data-saver mode */
@media (prefers-reduced-data: reduce) {
  .particles { display: none; }
  .aurora::before, .aurora::after { animation: none; }
}
