/* ═══════════════════════════════════════════════════════════
   React Bits Kit — Level 0 Vanilla Port
   Sources: reactbits.dev (MIT License)
   Components: SpotlightCard · GlareHover · ShinyText · ClickSpark
               ScrollReveal · BlurText · StarBorder · Threads bg
               CountUp · Stagger
════════════════════════════════════════════════════════════ */

/* ── THREADS / WEBGL HERO BACKGROUND ──────────────────────── */
.rb-threads-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}
.rb-threads-bg canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  opacity: 0.22;
}
@media (max-width: 640px) {
  .rb-threads-bg canvas { opacity: 0.12; }
}

/* ── ENHANCED SCROLL REVEAL (all viewports, not just mobile) ─ */
@media (min-width: 640px) {
  .reveal {
    opacity: 0 !important;
    transform: translateY(32px) !important;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .reveal.in {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── STAGGER REVEAL ───────────────────────────────────────── */
.rb-stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.rb-stagger-item.in {
  opacity: 1;
  transform: none;
}

/* ── SPOTLIGHT CARD ───────────────────────────────────────── */
.spotlight-card {
  position: relative;
  overflow: hidden;
  --mouse-x: 50%;
  --mouse-y: 50%;
  --spotlight-color: rgba(198, 242, 78, 0.07);
}
.spotlight-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    280px circle at var(--mouse-x) var(--mouse-y),
    var(--spotlight-color),
    transparent 75%
  );
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: 0;
}
.spotlight-card:hover::before,
.spotlight-card:focus-within::before {
  opacity: 1;
}
.spotlight-card > * {
  position: relative;
  z-index: 1;
}

/* rizz variant */
.spotlight-card.rizz-card {
  --spotlight-color: rgba(167, 139, 250, 0.07);
}
/* tracker variant */
.spotlight-card.trk-card {
  --spotlight-color: rgba(52, 211, 153, 0.07);
}

/* ── GLARE HOVER BUTTON ──────────────────────────────────── */
.glare-btn {
  position: relative;
  overflow: hidden;
}
.glare-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    -45deg,
    transparent 0%,
    transparent 30%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 70%,
    transparent 100%
  );
  background-size: 250% 250%;
  background-position: -100% -100%;
  transition: background-position 650ms ease;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}
.glare-btn:hover::before {
  background-position: 100% 100%;
}

/* ── SHINY TEXT ──────────────────────────────────────────── */
@keyframes rb-shine {
  0%   { background-position: 200% center; }
  100% { background-position: -100% center; }
}
.rb-shiny {
  background-image: linear-gradient(
    120deg,
    currentColor 0%,
    currentColor 30%,
    rgba(255, 255, 255, 0.88) 50%,
    currentColor 70%,
    currentColor 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: rb-shine 4s linear infinite;
  display: inline-block;
}

/* ── BLUR TEXT WORD REVEAL ───────────────────────────────── */
.rb-blur-text {
  overflow: visible;
}
.rb-blur-word {
  display: inline-block;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(10px);
  transition: opacity 0.6s ease,
              filter 0.6s ease,
              transform 0.6s ease;
  will-change: opacity, filter, transform;
}
.rb-blur-text.in .rb-blur-word {
  opacity: 1;
  filter: blur(0px);
  transform: translateY(0);
}

/* ── CLICK SPARK CANVAS ──────────────────────────────────── */
#rb-spark-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9990;
}

/* ── STAR BORDER ANIMATION ───────────────────────────────── */
@keyframes rb-star-bottom {
  0%   { transform: translate(0%, 0%);    opacity: 0.65; }
  100% { transform: translate(-100%, 0%); opacity: 0; }
}
@keyframes rb-star-top {
  0%   { transform: translate(0%, 0%);   opacity: 0.65; }
  100% { transform: translate(100%, 0%); opacity: 0; }
}
.rb-star-border {
  position: relative;
  overflow: hidden;
}
.rb-star-border::before,
.rb-star-border::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}
.rb-star-border::before {
  width: 300%;
  height: 55%;
  bottom: -10px;
  right: -250%;
  background: radial-gradient(circle, rgba(198, 242, 78, 0.7), transparent 12%);
  animation: rb-star-bottom 6s linear infinite alternate;
}
.rb-star-border::after {
  width: 300%;
  height: 55%;
  top: -10px;
  left: -250%;
  background: radial-gradient(circle, rgba(198, 242, 78, 0.7), transparent 12%);
  animation: rb-star-top 6s linear infinite alternate;
}
.rb-star-border > * {
  position: relative;
  z-index: 1;
}

/* ── RIZZ0 STAR BORDER VARIANT ───────────────────────────── */
.rb-star-border.rizz-wl::before,
.rb-star-border.rizz-wl::after {
  background: radial-gradient(circle, rgba(167, 139, 250, 0.65), transparent 12%);
}

/* ── TRACKER STAR BORDER VARIANT ─────────────────────────── */
.rb-star-border.trk-wl::before,
.rb-star-border.trk-wl::after {
  background: radial-gradient(circle, rgba(52, 211, 153, 0.65), transparent 12%);
}

/* ── UPGRADE BAR STAR BORDER ─────────────────────────────── */
.rb-star-border.upgrade-bar::before,
.rb-star-border.upgrade-bar::after {
  background: radial-gradient(circle, rgba(198, 242, 78, 0.55), transparent 12%);
}

/* ── TOOL CARD ENTRY TRANSITION ──────────────────────────── */
.rb-card-enter {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.rb-card-enter.in {
  opacity: 1;
  transform: none;
}

/* ── HERO SECTION THREADS CONTAINER SETUP ────────────────── */
.hero {
  position: relative;
}
.hero > .rb-threads-bg ~ .wrap {
  position: relative;
  z-index: 2;
}

/* ── REDUCED MOTION SAFETY ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .rb-blur-word,
  .rb-stagger-item,
  .rb-card-enter {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
  }
  .rb-shiny {
    animation: none !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    color: inherit !important;
  }
  .glare-btn::before {
    display: none !important;
  }
  .rb-threads-bg {
    display: none !important;
  }
  @media (min-width: 640px) {
    .reveal {
      opacity: 1 !important;
      transform: none !important;
      transition: none !important;
    }
  }
}
