/* =========================================
   VELMORAS — Phase 2 Motion Layer
   USA-professional animations, 3D touch, cinematic scroll
   ========================================= */

:root {
  --anim-ease: cubic-bezier(.2, .7, .2, 1);
  --anim-ease-out: cubic-bezier(.16, 1, .3, 1);
  --anim-ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- 1. Scroll reveals ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s var(--anim-ease-out),
    transform 0.9s var(--anim-ease-out);
  will-change: opacity, transform;
}
[data-reveal="fade"] { transform: none; }
[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="scale"] { transform: scale(0.94); }

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* Staggered children */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s var(--anim-ease-out),
    transform 0.7s var(--anim-ease-out);
}
[data-stagger].revealed > * { opacity: 1; transform: none; }
[data-stagger].revealed > *:nth-child(1) { transition-delay: 0.05s; }
[data-stagger].revealed > *:nth-child(2) { transition-delay: 0.15s; }
[data-stagger].revealed > *:nth-child(3) { transition-delay: 0.25s; }
[data-stagger].revealed > *:nth-child(4) { transition-delay: 0.35s; }
[data-stagger].revealed > *:nth-child(5) { transition-delay: 0.45s; }
[data-stagger].revealed > *:nth-child(6) { transition-delay: 0.55s; }

/* ---------- 2. Split-text hero title ---------- */
.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}
.split-word > span {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
  transition:
    transform 0.9s var(--anim-ease-out),
    opacity 0.9s var(--anim-ease-out);
}
.split-word.in > span {
  transform: translateY(0);
  opacity: 1;
}

/* ---------- 3. 3D tilt ---------- */
[data-tilt-3d] {
  transform-style: preserve-3d;
  transition: transform 0.35s var(--anim-ease-out);
  will-change: transform;
}
[data-tilt-3d] > * {
  transform: translateZ(0);
}
[data-tilt-3d] img {
  transition: transform 0.4s var(--anim-ease-out);
}

/* ---------- 4. Magnetic buttons ---------- */
[data-magnetic] {
  transition: transform 0.25s var(--anim-ease-out);
  will-change: transform;
  position: relative;
}
[data-magnetic] > * {
  pointer-events: none;
}

/* ---------- 5. Custom cursor spotlight ---------- */
.velm-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(183, 110, 121, 0.85), rgba(232, 201, 130, 0.3) 60%, transparent 80%);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, opacity 0.3s;
  /* mix-blend-mode removed — was darkening the whole area */
  opacity: 0;
}
.velm-cursor.on { opacity: 1; }
.velm-cursor.hover {
  transform: translate(-50%, -50%) scale(2.4);
  background: radial-gradient(circle, rgba(31, 74, 58, 0.45), rgba(31, 74, 58, 0.1) 60%, transparent 80%);
}
.velm-cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(183, 110, 121, 0.5);
  pointer-events: none;
  z-index: 9997;
  transform: translate(-50%, -50%);
  transition: transform 0.35s var(--anim-ease-out), opacity 0.3s, border-color 0.3s;
  opacity: 0;
}
.velm-cursor-ring.on { opacity: 0.7; }
.velm-cursor-ring.hover {
  transform: translate(-50%, -50%) scale(1.4);
  border-color: rgba(31, 74, 58, 0.6);
}
@media (hover: none), (max-width: 900px) {
  .velm-cursor, .velm-cursor-ring { display: none !important; }
}

/* ---------- 6. Ken Burns on hero slider ---------- */
.hero-bg.active {
  animation: kenBurns 12s ease-in-out both;
}
@keyframes kenBurns {
  0% { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.14) translate(-1.5%, -1.5%); }
}

/* ---------- 7. Number counter — no visual change; JS handles ---------- */
[data-count] { display: inline-block; }

/* ---------- 8. Marquee announcement bar ----------
   Speed is driven by JS (js/announce.js) which measures the track's
   real pixel width and sets --marquee-duration for a constant
   pixels-per-second rate, so it looks the same on every device. */
.velm-announce {
  overflow: hidden;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: relative;
  contain: paint;   /* perf: isolate this bar from layout thrash */
}
.velm-announce-track {
  display: inline-flex;
  gap: 60px;
  white-space: nowrap;
  will-change: transform;
  /* JS sets --marquee-duration; the fallback 34s runs if JS is disabled. */
  animation: marqueeSlide var(--marquee-duration, 34s) linear infinite;
  animation-play-state: running;
}
/* Pause when the user hovers so they can actually read the message */
.velm-announce:hover .velm-announce-track,
.velm-announce:focus-within .velm-announce-track {
  animation-play-state: paused;
}
.velm-announce-track span {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;   /* never let a message wrap or squish */
}
.velm-announce-track span::before {
  content: '✦';
  color: var(--gold);
  font-size: 10px;
}
@keyframes marqueeSlide {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* Accessibility — kill motion for users who ask */
@media (prefers-reduced-motion: reduce) {
  .velm-announce-track {
    animation: none;
    transform: none;
    /* Show all messages as a static, wrapping list */
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px 40px;
  }
}

/* ---------- 9. Reveal-mask headings ---------- */
.mask-reveal {
  display: inline-block;
  position: relative;
  overflow: hidden;
  padding-bottom: 0.1em;
}
.mask-reveal::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--cream);
  transform: translateX(0);
  transition: transform 0.9s var(--anim-ease-out);
}
.mask-reveal.in::after {
  transform: translateX(100%);
}

/* ---------- 10. Product detail — floating rotation ---------- */
[data-float-rotate] {
  animation: floatRotate 8s ease-in-out infinite;
  will-change: transform;
}
@keyframes floatRotate {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-14px) rotate(1deg); }
}

/* ---------- 11. Hover glow on cards ---------- */
[data-glow] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
[data-glow]::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: conic-gradient(
    from var(--glow-angle, 0deg),
    transparent 60%,
    rgba(183, 110, 121, 0.6) 75%,
    rgba(232, 201, 130, 0.55) 85%,
    transparent 100%
  );
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s;
  z-index: -1;
  animation: rotateGlow 4s linear infinite paused;
}
[data-glow]:hover::before {
  opacity: 1;
  animation-play-state: running;
}
@property --glow-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@keyframes rotateGlow {
  from { --glow-angle: 0deg; }
  to   { --glow-angle: 360deg; }
}

/* ---------- 12. Pulse dot for hot items ---------- */
.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: #d47a80;
  position: relative;
  margin-right: 6px;
}
.pulse-dot::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 1.8s ease-out infinite;
  opacity: 0.6;
}
@keyframes pulse {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(3.5); opacity: 0; }
}

/* ---------- 13. Shine sweep on CTA buttons ---------- */
.btn-primary, .btn-dark {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-primary::after, .btn-dark::after {
  content: '';
  position: absolute;
  top: -100%; left: -100%;
  width: 60%; height: 300%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: rotate(20deg);
  transition: transform 0.6s var(--anim-ease-out);
  z-index: -1;
}
.btn-primary:hover::after, .btn-dark:hover::after {
  top: 100%; left: 150%;
}

/* ---------- 14. Category tile 3D lift ---------- */
.cat[data-tilt-3d] {
  transition: transform 0.35s var(--anim-ease-out);
}
.cat[data-tilt-3d]:hover {
  transform: translateY(-8px) scale(1.02);
}
.cat[data-tilt-3d] .cat-img {
  transition: box-shadow 0.35s var(--anim-ease-out), transform 0.35s var(--anim-ease-out);
}
.cat[data-tilt-3d]:hover .cat-img {
  box-shadow: 0 20px 40px -12px rgba(183, 110, 121, 0.35);
  transform: translateZ(24px);
}

/* ---------- 15. Product card 3D lift ---------- */
.product-card[data-tilt-3d]:hover img,
.shop-card[data-tilt-3d]:hover img {
  transform: translateZ(30px) scale(1.06);
}

/* ---------- 16. Section spacer for dramatic reveal timing ---------- */
.section[data-reveal] { opacity: 0; }
.section[data-reveal].revealed { opacity: 1; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal], [data-stagger] > *, .split-word > span {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-bg.active { animation: none !important; }
  .mask-reveal::after { display: none; }
  .velm-cursor, .velm-cursor-ring { display: none; }
}
