{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"weighted-letter-drop-headline-animation","type":"registry:block","title":"Weighted Letter Drop Headline","description":"","dependencies":[],"files":[{"path":"components/we-inc/weighted-letter-drop-headline-animation.tsx","type":"registry:component","content":"import { useEffect, useRef, useState, type CSSProperties } from \"react\";\n\nconst HEADLINE = \"Bread worth waking for.\";\n\nexport default function WeightedLetterDropHeadlineAnimation() {\n  const rootRef = useRef<HTMLElement>(null);\n  const [paused, setPaused] = useState(false);\n\n  useEffect(() => {\n    const el = rootRef.current;\n    if (!el) return;\n    const io = new IntersectionObserver(([e]) => setPaused(!e.isIntersecting));\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  let n = 0;\n  const words = HEADLINE.split(\" \").map((w) => [...w].map((ch) => ({ ch, i: n++ })));\n\n  return (\n    <section ref={rootRef} data-paused={paused || undefined} className=\"wld-root px-5 py-20 sm:px-10 sm:py-24\">\n      <style>{`\n        .wld-root { background: #f2efe6; color: #1f3b2d;\n          background-image: linear-gradient(180deg, rgba(255,255,255,.5), transparent 40%), radial-gradient(80% 60% at 100% 100%, rgba(196,148,82,.16), transparent 70%); }\n        .wld-h { font-family: Georgia, \"Iowan Old Style\", \"Times New Roman\", serif; font-weight: 700;\n          font-size: clamp(2.5rem, 8.4vw, 6rem); line-height: 1.02; letter-spacing: -.03em; margin: 0; }\n        .wld-word { display: inline-block; white-space: nowrap; }\n        .wld-ch { display: inline-block; transform-origin: 50% 100%;\n          animation: wld-drop 8s linear infinite both; animation-delay: calc(var(--i) * 42ms); }\n        @keyframes wld-drop {\n          0% { transform: translateY(-0.55em); opacity: 0; animation-timing-function: cubic-bezier(.5,0,.9,.4) }\n          6% { transform: translateY(0) scale(1.06, .9); opacity: 1; animation-timing-function: cubic-bezier(.2,.7,.4,1) }\n          8.5% { transform: translateY(-0.07em) scale(.98, 1.03) }\n          11%, 88% { transform: none; opacity: 1 }\n          94%, 100% { transform: translateY(.18em); opacity: 0 } }\n        .wld-root[data-paused] .wld-ch { animation-play-state: paused; }\n        @media (prefers-reduced-motion: reduce) { .wld-ch { animation: none; } }\n      `}</style>\n      <div className=\"mx-auto max-w-5xl\">\n        <p className=\"text-sm font-semibold uppercase tracking-[0.2em] text-[#8a5a24]\">Fernhollow Bakery</p>\n        <h1 className=\"wld-h mt-5\">\n          <span className=\"sr-only\">{HEADLINE}</span>\n          <span aria-hidden=\"true\">\n            {words.map((letters, w) => (\n              <span key={w}>\n                {w > 0 && \" \"}\n                <span className=\"wld-word\">\n                  {letters.map(({ ch, i }) => (\n                    <span key={i} className=\"wld-ch\" style={{ \"--i\": i } as CSSProperties}>{ch}</span>\n                  ))}\n                </span>\n              </span>\n            ))}\n          </span>\n        </h1>\n        <p className=\"mt-7 max-w-lg text-base leading-relaxed text-[#3c4f44] sm:text-lg\">\n          Sourdough, rye and seeded loaves from a wood oven lit at four. Collect from the side door until we sell out.\n        </p>\n        <a href=\"#\" className=\"mt-8 inline-flex min-h-[44px] items-center rounded-lg bg-[#1f3b2d] px-6 text-sm font-semibold text-[#f2efe6] transition hover:bg-[#2b4f3d] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1f3b2d] focus-visible:ring-offset-2 focus-visible:ring-offset-[#f2efe6]\">\n          Reserve tomorrow&apos;s loaf\n        </a>\n      </div>\n    </section>\n  );\n}\n"}]}
