/* ============================================================
   AUREMY.COM — ANIMATIONS STYLESHEET
   Scroll-triggered animations, keyframes, transitions
   ============================================================ */

/* ============================================================
   KEYFRAME DEFINITIONS
   ============================================================ */

/* Blinking cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Floating terminal */
@keyframes floatTerminal {
  0%, 100% { transform: translateY(-50%); }
  50%       { transform: translateY(calc(-50% - 12px)); }
}

/* Ticker scroll */
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Pulse (badge dot, live dot) */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

/* Glow pulse on buttons */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.3); }
  50%       { box-shadow: 0 0 40px rgba(0, 212, 255, 0.6); }
}

/* Fade in up (scroll-triggered) */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in (generic) */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Fade in from left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in from right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Number counter shimmer */
@keyframes counterShimmer {
  0%   { opacity: 0.4; }
  50%  { opacity: 1; }
  100% { opacity: 1; }
}

/* Gradient border rotation */
@keyframes borderRotate {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}

/* Typewriter caret */
@keyframes caretBlink {
  0%, 100% { border-color: var(--accent-cyan); }
  50%       { border-color: transparent; }
}

/* Candlestick draw */
@keyframes candleDraw {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

/* Price update flash (green/red) */
@keyframes flashGreen {
  0%   { background-color: rgba(0,255,136,0.2); }
  100% { background-color: transparent; }
}

@keyframes flashRed {
  0%   { background-color: rgba(255,71,87,0.2); }
  100% { background-color: transparent; }
}

/* Bar fill animation */
@keyframes barGrow {
  from { width: 0; }
  to   { width: var(--pct); }
}

/* Scan line (terminal effect) */
@keyframes scanLine {
  0%   { top: 0%; }
  100% { top: 100%; }
}

/* ============================================================
   SCROLL-TRIGGERED ANIMATION CLASSES
   Initial state: hidden. JS adds .is-visible to trigger.
   ============================================================ */

[data-animate] {
  opacity: 0;
  will-change: opacity, transform;
  transition: none; /* Controlled by animation */
}

[data-animate="fade-up"] {
  transform: translateY(32px);
}

[data-animate="fade-down"] {
  transform: translateY(-32px);
}

[data-animate="fade-left"] {
  transform: translateX(32px);
}

[data-animate="fade-right"] {
  transform: translateX(-32px);
}

[data-animate="scale-in"] {
  transform: scale(0.92);
}

/* When .is-visible is added */
[data-animate].is-visible {
  animation-fill-mode: forwards;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  animation-duration: 0.7s;
  animation-delay: calc(var(--delay, 0) * 1ms);
}

[data-animate="fade-up"].is-visible {
  animation-name: fadeInUp;
}

[data-animate="fade-down"].is-visible {
  animation-name: fadeInUp; /* reversed direction ok */
}

[data-animate="fade-left"].is-visible {
  animation-name: fadeInLeft;
}

[data-animate="fade-right"].is-visible {
  animation-name: fadeInRight;
}

[data-animate="scale-in"].is-visible {
  animation-name: scaleIn;
}

/* Staggered children — set via JS or data-delay attribute */
[data-delay="0"]   { --delay: 0;   }
[data-delay="100"] { --delay: 100; }
[data-delay="200"] { --delay: 200; }
[data-delay="300"] { --delay: 300; }
[data-delay="400"] { --delay: 400; }
[data-delay="500"] { --delay: 500; }

/* ============================================================
   HERO ANIMATIONS (run on page load, not scroll-triggered)
   ============================================================ */

.hero-badge {
  animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.hero-headline {
  animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

.hero-sub {
  animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

.hero-cta-group {
  animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

.hero-stats {
  animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.7s both;
}

.hero-terminal {
  animation: fadeInRight 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.9s both,
             floatTerminal 5s ease-in-out 1.7s infinite;
}

/* Terminal line stagger */
.t-line {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.t-line:nth-child(1) { animation-delay: 1.2s; }
.t-line:nth-child(2) { animation-delay: 1.6s; }
.t-line:nth-child(3) { animation-delay: 1.9s; }
.t-line:nth-child(4) { animation-delay: 2.2s; }
.t-line:nth-child(5) { animation-delay: 2.5s; }
.t-line:nth-child(6) { animation-delay: 2.8s; }
.t-line:nth-child(7) { animation-delay: 3.1s; }
.t-line:nth-child(8) { animation-delay: 3.4s; }

/* ============================================================
   METRIC BAR ANIMATION — triggered when in viewport
   ============================================================ */
.metric-bar {
  width: 0;
}

.metric-bar.animate {
  animation: barGrow 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ============================================================
   COUNTER ANIMATION
   Stat numbers animate from 0 to target (handled by JS)
   Apply shimmer while counting
   ============================================================ */
.stat-num.counting,
.stats-num.counting {
  animation: counterShimmer 0.3s ease infinite alternate;
}

/* ============================================================
   PRICE FLASH ANIMATIONS
   Applied by JS on liquidity feed updates
   ============================================================ */
.flash-up   { animation: flashGreen 0.6s ease forwards; }
.flash-down { animation: flashRed   0.6s ease forwards; }

/* ============================================================
   INTERACTIVE HOVER EFFECTS
   ============================================================ */

/* Glow on primary CTA hover */
.btn-primary:hover {
  animation: glowPulse 1.5s ease infinite;
}

/* Hover shine effect on cards */
.sol-card::after,
.why-card::after,
.testi-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.03),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.sol-card:hover::after,
.why-card:hover::after,
.testi-card:hover::after {
  left: 125%;
}

/* ============================================================
   NAV SCROLL INDICATOR
   ============================================================ */
.navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1px;
  width: var(--scroll-pct, 0%);
  background: var(--grad-cyan);
  transition: width 0.1s linear;
}

/* ============================================================
   CANVAS HERO BACKGROUND FADE-IN
   ============================================================ */
#heroCanvas {
  opacity: 0;
  animation: fadeIn 1.5s ease 0.3s forwards;
}

/* ============================================================
   PAGE TRANSITION — reduces flash on load
   ============================================================ */
body {
  animation: fadeIn 0.4s ease both;
}

/* ============================================================
   REDUCED MOTION OVERRIDES
   Respect user preference for reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .ticker-track { animation: none; }
  .hero-terminal { animation: none; }
  [data-animate] { opacity: 1; transform: none; }
}
