/* ===================================
   OneQubits Software - Animations CSS
   Edge Animations, Keyframes, Effects
   =================================== */

/* ============ KEYFRAME ANIMATIONS ============ */

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

@keyframes pulse-ring {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes device-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

@keyframes badge-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes bar-fill {
  from { width: 0; }
  to { width: var(--fill-width, 80%); }
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes loader-fill {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes edge-scan {
  0% { top: -2px; opacity: 0; }
  5% { opacity: 1; }
  95% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.4); }
  50% { box-shadow: 0 0 50px rgba(124, 58, 237, 0.8), 0 0 100px rgba(124, 58, 237, 0.2); }
}

@keyframes glow-pulse-cyan {
  0%, 100% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.4); }
  50% { box-shadow: 0 0 50px rgba(6, 182, 212, 0.8), 0 0 100px rgba(6, 182, 212, 0.2); }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-cursor {
  0%, 100% { border-right-color: var(--primary-light); }
  50% { border-right-color: transparent; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-down {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-left {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fade-in-right {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes counter-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ EDGE BORDER ANIMATIONS ============ */

/* Animated gradient border */
.border-glow {
  position: relative;
}

.border-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% 200%;
  animation: gradient-rotate 3s linear infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.border-glow:hover::before { opacity: 1; }

@keyframes gradient-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Corner accent lines */
.corner-accent {
  position: relative;
  overflow: visible;
}

.corner-accent::before,
.corner-accent::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
}

.corner-accent::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--primary);
  border-left: 2px solid var(--primary);
}

.corner-accent::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--secondary);
  border-right: 2px solid var(--secondary);
}

.corner-accent:hover::before,
.corner-accent:hover::after {
  width: 40px;
  height: 40px;
}

/* Scan line effect */
.scan-effect {
  position: relative;
  overflow: hidden;
}

.scan-effect::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(124, 58, 237, 0.05) 45%,
    rgba(124, 58, 237, 0.12) 50%,
    rgba(124, 58, 237, 0.05) 55%,
    transparent 100%
  );
  animation: scan-line 4s linear infinite;
}

@keyframes scan-line {
  from { top: -100%; }
  to { top: 200%; }
}

/* Neon glow text */
.neon-text {
  color: var(--primary-light);
  text-shadow:
    0 0 7px rgba(159, 103, 255, 0.8),
    0 0 14px rgba(159, 103, 255, 0.6),
    0 0 28px rgba(159, 103, 255, 0.4);
  animation: neon-flicker 3s infinite alternate;
}

@keyframes neon-flicker {
  0%, 90%, 100% { opacity: 1; }
  92% { opacity: 0.85; }
  94% { opacity: 1; }
  96% { opacity: 0.7; }
  98% { opacity: 1; }
}

/* Shimmer loading effect */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.05) 50%,
    rgba(255,255,255,0) 100%
  );
  background-size: 200% auto;
  animation: shimmer 2s linear infinite;
}

/* Ripple on click */
.ripple-btn {
  position: relative;
  overflow: hidden;
}

.ripple-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: scale(0);
  animation: ripple-expand 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-expand {
  to { transform: scale(4); opacity: 0; }
}

/* Particle trail on cursor hover */
.particle-trail-active * { cursor: none; }

/* ============ HERO SPECIFIC ANIMATIONS ============ */

.hero-title .line1 {
  animation: fade-in-up 0.8s ease both;
  animation-delay: 0.2s;
}

.hero-title .line2 {
  animation: fade-in-up 0.8s ease both;
  animation-delay: 0.35s;
}

.hero-text .badge {
  animation: fade-in-down 0.6s ease both;
  animation-delay: 0.1s;
}

.hero-subtitle {
  animation: fade-in-up 0.8s ease both;
  animation-delay: 0.5s;
}

.hero-actions {
  animation: fade-in-up 0.8s ease both;
  animation-delay: 0.65s;
}

.hero-stats {
  animation: fade-in-up 0.8s ease both;
  animation-delay: 0.8s;
}

.hero-visual {
  animation: fade-in-right 1s ease both;
  animation-delay: 0.4s;
}

/* ============ GLITCH EFFECT ============ */

.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.glitch::before {
  color: var(--secondary);
  animation: glitch-1 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
  transform: translate(-2px, -2px);
}

.glitch::after {
  color: var(--primary);
  animation: glitch-2 3s infinite;
  clip-path: polygon(0 66%, 100% 66%, 100% 100%, 0 100%);
  transform: translate(2px, 2px);
}

@keyframes glitch-1 {
  0%, 85%, 100% { transform: translate(-2px, -2px); opacity: 0; }
  86% { transform: translate(-3px, -1px); opacity: 0.8; }
  88% { transform: translate(3px, -2px); opacity: 0; }
  90% { transform: translate(-2px, 2px); opacity: 0.6; }
  92% { transform: translate(-2px, -2px); opacity: 0; }
}

@keyframes glitch-2 {
  0%, 85%, 100% { transform: translate(2px, 2px); opacity: 0; }
  87% { transform: translate(3px, 2px); opacity: 0.8; }
  89% { transform: translate(-2px, 3px); opacity: 0; }
  91% { transform: translate(2px, -2px); opacity: 0.5; }
  93% { transform: translate(2px, 2px); opacity: 0; }
}

/* ============ TYPING CURSOR ============ */

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary-light);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.8s infinite;
}

/* ============ SCROLL PROGRESS BAR ============ */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-primary);
  z-index: 10001;
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.6);
}

/* ============ GRID BACKGROUND ============ */

.grid-bg {
  position: relative;
}

.grid-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
  pointer-events: none;
}

/* ============ HOVER LIFT ============ */

.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-glow);
}

/* ============ FOCUS VISIBLE ============ */

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============ SELECTION ============ */

::selection {
  background: rgba(124, 58, 237, 0.3);
  color: var(--text-primary);
}

/* ============ SCROLLBAR ============ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============ NUMBER COUNT ANIMATION ============ */

.count-up {
  display: inline-block;
  animation: counter-up 0.5s ease both;
}

/* ============ STAGGER CHILDREN ============ */

.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.animated > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.animated > *:nth-child(2) { transition-delay: 0.15s; }
.stagger-children.animated > *:nth-child(3) { transition-delay: 0.25s; }
.stagger-children.animated > *:nth-child(4) { transition-delay: 0.35s; }
.stagger-children.animated > *:nth-child(5) { transition-delay: 0.45s; }
.stagger-children.animated > *:nth-child(6) { transition-delay: 0.55s; }
.stagger-children.animated > * { opacity: 1; transform: translateY(0); }

/* ============ TOOLTIP ============ */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: var(--shadow-sm);
}

[data-tooltip]:hover::after { opacity: 1; }

/* ============ CYBER / TECH GRID OVERLAY ============ */

.cyber-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.cyber-line-h, .cyber-line-v {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.08), transparent);
  opacity: 0;
  animation: cyber-flash 8s infinite;
}

.cyber-line-h {
  height: 1px;
  width: 100%;
  animation-name: cyber-flash-h;
}

.cyber-line-v {
  width: 1px;
  height: 100%;
  background: linear-gradient(0deg, transparent, rgba(6, 182, 212, 0.08), transparent);
  animation-name: cyber-flash-v;
}

@keyframes cyber-flash-h {
  0%, 100% { top: 20%; opacity: 0; }
  15%, 20% { opacity: 1; }
  50% { top: 80%; opacity: 0; }
  65%, 70% { top: 45%; opacity: 1; }
}

@keyframes cyber-flash-v {
  0%, 100% { left: 30%; opacity: 0; }
  20%, 25% { opacity: 1; }
  55% { left: 70%; opacity: 0; }
  70%, 75% { left: 55%; opacity: 1; }
}

/* ============ RESPONSIVENESS ============ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
