/* ═══════════════════════════════════════════════════════ */
/* ANIMATIONS / EFFECTS                                   */
/* ═══════════════════════════════════════════════════════ */

/* Glow pulse - more dramatic */
.glow-pulse {
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(var(--glow-rgb, 77,166,219), 0.2), 0 0 30px rgba(var(--glow-rgb, 77,166,219), 0.08); }
  50% { box-shadow: 0 0 20px rgba(var(--glow-rgb, 77,166,219), 0.35), 0 0 40px rgba(var(--glow-rgb, 77,166,219), 0.15); }
}

/* Text glow - enhanced */
.text-glow {
  text-shadow: 0 0 20px rgba(var(--glow-rgb, 77,166,219), 0.5), 0 0 40px rgba(var(--glow-rgb, 77,166,219), 0.3), 0 0 80px rgba(var(--glow-rgb, 77,166,219), 0.15);
}

/* Glitch text effect */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.glitch::before {
  color: var(--neon-pink);
  z-index: -1;
  animation: glitch-1 4s infinite linear alternate-reverse;
}

.glitch::after {
  color: var(--neon-blue);
  z-index: -2;
  animation: glitch-2 4s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
  0%, 90%, 100% { opacity: 0; transform: none; }
  91% { opacity: 0.8; transform: translate(2px, -1px); clip-path: inset(20% 0 60% 0); }
  93% { opacity: 0.8; transform: translate(-2px, 1px); clip-path: inset(50% 0 20% 0); }
  95% { opacity: 0; transform: none; }
}

@keyframes glitch-2 {
  0%, 88%, 100% { opacity: 0; transform: none; }
  89% { opacity: 0.8; transform: translate(-2px, 1px); clip-path: inset(40% 0 30% 0); }
  91% { opacity: 0.8; transform: translate(2px, -1px); clip-path: inset(10% 0 70% 0); }
  93% { opacity: 0; transform: none; }
}

/* Typing cursor */
.typing-cursor::after {
  content: '|';
  color: var(--primary);
  animation: cursorBlink 0.8s step-end infinite;
  font-weight: 300;
}

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

/* Card hover - with holographic effect */
.card-hover {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(77, 166, 219, 0.1);
}

/* Holographic border animation */
.holo-border {
  position: relative;
}

.holo-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--holo-angle, 0deg),
    transparent 0%,
    var(--primary) 10%,
    var(--accent) 20%,
    #a855f7 30%,
    transparent 40%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.holo-border:hover::before {
  opacity: 1;
  animation: holoSpin 3s linear infinite;
}

@keyframes holoSpin {
  to { --holo-angle: 360deg; }
}

@property --holo-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* Mouse spotlight on cards */
.card-spotlight {
  --mouse-x: 50%;
  --mouse-y: 50%;
}

.card-spotlight::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    600px circle at var(--mouse-x) var(--mouse-y),
    rgba(77, 166, 219, 0.06),
    transparent 40%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.card-spotlight:hover::after {
  opacity: 1;
}

/* Animated underline */
.animated-underline {
  position: relative;
}

.animated-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

.animated-underline:hover::after {
  width: 100%;
}

/* Cyberpunk divider */
.cyber-divider {
  position: relative;
  height: 1px;
  background: var(--border);
  overflow: visible;
}

.cyber-divider::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  animation: scanLine 4s ease-in-out infinite;
}

@keyframes scanLine {
  0% { left: 0; }
  50% { left: calc(100% - 80px); }
  100% { left: 0; }
}

/* Magnetic button */
.btn-magnetic {
  transition: transform 0.2s ease;
}

/* Staggered reveal */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.15s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.3s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.45s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.6s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.75s; }

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Floating badge */
.hero-badge {
  animation: floatBadge 3s ease-in-out infinite;
}

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

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Ping keyframe (hero badge dot) */
@keyframes ping {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2); opacity: 0; }
}

/* 3D card tilt perspective */
.card-tilt {
  transform-style: preserve-3d;
  transition: transform 0.15s ease;
}

/* Text scramble reveal */
.scramble-reveal {
  display: inline-block;
}

/* Shape-outside floating orbs for text reflow */
.text-orb {
  float: left;
  shape-outside: circle(50%);
  shape-margin: 20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--glow-rgb, 77,166,219), 0.15), rgba(var(--glow-rgb, 77,166,219), 0.03));
  border: 1px solid rgba(var(--glow-rgb, 77,166,219), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin: 10px 24px 10px 0;
  backdrop-filter: blur(8px);
  animation: orbFloat 6s ease-in-out infinite;
}

.text-orb.right {
  float: right;
  margin: 10px 0 10px 24px;
}

.text-orb img, .text-orb svg {
  width: 48px;
  height: 48px;
  opacity: 0.6;
  position: relative;
  z-index: 2;
}

.text-orb::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(var(--glow-rgb, 77,166,219), 0.3), transparent);
  animation: orbSpin 8s linear infinite;
  opacity: 0.5;
}

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

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

/* Text reflow container */
.text-reflow {
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 2;
  color: var(--muted-foreground);
  max-width: 900px;
  margin: 0 auto;
  overflow: visible;
}

.text-reflow .container {
  overflow: visible;
}

.text-reflow strong {
  color: var(--foreground);
  font-weight: 500;
}

/* ── Racing Pulse Lines ── */
.pulse-line {
  position: fixed;
  left: 0;
  right: 0;
  height: 1px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.pulse-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: -200px;
  width: 200px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), 0.6), rgba(var(--glow-rgb), 0.8), transparent);
  animation: racePulse var(--race-duration, 4s) linear infinite;
  animation-delay: var(--race-delay, 0s);
}

.pulse-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: rgba(var(--glow-rgb), 0.03);
}

@keyframes racePulse {
  0% { left: -200px; }
  100% { left: calc(100% + 200px); }
}

/* Vertical racing pulse */
.pulse-line-v {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 1px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.pulse-line-v::before {
  content: '';
  position: absolute;
  left: 0;
  top: -150px;
  width: 100%;
  height: 150px;
  background: linear-gradient(180deg, transparent, rgba(var(--glow-rgb), 0.4), transparent);
  animation: racePulseV var(--race-duration, 6s) linear infinite;
  animation-delay: var(--race-delay, 0s);
}

@keyframes racePulseV {
  0% { top: -150px; }
  100% { top: calc(100% + 150px); }
}

/* ── Floating Particles (CSS-only micro dots) ── */
.particle-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(var(--glow-rgb), 0.5);
  animation: particleDrift var(--p-duration, 15s) linear infinite;
}

@keyframes particleDrift {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; transform: translateY(90vh) scale(1); }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(0.5); opacity: 0; }
}

/* ── Hero Shimmer Line ── */
.hero-shimmer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), 0.3), transparent);
  overflow: hidden;
}

.hero-shimmer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -100%;
  width: 50%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), 0.8), var(--primary), rgba(var(--glow-rgb), 0.8), transparent);
  animation: shimmerRace 3s ease-in-out infinite;
}

@keyframes shimmerRace {
  0% { left: -50%; }
  100% { left: 150%; }
}

/* ── Section Divider Pulse ── */
.section-pulse {
  position: relative;
  height: 1px;
  margin: 0;
  border: none;
  background: rgba(var(--glow-rgb), 0.06);
}

.section-pulse::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 120px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: sectionScan 4s ease-in-out infinite;
  filter: blur(1px);
}

.section-pulse::after {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(var(--glow-rgb), 0.5), 0 0 20px rgba(var(--glow-rgb), 0.3);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes sectionScan {
  0% { left: -120px; }
  100% { left: calc(100% + 120px); }
}

@keyframes dotPulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  50% { transform: translateX(-50%) scale(1.5); opacity: 1; }
}

/* ── Corner Brackets (tech frame feel) ── */
.tech-frame {
  position: relative;
}

.tech-frame::before,
.tech-frame::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: rgba(var(--glow-rgb), 0.2);
  border-style: solid;
  pointer-events: none;
  z-index: 2;
}

.tech-frame::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.tech-frame::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 1px 1px 0;
}

/* ── Improved Text Orbs ── */
.text-orb {
  width: 140px;
  height: 140px;
  background: radial-gradient(circle at 30% 30%,
    rgba(var(--glow-rgb), 0.25),
    rgba(var(--glow-rgb), 0.08) 50%,
    rgba(var(--glow-rgb), 0.02)
  );
  border: 1px solid rgba(var(--glow-rgb), 0.15);
  box-shadow:
    0 0 30px rgba(var(--glow-rgb), 0.1),
    0 0 60px rgba(var(--glow-rgb), 0.05),
    inset 0 0 30px rgba(var(--glow-rgb), 0.05);
}

.text-orb::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid rgba(var(--glow-rgb), 0.08);
  animation: orbSpin 12s linear infinite reverse;
}

.text-orb img, .text-orb svg {
  width: 52px;
  height: 52px;
  opacity: 0.7;
  filter: drop-shadow(0 0 8px rgba(var(--glow-rgb), 0.3));
}
