/*!
 * Bhoo Agrocare — homepage motion layer (front page only).
 *
 * Every rule here is scoped to html.motion, a class assets/js/motion.js adds
 * only once it has confirmed GSAP *and* ScrollTrigger are both on the page. A
 * blocked, 404'd or broken script therefore leaves the homepage on the
 * IntersectionObserver reveal in main.js rather than stranding a section at
 * opacity:0 — the same safety contract the hero already uses (home.css §Hero).
 *
 * Nothing here sets an entry state. motion.js owns every from-state as an
 * inline style, so this file only carries what GSAP cannot express: the masks
 * split headlines rise out of, the 3D stage the flips play on, the
 * pointer-driven surfaces, the transitions that have to step aside while GSAP
 * drives an element, and the hover effects that take over once it is done.
 *
 * Block order follows assets/css/home.css.
 */

/* ==========================================================================
   Split headlines
   ========================================================================== */

/* One mask per visual line, cut with clip-path rather than overflow.
   The mask has to reach past the line box: several headings are Devanagari,
   and the matras above the headline stroke (ि ी े ं) and below the baseline
   (ु ृ) overhang it further than any Latin descender, so a mask the size of
   the box clips them while the line is at rest. A negative inset grows the
   clip region without touching layout. The obvious alternative — padding the
   box and cancelling it with a negative margin — does not cancel: vertical
   margins between adjacent lines collapse, two -.25em margins merge into
   one, and a wrapped heading grows .25em per extra line while it is split,
   then snaps back when the split is removed. That jump is layout shift. */
.motion .split-line {
	display: block;
	clip-path: inset(-.3em -.15em);
}

.motion .split-line__inner { display: block; }

/* Words carry the line break; inline-block is what makes offsetTop differ per
   line, which is how motion.js groups them. Real space text nodes stay between
   them, so selection and screen-reader output are unchanged. */
.motion .split-word { display: inline-block; }


/* ==========================================================================
   Hero
   ========================================================================== */

/* The poster is the LCP element and is never hidden — motion.js only settles
   and scrubs a transform on it. Promoting both layers up front keeps that off
   the main thread from the first frame instead of mid-scroll. */
.motion .hero__poster,
.motion .hero__video { will-change: transform; }


/* ==========================================================================
   Categories — 3D tilt + pointer spotlight
   ========================================================================== */

.motion .cats__item { perspective: 1000px; }

/* GSAP writes this transform on every pointer move, so transform has to leave
   the transition list — otherwise each frame is chased by a 280ms tween and
   the tilt lags the cursor. box-shadow still transitions, from .cats__card. */
.motion .cats__card {
	transform-style: preserve-3d;
	transition: box-shadow .28s;
}

/* Spotlight. z-index 0 puts it over the photo and scrim but under
   .cats__body (z-index 1), so the title and copy never sit in the glare. */
.motion .cats__card::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background: radial-gradient(
		42% 32% at var(--mx, 50%) var(--my, 50%),
		rgba(255, 255, 255, .20),
		rgba(255, 255, 255, 0) 70%
	);
	opacity: 0;
	transition: opacity .32s ease;
}
.motion .cats__card:hover::after,
.motion .cats__card:focus-visible::after { opacity: 1; }


/* ==========================================================================
   Featured products — the stage the cards tip up on
   ========================================================================== */

/* Perspective on the slide, not the track: Splide moves the track with its own
   transform, and a perspective there would put the vanishing point somewhere
   off along the row instead of behind each card. */
.motion .featured__slider .splide__slide { perspective: 1200px; }

/* Arrows and dots wait for the cards they steer (motion.js, chromeAfter). The
   state sits on the slider, not the controls, because Splide rebuilds its
   pagination on refresh() and would discard anything set on the old one. The
   attribute only exists while the motion layer is running — motion.js removes
   it on revert — so the controls can never be left hidden. */
.motion [data-chrome] .splide__arrows,
.motion [data-chrome] .splide__pagination {
	transition: opacity .6s var(--ease), visibility .6s;
}
.motion [data-chrome="wait"] .splide__arrows,
.motion [data-chrome="wait"] .splide__pagination {
	opacity: 0;
	visibility: hidden;
}


/* ==========================================================================
   Why Bhoo Agrocare
   ========================================================================== */

/* These items, and the crop and article items below, carry a
   transition-delay (--d) left over from the CSS-only reveal. A delay on its
   own is enough to start a transition, so it would hold back every value GSAP
   writes; motion.js switches it off inline during the entrance, and this rule
   keeps it off for good, because nothing animates the item itself afterwards. */
.motion .why__item,
.motion .crops__item,
.motion .posts__item { transition: none; }

/* Hover is handed over only once the entrance has finished (.is-in): before
   that the disc's transform belongs to GSAP, and a CSS transition on it would
   re-interpolate every frame of the spring. */
.motion .why__item.is-in .why__icon {
	transition: transform .4s var(--ease), background-color .3s, color .3s;
}
.motion .why__item.is-in:hover .why__icon {
	transform: translateY(-5px) rotate(-8deg);
	background: var(--g-600);
	color: #fff;
}


/* ==========================================================================
   Crops
   ========================================================================== */

/* Same handover: the cut-out lifts and turns a little when its card is
   pointed at, once its own entrance spring has finished. */
.motion .crops__item.is-in .crops__media img {
	transition: transform .45s var(--ease);
}
.motion .crops__item.is-in .crops__card:hover .crops__media img {
	transform: translateY(-6px) scale(1.06) rotate(-3deg);
}


/* ==========================================================================
   Brands — the stage the diamonds flip on
   ========================================================================== */

.motion .brands__slider .splide__slide { perspective: 900px; }


/* ==========================================================================
   Stats — odometer
   ========================================================================== */

/* The rolling digits are decorative duplicates: motion.js puts the real value
   in a .screen-reader-text sibling and marks this subtree aria-hidden. */
.motion .odo {
	display: inline-flex;
	align-items: center;
	--odo-h: 1.08em;
}

/* Every cell is the same box so the reels and the fixed characters line up on
   one row. Baseline alignment cannot do it: a digit cell clips its overflow,
   which makes the browser synthesise its baseline at the bottom edge and sit
   the figures a fraction above the text beside them.
   white-space:pre keeps the separating space in a value like "Since 1998" —
   each character is its own flex item, and a collapsible space in one would
   be dropped, closing the gap. */
.motion .odo__char {
	display: inline-block;
	height: var(--odo-h);
	line-height: var(--odo-h);
	white-space: pre;
}

.motion .odo__digit {
	display: inline-block;
	height: var(--odo-h);
	overflow: hidden;
}

.motion .odo__reel { display: block; will-change: transform; }

.motion .odo__reel span {
	display: block;
	height: var(--odo-h);
	line-height: var(--odo-h);
	font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   Buttons — sheen sweep + magnetic pull
   ========================================================================== */

/* A diagonal light streak across the pill, the guide's "shine on glass". It
   runs over the label rather than behind it: the button's background sits on
   the element itself, so a pseudo-element placed under the text would have to
   go behind that background too. At .22 alpha for 700ms it reads as a gloss. */
.motion .btn[data-sheen] {
	position: relative;
	overflow: hidden;
}

.motion .btn[data-sheen]::before {
	content: "";
	position: absolute;
	top: -60%;
	left: -75%;
	width: 45%;
	height: 220%;
	pointer-events: none;
	background: linear-gradient(
		100deg,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, .22) 50%,
		rgba(255, 255, 255, 0) 100%
	);
	transform: skewX(-22deg) translateX(0);
	opacity: 0;
}

/* On hover with a pointer, and once by itself (.is-gleam) as a button
   finishes arriving — which is also how a touch screen gets to see it. */
.motion .btn[data-sheen]:hover::before,
.motion .btn[data-sheen]:focus-visible::before,
.motion .btn[data-sheen].is-gleam::before {
	animation: bhoo-sheen .9s var(--ease) both;
}

@keyframes bhoo-sheen {
	from { opacity: 1; transform: skewX(-22deg) translateX(0); }
	to   { opacity: 1; transform: skewX(-22deg) translateX(420%); }
}

/* Same reason as .cats__card: GSAP drives this transform per pointer move, so
   it cannot stay in the button's transition list. The rest of .btn's hover
   feedback (colour, shadow, the arrow's nudge) is untouched. */
.motion .btn[data-magnetic] {
	transition: background-color .18s, color .18s, border-color .18s, box-shadow .18s;
}


/* ==========================================================================
   Reduced motion
   ========================================================================== */

/* GSAP reverts its own work through gsap.matchMedia(); these are the pieces it
   never owned. main.css already flattens durations globally, so this block only
   has to stop the pointer and hover effects from firing at all. */
@media (prefers-reduced-motion: reduce) {
	.motion .btn[data-sheen]:hover::before,
	.motion .btn[data-sheen]:focus-visible::before,
	.motion .btn[data-sheen].is-gleam::before { animation: none; opacity: 0; }

	.motion .cats__card::after { display: none; }

	.motion .why__item.is-in:hover .why__icon,
	.motion .crops__item.is-in .crops__card:hover .crops__media img { transform: none; }
}
