/* ============================================
   G.R.I.P. Platform — Animations & Transitions
   ============================================ */

/* ===================== KEYFRAMES ===================== */

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade Out */
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Slide Up */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide Down */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In from Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In from Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Glow — cyan box-shadow pulse */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2), 0 0 2px rgba(0, 240, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.35), 0 0 6px rgba(0, 240, 255, 0.6);
  }
}

/* Glow Text — text-shadow pulse */
@keyframes glowText {
  0%, 100% {
    text-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
  }
  50% {
    text-shadow: 0 0 16px rgba(0, 240, 255, 0.6), 0 0 4px rgba(0, 240, 255, 0.8);
  }
}

/* Scan Line — horizontal sweep */
@keyframes scan-line {
  0% {
    top: -2px;
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  95% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* Data Stream — vertical scroll of data */
@keyframes data-stream {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

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

/* Rotate (for spinners) */
@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Float — subtle vertical bobbing */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Ripple — expanding ring */
@keyframes ripple {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Canvas Wipe In */
@keyframes canvasWipeIn {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* ===================== UTILITY CLASSES ===================== */

/* Animations */
.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.animate-slide-up {
  animation: slideUp 0.35s ease forwards;
}

.animate-slide-down {
  animation: slideDown 0.35s ease forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.35s ease forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.35s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.25s ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease infinite;
}

.animate-glow {
  animation: glow 2.5s ease infinite;
}

.animate-glow-text {
  animation: glowText 2.5s ease infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-data-stream {
  animation: data-stream 20s linear infinite;
}

.animate-blink {
  animation: blink 1s step-end infinite;
}

/* Stagger delays for sequential card/list animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* Start invisible for staggered items */
.stagger-item {
  opacity: 0;
  animation-fill-mode: forwards;
}

/* Duration modifiers */
.duration-fast   { animation-duration: 0.15s; }
.duration-normal { animation-duration: 0.3s; }
.duration-slow   { animation-duration: 0.5s; }
.duration-slower { animation-duration: 0.8s; }

/* ===================== TRANSITION UTILITIES ===================== */

.transition-none     { transition: none; }
.transition-all      { transition: var(--transition-all); }
.transition-colors   { transition: var(--transition-color); }
.transition-opacity  { transition: var(--transition-opacity); }
.transition-shadow   { transition: var(--transition-shadow); }
.transition-transform { transition: var(--transition-transform); }

/* ===================== CANVAS CONTAINERS ===================== */

.canvas-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.canvas-container--animate-in {
  animation: canvasWipeIn 0.6s ease forwards;
}

.canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Scan line overlay for biometric canvases */
.canvas-container--scan::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 240, 255, 0.25),
    transparent
  );
  animation: scan-line 4s ease infinite;
  pointer-events: none;
}

/* Data stream overlay */
.data-stream-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.04;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  line-height: 1.8;
  animation: data-stream 20s linear infinite;
}

/* ===================== REDUCED MOTION ===================== */

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-fade-out,
  .animate-slide-up,
  .animate-slide-down,
  .animate-slide-in-left,
  .animate-slide-in-right,
  .animate-scale-in {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .animate-pulse,
  .animate-glow,
  .animate-glow-text,
  .animate-float,
  .animate-data-stream,
  .animate-blink {
    animation: none;
  }

  .canvas-container--animate-in {
    animation: none;
    clip-path: none;
  }

  .canvas-container--scan::after {
    animation: none;
    display: none;
  }
}
