/* ===== Alon.dev — WOW Visual Effects ===== */

/* ===== Animated Gradient Mesh (Hero Background) ===== */
@property --mesh-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.hero-mesh {
  position: absolute;
  inset: 0;
  background: conic-gradient(
    from var(--mesh-angle),
    rgba(176, 38, 255, 0.04),
    rgba(6, 182, 212, 0.03),
    rgba(115, 83, 186, 0.04),
    rgba(176, 38, 255, 0.04)
  );
  animation: mesh-rotate 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .hero-mesh {
  background: conic-gradient(
    from var(--mesh-angle),
    rgba(176, 38, 255, 0.08),
    rgba(6, 182, 212, 0.06),
    rgba(115, 83, 186, 0.08),
    rgba(176, 38, 255, 0.08)
  );
}

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

/* ===== Floating Orbs ===== */
.floating-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.floating-orb-1 {
  width: 400px;
  height: 400px;
  background: rgba(176, 38, 255, 0.06);
  top: -100px;
  right: 10%;
  animation: orb-float-1 12s ease-in-out infinite;
}

.floating-orb-2 {
  width: 300px;
  height: 300px;
  background: rgba(6, 182, 212, 0.05);
  bottom: -50px;
  left: 5%;
  animation: orb-float-2 15s ease-in-out infinite;
}

.floating-orb-3 {
  width: 250px;
  height: 250px;
  background: rgba(115, 83, 186, 0.05);
  top: 40%;
  left: 50%;
  animation: orb-float-3 18s ease-in-out infinite;
}

[data-theme="dark"] .floating-orb-1 { background: rgba(176, 38, 255, 0.12); }
[data-theme="dark"] .floating-orb-2 { background: rgba(6, 182, 212, 0.10); }
[data-theme="dark"] .floating-orb-3 { background: rgba(115, 83, 186, 0.10); }

@keyframes orb-float-1 {
  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 orb-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, -30px) scale(1.08); }
  66% { transform: translate(20px, -10px) scale(0.92); }
}

@keyframes orb-float-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 30px) scale(1.1); }
}

/* ===== Mouse-follow glow ===== */
.hero-mouse-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 38, 255, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  left: var(--mouse-x, 50%);
  top: var(--mouse-y, 50%);
  transform: translate(-50%, -50%);
  transition: left 0.15s ease-out, top 0.15s ease-out;
  opacity: 0;
}

.hero:hover .hero-mouse-glow {
  opacity: 1;
}

[data-theme="dark"] .hero-mouse-glow {
  background: radial-gradient(circle, rgba(176, 38, 255, 0.25) 0%, transparent 70%);
}

/* ===== Glass morphism cards ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(115, 83, 186, 0.12);
  transition: all var(--transition);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(176, 38, 255, 0.25);
  box-shadow: 0 8px 32px rgba(115, 83, 186, 0.12);
}

[data-theme="dark"] .glass-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .glass-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(176, 38, 255, 0.3);
  box-shadow: 0 8px 32px rgba(176, 38, 255, 0.15);
}

/* ===== Animated gradient text ===== */
.gradient-text-animated {
  background: linear-gradient(135deg, #B026FF, #06B6D4, #7353BA, #B026FF);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}

/* ===== Animated gradient border on hover ===== */
.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, #B026FF, #06B6D4, #7353BA, #B026FF);
  background-size: 300% 300%;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition);
  animation: gradient-shift 4s ease infinite;
}

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

/* ===== Section decorative blobs ===== */
.section-blob {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.section-blob-left {
  width: 300px;
  height: 300px;
  left: -150px;
  top: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle, rgba(176, 38, 255, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
}

.section-blob-right {
  width: 250px;
  height: 250px;
  right: -120px;
  top: 30%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
}

[data-theme="dark"] .section-blob-left {
  background: radial-gradient(circle, rgba(176, 38, 255, 0.08) 0%, transparent 70%);
}

[data-theme="dark"] .section-blob-right {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
}

/* ===== Shimmer effect for stats ===== */
.stat-shimmer {
  position: relative;
  overflow: hidden;
}

.stat-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(176, 38, 255, 0.06) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

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

/* ===== Reveal animation ===== */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ===== Animated dot-grid hero background ===== */
.hero-dot-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-dot-grid canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ===== CTA Button pulse + shimmer ===== */
@keyframes btn-pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(176, 38, 255, 0.35), 0 0 0 0 rgba(176, 38, 255, 0.4);
  }
  50% {
    box-shadow: 0 8px 40px rgba(176, 38, 255, 0.55), 0 0 0 8px rgba(176, 38, 255, 0);
  }
}

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

.btn-primary {
  position: relative;
  overflow: hidden;
  animation: btn-pulse-glow 2.5s ease-in-out infinite;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: btn-shimmer 3s linear infinite;
  pointer-events: none;
}

.btn-primary:hover {
  animation: none;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 40px rgba(176, 38, 255, 0.6);
}

/* ===== Enhanced card hover — glow border + pop ===== */
.card {
  position: relative;
  isolation: isolate;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(135deg, #B026FF, #06B6D4, #7353BA, #B026FF);
  background-size: 300% 300%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.35s ease;
  animation: gradient-shift 4s ease infinite;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(176, 38, 255, 0.2), 0 8px 20px rgba(0,0,0,0.1);
}

.card:hover::before {
  opacity: 1;
}

/* ===== Portfolio card enhanced hover ===== */
.portfolio-card {
  position: relative;
  isolation: isolate;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes portfolio-glow-rotate {
  0% { box-shadow: 0 0 0 2px #B026FF, 0 20px 60px rgba(176, 38, 255, 0.3); }
  33% { box-shadow: 0 0 0 2px #06B6D4, 0 20px 60px rgba(6, 182, 212, 0.3); }
  66% { box-shadow: 0 0 0 2px #7353BA, 0 20px 60px rgba(115, 83, 186, 0.3); }
  100% { box-shadow: 0 0 0 2px #B026FF, 0 20px 60px rgba(176, 38, 255, 0.3); }
}

.portfolio-card:hover {
  transform: translateY(-10px) scale(1.02);
  animation: portfolio-glow-rotate 2s linear infinite;
  border-color: transparent;
}

/* Stop the transition from fighting the animation */
.portfolio-card:not(:hover) {
  animation: none;
}

/* ===== Staggered card entrance animation ===== */
/* Individual card stagger - applies when parent .stagger gets .visible */
.stagger > *:nth-child(1) { transition-delay: 0s !important; }
.stagger > *:nth-child(2) { transition-delay: 0.1s !important; }
.stagger > *:nth-child(3) { transition-delay: 0.2s !important; }
.stagger > *:nth-child(4) { transition-delay: 0.3s !important; }
.stagger > *:nth-child(5) { transition-delay: 0.4s !important; }
.stagger > *:nth-child(6) { transition-delay: 0.5s !important; }
.stagger > *:nth-child(7) { transition-delay: 0.6s !important; }
.stagger > *:nth-child(8) { transition-delay: 0.7s !important; }
.stagger > *:nth-child(9) { transition-delay: 0.8s !important; }

/* When .stagger is NOT visible, hide all children */
.stagger:not(.visible) > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* When .stagger becomes visible, show children with stagger */
.stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Typewriter cursor blink ===== */
@keyframes typewriter-blink {
  0%, 100% { border-right-color: #B026FF; }
  50% { border-right-color: transparent; }
}

.typewriter-wrap {
  display: inline;
}

#typewriter-text {
  border-right: 2px solid #B026FF;
  animation: typewriter-blink 0.8s ease-in-out infinite;
  padding-right: 2px;
}

/* ===== Stats bar enhanced ===== */
.stat-item {
  position: relative;
  transition: transform 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-4px);
}

.stat-item h3 {
  transition: all 0.3s ease;
}

.stat-item:hover h3 {
  filter: drop-shadow(0 0 12px rgba(176, 38, 255, 0.6));
}

/* ===== Video card enhanced hover ===== */
.video-card {
  position: relative;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-card:hover {
  transform: translateY(-8px) scale(1.01);
  animation: portfolio-glow-rotate 2s linear infinite;
  border-color: transparent;
}

.video-card:not(:hover) {
  animation: none;
}

/* ===== Prefers reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .hero-mesh,
  .floating-orb,
  .hero-mouse-glow,
  .stat-shimmer::after,
  .btn-primary,
  .btn-primary::after,
  .card::before,
  .portfolio-card::before,
  .video-card::before {
    animation: none !important;
  }

  .hero-mouse-glow {
    display: none;
  }

  .gradient-text-animated {
    animation: none !important;
  }

  .stagger:not(.visible) > * {
    opacity: 1;
    transform: none;
  }
}

/* ===== Mobile: disable heavy effects ===== */
@media (max-width: 768px) {
  .floating-orb {
    display: none;
  }

  .hero-mouse-glow {
    display: none;
  }

  .hero-mesh {
    animation-duration: 40s;
  }

  .card:hover,
  .portfolio-card:hover {
    transform: translateY(-4px) scale(1);
  }

  .btn-primary:hover {
    transform: translateY(-2px) scale(1);
  }
}
