hero-title.tsx 21 KB

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