{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"outline-text-filling-from-the-baseline-up","type":"registry:component","title":"Outline Text Filling from the Baseline Up","description":"","dependencies":[],"files":[{"path":"components/we-inc/outline-text-filling-from-the-baseline-up.tsx","type":"registry:component","content":"import { useEffect, useRef } from \"react\";\n\nconst BUSINESS = \"Morrow Hill Coffee Roasters\";\nconst HEADLINE = \"Roasted before first light.\";\nconst COPY = \"Small batches on a twelve-kilo drum every weekday morning, bagged by ten and on the counter of the shop downstairs by noon.\";\n\nconst CSS = `\n/* Edit these first: colours, and how long one full cycle takes. */\n.sf-root {\n  --sf-bg: #f8dcc6;\n  --sf-ink: #3a1d14;\n  --sf-muted: #62392a;\n  --sf-accent: #9a4322;\n  --sf-speed: 7s;\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: linear-gradient(170deg, #fdf1e6 0%, #f8dcc6 55%, #f0c2a4 100%);\n  color: var(--sf-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.sf-root *, .sf-root *::before, .sf-root *::after { box-sizing: border-box; }\n.sf-inner { position: relative; z-index: 1; width: 100%; max-width: 1040px; }\n.sf-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(--sf-muted); }\n.sf-h { margin: 0; font-size: clamp(44px, 8.4vw, 110px); font-weight: 800; line-height: .98; letter-spacing: -.035em; }\n.sf-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(--sf-muted); }\n.sf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n.sf-w { display: inline-block; white-space: nowrap; }\n.sf-l { display: inline-block; }\n/* Paused while scrolled out of view (the script sets data-paused). */\n.sf-root[data-paused=\"true\"] *, .sf-root[data-paused=\"true\"] *::before, .sf-root[data-paused=\"true\"] *::after { animation-play-state: paused !important; }\n@media (prefers-reduced-motion: reduce) {\n  .sf-root *, .sf-root *::before, .sf-root *::after { animation: none !important; }\n}\n\n.sf-h { max-width: 10em; font-family: \"Arial Black\", \"Helvetica Neue\", Arial, sans-serif; font-weight: 900; letter-spacing: -.045em; }\n.sf-stack { display: grid; }\n.sf-outline, .sf-fill { grid-area: 1 / 1; }\n.sf-outline { color: transparent; -webkit-text-stroke: .02em var(--sf-ink); }\n.sf-fill {\n  background: linear-gradient(0deg, var(--sf-accent) 0%, var(--sf-ink) 70%);\n  -webkit-background-clip: text;\n  background-clip: text;\n  color: transparent;\n  -webkit-text-fill-color: transparent;\n  clip-path: inset(0 0 0 0);\n  animation: sf-flood var(--sf-speed) cubic-bezier(.6, 0, .25, 1) infinite;\n}\n.sf-root::before { content: \"\"; position: absolute; right: -8%; top: -18%; width: 52vmax; height: 52vmax; max-width: 640px; max-height: 640px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 246, 232, .9), rgba(255, 246, 232, 0)); pointer-events: none; }\n@keyframes sf-flood {\n  0%, 8% { clip-path: inset(100% 0 0 0); }\n  44%, 84% { clip-path: inset(0 0 0 0); }\n  97%, 100% { clip-path: inset(100% 0 0 0); }\n}\n`;\n\nexport default function OutlineTextFillingUp() {\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=\"sf-root w-full\">\n      <style>{CSS}</style>\n      <div className=\"sf-inner\">\n        <p className=\"sf-eyebrow\">{BUSINESS}</p>\n        <h2 className=\"sf-h\">\n          <span className=\"sf-sr\">{HEADLINE}</span>\n          <span className=\"sf-stack\" aria-hidden=\"true\">\n            <span className=\"sf-outline\">{HEADLINE}</span>\n            <span className=\"sf-fill\">{HEADLINE}</span>\n          </span>\n        </h2>\n        <p className=\"sf-copy\">{COPY}</p>\n      </div>\n    </section>\n  );\n}\n"}]}
