/*
 * VyaparMart experience layer — depth, motion and glass for the storefront.
 *
 * Deliberately dependency-free: every effect here is CSS transforms, gradients and keyframes, so the
 * page gains real 3D depth without shipping a WebGL library (which the CSP would block anyway, and
 * which would cost far more than it returns on a product grid).
 *
 * Everything is additive — remove the class and the element falls back to its plain Tailwind styling.
 *
 * ACCESSIBILITY: the whole file is disabled under prefers-reduced-motion at the bottom. Motion here
 * is decoration, never the only way to understand the page.
 */

/* ============================================================== tokens */

:root {
  --vm-depth: 0 10px 30px -10px rgb(79 70 229 / 0.35);
  --vm-depth-lg: 0 30px 60px -20px rgb(79 70 229 / 0.45);
  --vm-glass: rgb(255 255 255 / 0.7);
  --vm-glass-line: rgb(255 255 255 / 0.35);
  --vm-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.dark {
  --vm-glass: rgb(17 24 39 / 0.6);
  --vm-glass-line: rgb(255 255 255 / 0.08);
}

/* ============================================================== aurora backdrop */

/* A slow-drifting colour field behind the hero. Three blurred blobs on one composited layer —
   cheaper and calmer than a canvas animation, and it never blocks the main thread. */
.vm-aurora {
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.55;
}

.vm-aurora span {
  position: absolute;
  display: block;
  width: 45%;
  height: 55%;
  border-radius: 50%;
  will-change: transform;
}

.vm-aurora span:nth-child(1) { background: #6366f1; top: 5%;  left: 2%;  animation: vm-drift-a 18s var(--vm-ease) infinite alternate; }
.vm-aurora span:nth-child(2) { background: #d946ef; top: 25%; left: 45%; animation: vm-drift-b 22s var(--vm-ease) infinite alternate; }
.vm-aurora span:nth-child(3) { background: #06b6d4; top: 45%; left: 15%; animation: vm-drift-c 26s var(--vm-ease) infinite alternate; }

@keyframes vm-drift-a { to { transform: translate3d(18%, 12%, 0) scale(1.25); } }
@keyframes vm-drift-b { to { transform: translate3d(-16%, 18%, 0) scale(1.15); } }
@keyframes vm-drift-c { to { transform: translate3d(12%, -16%, 0) scale(1.3); } }

/* ============================================================== 3D tilt cards */

.vm-scene { perspective: 1000px; }

.vm-tilt {
  transform-style: preserve-3d;
  transition: transform 0.4s var(--vm-ease), box-shadow 0.4s var(--vm-ease);
  will-change: transform;
}

/* JS writes --rx/--ry from the pointer position; with no JS the card simply lifts on hover. */
.vm-tilt:hover {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(18px);
  box-shadow: var(--vm-depth-lg);
}

/* Children can be pushed forward so the card has genuine layers rather than a flat rotation. */
.vm-tilt .vm-layer-1 { transform: translateZ(24px); }
.vm-tilt .vm-layer-2 { transform: translateZ(48px); }
.vm-tilt .vm-layer-1,
.vm-tilt .vm-layer-2 { transition: transform 0.4s var(--vm-ease); }

/* A light sweep that follows the pointer, which is what sells the surface as physical. */
.vm-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--vm-ease);
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgb(255 255 255 / 0.28), transparent 45%);
}

.vm-tilt:hover .vm-glare { opacity: 1; }

/* ============================================================== scroll reveal */

.vm-reveal {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity 0.7s var(--vm-ease), transform 0.7s var(--vm-ease);
}

.vm-reveal.vm-in {
  opacity: 1;
  transform: none;
}

/* Stagger children so a rail assembles rather than snapping in all at once. */
.vm-stagger > * { transition-delay: calc(var(--i, 0) * 70ms); }

/* ============================================================== glass surfaces */

.vm-glass {
  background: var(--vm-glass);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--vm-glass-line);
}

/* ============================================================== shine button */

.vm-shine {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.vm-shine::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-120%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.45), transparent);
}

.vm-shine:hover::after { animation: vm-sweep 0.85s var(--vm-ease); }

@keyframes vm-sweep { to { transform: translateX(120%) skewX(-18deg); } }

/* ============================================================== floating / pulse accents */

.vm-float { animation: vm-float 6s ease-in-out infinite; }
.vm-float-slow { animation: vm-float 9s ease-in-out infinite; }

@keyframes vm-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(-1.5deg); }
}

/* A soft ring that breathes — used on the AI dock so it reads as live without being noisy. */
.vm-pulse-ring::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid currentColor;
  opacity: 0.5;
  animation: vm-pulse 2.4s ease-out infinite;
}

@keyframes vm-pulse {
  0%   { transform: scale(0.9); opacity: 0.55; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* ============================================================== marquee */

.vm-marquee { display: flex; gap: 3rem; width: max-content; animation: vm-marquee 28s linear infinite; }
.vm-marquee-wrap:hover .vm-marquee { animation-play-state: paused; }

@keyframes vm-marquee { to { transform: translateX(-50%); } }

/* ============================================================== gradient text + border */

.vm-gradient-text {
  background: linear-gradient(100deg, #6366f1, #d946ef 45%, #06b6d4);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: vm-pan 6s linear infinite;
}

@keyframes vm-pan { to { background-position: 200% center; } }

.vm-gradient-ring {
  position: relative;
  background-clip: padding-box;
  border: 2px solid transparent;
}

.vm-gradient-ring::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(120deg, #6366f1, #d946ef, #06b6d4, #6366f1);
  background-size: 300% 300%;
  animation: vm-pan-bg 8s linear infinite;
}

@keyframes vm-pan-bg {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ============================================================== product card lift */

.vm-card {
  transition: transform 0.35s var(--vm-ease), box-shadow 0.35s var(--vm-ease);
  will-change: transform;
}

.vm-card:hover {
  transform: translateY(-8px) scale(1.015);
  box-shadow: var(--vm-depth);
}

.vm-card img { transition: transform 0.5s var(--vm-ease); }
.vm-card:hover img { transform: scale(1.07); }

/* ============================================================== command palette */

.vm-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgb(15 23 42 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: vm-fade 0.2s var(--vm-ease);
}

.vm-palette {
  animation: vm-pop 0.28s var(--vm-ease);
}

@keyframes vm-fade { from { opacity: 0; } }
@keyframes vm-pop {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
}

/* ============================================================== skeleton shimmer */

.vm-skeleton {
  background: linear-gradient(90deg, rgb(148 163 184 / 0.12) 25%, rgb(148 163 184 / 0.25) 37%, rgb(148 163 184 / 0.12) 63%);
  background-size: 400% 100%;
  animation: vm-shimmer 1.3s ease-in-out infinite;
}

@keyframes vm-shimmer { to { background-position: -100% 0; } }

/* ==============================================================
   Reduced motion: every animation and transform effect above is decoration, so honour the OS
   preference by switching all of it off rather than merely slowing it down.
   ============================================================== */

@media (prefers-reduced-motion: reduce) {
  .vm-aurora span,
  .vm-float,
  .vm-float-slow,
  .vm-marquee,
  .vm-gradient-text,
  .vm-gradient-ring::before,
  .vm-pulse-ring::before,
  .vm-skeleton,
  .vm-palette,
  .vm-palette-backdrop {
    animation: none !important;
  }

  .vm-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .vm-tilt,
  .vm-tilt:hover,
  .vm-card,
  .vm-card:hover,
  .vm-card img,
  .vm-card:hover img,
  .vm-tilt .vm-layer-1,
  .vm-tilt .vm-layer-2 {
    transform: none !important;
    transition: none !important;
  }

  .vm-glare { display: none; }
  .vm-shine:hover::after { animation: none; }
}
