/* MagicBento (vanilla) — pairs with frontend/components/MagicBento.js */

.magic-bento-section {
  position: relative;
  --glow-color: 132, 0, 255;
  --spotlight-r: 400px;
  --glow-x-pct: 50%;
  --glow-y-pct: 50%;
}

.magic-bento-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: var(--radius-xl, 18px);
  background: radial-gradient(
    circle var(--spotlight-r) at var(--glow-x-pct) var(--glow-y-pct),
    rgba(var(--glow-color), 0.14) 0%,
    transparent 60%
  );
  mix-blend-mode: screen;
}

.magic-bento-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  border-radius: var(--radius-xl, 18px);
}

.magic-bento-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(var(--glow-color), 0.55);
  box-shadow: 0 0 8px rgba(var(--glow-color), 0.35);
  animation: magic-bento-float 5s ease-in-out infinite;
}

@keyframes magic-bento-float {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-10px) scale(1.2);
  }
}

.magic-bento-section > .home-category {
  position: relative;
  z-index: 1;
}

.magic-bento-section .home-tool-card.magic-bento-card {
  position: relative;
  overflow: hidden;
  --card-glow-x: 50%;
  --card-glow-y: 50%;
}

.magic-bento-section .magic-bento-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
  background: radial-gradient(
    circle 120% at var(--card-glow-x) var(--card-glow-y),
    rgba(var(--glow-color), 0.2) 0%,
    transparent 55%
  );
  z-index: 0;
}

.magic-bento-section .magic-bento-card:hover::before {
  opacity: 1;
}

.magic-bento-section .magic-bento-card .home-tool-name,
.magic-bento-section .magic-bento-card .home-tool-desc {
  position: relative;
  z-index: 1;
}

.magic-bento-text-autohide .home-tool-desc {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

.magic-bento-text-autohide:hover .home-tool-desc,
.magic-bento-text-autohide:focus-visible .home-tool-desc {
  opacity: 1;
  transform: translateY(0);
}

.magic-bento-ripple {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--glow-color), 0.55) 0%, transparent 70%);
  animation: magic-bento-ripple 0.62s ease-out forwards;
  pointer-events: none;
  z-index: 4;
}

@keyframes magic-bento-ripple {
  to {
    transform: scale(28);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .magic-bento-spotlight,
  .magic-bento-particles,
  .magic-bento-particle {
    animation: none !important;
    display: none !important;
  }

  .magic-bento-text-autohide .home-tool-desc {
    opacity: 1;
    transform: none;
  }
}
