/* ================================================================
   Loot Geek — Animations & Effects
   ================================================================ */

/* ── Keyframes ── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.6); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(255, 215, 0, 0.3); }
  50% { border-color: rgba(255, 107, 53, 0.5); }
}

@keyframes textGlitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

@keyframes neonFlicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow: 
      0 0 7px rgba(255, 215, 0, 0.6),
      0 0 10px rgba(255, 215, 0, 0.4),
      0 0 21px rgba(255, 215, 0, 0.3);
  }
  20%, 24%, 55% {
    text-shadow: none;
  }
}

@keyframes particleFloat {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% {
    transform: translate(var(--tx, 100px), var(--ty, -200px)) rotate(720deg);
    opacity: 0;
  }
}

/* ── Scroll Reveal Animations ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Stagger delays for grid items */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ── Animated Gradient Text ── */
.animated-gradient {
  background: linear-gradient(270deg, var(--accent-primary), var(--accent-secondary), var(--accent-amber), var(--accent-primary));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}

/* ── Hover Effects ── */
.hover-glow {
  transition: all var(--transition-normal);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow-cyan);
}

.hover-lift {
  transition: transform var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-6px);
}

.hover-scale {
  transition: transform var(--transition-normal);
}

.hover-scale:hover {
  transform: scale(1.03);
}

/* ── Particles (CSS only) ── */
.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-cyan);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}

.particle:nth-child(1) {
  left: 10%;
  top: 80%;
  --tx: 30px;
  --ty: -300px;
  animation-duration: 8s;
  animation-delay: 0s;
}

.particle:nth-child(2) {
  left: 25%;
  top: 90%;
  --tx: -50px;
  --ty: -400px;
  animation-duration: 10s;
  animation-delay: 1s;
  background: var(--accent-secondary);
}

.particle:nth-child(3) {
  left: 50%;
  top: 85%;
  --tx: 80px;
  --ty: -350px;
  animation-duration: 9s;
  animation-delay: 2s;
}

.particle:nth-child(4) {
  left: 70%;
  top: 95%;
  --tx: -30px;
  --ty: -450px;
  animation-duration: 11s;
  animation-delay: 0.5s;
  background: var(--accent-tertiary);
}

.particle:nth-child(5) {
  left: 85%;
  top: 80%;
  --tx: 60px;
  --ty: -380px;
  animation-duration: 7s;
  animation-delay: 3s;
  background: var(--accent-amber);
}

.particle:nth-child(6) {
  left: 40%;
  top: 92%;
  --tx: -70px;
  --ty: -420px;
  animation-duration: 12s;
  animation-delay: 1.5s;
}

.particle:nth-child(7) {
  left: 60%;
  top: 88%;
  --tx: 40px;
  --ty: -360px;
  animation-duration: 8.5s;
  animation-delay: 4s;
  background: var(--accent-pink);
}

.particle:nth-child(8) {
  left: 15%;
  top: 95%;
  --tx: 90px;
  --ty: -500px;
  animation-duration: 13s;
  animation-delay: 2.5s;
  background: var(--accent-orange);
}

/* ── Typing Effect ── */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-cyan);
  white-space: nowrap;
  animation: 
    typing 3.5s steps(40, end),
    blinkCaret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blinkCaret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-cyan); }
}

/* ── Counter Animation ── */
.counter-value {
  display: inline-block;
  transition: all 0.5s ease;
}

/* ── Loading Spinner ── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

/* ── Rating Stars Animation ── */
.star-animated {
  display: inline-block;
  transition: transform 0.2s ease;
}

.star-animated:hover {
  transform: scale(1.3) rotate(15deg);
}

/* ── Card Entrance (for dynamically added cards) ── */
.card-enter {
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Neon text ── */
.neon-text {
  color: var(--accent-primary);
  text-shadow: 
    0 0 7px rgba(255, 215, 0, 0.6),
    0 0 10px rgba(255, 215, 0, 0.4),
    0 0 21px rgba(255, 215, 0, 0.3);
}

/* ── Glowing border animation ── */
.glow-border {
  animation: borderGlow 3s ease infinite;
}

/* ── Page transition overlay ── */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-transition.active {
  opacity: 1;
}

/* ── 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;
    transform: none;
  }
}
