/* Hyperia × React Bits Vanilla Motion & Surface System
 * Pure CSS/Web-standard ports of React Bits concepts:
 * PillNav, StarBorder, SpotlightCard/MagicBento, GlareHover, ShinyText, ClickSpark & Aurora.
 */

/* 1. Ambient Soft Aurora Background Mesh */
.rb-ambient-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.rb-ambient-aurora::before,
.rb-ambient-aurora::after {
  content: '';
  position: absolute;
  border-radius: 9999px;
  filter: blur(110px);
  will-change: transform, opacity;
  opacity: 0.42;
}

.rb-ambient-aurora::before {
  width: min(55vw, 760px);
  height: min(45vh, 520px);
  top: -12%;
  left: 12%;
  background: radial-gradient(circle, rgba(var(--accent-brand-rgb), 0.14) 0%, rgba(var(--accent-brand-rgb), 0.03) 55%, transparent 75%);
  animation: rb-aurora-drift-a 18s ease-in-out infinite alternate;
}

.rb-ambient-aurora::after {
  width: min(50vw, 680px);
  height: min(44vh, 500px);
  bottom: -14%;
  right: 8%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, rgba(16, 185, 129, 0.04) 55%, transparent 75%);
  animation: rb-aurora-drift-b 22s ease-in-out infinite alternate;
}

@keyframes rb-aurora-drift-a {
  0% { transform: translate3d(-4%, 0, 0) scale(1); }
  100% { transform: translate3d(10%, 7%, 0) scale(1.12); }
}

@keyframes rb-aurora-drift-b {
  0% { transform: translate3d(4%, 0, 0) scale(1.06); }
  100% { transform: translate3d(-9%, -6%, 0) scale(0.96); }
}

/* 2. PillNav Sliding Magnetic Pill Indicator */
.nav-links {
  position: relative;
}

.nav-links > .nav-tab-btn,
.nav-links > .nav-create-menu {
  position: relative;
  z-index: 2;
}

.rb-pill-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  z-index: 1;
  border-radius: 9999px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 100%, rgba(var(--accent-brand-rgb), 0.28), rgba(var(--accent-brand-rgb), 0.1) 75%);
  border: 1px solid rgba(var(--accent-brand-rgb), 0.45);
  box-shadow: 0 0 20px rgba(var(--accent-brand-rgb), 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.24s ease,
              opacity 0.2s ease;
  will-change: transform, width;
}

.rb-pill-indicator.is-visible {
  opacity: 1;
}

.rb-pill-indicator.is-hovering {
  background: radial-gradient(circle at 50% 100%, rgba(var(--accent-brand-rgb), 0.2), rgba(255, 255, 255, 0.06) 80%);
  border-color: rgba(var(--accent-brand-rgb), 0.34);
}

/* 3. StarBorder Orbiting Neon Beam */
@keyframes rb-star-rotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

#nav-create-trigger,
.hub-prompt,
#btn-studio-generate,
#btn-render-video {
  position: relative;
  isolation: isolate;
}

#nav-create-trigger::before,
.hub-prompt::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 285deg, rgba(var(--accent-brand-rgb), 0.92) 330deg, #b6ff9f 348deg, transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
  opacity: 0.72;
  transition: opacity 0.25s ease;
  animation: rb-conic-spin 4.5s linear infinite;
}

#nav-create-trigger:hover::before,
.hub-prompt:focus-within::after {
  opacity: 1;
}

@supports not (background: paint(something)) {
  @property --rb-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
  }

  #nav-create-trigger::before,
  .hub-prompt::after {
    background: conic-gradient(from var(--rb-angle), transparent 0deg, transparent 280deg, rgba(var(--accent-brand-rgb), 0.95) 332deg, #c6ffb3 350deg, transparent 360deg);
  }

  @keyframes rb-conic-spin {
    from { --rb-angle: 0deg; }
    to { --rb-angle: 360deg; }
  }
}

/* 4. SpotlightCard & MagicBento Dynamic Cursor Lighting */
.rb-spotlight {
  position: relative;
  --rb-x: 50%;
  --rb-y: 50%;
  --rb-spot-opacity: 0;
}

.rb-spotlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  opacity: var(--rb-spot-opacity);
  background: radial-gradient(380px circle at var(--rb-x) var(--rb-y), rgba(var(--accent-brand-rgb), 0.16), transparent 60%);
  transition: opacity 0.28s ease;
}

.rb-spotlight:hover {
  --rb-spot-opacity: 1;
}

/* 5. GlareHover Diagonal Specular Reflection */
.rb-glare {
  position: relative;
  overflow: hidden;
}

.rb-glare::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 255, 255, 0.14) 45%,
    rgba(var(--accent-brand-rgb), 0.2) 50%,
    rgba(255, 255, 255, 0.08) 54%,
    transparent 76%
  );
  background-size: 230% 230%;
  background-position: 165% 165%;
  opacity: 0;
  transition: background-position 0.65s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.rb-glare:hover::after {
  background-position: -35% -35%;
  opacity: 1;
}

/* 6. ShinyText Sweep for Brand & Status Kickers */
@keyframes rb-shiny-sweep {
  0% { background-position: 130% 0; }
  100% { background-position: -130% 0; }
}

.rb-shiny-text {
  background-image: linear-gradient(120deg, var(--accent-brand) 35%, #eaffdf 50%, var(--accent-brand) 65%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  animation: rb-shiny-sweep 5.5s linear infinite;
}

/* 7. ClickSpark Neon Micro-Burst */
.rb-spark-layer {
  position: fixed;
  pointer-events: none;
  z-index: 250;
  width: 0;
  height: 0;
}

.rb-spark-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 11px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-brand), #d9ffcc);
  box-shadow: 0 0 8px rgba(var(--accent-brand-rgb), 0.85);
  transform-origin: 0 50%;
  animation: rb-spark-fly 0.44s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rb-spark-fly {
  0% {
    opacity: 1;
    transform: rotate(var(--rb-deg)) translateX(4px) scaleX(0.5);
  }
  70% {
    opacity: 0.9;
    transform: rotate(var(--rb-deg)) translateX(22px) scaleX(1.1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--rb-deg)) translateX(30px) scaleX(0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rb-ambient-aurora::before,
  .rb-ambient-aurora::after,
  #nav-create-trigger::before,
  .hub-prompt::after,
  .rb-shiny-text,
  .rb-spark-line {
    animation: none !important;
  }
  .rb-pill-indicator,
  .rb-spotlight::before,
  .rb-glare::after {
    transition: none !important;
  }
}
