/* ============================================================================
   VEDAANT motion layer (owner, 20 Nov: "scroll karte hue 3D motion dikhe").
   1. 3D reveal: blocks rise and un-tilt into place as they enter the screen.
   2. Swipe rails (products, videos, blog, reviews): coverflow — cards turn
      in 3D as they slide past the centre (JS sets --p from -1 to 1).
   3. Scroll tilt: sections lean a little with scroll speed, then settle.
   4. Page-to-page slide (View Transitions) and a soft hero parallax.
   Everything switches off for people who ask the phone for reduced motion.
   ============================================================================ */

/* 1. 3D reveal */
.reveal {
    opacity: 0;
    transform: perspective(1000px) translate3d(0, 48px, -40px) rotateX(16deg) scale(.96);
    transform-origin: 50% 100%;
    transition: opacity .75s cubic-bezier(.2, .75, .25, 1), transform .95s cubic-bezier(.2, .75, .25, 1);
    transition-delay: var(--d, 0s);
}
.reveal.from-left  { transform: perspective(1000px) translate3d(-60px, 10px, 0) rotateY(18deg); transform-origin: 0 50%; }
.reveal.from-right { transform: perspective(1000px) translate3d(60px, 10px, 0) rotateY(-18deg); transform-origin: 100% 50%; }
.reveal.flip       { transform: perspective(900px) rotateY(-75deg) scale(.9); transform-origin: 50% 50%; }
.reveal.pop        { transform: perspective(900px) translate3d(0, 20px, 0) scale(.82) rotateX(10deg); }
.reveal.in { opacity: 1; transform: none; }

/* 2. coverflow rails */
.v-3d { perspective: 1100px; perspective-origin: 50% 40%; }
.v-3d > * {
    transform: rotateY(calc(var(--p, 0) * -24deg)) translateZ(calc(var(--a, 0) * -60px)) scale(calc(1 - var(--a, 0) * .07));
    transform-style: preserve-3d;
    transition: transform .14s linear, box-shadow .3s;
    will-change: transform;
}
.v-3d > *:hover { transform: rotateY(calc(var(--p, 0) * -24deg)) translateZ(calc(var(--a, 0) * -60px)) scale(calc(1 - var(--a, 0) * .07)) translateY(-4px); }
.v-3d > .rail-in { animation: vRailIn .9s cubic-bezier(.2, .75, .25, 1) both; animation-delay: var(--d, 0s); }
@keyframes vRailIn { from { opacity: 0; translate: 80px 0; rotate: y -40deg; } }

/* 3. scroll tilt (home + shop + blog lists) */
.v-tilt .section > .container,
.v-tilt .v-strip-in, .v-tilt .v-band-in {
    transform: perspective(1400px) rotateX(calc(var(--vel, 0) * 1deg)) translateZ(0);
    transform-origin: 50% 50%;
    transition: transform .45s cubic-bezier(.2, .75, .25, 1);
}

/* 4a. hero parallax: the photo drifts slower than the page */
.v-arch img { transform: translate3d(0, var(--par, 0px), 0) scale(1.08); transition: transform .1s linear; }
.v-float { will-change: transform; }

/* 4b. page-to-page slide (Chrome / Edge / Android browsers; others just load normally) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vPageOut .32s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vPageIn .5s cubic-bezier(.2, .75, .25, 1) both; }
@keyframes vPageOut { to { opacity: 0; transform: perspective(1200px) translate3d(-8%, 0, -80px) rotateY(10deg); } }
@keyframes vPageIn { from { opacity: 0; transform: perspective(1200px) translate3d(10%, 0, -80px) rotateY(-12deg); } }
.v-header { view-transition-name: vs-header; }
.v-dock { view-transition-name: vs-dock; }
::view-transition-old(vs-header), ::view-transition-new(vs-header),
::view-transition-old(vs-dock), ::view-transition-new(vs-dock) { animation: none; }

/* product gallery as a swipe rail on phones (built by motion.js) */
.v-gal { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 2px 10px; }
.v-gal::-webkit-scrollbar { display: none; }
.v-gal img { flex: 0 0 86%; aspect-ratio: 1; object-fit: cover; border-radius: 22px; scroll-snap-align: center; background: var(--cream-2); border: 1px solid var(--line); }
.v-gal-count { position: absolute; right: 14px; top: 14px; background: rgba(36, 26, 19, .75); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; z-index: 2; }
.pd-gallery.has-gal { position: relative; top: 0; }
.pd-gallery.has-gal .pd-main-img, .pd-gallery.has-gal .pd-thumbs { display: none; }

/* swipe hint on rails that overflow */
.v-swipehint { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.v-swipehint i { animation: vNudge 1.6s ease-in-out infinite; }
@keyframes vNudge { 50% { transform: translateX(6px); } }
@media (min-width: 900px) { .v-swipehint { display: none; } }

@media (prefers-reduced-motion: reduce) {
    /* keep the gentle reveal + user-driven coverflow; drop the big moves */
    .reveal, .reveal.from-left, .reveal.from-right, .reveal.flip, .reveal.pop { transform: translate3d(0, 18px, 0); transition-duration: .5s; }
    .reveal.in { transform: none; }
    .v-tilt .section > .container, .v-tilt .v-strip-in, .v-tilt .v-band-in, .v-arch img { transform: none !important; }
    @view-transition { navigation: none; }
}

/* blog index: a vertical list on phones (each card flips in on scroll) */
@media (max-width: 899px) { .blog-grid.is-list { display: grid; grid-template-columns: 1fr; gap: 18px; overflow: visible; } .blog-grid.is-list > * { max-width: none; flex: none; } }

/* never let a moving card widen the page (real phones showed a blank strip on the right) */
html, body { overflow-x: clip; max-width: 100%; }
@supports not (overflow: clip) { html, body { overflow-x: hidden; } }
#page, .site-footer { overflow-x: clip; }
.reveal.from-left:not(.in)  { transform: perspective(1000px) translate3d(-24px, 14px, 0) rotateY(12deg); }
.reveal.from-right:not(.in) { transform: perspective(1000px) translate3d(24px, 14px, 0) rotateY(-12deg); }
.v-float.f1 { left: 4px; } .v-float.f2 { right: 4px; }
@media (min-width: 900px) { .v-float.f1 { left: -40px; } .v-float.f2 { right: -30px; } }
