/**
 * A R Perfumes Lab — Motion & Animation System
 * Mobile-first. No libraries. Pure CSS + JS-driven classes.
 * Every animation respects prefers-reduced-motion.
 */

/* ==========================================================================
   00. Reduced Motion Override — Accessibility First
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
  }
  .mouse-spotlight {
    display: none !important;
  }
}

/* ==========================================================================
   01. Base State for Scroll-Reveal Elements
   All animated elements start invisible and shifted, then JS adds .is-visible
   ========================================================================== */
[data-animate] {
  opacity: 0;
  will-change: transform, opacity;
  transition-property: opacity, transform;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Duration variants */
[data-animate-speed="fast"]   { transition-duration: 0.4s; }
[data-animate-speed="normal"] { transition-duration: 0.7s; }
[data-animate-speed="slow"]   { transition-duration: 1.1s; }
[data-animate]:not([data-animate-speed]) { transition-duration: 0.7s; }

/* Delay variants via stagger index */
[data-animate-delay="1"] { transition-delay: 0.08s; }
[data-animate-delay="2"] { transition-delay: 0.16s; }
[data-animate-delay="3"] { transition-delay: 0.24s; }
[data-animate-delay="4"] { transition-delay: 0.32s; }
[data-animate-delay="5"] { transition-delay: 0.40s; }
[data-animate-delay="6"] { transition-delay: 0.48s; }

/* ==========================================================================
   02. Reveal Types — Initial Hidden States
   ========================================================================== */

/* Fade Up (default) */
[data-animate="fade-up"] {
  transform: translateY(40px);
}

/* Fade Down */
[data-animate="fade-down"] {
  transform: translateY(-40px);
}

/* Fade Left */
[data-animate="fade-left"] {
  transform: translateX(40px);
}

/* Fade Right */
[data-animate="fade-right"] {
  transform: translateX(-40px);
}

/* Scale In */
[data-animate="scale-in"] {
  transform: scale(0.92);
}

/* Scale Up from below */
[data-animate="scale-up"] {
  transform: scale(0.85) translateY(30px);
}

/* Blur In */
[data-animate="blur-in"] {
  filter: blur(12px);
  transform: translateY(20px);
}

/* Clip Reveal — uses clip-path wipe */
[data-animate="clip-up"] {
  clip-path: inset(100% 0 0 0);
  transform: none;
}

/* Split text lines — each word slides up independently */
[data-animate="line-up"] {
  overflow: hidden;
}
[data-animate="line-up"] > * {
  display: inline-block;
  transform: translateY(100%);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   03. Visible State — Applied by IntersectionObserver in JS
   ========================================================================== */
[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
  filter: blur(0);
  clip-path: inset(0 0 0 0);
}

[data-animate="line-up"].is-visible > * {
  transform: translateY(0);
}

/* Dynamic active state when scrolling down/up */
body.is-scrolling-down [data-scroll-movement="scale-up"] {
  transform: scale(1.01);
  transition: transform 0.6s ease;
}
body.is-scrolling-up [data-scroll-movement="scale-up"] {
  transform: scale(0.99);
  transition: transform 0.6s ease;
}

/* ==========================================================================
   04. Keyframe Animations — Ambient & Continuous
   ========================================================================== */

/* Slow drift for hero backgrounds / floating elements */
@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(8px, -12px) rotate(0.5deg); }
  50%      { transform: translate(-5px, -20px) rotate(-0.3deg); }
  75%      { transform: translate(-10px, -8px) rotate(0.2deg); }
}

/* Gentle pulse glow for accent elements */
@keyframes amber-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(230, 154, 56, 0.15); }
  50%      { box-shadow: 0 0 40px rgba(230, 154, 56, 0.35); }
}

/* Shimmer sweep for borders or dividers */
@keyframes shimmer-sweep {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Smoke rise — subtle vertical drift with fade */
@keyframes smoke-rise {
  0%   { transform: translateY(0) scaleX(1); opacity: 0.6; }
  50%  { transform: translateY(-30px) scaleX(1.15); opacity: 0.3; }
  100% { transform: translateY(-60px) scaleX(1.3); opacity: 0; }
}

/* Liquid fill — bottom-to-top reveal for cards */
@keyframes liquid-fill {
  0%   { clip-path: inset(100% 0 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* Rotate slow — for decorative compass/mandala elements */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Horizontal scroll marquee */
@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Floating particle float */
@keyframes float-particle {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.4; }
  50%      { transform: translateY(-15px) scale(1.1); opacity: 0.8; }
}

/* ==========================================================================
   05. Utility Classes for Continuous Animations
   ========================================================================== */
.anim-drift {
  animation: drift 18s ease-in-out infinite;
}

.anim-pulse-glow {
  animation: amber-pulse 3s ease-in-out infinite;
}

.anim-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(230, 154, 56, 0.12) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 3s linear infinite;
}

.anim-smoke {
  animation: smoke-rise 4s ease-out infinite;
}

.anim-spin-slow {
  animation: spin-slow 40s linear infinite;
}

.anim-marquee {
  animation: marquee-scroll 25s linear infinite;
}

.anim-float {
  animation: float-particle 4s ease-in-out infinite;
}

/* ==========================================================================
   06. Mouse / Touch Parallax Layer & Interactive 3D Card Tilt
   ========================================================================== */
[data-parallax] {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

[data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* ==========================================================================
   07. Mouse Ambient Spotlight Follower Layer
   Follows cursor across page to illuminate dark luxury backgrounds.
   ========================================================================== */
.mouse-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(230, 154, 56, 0.08) 0%,
    rgba(230, 154, 56, 0.03) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  opacity: 0;
  mix-blend-mode: screen;
}

body:hover .mouse-spotlight {
  opacity: 1;
}

/* ==========================================================================
   08. Custom Cursor Follower (Desktop Only)
   ========================================================================== */
.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 154, 56, 0.7) 0%, rgba(230, 154, 56, 0) 70%);
  pointer-events: none;
  z-index: 99998;
  mix-blend-mode: screen;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.3s ease,
              height 0.3s ease,
              background 0.3s ease;
  transform: translate(-50%, -50%);
  display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .cursor-follower {
    display: block;
  }
  body {
    cursor: none;
  }
  a, button, [role="button"], input, select, textarea {
    cursor: none;
  }
}

.cursor-follower.is-hovering {
  width: 48px;
  height: 48px;
  background: radial-gradient(circle, rgba(230, 154, 56, 0.35) 0%, rgba(230, 154, 56, 0) 70%);
}

/* ==========================================================================
   09. Section Transition Wipes — Scroll-Time Movement
   ========================================================================== */
.section-wipe {
  position: relative;
  overflow: hidden;
}

.section-wipe::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #0C0907;
  z-index: 2;
  transform-origin: left;
  transition: transform 0.9s cubic-bezier(0.77, 0, 0.175, 1);
}

.section-wipe.is-visible::before {
  transform: scaleX(0);
  transform-origin: right;
}

/* ==========================================================================
   10. Stagger Grid Children
   ========================================================================== */
.stagger-grid > * {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.stagger-grid.is-visible > *:nth-child(1)  { transition-delay: 0s; }
.stagger-grid.is-visible > *:nth-child(2)  { transition-delay: 0.07s; }
.stagger-grid.is-visible > *:nth-child(3)  { transition-delay: 0.14s; }
.stagger-grid.is-visible > *:nth-child(4)  { transition-delay: 0.21s; }
.stagger-grid.is-visible > *:nth-child(5)  { transition-delay: 0.28s; }
.stagger-grid.is-visible > *:nth-child(6)  { transition-delay: 0.35s; }
.stagger-grid.is-visible > *:nth-child(7)  { transition-delay: 0.42s; }
.stagger-grid.is-visible > *:nth-child(8)  { transition-delay: 0.49s; }
.stagger-grid.is-visible > *:nth-child(9)  { transition-delay: 0.56s; }

.stagger-grid.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   11. Text Split Animation
   ========================================================================== */
.text-reveal-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) rotate(4deg);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.text-reveal-char.is-visible {
  opacity: 1;
  transform: translateY(0) rotate(0deg);
}

/* ==========================================================================
   12. Magnetic Button Effect
   ========================================================================== */
[data-magnetic] {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   13. Progress / Scroll Indicator Bar
   ========================================================================== */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #e69a38, #ffb865, #e9c349);
  z-index: 10001;
  transform-origin: left;
  transform: scaleX(0);
  will-change: transform;
}

/* ==========================================================================
   14. Mobile-Specific Adjustments
   ========================================================================== */
@media (max-width: 768px) {
  .anim-drift { animation-duration: 30s; }
  .anim-marquee { animation-duration: 40s; }

  [data-animate="fade-up"]   { transform: translateY(20px); }
  [data-animate="fade-down"] { transform: translateY(-20px); }
  [data-animate="fade-left"] { transform: translateX(20px); }
  [data-animate="fade-right"]{ transform: translateX(-20px); }
  [data-animate="scale-in"]  { transform: scale(0.96); }
  [data-animate="blur-in"]   { filter: blur(6px); transform: translateY(10px); }

  [data-animate] { transition-duration: 0.5s !important; }
  .stagger-grid > * { transition-duration: 0.4s !important; }
}
