/* ============================================
   BitPulse — Animations CSS
   Scroll reveal, transitions, subtle effects
   ============================================ */

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-smooth);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-smooth);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-smooth);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s var(--ease-smooth), transform 0.5s var(--ease-smooth);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Staggered children */
.stagger-children .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger-children .reveal:nth-child(2) { transition-delay: 100ms; }
.stagger-children .reveal:nth-child(3) { transition-delay: 200ms; }
.stagger-children .reveal:nth-child(4) { transition-delay: 300ms; }
.stagger-children .reveal:nth-child(5) { transition-delay: 400ms; }
.stagger-children .reveal:nth-child(6) { transition-delay: 500ms; }
.stagger-children .reveal:nth-child(7) { transition-delay: 600ms; }
.stagger-children .reveal:nth-child(8) { transition-delay: 700ms; }

/* --- Hero Background Animation --- */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.hero-grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(0, 212, 180, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 180, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

.hero-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  animation: glowFloat 8s ease-in-out infinite;
}

.hero-glow--accent {
  background: var(--color-accent);
  top: -200px;
  right: -100px;
}

.hero-glow--btc {
  background: var(--color-btc);
  bottom: -200px;
  left: -100px;
  animation-delay: -4s;
}

@keyframes glowFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.1); }
}

/* --- Pulse Dot --- */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-green);
  position: relative;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--color-green);
  animation: pulseDot 2s ease-out infinite;
}

@keyframes pulseDot {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* --- Counter Animation --- */
.counter-value {
  display: inline-block;
  transition: transform 0.3s var(--ease-bounce);
}

.counter-value.updating {
  transform: scale(1.1);
}

/* --- Card Shine Effect --- */
.card-shine {
  position: relative;
  overflow: hidden;
}

.card-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    transparent 40%,
    rgba(255, 255, 255, 0.02) 50%,
    transparent 60%
  );
  transform: rotate(30deg);
  transition: transform 0.5s var(--ease-smooth);
  pointer-events: none;
}

.card-shine:hover::after {
  transform: rotate(30deg) translateY(-30%);
}

/* --- Bitcoin Icon Spin --- */
.btc-spin {
  display: inline-block;
  animation: btcSpin 10s linear infinite;
}

@keyframes btcSpin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

/* --- Floating Particles --- */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 6s ease-in-out infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 5s; }
.particle:nth-child(2) { left: 25%; animation-delay: 1s; animation-duration: 7s; }
.particle:nth-child(3) { left: 40%; animation-delay: 2s; animation-duration: 6s; }
.particle:nth-child(4) { left: 55%; animation-delay: 0.5s; animation-duration: 8s; }
.particle:nth-child(5) { left: 70%; animation-delay: 1.5s; animation-duration: 5.5s; }
.particle:nth-child(6) { left: 85%; animation-delay: 2.5s; animation-duration: 7s; }

@keyframes particleFloat {
  0% { transform: translateY(100vh); opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-20px); opacity: 0; }
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-accent), var(--color-btc));
  transition: width 1s var(--ease-smooth);
}

/* --- Number Ticker --- */
.number-flip {
  display: inline-flex;
  overflow: hidden;
  height: 1.2em;
}

.number-flip-digit {
  display: inline-block;
  transition: transform 0.5s var(--ease-bounce);
}

/* --- Typing Cursor --- */
.typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--color-accent);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Countdown Timer --- */
.countdown-grid {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.countdown-value {
  font-family: var(--font-mono);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  color: var(--color-accent);
  min-width: 80px;
  text-align: center;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  line-height: 1;
}

.countdown-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

/* --- Gauge (SVG circular) --- */
.gauge-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.gauge-bg {
  fill: none;
  stroke: var(--color-bg-tertiary);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s var(--ease-smooth);
}

.gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
}

.gauge-label {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Theme Transition --- */
body {
  transition: background-color var(--duration-slow) var(--ease-smooth),
              color var(--duration-slow) var(--ease-smooth);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .countdown-value {
    font-size: var(--fs-2xl);
    min-width: 60px;
    padding: var(--space-sm) var(--space-md);
  }

  .hero-glow {
    width: 300px;
    height: 300px;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
  }
}

/* --- Degen Zone High-Energy Animations --- */

/* Glow Pulse for neon elements */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 212, 180, 0.2), 0 0 20px rgba(0, 212, 180, 0.2); }
  50% { box-shadow: 0 0 25px var(--color-accent), 0 0 45px rgba(0, 212, 180, 0.4); }
}

.glow-pulse {
  animation: glow-pulse 3s infinite;
}

/* Glitch for Degen titles */
@keyframes glitch-sm {
  0% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(-1px, -1px); }
  60% { transform: translate(1px, 1px); }
  80% { transform: translate(1px, -1px); }
  100% { transform: translate(0); }
}

.glitch-text-sm:hover {
  animation: glitch-sm 0.3s cubic-bezier(.25,.46,.45,.94) both infinite;
}

/* Floating animation for cards */
@keyframes card-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.card-float {
  animation: card-float 4s ease-in-out infinite;
}

/* Neon border flow */
@keyframes neon-border-flow {
  0% { border-color: var(--color-accent); }
  33% { border-color: var(--color-btc); }
  66% { border-color: var(--color-green); }
  100% { border-color: var(--color-accent); }
}

.neon-border-flow {
  border-width: 2px;
  animation: neon-border-flow 6s linear infinite;
}

/* Rapid price pulse (for price updates) */
@keyframes price-update-up {
  0% { transform: scale(1); }
  20% { color: var(--color-green); transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes price-update-down {
  0% { transform: scale(1); }
  20% { color: var(--color-red); transform: scale(1.1); }
  100% { transform: scale(1); }
}

.price-pulse-up { animation: price-update-up 0.8s ease-out; }
.price-pulse-down { animation: price-update-down 0.8s ease-out; }
