/* =========================================================
   KAMAL VISHNU M — PORTFOLIO
   Motion layer: starfield, scroll effects, cursor fx
   Loaded after style.css
   ========================================================= */

/* ---------------- Scroll progress bar ---------------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--violet-deep), var(--violet), var(--gold));
  background-size: 200% 100%;
  z-index: 1000;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
  animation: progressShine 4s linear infinite;
  transition: width 0.12s ease-out;
}
@keyframes progressShine {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ---------------- Mouse-follow glow ---------------- */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(210, 210, 216, 0.14), rgba(255, 255, 255, 0.05) 45%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: transform, opacity;
}
.cursor-glow.active { opacity: 1; }

/* ---------------- Nebula drift (slow, ambient) ---------------- */
.bg-nebula .glow { will-change: transform; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -5%, rgba(210,210,216,0.14), transparent 60%),
    radial-gradient(500px 350px at -10% 30%, rgba(255,255,255,0.06), transparent 60%);
  animation: sheenDrift 22s ease-in-out infinite alternate;
}
@keyframes sheenDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-6%, 5%, 0) scale(1.12); }
  100% { transform: translate3d(6%, -4%, 0) scale(1.05); }
}

/* ---------------- Extra depth on scroll-revealed cards ---------------- */
.reveal {
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  filter: blur(4px);
}
.reveal.in { filter: blur(0); }

@media (prefers-reduced-motion: reduce) {
  .bg-nebula .glow,
  body::before { animation: none !important; }
  .cursor-glow { display: none !important; }
  .scroll-progress { animation: none; }
  .reveal { filter: none; }
  #starfield-canvas { display: none; }
}

@media (max-width: 600px) {
  .cursor-glow { display: none; }
}
