/* ==========================================================================
   VilaVPN homepage motion layer (homepage only; loaded from homepage.tpl).
   Pure CSS + js/vila-motion.js. No third-party code, no CDN (CN users).
   Every effect animates transform/opacity only and switches off under
   prefers-reduced-motion. Without JS the page renders exactly as before:
   all hidden start states are keyed on html.vm-on, which the JS sets.
   ========================================================================== */

:root { --vm-css: 1; } /* sentinel: js/vila-motion.js runs only when this file applied */

/* ---- Scroll progress bar ---------------------------------------------- */
.vm-progress {
  position: fixed; top: 0; left: 0; z-index: 1100;
  width: 100%; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--accent-cyan, #28a3cc), var(--accent-teal, #14f1d9));
  box-shadow: 0 0 10px rgba(20,241,217,.55);
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---- Hero: network canvas + aurora ------------------------------------ */
.vm-net {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; pointer-events: none;
  opacity: 0; transition: opacity 1.2s ease;
}
.vm-net.is-on { opacity: 1; }
.vm-aurora {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.vm-aurora::before,
.vm-aurora::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(60px);
  will-change: transform;
}
.vm-aurora::before {
  width: 520px; height: 520px; left: 8%; top: 12%;
  background: radial-gradient(circle, rgba(40,163,204,.22) 0%, transparent 70%);
  animation: vm-drift-a 18s ease-in-out infinite alternate;
}
.vm-aurora::after {
  width: 460px; height: 460px; right: 6%; top: 4%;
  background: radial-gradient(circle, rgba(20,241,217,.14) 0%, transparent 70%);
  animation: vm-drift-b 22s ease-in-out infinite alternate;
}
@keyframes vm-drift-a { to { transform: translate3d(120px, 60px, 0) scale(1.15); } }
@keyframes vm-drift-b { to { transform: translate3d(-140px, 90px, 0) scale(.9); } }

/* Hero entrance (above the fold: short, transform-led) */
.vm-on .hero-content > * {
  animation: vm-rise .8s cubic-bezier(.2,.7,.2,1) both;
}
.vm-on .hero-content > :nth-child(1) { animation-delay: .05s; }
.vm-on .hero-content > :nth-child(2) { animation-delay: .15s; }
.vm-on .hero-content > :nth-child(3) { animation-delay: .25s; }
.vm-on .hero-content > :nth-child(4) { animation-delay: .35s; }
.vm-on .hero-content > :nth-child(5) { animation-delay: .45s; }
@keyframes vm-rise {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to   { opacity: 1; transform: none; }
}
/* The logo is the LCP image: keep it opaque, move it only. */
.vm-on .hero-content > .hero-logo {
  animation: vm-logo-in .9s cubic-bezier(.2,.7,.2,1) both, vm-float 6s ease-in-out .9s infinite;
  filter: drop-shadow(0 0 0 rgba(40,163,204,0));
}
@keyframes vm-logo-in { from { transform: translate3d(0, 18px, 0) scale(.94); } to { transform: none; } }
@keyframes vm-float {
  0%, 100% { transform: translate3d(0, 0, 0); filter: drop-shadow(0 0 6px rgba(40,163,204,.25)); }
  50%      { transform: translate3d(0, -8px, 0); filter: drop-shadow(0 0 18px rgba(20,241,217,.45)); }
}

/* Title shimmer sweep */
.vm-on .hero-title {
  background: linear-gradient(100deg, #ffffff 0%, #ffffff 40%, #8ff7ec 50%, #ffffff 60%, #ffffff 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  animation: vm-rise .8s cubic-bezier(.2,.7,.2,1) .15s both, vm-shimmer 5s ease-in-out 1.2s infinite;
}
@keyframes vm-shimmer { 0% { background-position: 100% 0; } 60%, 100% { background-position: -50% 0; } }

/* Primary CTA: light sweep + soft ring */
.vm-on .hero-cta .btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.vm-on .hero-cta .btn-primary::after {
  content: ''; position: absolute; top: 0; left: -60%; z-index: -1;
  width: 40%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg);
  animation: vm-sweep 3.6s ease-in-out 1.4s infinite;
}
@keyframes vm-sweep { 0% { left: -60%; } 45%, 100% { left: 130%; } }
.vm-on .hero-cta .btn-primary { animation: vm-ring 2.8s ease-out 1.6s infinite; }
@keyframes vm-ring {
  0%   { box-shadow: 0 0 0 0 rgba(40,163,204,.55); }
  70%  { box-shadow: 0 0 0 14px rgba(40,163,204,0); }
  100% { box-shadow: 0 0 0 0 rgba(40,163,204,0); }
}

/* Globe: orbit rings with satellites (decorative overlay) */
.vm-orbits { position: absolute; inset: -6%; z-index: 4; pointer-events: none; }
.vm-orbit {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px dashed rgba(40,163,204,.28);
  transform-style: preserve-3d;
}
.vm-orbit--a { transform: rotateX(72deg) rotateZ(0deg); animation: vm-spin-a 16s linear infinite; }
.vm-orbit--b { inset: 6%; border-color: rgba(20,241,217,.22); transform: rotateX(68deg) rotateY(38deg); animation: vm-spin-b 24s linear infinite; }
.vm-orbit::after {
  content: ''; position: absolute; top: -4px; left: 50%;
  width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: var(--accent-teal, #14f1d9);
  box-shadow: 0 0 12px 3px rgba(20,241,217,.7);
}
.vm-orbit--b::after { background: #7fd3f0; box-shadow: 0 0 10px 2px rgba(40,163,204,.8); }
@keyframes vm-spin-a { to { transform: rotateX(72deg) rotateZ(360deg); } }
@keyframes vm-spin-b { to { transform: rotateX(68deg) rotateY(38deg) rotateZ(-360deg); } }
.vm-on .hero-globe { animation: vm-globe-in 1.2s cubic-bezier(.2,.7,.2,1) .2s both; }
@keyframes vm-globe-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

/* ---- Section reveals (extends the theme's data-animate system) -------- */
.vm-on .animate-hidden { transform: translate3d(0, 34px, 0) scale(.98); transition-duration: .8s; transition-timing-function: cubic-bezier(.2,.7,.2,1); }
.vm-on .animate-hidden.animate-visible { transform: none; }

/* Feature cards: tilt + icon bob */
.vm-on .vb-fcard { transform-style: preserve-3d; will-change: transform; }
.vm-on .vb-fcard.vm-tilting { transition: transform .12s ease-out, box-shadow .3s ease; }
.vm-on .vb-fcard .vb-fcard__icon { transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.vm-on .vb-fcard:hover .vb-fcard__icon { transform: translate3d(0, -6px, 0) scale(1.08); }
.vm-on .vb-fcard.animate-visible .vb-fcard__icon { animation: vm-icon-pop .7s cubic-bezier(.3,1.6,.5,1) .35s backwards; }
@keyframes vm-icon-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* Plan feature rows tick in after the card lands (prices stay static on purpose). */
.vm-on .vb-plan.animate-visible .vb-plan__list li {
  animation: vm-row-in .5s cubic-bezier(.2,.7,.2,1) backwards;
}
.vm-on .vb-plan.animate-visible .vb-plan__list li:nth-child(1) { animation-delay: .35s; }
.vm-on .vb-plan.animate-visible .vb-plan__list li:nth-child(2) { animation-delay: .42s; }
.vm-on .vb-plan.animate-visible .vb-plan__list li:nth-child(3) { animation-delay: .49s; }
.vm-on .vb-plan.animate-visible .vb-plan__list li:nth-child(4) { animation-delay: .56s; }
.vm-on .vb-plan.animate-visible .vb-plan__list li:nth-child(5) { animation-delay: .63s; }
.vm-on .vb-plan.animate-visible .vb-plan__list li:nth-child(6) { animation-delay: .70s; }
@keyframes vm-row-in { from { opacity: 0; transform: translate3d(-12px, 0, 0); } }
/* Buy Now: light sweep on hover */
.vm-on .vb-plan__cta .vb-btn { position: relative; overflow: hidden; isolation: isolate; }
.vm-on .vb-plan__cta .vb-btn::after {
  content: ''; position: absolute; top: 0; left: -70%; z-index: -1;
  width: 50%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); transition: left .6s ease;
}
.vm-on .vb-plan__cta .vb-btn:hover::after { left: 130%; }

/* Magnetic buttons (JS sets the `translate` property, so `transform` hovers still work) */
.vm-magnetic { transition: translate .25s cubic-bezier(.2,.7,.2,1); }

/* Hero scroll cue */
.vm-cue {
  position: absolute; left: 50%; bottom: 8px; z-index: 3;
  width: 26px; height: 42px; margin-left: -13px; padding: 0;
  border: 2px solid rgba(255,255,255,.45); border-radius: 14px; background: transparent;
  cursor: pointer; transition: opacity .4s ease, border-color .3s ease;
}
.vm-cue::before {
  content: ''; position: absolute; left: 50%; top: 8px;
  width: 4px; height: 8px; margin-left: -2px; border-radius: 2px;
  background: var(--accent-teal, #14f1d9);
  animation: vm-cue 1.8s ease-in-out infinite;
}
.vm-cue:hover, .vm-cue:focus-visible { border-color: var(--accent-teal, #14f1d9); outline: none; }
.vm-cue.is-gone { opacity: 0; pointer-events: none; }
@keyframes vm-cue { 0% { opacity: 0; transform: translate3d(0, 0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate3d(0, 14px, 0); } }

/* Why-us: payment-methods strip rises in */
.vm-on .vb-paytray { display: block; transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.vm-on .vb-paytray.vm-pre { opacity: 0; transform: translate3d(0, 24px, 0); }


/* Smooth in-page jumps (hero "Learn more" -> features) */
html.vm-on { scroll-behavior: smooth; }

/* Trust band: stars fill one by one */
.vm-on .trust-band__rating-star { display: inline-block; }
.vm-on .vm-in .trust-band__rating-star { animation: vm-star .9s cubic-bezier(.3,1.6,.5,1) .3s backwards; }
@keyframes vm-star { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }

/* Why-us flow diagram: data moves through the tunnel, the core breathes */
.vm-on .vx-flowline { animation: vx-flow 1.1s linear infinite; }
@keyframes vx-flow { to { stroke-dashoffset: -28; } }
.vm-on .vx-halo { transform-box: fill-box; transform-origin: center; animation: vx-breathe 3.2s ease-in-out infinite; }
@keyframes vx-breathe { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: .5; } }

/* Advanced clients: pointer spotlight + terminal caret */
.vm-on #advanced-clients .client-card {
  background-image: radial-gradient(420px circle at var(--vm-x, 50%) var(--vm-y, -40%), rgba(40,163,204,.14), transparent 45%);
}
.vm-on #advanced-clients .fa-terminal { position: relative; }
.vm-on #advanced-clients .fa-terminal::after {
  content: ''; position: absolute; right: -5px; bottom: 2px;
  width: 6px; height: 2px; background: var(--accent-teal, #14f1d9);
  animation: vm-caret 1s steps(1) infinite;
}
@keyframes vm-caret { 50% { opacity: 0; } }
.vm-on #advanced-clients .card-icon-badge { transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
.vm-on #advanced-clients .client-card:hover .card-icon-badge { transform: rotate(-8deg) scale(1.08); }

/* ---- Small screens: keep it light ------------------------------------- */
@media (max-width: 991px) {
  .vm-aurora::before { width: 320px; height: 320px; }
  .vm-aurora::after  { width: 280px; height: 280px; }
  .vm-orbits { display: none; }
  .vm-cue { display: none; }
}

/* ---- Reduced motion: everything off ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .vm-progress, .vm-net, .vm-aurora, .vm-orbits, .vm-cue { display: none !important; }
  html.vm-on { scroll-behavior: auto; }
  .vm-on *, .vm-on *::before, .vm-on *::after { animation: none !important; }
  .vm-on .hero-title { -webkit-text-fill-color: currentColor; background: none; }
}
