/*
 * SWARM Visual Effects System v1.0
 * Premium CSS animations and effects for SWARM Protocol crypto platform
 * Production-ready: Chrome 90+, Firefox 88+, Safari 15+
 * ================================================================ */

/* ============================================
   1. CSS CUSTOM PROPERTIES
   ============================================ */

:root {
  /* Core palette */
  --cc-black: #0a0a0f;
  --cc-dark: #12121a;
  --cc-surface: #1a1a2e;
  --cc-surface-light: #222240;

  /* Accent colors */
  --cc-cyan: #00E5FF;
  --cc-blue: #00AAFF;
  --cc-purple: #8B5CF6;
  --cc-purple-deep: #6D28D9;
  --cc-green: #10B981;
  --cc-green-bright: #34D399;
  --cc-gold: #F59E0B;
  --cc-gold-light: #FBBF24;
  --cc-red: #EF4444;
  --cc-pink: #EC4899;

  /* Glow presets */
  --cc-glow-cyan: 0 0 20px rgba(0, 229, 255, 0.3);
  --cc-glow-cyan-strong: 0 0 30px rgba(0, 229, 255, 0.5), 0 0 60px rgba(0, 229, 255, 0.2);
  --cc-glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);
  --cc-glow-purple-strong: 0 0 30px rgba(139, 92, 246, 0.5), 0 0 60px rgba(139, 92, 246, 0.2);
  --cc-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);
  --cc-glow-gold: 0 0 20px rgba(245, 158, 11, 0.3);

  /* Timing functions */
  --cc-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --cc-ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
  --cc-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Durations */
  --cc-duration-fast: 150ms;
  --cc-duration-normal: 300ms;
  --cc-duration-slow: 500ms;
  --cc-duration-glacial: 1000ms;
}


/* ============================================
   2. ANIMATED DOT GRID BACKGROUND
   ============================================ */

.cc-grid-bg {
  position: relative;
  overflow: hidden;
}

.cc-grid-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(0, 229, 255, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: cc-grid-pulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 100%);
}

.cc-grid-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(139, 92, 246, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 20px 20px;
  animation: cc-grid-pulse 8s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 100%);
}

@keyframes cc-grid-pulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}


/* ============================================
   3. GLASSMORPHISM CARDS
   ============================================ */

.cc-glass {
  background: rgba(18, 18, 26, 0.55);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(0, 229, 255, 0.08);
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color var(--cc-duration-normal) ease,
    box-shadow var(--cc-duration-normal) ease;
}

.cc-glass:hover {
  border-color: rgba(0, 229, 255, 0.2);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(0, 229, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.cc-glass-purple {
  background: rgba(18, 18, 26, 0.55);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(139, 92, 246, 0.08);
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color var(--cc-duration-normal) ease,
    box-shadow var(--cc-duration-normal) ease;
}

.cc-glass-purple:hover {
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(139, 92, 246, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}


/* ============================================
   4. GRADIENT TEXT
   ============================================ */

.cc-gradient-text {
  background: linear-gradient(
    135deg,
    var(--cc-cyan) 0%,
    var(--cc-blue) 40%,
    var(--cc-purple) 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: cc-gradient-shift 6s ease infinite;
}

.cc-gradient-text-gold {
  background: linear-gradient(
    135deg,
    var(--cc-gold) 0%,
    var(--cc-gold-light) 50%,
    var(--cc-cyan) 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: cc-gradient-shift 6s ease infinite;
}

.cc-gradient-text-fire {
  background: linear-gradient(
    135deg,
    var(--cc-red) 0%,
    var(--cc-gold) 50%,
    var(--cc-gold-light) 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: cc-gradient-shift 6s ease infinite;
}

@keyframes cc-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}


/* ============================================
   5. NEON GLOW EFFECTS
   ============================================ */

.cc-glow-cyan {
  box-shadow: var(--cc-glow-cyan);
  transition: box-shadow var(--cc-duration-normal) ease;
}

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

.cc-glow-purple {
  box-shadow: var(--cc-glow-purple);
  transition: box-shadow var(--cc-duration-normal) ease;
}

.cc-glow-purple:hover {
  box-shadow: var(--cc-glow-purple-strong);
}

.cc-glow-pulse-cyan {
  animation: cc-pulse-cyan 2.5s ease-in-out infinite;
}

.cc-glow-pulse-purple {
  animation: cc-pulse-purple 2.5s ease-in-out infinite;
}

@keyframes cc-pulse-cyan {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2), 0 0 30px rgba(0, 229, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4), 0 0 50px rgba(0, 229, 255, 0.2), 0 0 80px rgba(0, 229, 255, 0.08);
  }
}

@keyframes cc-pulse-purple {
  0%, 100% {
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2), 0 0 30px rgba(139, 92, 246, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), 0 0 50px rgba(139, 92, 246, 0.2), 0 0 80px rgba(139, 92, 246, 0.08);
  }
}


/* ============================================
   6. PARTICLE BACKGROUND (CSS only)
   ============================================ */

.cc-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cc-particles::before {
  content: '';
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: transparent;
  top: 0;
  left: 0;
  box-shadow:
    /* Layer 1 — cyan particles */
    25vw 15vh 0 0 rgba(0, 229, 255, 0.5),
    75vw 25vh 0 0 rgba(0, 229, 255, 0.3),
    45vw 55vh 0 0 rgba(0, 229, 255, 0.4),
    10vw 80vh 0 0 rgba(0, 229, 255, 0.25),
    85vw 65vh 0 0 rgba(0, 229, 255, 0.35),
    60vw 10vh 0 0 rgba(0, 229, 255, 0.45),
    30vw 90vh 0 0 rgba(0, 229, 255, 0.2),
    92vw 40vh 0 0 rgba(0, 229, 255, 0.3),
    15vw 45vh 0 0 rgba(0, 229, 255, 0.35),
    55vw 75vh 0 0 rgba(0, 229, 255, 0.25),
    /* Layer 2 — purple particles */
    35vw 20vh 0 0 rgba(139, 92, 246, 0.4),
    80vw 50vh 0 0 rgba(139, 92, 246, 0.3),
    20vw 70vh 0 0 rgba(139, 92, 246, 0.35),
    65vw 35vh 0 0 rgba(139, 92, 246, 0.25),
    50vw 85vh 0 0 rgba(139, 92, 246, 0.3),
    5vw 30vh 0 0 rgba(139, 92, 246, 0.2),
    90vw 15vh 0 0 rgba(139, 92, 246, 0.35),
    40vw 60vh 0 0 rgba(139, 92, 246, 0.4);
  animation: cc-particles-drift-1 25s linear infinite;
}

.cc-particles::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: transparent;
  top: 0;
  left: 0;
  box-shadow:
    /* Layer 3 — gold accent particles */
    18vw 35vh 0 0 rgba(245, 158, 11, 0.3),
    72vw 70vh 0 0 rgba(245, 158, 11, 0.25),
    48vw 12vh 0 0 rgba(245, 158, 11, 0.2),
    /* Layer 4 — larger cyan glows */
    33vw 48vh 0 1px rgba(0, 229, 255, 0.15),
    67vw 82vh 0 1px rgba(0, 229, 255, 0.12),
    88vw 22vh 0 1px rgba(139, 92, 246, 0.15),
    12vw 58vh 0 1px rgba(139, 92, 246, 0.12);
  animation: cc-particles-drift-2 35s linear infinite;
}

@keyframes cc-particles-drift-1 {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-15px, -25px); }
  50% { transform: translate(10px, -50px); }
  75% { transform: translate(-5px, -75px); }
  100% { transform: translate(0, -100vh); }
}

@keyframes cc-particles-drift-2 {
  0% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(20px, -30vh) rotate(2deg); }
  66% { transform: translate(-10px, -60vh) rotate(-1deg); }
  100% { transform: translate(0, -100vh) rotate(0deg); }
}


/* ============================================
   7. TERMINAL EFFECT
   ============================================ */

.cc-terminal {
  background: linear-gradient(180deg, #0d1117 0%, #0a0e14 100%);
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 12px;
  padding: 1.5rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--cc-green-bright);
  position: relative;
  overflow: hidden;
}

.cc-terminal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Terminal title bar dots */
.cc-terminal-header {
  display: flex;
  gap: 6px;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.cc-terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.cc-terminal-dot--red { background: #FF5F56; }
.cc-terminal-dot--yellow { background: #FFBD2E; }
.cc-terminal-dot--green { background: #27C93F; }

/* Terminal text colors */
.cc-terminal .cc-t-cyan { color: var(--cc-cyan); }
.cc-terminal .cc-t-purple { color: var(--cc-purple); }
.cc-terminal .cc-t-gold { color: var(--cc-gold); }
.cc-terminal .cc-t-green { color: var(--cc-green-bright); }
.cc-terminal .cc-t-dim { color: rgba(255, 255, 255, 0.35); }
.cc-terminal .cc-t-white { color: #e6e6e6; }

/* Blinking cursor */
.cc-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--cc-cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cc-blink 1s step-end infinite;
}

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

/* Typewriter effect */
.cc-typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--cc-cyan);
  width: 0;
  animation:
    cc-typing 3s steps(40) 0.5s forwards,
    cc-blink-border 0.75s step-end infinite;
}

@keyframes cc-typing {
  to { width: 100%; }
}

@keyframes cc-blink-border {
  0%, 100% { border-color: var(--cc-cyan); }
  50% { border-color: transparent; }
}

/* Multi-line typewriter with stagger */
.cc-typewriter-line {
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  animation: cc-typing 2s steps(30) forwards;
}

.cc-typewriter-line:nth-child(1) { animation-delay: 0s; }
.cc-typewriter-line:nth-child(2) { animation-delay: 1.5s; }
.cc-typewriter-line:nth-child(3) { animation-delay: 3s; }
.cc-typewriter-line:nth-child(4) { animation-delay: 4.5s; }
.cc-typewriter-line:nth-child(5) { animation-delay: 6s; }


/* ============================================
   8. CARD HOVER EFFECTS
   ============================================ */

/* 3D Tilt on hover */
.cc-card-tilt {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.cc-card-tilt > * {
  transition: transform var(--cc-duration-slow) var(--cc-ease-out-expo);
  transform-style: preserve-3d;
}

.cc-card-tilt:hover > * {
  transform: rotateX(2deg) rotateY(-3deg) translateZ(10px);
}

/* Inner highlight that follows the tilt */
.cc-card-tilt::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(0, 229, 255, 0.06) 0%,
    transparent 50%,
    rgba(139, 92, 246, 0.04) 100%
  );
  opacity: 0;
  transition: opacity var(--cc-duration-normal) ease;
  pointer-events: none;
  z-index: 1;
}

.cc-card-tilt:hover::after {
  opacity: 1;
}

/* Rotating gradient border */
.cc-card-border-gradient {
  position: relative;
  border-radius: 16px;
  z-index: 0;
}

.cc-card-border-gradient::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--cc-border-angle, 0deg),
    var(--cc-cyan),
    var(--cc-purple),
    var(--cc-gold),
    var(--cc-green),
    var(--cc-cyan)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: cc-rotate-border 4s linear infinite;
  opacity: 0.4;
  transition: opacity var(--cc-duration-normal) ease;
  z-index: -1;
}

.cc-card-border-gradient:hover::before {
  opacity: 1;
}

@keyframes cc-rotate-border {
  to {
    --cc-border-angle: 360deg;
  }
}

/* Register custom property for animation */
@property --cc-border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* Card lift on hover */
.cc-card-lift {
  transition:
    transform var(--cc-duration-normal) var(--cc-ease-out-expo),
    box-shadow var(--cc-duration-normal) ease;
}

.cc-card-lift:hover {
  transform: translateY(-6px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(0, 229, 255, 0.05);
}

/* Shimmer shine effect on hover */
.cc-card-shimmer {
  position: relative;
  overflow: hidden;
}

.cc-card-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(0, 229, 255, 0.06) 45%,
    rgba(139, 92, 246, 0.04) 50%,
    transparent 70%
  );
  transform: translateX(-100%) rotate(0deg);
  transition: none;
  pointer-events: none;
}

.cc-card-shimmer:hover::after {
  animation: cc-shimmer-sweep 0.8s ease forwards;
}

@keyframes cc-shimmer-sweep {
  to {
    transform: translateX(50%) rotate(0deg);
  }
}


/* ============================================
   9. AGENT STATUS INDICATORS
   ============================================ */

.cc-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.cc-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Active — pulsing green */
.cc-status-active {
  color: var(--cc-green-bright);
}

.cc-status-active::before {
  background: var(--cc-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: cc-status-pulse-green 2s ease-in-out infinite;
}

@keyframes cc-status-pulse-green {
  0%, 100% {
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8), 0 0 24px rgba(16, 185, 129, 0.3);
    transform: scale(1.15);
  }
}

/* Processing — amber pulse with spin ring */
.cc-status-processing {
  color: var(--cc-gold-light);
}

.cc-status-processing::before {
  background: var(--cc-gold);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  animation: cc-status-pulse-amber 1.5s ease-in-out infinite;
}

@keyframes cc-status-pulse-amber {
  0%, 100% {
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8), 0 0 20px rgba(245, 158, 11, 0.3);
    transform: scale(1.2);
  }
}

/* Idle — static gray */
.cc-status-idle {
  color: rgba(255, 255, 255, 0.4);
}

.cc-status-idle::before {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

/* Error — red pulse */
.cc-status-error {
  color: var(--cc-red);
}

.cc-status-error::before {
  background: var(--cc-red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
  animation: cc-status-pulse-red 1s ease-in-out infinite;
}

@keyframes cc-status-pulse-red {
  0%, 100% {
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.8), 0 0 28px rgba(239, 68, 68, 0.3);
  }
}


/* ============================================
   10. BUTTON EFFECTS
   ============================================ */

.cc-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--cc-black);
  background: linear-gradient(135deg, var(--cc-cyan) 0%, var(--cc-blue) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--cc-duration-fast) ease,
    box-shadow var(--cc-duration-normal) ease;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.25);
}

.cc-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px rgba(0, 229, 255, 0.35),
    0 0 40px rgba(0, 229, 255, 0.15);
}

.cc-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.2);
}

/* Ripple effect on click */
.cc-btn-primary::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 70%);
  transform: scale(0);
  opacity: 0;
  transition: none;
}

.cc-btn-primary:active::after {
  transform: scale(2.5);
  opacity: 1;
  transition: transform 0.5s ease, opacity 0.4s ease;
}

/* Glow button variant */
.cc-btn-glow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--cc-cyan);
  background: transparent;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    color var(--cc-duration-normal) ease,
    border-color var(--cc-duration-normal) ease,
    box-shadow var(--cc-duration-normal) ease,
    background var(--cc-duration-normal) ease;
  animation: cc-btn-glow-breathe 3s ease-in-out infinite;
}

.cc-btn-glow:hover {
  color: #fff;
  border-color: var(--cc-cyan);
  background: rgba(0, 229, 255, 0.08);
  box-shadow:
    0 0 20px rgba(0, 229, 255, 0.2),
    0 0 40px rgba(0, 229, 255, 0.08),
    inset 0 0 20px rgba(0, 229, 255, 0.05);
  animation: none;
}

@keyframes cc-btn-glow-breathe {
  0%, 100% {
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.2), 0 0 40px rgba(0, 229, 255, 0.06);
  }
}

/* Purple variant */
.cc-btn-glow--purple {
  color: var(--cc-purple);
  border-color: rgba(139, 92, 246, 0.3);
  animation: cc-btn-glow-breathe-purple 3s ease-in-out infinite;
}

.cc-btn-glow--purple:hover {
  color: #fff;
  border-color: var(--cc-purple);
  background: rgba(139, 92, 246, 0.08);
  box-shadow:
    0 0 20px rgba(139, 92, 246, 0.2),
    0 0 40px rgba(139, 92, 246, 0.08),
    inset 0 0 20px rgba(139, 92, 246, 0.05);
  animation: none;
}

@keyframes cc-btn-glow-breathe-purple {
  0%, 100% {
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.1);
  }
  50% {
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.2), 0 0 40px rgba(139, 92, 246, 0.06);
  }
}


/* ============================================
   11. COUNTER ANIMATION
   ============================================ */

.cc-counter {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  transition: all 0.6s var(--cc-ease-out-expo);
  display: inline-block;
}

/* Number highlight flash on change */
.cc-counter-flash {
  animation: cc-counter-pop 0.4s var(--cc-ease-spring);
}

@keyframes cc-counter-pop {
  0% {
    transform: scale(1);
    text-shadow: none;
  }
  40% {
    transform: scale(1.15);
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
  }
  100% {
    transform: scale(1);
    text-shadow: none;
  }
}

/* Odometer-style rolling digits */
.cc-counter-roll {
  display: inline-flex;
  overflow: hidden;
  height: 1.2em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.cc-counter-digit {
  display: inline-block;
  transition: transform 0.8s var(--cc-ease-out-expo);
}


/* ============================================
   12. SCAN LINE
   ============================================ */

.cc-scanline {
  position: relative;
  overflow: hidden;
}

.cc-scanline::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 229, 255, 0.4) 20%,
    rgba(0, 229, 255, 0.8) 50%,
    rgba(0, 229, 255, 0.4) 80%,
    transparent 100%
  );
  box-shadow:
    0 0 10px rgba(0, 229, 255, 0.4),
    0 0 30px rgba(0, 229, 255, 0.15);
  animation: cc-scan-move 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes cc-scan-move {
  0%, 100% {
    top: -2px;
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  95% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* Purple scanline variant */
.cc-scanline--purple::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(139, 92, 246, 0.4) 20%,
    rgba(139, 92, 246, 0.8) 50%,
    rgba(139, 92, 246, 0.4) 80%,
    transparent 100%
  );
  box-shadow:
    0 0 10px rgba(139, 92, 246, 0.4),
    0 0 30px rgba(139, 92, 246, 0.15);
}


/* ============================================
   13. FADE-IN ON SCROLL (IntersectionObserver)
   ============================================ */

/* Base: hidden state for all scroll-reveal elements */
.cc-fade-up,
.cc-fade-left,
.cc-fade-right,
.cc-fade-in,
.cc-fade-scale {
  opacity: 0;
  will-change: transform, opacity;
  transition:
    opacity 0.7s var(--cc-ease-out-expo),
    transform 0.7s var(--cc-ease-out-expo);
}

.cc-fade-up {
  transform: translateY(40px);
}

.cc-fade-left {
  transform: translateX(-40px);
}

.cc-fade-right {
  transform: translateX(40px);
}

.cc-fade-in {
  transform: none;
}

.cc-fade-scale {
  transform: scale(0.92);
}

/* Visible state — toggled by JS IntersectionObserver adding .cc-visible */
.cc-fade-up.cc-visible,
.cc-fade-left.cc-visible,
.cc-fade-right.cc-visible,
.cc-fade-in.cc-visible,
.cc-fade-scale.cc-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delay utilities */
.cc-delay-1 { transition-delay: 100ms; }
.cc-delay-2 { transition-delay: 200ms; }
.cc-delay-3 { transition-delay: 300ms; }
.cc-delay-4 { transition-delay: 400ms; }
.cc-delay-5 { transition-delay: 500ms; }
.cc-delay-6 { transition-delay: 600ms; }
.cc-delay-7 { transition-delay: 700ms; }
.cc-delay-8 { transition-delay: 800ms; }


/* ============================================
   14. LOADING / SKELETON STATES
   ============================================ */

.cc-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: cc-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

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

/* Spinner */
.cc-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0, 229, 255, 0.15);
  border-top-color: var(--cc-cyan);
  border-radius: 50%;
  animation: cc-spin 0.75s linear infinite;
}

.cc-spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes cc-spin {
  to { transform: rotate(360deg); }
}


/* ============================================
   15. UTILITY ANIMATIONS
   ============================================ */

/* Float up-down */
.cc-float {
  animation: cc-float 4s ease-in-out infinite;
}

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

/* Subtle rotate */
.cc-rotate-slow {
  animation: cc-rotate-slow 20s linear infinite;
}

@keyframes cc-rotate-slow {
  to { transform: rotate(360deg); }
}

/* Scale in */
.cc-scale-in {
  animation: cc-scale-in 0.5s var(--cc-ease-spring) forwards;
}

@keyframes cc-scale-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide in from bottom */
.cc-slide-up {
  animation: cc-slide-up 0.6s var(--cc-ease-out-expo) forwards;
}

@keyframes cc-slide-up {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shake for attention */
.cc-shake {
  animation: cc-shake 0.5s ease-in-out;
}

@keyframes cc-shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-4px); }
  30%, 70% { transform: translateX(4px); }
}

/* Highlight flash — useful for new items */
.cc-highlight {
  animation: cc-highlight-flash 1.5s ease forwards;
}

@keyframes cc-highlight-flash {
  0% {
    background-color: rgba(0, 229, 255, 0.15);
  }
  100% {
    background-color: transparent;
  }
}


/* ============================================
   16. DATA VISUALIZATION HELPERS
   ============================================ */

/* Progress bar */
.cc-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.cc-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cc-cyan), var(--cc-blue));
  border-radius: 4px;
  transition: width 0.8s var(--cc-ease-out-expo);
  position: relative;
}

.cc-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  animation: cc-progress-shine 2s ease-in-out infinite;
}

@keyframes cc-progress-shine {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* Badge / tag */
.cc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cc-badge--cyan {
  background: rgba(0, 229, 255, 0.1);
  color: var(--cc-cyan);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.cc-badge--purple {
  background: rgba(139, 92, 246, 0.1);
  color: var(--cc-purple);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.cc-badge--green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--cc-green-bright);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.cc-badge--gold {
  background: rgba(245, 158, 11, 0.1);
  color: var(--cc-gold-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
}


/* ============================================
   17. ENERGY LINE / CIRCUIT TRACE
   ============================================ */

.cc-circuit-line {
  position: relative;
  overflow: hidden;
}

.cc-circuit-line::before {
  content: '';
  position: absolute;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cc-cyan), transparent);
  top: 50%;
  left: 0;
  /* Use transform instead of left to avoid layout jank (60fps-safe) */
  transform: translateX(-60px);
  animation: cc-circuit-trace 3s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes cc-circuit-trace {
  0% { transform: translateX(-60px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 60px)); opacity: 0; }
}


/* ============================================
   18. RESPONSIVE & ACCESSIBILITY
   ============================================ */

/* Respect reduced motion preference */
@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;
  }

  .cc-fade-up,
  .cc-fade-left,
  .cc-fade-right,
  .cc-fade-in,
  .cc-fade-scale {
    opacity: 1;
    transform: none;
  }

  .cc-typewriter {
    width: 100%;
    border-right: none;
  }

  .cc-typewriter-line {
    width: 100%;
  }

  .cc-particles::before,
  .cc-particles::after {
    display: none;
  }
}

/* Mobile: reduce heavy effects for performance */
@media (max-width: 768px) {
  .cc-grid-bg::before,
  .cc-grid-bg::after {
    background-size: 30px 30px;
    animation: none;
    opacity: 0.3;
  }

  .cc-particles::after {
    display: none;
  }

  .cc-card-tilt:hover > * {
    transform: none;
  }

  .cc-scanline::after {
    display: none;
  }

  .cc-btn-primary {
    padding: 10px 22px;
    font-size: 0.875rem;
  }

  .cc-btn-glow {
    padding: 10px 22px;
    font-size: 0.875rem;
  }

  .cc-terminal {
    font-size: 0.8125rem;
    padding: 1rem;
  }
}

/* Small mobile: strip more effects */
@media (max-width: 480px) {
  .cc-grid-bg::before,
  .cc-grid-bg::after {
    display: none;
  }

  .cc-glass,
  .cc-glass-purple {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .cc-card-border-gradient::before {
    display: none;
  }
}

/* Large screens: enhance effects */
@media (min-width: 1440px) {
  .cc-grid-bg::before {
    background-size: 50px 50px;
  }

  .cc-grid-bg::after {
    background-size: 50px 50px;
    background-position: 25px 25px;
  }
}


/* ============================================
   19. DARK SURFACE LAYERS
   ============================================ */

.cc-surface-0 { background: var(--cc-black); }
.cc-surface-1 { background: var(--cc-dark); }
.cc-surface-2 { background: var(--cc-surface); }
.cc-surface-3 { background: var(--cc-surface-light); }

.cc-border-subtle { border: 1px solid rgba(255, 255, 255, 0.06); }
.cc-border-glow { border: 1px solid rgba(0, 229, 255, 0.12); }
.cc-border-glow-purple { border: 1px solid rgba(139, 92, 246, 0.12); }


/* ============================================
   20. INTERSECTION OBSERVER INIT SCRIPT HELPER
   ============================================ */

/*
  Drop this <script> into your page to activate scroll reveals:

  <script>
  (function() {
    const obs = new IntersectionObserver((entries) => {
      entries.forEach(e => {
        if (e.isIntersecting) {
          e.target.classList.add('cc-visible');
          obs.unobserve(e.target);
        }
      });
    }, { threshold: 0.15, rootMargin: '0px 0px -40px 0px' });

    document.querySelectorAll(
      '.cc-fade-up,.cc-fade-left,.cc-fade-right,.cc-fade-in,.cc-fade-scale'
    ).forEach(el => obs.observe(el));
  })();
  </script>
*/
