/* ==========================================================================
   XIRO Testnet — Motion & skeleton (WP02, blueprint §07)
   Loaded after tokens.css, before page CSS. Native scroll is the default:
   no full-screen curtain, no scroll hijack, no reveal-hidden critical
   content. Durations come from the tokens; nothing here animates width,
   top, height, large blur or box-shadow per frame.
   ========================================================================== */

/* --- Page / section entrance: 180–240ms, opacity + translateY(6px) ------- */
@keyframes xiro-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.xiro-enter {
  animation: xiro-enter var(--motion-entrance) var(--motion-ease) both;
}
/* Stagger: 30–40ms per item, max six items, total visible entrance ≤400ms. */
.xiro-enter-stagger > *:nth-child(1) { animation-delay: 0ms; }
.xiro-enter-stagger > *:nth-child(2) { animation-delay: var(--motion-stagger); }
.xiro-enter-stagger > *:nth-child(3) { animation-delay: calc(var(--motion-stagger) * 2); }
.xiro-enter-stagger > *:nth-child(4) { animation-delay: calc(var(--motion-stagger) * 3); }
.xiro-enter-stagger > *:nth-child(5) { animation-delay: calc(var(--motion-stagger) * 4); }
.xiro-enter-stagger > *:nth-child(6) { animation-delay: calc(var(--motion-stagger) * 5); }

/* --- Modal / drawer -------------------------------------------------------- */
@keyframes xiro-modal-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
.xiro-modal-in { animation: xiro-modal-in var(--motion-modal) var(--motion-ease) both; }
@keyframes xiro-drawer-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.xiro-drawer-in { animation: xiro-drawer-in var(--motion-drawer) var(--motion-ease) both; }

/* --- Confirmed-live status pulse only (1.6–2s). Never on stale/offline. --- */
@keyframes xiro-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.xiro-pulse-live { animation: xiro-pulse var(--motion-pulse) ease-in-out infinite; }

/* --- Metric refresh: subtle opacity only, 120–180ms. No count-up for ----- */
/* --- funds / reward confirmation. ---------------------------------------- */
.xiro-metric-refresh { transition: opacity 150ms ease; }
.xiro-metric-refresh.is-refreshing { opacity: 0.55; }

/* --- Skeleton (§07): stable placeholder, same dimensions as content. ----- */
/* --- 120ms flash rule + 8–10s timeout live in public/js/components.js. -- */
.xiro-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeleton-base);
  border-radius: var(--radius-card);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}
.xiro-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    var(--skeleton-highlight),
    transparent
  );
  animation: xiro-shimmer var(--motion-skeleton) linear infinite;
}
@keyframes xiro-shimmer {
  to { transform: translateX(100%); }
}
.xiro-skeleton-bar { height: 14px; border-radius: 6px; }
.xiro-skeleton-line { height: 12px; border-radius: 6px; }
.xiro-skeleton-row { display: flex; gap: var(--space-3); align-items: center; }
.xiro-skeleton-row .xiro-skeleton { flex: 1; min-width: 0; }
.xiro-skeleton-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; }
/* Hidden tab: shimmer pauses (components.js also stops the timer). */
[hidden] .xiro-skeleton::after,
.xiro-skeleton-paused::after { animation-play-state: paused; }

/* --- The old full-screen curtain is gone (F22). If any stale markup ----- */
/* --- survives, it must never cover content. ------------------------------ */
#curtain { display: none !important; }

/* --- Reduced motion (§07 / WCAG animation-from-interactions) ------------- */
/* --- Movement / shimmer / autospin off; instant or ≤100ms fade. ---------- */
@media (prefers-reduced-motion: reduce) {
  .xiro-enter,
  .xiro-modal-in,
  .xiro-drawer-in { animation-duration: 100ms; animation-delay: 0ms; }
  .xiro-skeleton::after,
  .xiro-pulse-live { animation: none; }
  .xiro-skeleton { background: var(--skeleton-base); }
  html { scroll-behavior: auto; }
}
html.motion-off .xiro-enter,
html.motion-off .xiro-modal-in,
html.motion-off .xiro-drawer-in { animation-duration: 100ms; animation-delay: 0ms; }
html.motion-off .xiro-skeleton::after,
html.motion-off .xiro-pulse-live { animation: none; }
html.low-effects .xiro-skeleton::after { animation: none; }
