{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"text-shadow-depth-following-a-moving-light","type":"registry:component","title":"Text Shadow Depth Following a Moving Light","description":"","dependencies":[],"files":[{"path":"components/we-inc/text-shadow-depth-following-a-moving-light.tsx","type":"registry:component","content":"import { useEffect, useRef } from \"react\";\n\nconst BUSINESS = \"Casa Ombra Ceramics\";\nconst COPY = \"Stoneware plates, jugs and planters from a two-kiln workshop outside Ronda. The studio is open on Saturday mornings.\";\n\nconst CSS = `\n/* Edit these first: colours, and how long one full cycle takes. */\n.ts-root {\n  --ts-bg: #e8dccb;\n  --ts-ink: #8c3f22;\n  --ts-muted: #5c4536;\n  --ts-accent: #fff6e4;\n  --ts-speed: 11s;\n  position: relative;\n  overflow: hidden;\n  box-sizing: border-box;\n  min-height: 480px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  padding: 72px 20px;\n  background: var(--ts-bg);\n  color: var(--ts-ink);\n  font-family: \"Inter Tight\", Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n  -webkit-font-smoothing: antialiased;\n}\n.ts-root *, .ts-root *::before, .ts-root *::after { box-sizing: border-box; }\n.ts-inner { position: relative; z-index: 1; width: 100%; max-width: 1040px; }\n.ts-eyebrow { margin: 0 0 22px; font-family: \"Inter Tight\", Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ts-muted); }\n.ts-h { margin: 0; font-size: clamp(42px, 7.6vw, 98px); font-weight: 800; line-height: 1.06; letter-spacing: -.012em; }\n.ts-copy { margin: 28px 0 0; max-width: 34em; font-family: \"Inter Tight\", Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.6; color: var(--ts-muted); }\n.ts-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n.ts-w { display: inline-block; white-space: nowrap; }\n.ts-l { display: inline-block; }\n/* Paused while scrolled out of view (the script sets data-paused). */\n.ts-root[data-paused=\"true\"] *, .ts-root[data-paused=\"true\"] *::before, .ts-root[data-paused=\"true\"] *::after { animation-play-state: paused !important; }\n@media (prefers-reduced-motion: reduce) {\n  .ts-root *, .ts-root *::before, .ts-root *::after { animation: none !important; }\n}\n\n.ts-root { --ts-depth: #6b2f17; }\n.ts-light {\n  position: absolute;\n  left: 0;\n  top: -40%;\n  width: 70%;\n  height: 160%;\n  background: radial-gradient(closest-side, rgba(255, 246, 228, .95), rgba(255, 246, 228, 0));\n  pointer-events: none;\n  transform: translateX(20%);\n  animation: ts-sun var(--ts-speed) ease-in-out infinite alternate;\n}\n.ts-h {\n  max-width: 11em;\n  text-shadow: 0.000em 0.010em 0 var(--ts-depth), 0.000em 0.020em 0 var(--ts-depth), 0.000em 0.030em 0 var(--ts-depth), 0.000em 0.040em 0 var(--ts-depth), 0.000em 0.050em 0 var(--ts-depth), 0.000em .12em .18em rgba(90, 44, 20, .22);\n  animation: ts-cast var(--ts-speed) ease-in-out infinite alternate;\n}\n/* The light travels left to right; the extruded shadow swings the opposite way. */\n@keyframes ts-sun { from { transform: translateX(-30%); } to { transform: translateX(70%); } }\n@keyframes ts-cast {\n  from { text-shadow: 0.010em 0.010em 0 var(--ts-depth), 0.020em 0.020em 0 var(--ts-depth), 0.030em 0.030em 0 var(--ts-depth), 0.040em 0.040em 0 var(--ts-depth), 0.050em 0.050em 0 var(--ts-depth), 0.100em .12em .18em rgba(90, 44, 20, .22); }\n  to { text-shadow: -0.010em 0.010em 0 var(--ts-depth), -0.020em 0.020em 0 var(--ts-depth), -0.030em 0.030em 0 var(--ts-depth), -0.040em 0.040em 0 var(--ts-depth), -0.050em 0.050em 0 var(--ts-depth), -0.100em .12em .18em rgba(90, 44, 20, .22); }\n}\n`;\n\nexport default function ShadowFollowingMovingLight() {\n  const rootRef = useRef<HTMLElement>(null);\n\n  // Pause the CSS animation while the section is off screen.\n  useEffect(() => {\n    const el = rootRef.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") return;\n    const io = new IntersectionObserver(([entry]) => {\n      el.dataset.paused = entry.isIntersecting ? \"false\" : \"true\";\n    });\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  return (\n    <section ref={rootRef} data-paused=\"false\" className=\"ts-root w-full\">\n      <style>{CSS}</style>\n      <div className=\"ts-light\" aria-hidden=\"true\" />\n      <div className=\"ts-inner\">\n        <p className=\"ts-eyebrow\">{BUSINESS}</p>\n        <h2 className=\"ts-h\">Glazed in the yard, fired at dusk.</h2>\n        <p className=\"ts-copy\">{COPY}</p>\n      </div>\n    </section>\n  );\n}\n"}]}
