/* ==========================================================================
   Ritvi · Premium Motion Layer  v1.0
   Loaded after the compiled Next.js stylesheet. Pure enhancement:
   no structural overrides, hydration-safe, honors prefers-reduced-motion.
   Palette hooks into the site's own tokens (gold/champagne/ivory on #070707).
   ========================================================================== */

/* ---------- 1 · Scroll progress hairline (gold, fixed top) ---------- */
.pr-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(var(--scroll-p, 0));
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #ae7c3e, #d8b76a 45%, #fcf4d8);
  box-shadow: 0 0 12px rgba(216, 183, 106, 0.55);
  z-index: 90;
  pointer-events: none;
}

/* ---------- 2 · Living gold headline (shimmer sweep) ---------- */
.pr-js .text-gold-gradient {
  background-image:
    linear-gradient(120deg,
      rgba(255, 249, 226, 0) 38%,
      rgba(255, 250, 230, 0.85) 50%,
      rgba(255, 249, 226, 0) 62%),
    linear-gradient(180deg, var(--color-g-top) 0%, var(--color-g-mid1) 30%, var(--color-g-mid2) 62%, var(--color-g-bot) 100%);
  background-size: 250% 100%, 100% 100%;
  background-position: 120% 0, 0 0;
  animation: pr-shimmer 7s cubic-bezier(0.4, 0, 0.2, 1) 1.1s infinite;
}
@keyframes pr-shimmer {
  0%   { background-position: 120% 0, 0 0; }
  22%  { background-position: -60% 0, 0 0; }
  100% { background-position: -60% 0, 0 0; }
}

/* ---------- 3 · Ambient aurora drift behind hero ---------- */
.pr-aurora {
  position: absolute;
  inset: -20% -10%;
  pointer-events: none;
  opacity: 0.5;
  filter: blur(60px);
  background:
    radial-gradient(38% 30% at 22% 18%, rgba(141, 127, 181, 0.14), transparent 70%),
    radial-gradient(32% 26% at 78% 12%, rgba(111, 143, 175, 0.12), transparent 70%),
    radial-gradient(40% 34% at 60% 60%, rgba(216, 183, 106, 0.10), transparent 72%);
  animation: pr-aurora-drift 26s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes pr-aurora-drift {
  0%   { transform: translate3d(-2.5%, -1.5%, 0) rotate(-1.2deg) scale(1); }
  50%  { transform: translate3d(1.5%, 2%, 0) rotate(0.6deg) scale(1.06); }
  100% { transform: translate3d(3%, -2%, 0) rotate(1.4deg) scale(1.02); }
}

/* ---------- 4 · Shooting stars ---------- */
.pr-shooting-star {
  position: absolute;
  width: 150px;
  height: 1.5px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(252, 244, 216, 0.95), rgba(252, 244, 216, 0));
  border-radius: 999px;
  filter: drop-shadow(0 0 6px rgba(243, 223, 163, 0.8));
  opacity: 0;
  transform: rotate(var(--star-angle, 24deg));
  animation: pr-star-fly var(--star-dur, 1.6s) ease-in var(--star-delay, 3s) infinite;
  z-index: 1;
}
.pr-shooting-star::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -2.25px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fcf4d8;
  box-shadow: 0 0 10px 2px rgba(252, 244, 216, 0.9);
}
@keyframes pr-star-fly {
  0%   { opacity: 0; translate: 0 0; }
  6%   { opacity: 1; }
  46%  { opacity: 1; }
  60%  { opacity: 0; translate: var(--star-tx, -46vw) var(--star-ty, 22vh); }
  100% { opacity: 0; translate: var(--star-tx, -46vw) var(--star-ty, 22vh); }
}

/* ---------- 5 · Celestial orbit ring around the hero portrait ---------- */
.pr-orbit {
  position: absolute;
  inset: -9%;
  pointer-events: none;
  z-index: 0;
  animation: pr-orbit-spin 60s linear infinite;
}
.pr-orbit svg { width: 100%; height: 100%; display: block; }
.pr-orbit .pr-orbit-node {
  animation: pr-node-pulse 3.4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes pr-orbit-spin { to { transform: rotate(360deg); } }
@keyframes pr-node-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ---------- 6 · Cinematic film grain ---------- */
.pr-grain {
  position: fixed;
  inset: -100%;
  width: 300%;
  height: 300%;
  pointer-events: none;
  z-index: 80;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: pr-grain-shift 0.9s steps(4) infinite;
}
@keyframes pr-grain-shift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(-1.2%, 0.8%, 0); }
  50%  { transform: translate3d(0.9%, -1.1%, 0); }
  75%  { transform: translate3d(-0.6%, -0.7%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ---------- 7 · Cursor halo (fine pointers, dark sections only via blend) ---------- */
.pr-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  pointer-events: none;
  z-index: 5;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 183, 106, 0.09) 0%, rgba(216, 183, 106, 0.03) 38%, transparent 68%);
  mix-blend-mode: screen; /* melts away on the light editorial section */
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: transform;
}
.pr-glow.pr-on { opacity: 1; }
@media (pointer: coarse) { .pr-glow { display: none; } }

/* ---------- 8 · Magnetic CTAs with light sweep ---------- */
.pr-magnet {
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}
.pr-magnet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(252, 244, 216, 0.22) 50%, transparent 68%);
  transform: translateX(-130%);
  transition: transform 0s;
}
.pr-magnet:hover::after {
  transform: translateX(130%);
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 9 · Card cursor spotlight (no transforms — never fights the
   built-in reveal system's inline styles) ---------- */
main .pr-card { position: relative; }
main .pr-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(216, 183, 106, 0.11), transparent 60%);
}
main .pr-card:hover::before { opacity: 1; }

/* ---------- 10 · Secondary reveal (elements the built-in system misses) ---------- */
.pr-js .pr-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--pr-d, 0s);
}
.pr-js .pr-reveal.pr-in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 11 · Language marquee: pause on hover ---------- */
.pr-marquee:hover [class*="animate-marquee"],
.pr-marquee:focus-within [class*="animate-marquee"] {
  animation-play-state: paused;
}

/* ---------- 12 · Comfort & polish ---------- */
html { scroll-behavior: smooth; }
::selection { background: rgba(216, 183, 106, 0.32); color: #fcf4d8; }

/* Gentle breathing glow on the Play Store badge, drawing the eye to the one conversion */
.pr-js a[href*="play.google.com"] {
  animation: pr-cta-breathe 5.5s ease-in-out 2.4s infinite;
}
@keyframes pr-cta-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(216, 183, 106, 0); }
  50%      { box-shadow: 0 0 34px -4px rgba(216, 183, 106, 0.35); }
}

/* ---------- 13 · Reduced motion: switch the whole layer off ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pr-progress, .pr-grain, .pr-glow, .pr-shooting-star, .pr-aurora, .pr-orbit { display: none !important; }
  .pr-js .text-gold-gradient,
  .pr-js a[href*="play.google.com"],
  .pr-magnet::after { animation: none !important; }
  .pr-js .pr-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .pr-magnet { transition: none !important; transform: none !important; }
}
