hero-title.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. "use client";
  2. import { useEffect, useRef, useState } from "react";
  3. import {
  4. buildLensMap,
  5. supportsBackdropRefraction,
  6. type LensMap,
  7. } from "@/components/glass/displacement";
  8. import { GlassFilter, registerLight } from "@/components/glass/liquid-glass";
  9. import { useT } from "@/components/locale-provider";
  10. import { cn, prefersReducedMotion } from "@/lib/utils";
  11. const NAME = "Eric";
  12. const BASE_WEIGHT = 640;
  13. /** At rest the letters are fully soft; the wave sharpens what it passes and melts what it touches. */
  14. const REST = { fontWeight: BASE_WEIGHT, fontVariationSettings: "'SOFT' 100" };
  15. const FILTER_ID = "hero-droplet-lens";
  16. /** How much the full-size lens magnifies. */
  17. const MAGNIFY = 1.18;
  18. /** Han characters and CJK punctuation, which the Chinese headline sets in Noto Serif SC. */
  19. const HAN = /[ -〿㐀-䶿一-鿿＀-￯]/;
  20. /**
  21. * Noto Serif SC is loaded at one weight, so the wave can't make Han
  22. * characters heavier. It thickens their strokes instead: this much at the
  23. * crest, about the step from SemiBold to Black.
  24. */
  25. const HAN_STROKE = 0.05;
  26. const clamp = (v: number, min: number, max: number) =>
  27. Math.min(max, Math.max(min, v));
  28. const letter = (ch: string, i: number) => (
  29. <span
  30. key={i}
  31. className={cn("inline-block", ch === " " && "w-[0.24em]")}
  32. data-han={HAN.test(ch) || undefined}
  33. data-wave={i}
  34. style={REST}
  35. >
  36. {ch === " " ? " " : ch}
  37. </span>
  38. );
  39. // Sized in CSS (.hero-title): one line, or two when the card has the height.
  40. function Title() {
  41. const LEAD = useT().hero.lead;
  42. const TEXT = `${LEAD}${NAME}.`;
  43. return (
  44. <h1
  45. aria-label={TEXT}
  46. className="hero-title font-display tracking-[-0.022em] whitespace-nowrap"
  47. >
  48. <span aria-hidden>
  49. {LEAD.split("").map((ch, i) => letter(ch, i))}
  50. <span className="hero-tail inline-block">
  51. {/* One plain text node, the one form of background-clip: text every
  52. Safari paints: split into letters, the gradient name vanished on
  53. iPhone. The wave weighs the name as a whole. */}
  54. <span className="hero-name" data-wave={LEAD.length} style={REST}>
  55. {NAME}
  56. </span>
  57. <span
  58. className="inline-block"
  59. data-period=""
  60. data-wave={TEXT.length - 1}
  61. style={REST}
  62. >
  63. .
  64. <span
  65. className="inline-block size-0 align-baseline"
  66. data-baseline
  67. />
  68. </span>
  69. </span>
  70. </span>
  71. </h1>
  72. );
  73. }
  74. /**
  75. * The headline. Letters melt under the cursor (Fraunces' weight and SOFT axes), and the
  76. * period is a bead of liquid glass: pull it and it swells into a lens that
  77. * magnifies whatever on the card it passes over, stretching with speed; let
  78. * go and it springs home and shrinks back into a period. The lens shows a
  79. * pixel-aligned copy of the card, so it works in every browser.
  80. */
  81. export function HeroTitle() {
  82. const { hero } = useT();
  83. const wrapRef = useRef<HTMLDivElement>(null);
  84. const orbRef = useRef<HTMLDivElement>(null);
  85. const cloneRef = useRef<HTMLDivElement>(null);
  86. const handleRef = useRef<HTMLSpanElement>(null);
  87. const relayout = useRef<() => void>(() => {});
  88. const [map, setMap] = useState<LensMap | null>(null);
  89. /* ---------- Variable-weight wave ---------- */
  90. useEffect(() => {
  91. const wrap = wrapRef.current;
  92. if (!wrap) return;
  93. let frame = 0;
  94. /** `fx` gives each letter's closeness to the wave (0 to 1) from its box, or null for rest. */
  95. const setWeights = (fx: (box: DOMRect) => number | null) => {
  96. // The lens's copy of the card has the same letters: weigh them alike.
  97. const nodes = [...wrap.querySelectorAll<HTMLElement>("[data-wave]")];
  98. const originals = nodes.filter((el) => !el.closest("[data-clone]"));
  99. const boxes = originals.map((el) => el.getBoundingClientRect());
  100. const styles = new Map<string, [string, string, string]>();
  101. originals.forEach((el, i) => {
  102. const g = fx(boxes[i]);
  103. const weight = g === null ? REST.fontWeight : Math.round(500 + 400 * g);
  104. const soft =
  105. g === null
  106. ? REST.fontVariationSettings
  107. : `'SOFT' ${Math.round(20 + 80 * g)}`;
  108. // Only the weight above rest shows on Han: a stroke can't make them lighter.
  109. const stroke =
  110. HAN_STROKE *
  111. clamp((weight - REST.fontWeight) / (900 - REST.fontWeight), 0, 1);
  112. styles.set(el.dataset.wave!, [
  113. String(weight),
  114. soft,
  115. stroke ? `${stroke.toFixed(4)}em currentColor` : "",
  116. ]);
  117. });
  118. nodes.forEach((node) => {
  119. const style = styles.get(node.dataset.wave!);
  120. if (!style) return;
  121. if (node.dataset.han) {
  122. node.style.webkitTextStroke = style[2];
  123. return;
  124. }
  125. node.style.fontWeight = style[0];
  126. node.style.fontVariationSettings = style[1];
  127. });
  128. // Heavier letters are wider: keep the bead on the period as it moves.
  129. relayout.current();
  130. };
  131. // Closeness to a point; with no y, to a vertical line (the sweep crosses both lines at once).
  132. const near = (x: number, y?: number) => (b: DOMRect) =>
  133. Math.exp(
  134. -(
  135. (b.left + b.width / 2 - x) ** 2 +
  136. (y === undefined ? 0 : (b.top + b.height / 2 - y) ** 2)
  137. ) /
  138. (2 * 64 ** 2),
  139. );
  140. const onMove = (e: PointerEvent) => {
  141. if (e.pointerType === "touch") return;
  142. const { clientX: x, clientY: y } = e;
  143. // Pulling the bead captures the pointer, so moves keep arriving once it
  144. // has left the headline: out there the letters rest, as on leaving.
  145. const r = wrap.getBoundingClientRect();
  146. const inside = x >= r.left && x <= r.right && y >= r.top && y <= r.bottom;
  147. cancelAnimationFrame(frame);
  148. frame = requestAnimationFrame(() =>
  149. setWeights(inside ? near(x, y) : () => null),
  150. );
  151. };
  152. const onLeave = () => {
  153. cancelAnimationFrame(frame);
  154. frame = requestAnimationFrame(() => setWeights(() => null));
  155. };
  156. // One sweep on load so touch visitors see it too.
  157. let sweepFrame = 0;
  158. let sweepTimer = 0;
  159. if (!prefersReducedMotion()) {
  160. const run = (start: number) => (now: number) => {
  161. const t = (now - start) / 1400;
  162. const r = wrap.getBoundingClientRect();
  163. if (t >= 1) {
  164. setWeights(() => null);
  165. return;
  166. }
  167. setWeights(near(r.left - 60 + (r.width + 120) * t));
  168. sweepFrame = requestAnimationFrame(run(start));
  169. };
  170. sweepTimer = window.setTimeout(() => {
  171. sweepFrame = requestAnimationFrame(run(performance.now()));
  172. }, 600);
  173. }
  174. wrap.addEventListener("pointermove", onMove);
  175. wrap.addEventListener("pointerleave", onLeave);
  176. return () => {
  177. cancelAnimationFrame(frame);
  178. cancelAnimationFrame(sweepFrame);
  179. window.clearTimeout(sweepTimer);
  180. wrap.removeEventListener("pointermove", onMove);
  181. wrap.removeEventListener("pointerleave", onLeave);
  182. };
  183. }, []);
  184. /* ---------- The glass period ---------- */
  185. useEffect(() => {
  186. const wrap = wrapRef.current;
  187. const orb = orbRef.current;
  188. const clone = cloneRef.current;
  189. const handle = handleRef.current;
  190. const card = wrap?.closest<HTMLElement>("[data-hero]");
  191. if (!wrap || !orb || !clone || !handle || !card) return;
  192. const unlight = registerLight(orb);
  193. const size = orb.offsetWidth;
  194. const half = size / 2;
  195. const still = prefersReducedMotion();
  196. // Only Chromium draws the refraction filter in place: WebKit misplaces it,
  197. // leaving a dark disc with a stray fragment. Elsewhere the copy is simply
  198. // scaled up under the lens.
  199. const refract = supportsBackdropRefraction();
  200. // Ancestors may be scaled (a pressed card), so rects are turned back into
  201. // the wrapper's own pixels before they place anything.
  202. const scaleOf = (w: DOMRect) => w.width / wrap.offsetWidth || 1;
  203. // Real glass is subtle: a gentle loupe in the middle, light bending hard only at the rim.
  204. if (refract) {
  205. setMap(
  206. buildLensMap({
  207. width: size,
  208. height: size,
  209. radius: half,
  210. bezel: size * 0.3,
  211. thickness: size * 0.22,
  212. magnify: MAGNIFY,
  213. }),
  214. );
  215. }
  216. // What the lens shows: a copy of the whole card, held in place under it,
  217. // so it magnifies whatever it passes over. Recopied when the card changes
  218. // size and each time the bead is picked up (the avatar may have flipped).
  219. const area = { x: 0, y: 0, w: 0, h: 0 };
  220. const copyCard = () => {
  221. // Hidden by a view (phones hide the hero for Work): keep the copy we have.
  222. if (!card.offsetWidth) return;
  223. clone.replaceChildren();
  224. const copy = card.cloneNode(true) as HTMLElement;
  225. copy
  226. .querySelectorAll("[data-droplet], [data-grab]")
  227. .forEach((el) => el.remove());
  228. copy.querySelectorAll("[id]").forEach((el) => el.removeAttribute("id"));
  229. copy.querySelectorAll("[data-period], [data-baseline]").forEach((el) => {
  230. el.removeAttribute("data-period");
  231. el.removeAttribute("data-baseline");
  232. });
  233. copy.removeAttribute("data-hero");
  234. copy.setAttribute("aria-hidden", "true");
  235. copy.inert = true;
  236. copy.style.width = `${card.offsetWidth}px`;
  237. copy.style.height = `${card.offsetHeight}px`;
  238. clone.append(copy);
  239. // The card's box, in the same frame as the bead's position.
  240. const c = card.getBoundingClientRect();
  241. const w = wrap.getBoundingClientRect();
  242. const k = scaleOf(w);
  243. area.x = (c.left - w.left) / k;
  244. area.y = (c.top - w.top) / k;
  245. area.w = c.width / k;
  246. area.h = c.height / k;
  247. };
  248. // Where the period's dot is, from the font's real ink bounds.
  249. const home = { x: 0, y: 0, s: 0.16 };
  250. const measure = document.createElement("canvas").getContext("2d");
  251. const findHome = () => {
  252. const period = wrap.querySelector<HTMLElement>("[data-period]");
  253. const base = wrap.querySelector<HTMLElement>("[data-baseline]");
  254. // Hidden, there's nothing to measure: keep the last home.
  255. if (!period || !base || !wrap.offsetWidth) return;
  256. const w = wrap.getBoundingClientRect();
  257. const k = scaleOf(w);
  258. const r = period.getBoundingClientRect();
  259. const css = getComputedStyle(period);
  260. const fontSize = parseFloat(css.fontSize);
  261. let left = 0.06 * fontSize;
  262. let right = 0.2 * fontSize;
  263. let ascent = 0.15 * fontSize;
  264. if (measure) {
  265. measure.font = `${css.fontWeight} ${css.fontSize} ${css.fontFamily}`;
  266. const m = measure.measureText(".");
  267. left = -m.actualBoundingBoxLeft;
  268. right = m.actualBoundingBoxRight;
  269. ascent = m.actualBoundingBoxAscent;
  270. }
  271. // The dot is round. Some engines give the advance rather than the ink
  272. // for its width, so trust the smaller measure.
  273. const dot = Math.min(right - left, ascent);
  274. home.x = (r.left - w.left) / k + (left + right) / 2;
  275. home.y = (base.getBoundingClientRect().top - w.top) / k - ascent / 2;
  276. home.s = Math.min(0.5, (dot * 1.12) / size);
  277. handle.style.transform = `translate(${home.x}px, ${home.y}px)`;
  278. };
  279. // Center (x, y), scale s, and a jelly stretch along the direction of travel.
  280. const p = {
  281. x: 0,
  282. y: 0,
  283. vx: 0,
  284. vy: 0,
  285. s: 0.16,
  286. vs: 0,
  287. def: 0,
  288. dv: 0,
  289. angle: 0,
  290. };
  291. let held = false;
  292. let hover = false;
  293. let target = { x: 0, y: 0 };
  294. const render = () => {
  295. const a = (p.angle * 180) / Math.PI;
  296. const s = Math.max(0.05, p.s);
  297. orb.style.transform = `translate(${p.x - half}px, ${p.y - half}px) rotate(${a}deg) scale(${s * (1 + p.def)}, ${
  298. s * (1 - p.def * 0.7)
  299. }) rotate(${-a}deg)`;
  300. // Counter-scale the copy so the lens shows the card at true size and
  301. // place; without the refraction map, the copy grows as the bead does.
  302. const grow = refract
  303. ? 1
  304. : 1 + (MAGNIFY - 1) * clamp((s - home.s) / (1 - home.s), 0, 1);
  305. const k = grow / s;
  306. clone.style.transform = `translate(${half + (area.x - p.x) * k}px, ${
  307. half + (area.y - p.y) * k
  308. }px) scale(${k})`;
  309. };
  310. const settle = () => {
  311. p.x = home.x;
  312. p.y = home.y;
  313. p.s = home.s;
  314. p.vx = p.vy = p.vs = p.def = p.dv = 0;
  315. render();
  316. };
  317. copyCard();
  318. findHome();
  319. settle();
  320. orb.style.opacity = "1";
  321. // A moment after load the bead swells and settles once: a wink that it can be pulled.
  322. let wink = false;
  323. let winkTimer = 0;
  324. const winkStart = still
  325. ? 0
  326. : window.setTimeout(() => {
  327. if (held) return;
  328. wink = true;
  329. kick();
  330. winkTimer = window.setTimeout(() => {
  331. wink = false;
  332. kick();
  333. }, 700);
  334. }, 2600);
  335. let frame = 0;
  336. let last = performance.now();
  337. let lift = 0;
  338. const step = (now: number) => {
  339. const dt = Math.min(32, now - last) / 16.67;
  340. const goal = held ? target : home;
  341. // Hovering swells the bead a little: an invitation to pull it.
  342. const goalS = held ? 1 : hover || wink ? home.s * 1.55 : home.s;
  343. last = now;
  344. if (held) {
  345. // Follow the finger closely, with a little lag that reads as weight.
  346. const nx = p.x + (goal.x - p.x) * Math.min(1, 0.45 * dt);
  347. const ny = p.y + (goal.y - p.y) * Math.min(1, 0.45 * dt);
  348. p.vx = 0.7 * p.vx + 0.3 * ((nx - p.x) / dt);
  349. p.vy = 0.7 * p.vy + 0.3 * ((ny - p.y) / dt);
  350. p.x = nx;
  351. p.y = ny;
  352. } else {
  353. // An underdamped spring home, so it overshoots a touch and settles.
  354. p.vx += ((goal.x - p.x) * 0.075 - p.vx * 0.3) * dt;
  355. p.vy += ((goal.y - p.y) * 0.075 - p.vy * 0.3) * dt;
  356. p.x += p.vx * dt;
  357. p.y += p.vy * dt;
  358. }
  359. p.vs += ((goalS - p.s) * 0.12 - p.vs * 0.5) * dt;
  360. p.s += p.vs * dt;
  361. const speed = Math.hypot(p.vx, p.vy);
  362. if (speed > 0.4) p.angle = Math.atan2(p.vy, p.vx);
  363. const stretch = Math.min(0.28, speed * 0.016);
  364. p.dv += (stretch - p.def) * 0.16 * dt;
  365. p.dv *= Math.pow(0.8, dt);
  366. p.def += p.dv * dt;
  367. render();
  368. const moving =
  369. held ||
  370. speed > 0.03 ||
  371. Math.abs(goal.x - p.x) > 0.1 ||
  372. Math.abs(goal.y - p.y) > 0.1 ||
  373. Math.abs(goalS - p.s) > 0.002 ||
  374. Math.abs(p.vs) > 0.001 ||
  375. Math.abs(p.dv) > 0.0005;
  376. if (moving) {
  377. frame = requestAnimationFrame(step);
  378. } else {
  379. frame = 0;
  380. if (!hover && !wink) settle();
  381. }
  382. };
  383. const kick = () => {
  384. if (still) {
  385. if (held) {
  386. p.x = target.x;
  387. p.y = target.y;
  388. p.s = 1;
  389. render();
  390. } else settle();
  391. return;
  392. }
  393. if (!frame) {
  394. last = performance.now();
  395. frame = requestAnimationFrame(step);
  396. }
  397. };
  398. const aim = (e: PointerEvent) => {
  399. const w = wrap.getBoundingClientRect();
  400. const k = scaleOf(w);
  401. // On touch, float the lens above the finger like iOS's loupe. It stays
  402. // on the card, where its copy has something to show.
  403. target = {
  404. x: clamp(
  405. (e.clientX - w.left) / k,
  406. area.x + half,
  407. area.x + area.w - half,
  408. ),
  409. y: clamp(
  410. (e.clientY - w.top) / k - lift,
  411. area.y + half,
  412. area.y + area.h - half,
  413. ),
  414. };
  415. };
  416. const onDown = (e: PointerEvent) => {
  417. e.preventDefault();
  418. handle.setPointerCapture(e.pointerId);
  419. // The press is cancelled, so it no longer clears a selection by itself.
  420. getSelection()?.removeAllRanges();
  421. copyCard();
  422. held = true;
  423. lift = e.pointerType === "touch" ? size * 0.85 : 0;
  424. aim(e);
  425. kick();
  426. };
  427. const onMove = (e: PointerEvent) => {
  428. if (!held) return;
  429. aim(e);
  430. kick();
  431. };
  432. // Let go: the spring home starts from the lens's current velocity.
  433. const onUp = () => {
  434. if (!held) return;
  435. held = false;
  436. kick();
  437. };
  438. const onEnter = (e: PointerEvent) => {
  439. if (e.pointerType === "touch") return;
  440. hover = true;
  441. kick();
  442. };
  443. const onLeave = () => {
  444. hover = false;
  445. kick();
  446. };
  447. // iOS turns a long press into a text selection (loupe and handles
  448. // included) whatever touch-action says, and the pull then drags it across
  449. // the card. A handled touchstart keeps the press the bead's.
  450. const onTouchStart = (e: TouchEvent) => e.preventDefault();
  451. const onSelectStart = (e: Event) => {
  452. if (held) e.preventDefault();
  453. };
  454. relayout.current = () => {
  455. findHome();
  456. if (held || frame) return;
  457. p.x = home.x;
  458. p.y = home.y;
  459. if (!hover) p.s = home.s;
  460. render();
  461. };
  462. const onResize = () => relayout.current();
  463. // Resized, or shown again after a view hid it: the bead goes straight
  464. // home rather than springing there from wherever it was last measured.
  465. const ro = new ResizeObserver(() => {
  466. if (!card.offsetWidth) return;
  467. copyCard();
  468. findHome();
  469. if (held) return;
  470. cancelAnimationFrame(frame);
  471. frame = 0;
  472. settle();
  473. });
  474. handle.addEventListener("pointerdown", onDown);
  475. handle.addEventListener("pointermove", onMove);
  476. handle.addEventListener("pointerup", onUp);
  477. handle.addEventListener("pointercancel", onUp);
  478. handle.addEventListener("pointerenter", onEnter);
  479. handle.addEventListener("pointerleave", onLeave);
  480. handle.addEventListener("touchstart", onTouchStart, { passive: false });
  481. document.addEventListener("selectstart", onSelectStart);
  482. window.addEventListener("resize", onResize);
  483. ro.observe(card);
  484. document.fonts.ready.then(() => {
  485. copyCard();
  486. relayout.current();
  487. });
  488. // On a first visit the web fonts land late (html.ff) and move the period.
  489. const html = document.documentElement;
  490. let fonts = html.classList.contains("ff");
  491. const mo = new MutationObserver(() => {
  492. if (html.classList.contains("ff") === fonts) return;
  493. fonts = !fonts;
  494. copyCard();
  495. relayout.current();
  496. });
  497. mo.observe(html, { attributes: true, attributeFilter: ["class"] });
  498. return () => {
  499. cancelAnimationFrame(frame);
  500. window.clearTimeout(winkStart);
  501. window.clearTimeout(winkTimer);
  502. unlight();
  503. relayout.current = () => {};
  504. handle.removeEventListener("pointerdown", onDown);
  505. handle.removeEventListener("pointermove", onMove);
  506. handle.removeEventListener("pointerup", onUp);
  507. handle.removeEventListener("pointercancel", onUp);
  508. handle.removeEventListener("pointerenter", onEnter);
  509. handle.removeEventListener("pointerleave", onLeave);
  510. handle.removeEventListener("touchstart", onTouchStart);
  511. document.removeEventListener("selectstart", onSelectStart);
  512. window.removeEventListener("resize", onResize);
  513. ro.disconnect();
  514. mo.disconnect();
  515. };
  516. }, []);
  517. return (
  518. <div ref={wrapRef} className="relative -mx-1 px-1 py-1">
  519. <Title />
  520. <div
  521. ref={orbRef}
  522. aria-hidden
  523. data-droplet
  524. className="lg pointer-events-none absolute top-0 left-0 z-10 size-[76px] rounded-full opacity-0 select-none shadow-[0_14px_28px_-14px_rgb(0_0_0/0.4),0_2px_6px_-2px_rgb(0_0_0/0.18)] transition-opacity duration-700 [--lg-blur:0px] [backdrop-filter:none] [background:transparent] sm:size-[96px]"
  525. >
  526. {map && (
  527. <GlassFilter
  528. blur={0.2}
  529. chroma={0.025}
  530. id={FILTER_ID}
  531. map={map}
  532. saturate={1.05}
  533. />
  534. )}
  535. <div
  536. className="absolute inset-0 overflow-hidden rounded-full bg-[#eff4fa] [clip-path:circle(50%)] dark:bg-[#18212b]"
  537. style={{ filter: map ? `url(#${FILTER_ID})` : undefined }}
  538. >
  539. {/* Filled with a copy of the card from the effect; React keeps it empty. */}
  540. <div
  541. ref={cloneRef}
  542. className="absolute top-0 left-0 origin-top-left"
  543. data-clone
  544. />
  545. </div>
  546. {/* Bubble shading: rim thickness, a glossy specular highlight, and a soft caustic. */}
  547. <span className="pointer-events-none absolute inset-0 rounded-full shadow-[inset_0_0_0_1px_rgb(255_255_255/0.35),inset_0_12px_18px_-12px_rgb(255_255_255/0.75),inset_0_-14px_22px_-14px_rgb(255_255_255/0.5),inset_0_0_10px_rgb(0_0_0/0.05)]" />
  548. <span className="pointer-events-none absolute top-[9%] left-[19%] h-[22%] w-[44%] -rotate-[22deg] rounded-[50%] bg-[radial-gradient(closest-side,rgb(255_255_255/0.9),rgb(255_255_255/0))] opacity-75 mix-blend-screen" />
  549. <span className="pointer-events-none absolute right-[17%] bottom-[11%] h-[11%] w-[24%] -rotate-[22deg] rounded-[50%] bg-[radial-gradient(closest-side,rgb(255_255_255/0.55),transparent)] opacity-60" />
  550. </div>
  551. {/* A generous grab target around the period (the bead itself is tiny). */}
  552. <span
  553. ref={handleRef}
  554. aria-hidden
  555. className="absolute top-0 left-0 z-20 -mt-6 -ml-6 size-12 cursor-grab touch-none rounded-full select-none active:cursor-grabbing"
  556. data-cursor={hero.pull}
  557. data-grab
  558. data-nodrag
  559. />
  560. </div>
  561. );
  562. }