{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"wordmark-uncovered-by-sliding-mask-on-navy-band","type":"registry:component","title":"Wordmark Uncovered by a Sliding Mask","description":"","dependencies":[],"files":[{"path":"components/we-inc/wordmark-uncovered-by-sliding-mask-on-navy-band.tsx","type":"registry:component","content":"import { useEffect, useLayoutEffect, useRef } from \"react\";\n\n// Edit these first: the colours at the top of .m1msk; the wordmark size is the clamp() on .m1msk-word.\nconst CSS = `\n.m1msk { --m1msk-bg: #101d2f; --m1msk-ink: #f3efe6; --m1msk-quiet: #b8bfca; --m1msk-line: #34445a; --m1msk-focus: #d3b06e; --m1msk-brass: #c9a560; }\n.m1msk { position: relative; box-sizing: border-box; overflow: hidden; font-family: \"Inter Tight\", \"Inter\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif; -webkit-font-smoothing: antialiased; }\n.m1msk *, .m1msk *::before, .m1msk *::after { box-sizing: border-box; }\n.m1msk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }\n.m1msk-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m1msk-line); border-radius: 999px; background: transparent; color: var(--m1msk-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }\n.m1msk-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }\n.m1msk-replay:hover { color: var(--m1msk-ink); }\n.m1msk-replay:focus-visible { outline: 2px solid var(--m1msk-focus); outline-offset: 2px; }\n/* Reduced motion: no movement at all, the finished logo shows straight away. */\n@media (prefers-reduced-motion: reduce) {\n  .m1msk *, .m1msk *::before, .m1msk *::after { animation: none !important; transition: none !important; }\n  .m1msk-replay { display: none; }\n}\n\n.m1msk { min-height: 480px; display: flex; align-items: center; padding: 56px clamp(20px, 5vw, 72px) 76px; background: var(--m1msk-bg); color: var(--m1msk-ink); }\n.m1msk-inner { width: 100%; max-width: 1180px; margin: 0 auto; }\n.m1msk-eyebrow { display: flex; justify-content: space-between; margin: 0 0 18px; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--m1msk-quiet); }\n.m1msk-h { margin: 0; font-weight: 400; line-height: 1; }\n.m1msk-win { position: relative; display: inline-block; overflow: hidden; padding: .04em .02em .1em 0; }\n.m1msk-word { display: block; font-family: Georgia, \"Times New Roman\", serif; font-size: clamp(54px, 13.4vw, 184px); letter-spacing: -.03em; line-height: .95; }\n.m1msk-cover { position: absolute; inset: 0; background: var(--m1msk-bg); transform: translateX(101%); }\n.m1msk-cover::before { content: \"\"; position: absolute; top: 0; bottom: 0; left: 0; width: 6px; background: var(--m1msk-brass); }\n.m1msk-rule { display: block; height: 1px; margin: 26px 0 22px; background: var(--m1msk-line); transform-origin: left; }\n.m1msk-cols { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }\n.m1msk-cols p { margin: 0; max-width: 30em; font-size: 16px; line-height: 1.6; color: var(--m1msk-quiet); }\n.m1msk-cols a { display: inline-flex; align-items: center; min-height: 40px; margin-right: 22px; color: var(--m1msk-ink); font-size: 15px; font-weight: 500; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--m1msk-brass); }\n.m1msk-cols a:focus-visible { outline: 2px solid var(--m1msk-focus); outline-offset: 3px; }\n@media (prefers-reduced-motion: no-preference) {\n  .m1msk.is-js:not([data-run]) .m1msk-cover { transform: none; }\n  .m1msk.is-js:not([data-run]) .m1msk-rule { transform: scaleX(0); }\n  .m1msk.is-js:not([data-run]) .m1msk-cols, .m1msk.is-js:not([data-run]) .m1msk-eyebrow { opacity: 0; }\n}\n.m1msk[data-run] .m1msk-cover { animation: m1msk-wipe 1.05s cubic-bezier(.7, 0, .2, 1) .1s both; }\n.m1msk[data-run] .m1msk-rule { animation: m1msk-grow .9s cubic-bezier(.6, 0, .2, 1) .45s both; }\n.m1msk[data-run] .m1msk-eyebrow { animation: m1msk-fade .6s ease-out .2s both; }\n.m1msk[data-run] .m1msk-cols { animation: m1msk-up .6s cubic-bezier(.2, .7, .2, 1) .85s both; }\n@keyframes m1msk-wipe { from { transform: none; } to { transform: translateX(101%); } }\n@keyframes m1msk-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }\n@keyframes m1msk-fade { from { opacity: 0; } to { opacity: 1; } }\n@keyframes m1msk-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n`;\n\n// Runs before paint in the browser so the logo never flashes before its reveal.\nconst useBrowserLayoutEffect = typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nexport default function WordmarkUncoveredBySlidingMaskOn() {\n  const rootRef = useRef<HTMLElement>(null);\n\n  // Plays once when the piece scrolls into view (works inside a scrolling box too), then stops.\n  // With prefers-reduced-motion the CSS shows the finished logo and hides the Replay button.\n  useBrowserLayoutEffect(() => {\n    const root = rootRef.current;\n    if (!root) return;\n    root.classList.add(\"is-js\");\n    const play = () => {\n      root.removeAttribute(\"data-run\");\n      void root.offsetWidth; // restart the keyframes\n      root.setAttribute(\"data-run\", \"\");\n    };\n    const btn = root.querySelector(\".m1msk-replay\");\n    btn?.addEventListener(\"click\", play);\n    if (typeof IntersectionObserver === \"undefined\") {\n      play();\n      return () => btn?.removeEventListener(\"click\", play);\n    }\n    const io = new IntersectionObserver((entries) => {\n      if (entries[0].isIntersecting) {\n        play();\n        io.disconnect();\n      }\n    }, { threshold: 0.3 });\n    io.observe(root);\n    return () => {\n      io.disconnect();\n      btn?.removeEventListener(\"click\", play);\n    };\n  }, []);\n\n  return (\n    <section ref={rootRef} className=\"m1msk\">\n      <style>{CSS}</style>\n<div className=\"m1msk-inner\">\n  <p className=\"m1msk-eyebrow\"><span>Office for Architecture</span><span>Leeds</span></p>\n  <h2 className=\"m1msk-h\">\n    <span className=\"m1msk-win\"><span className=\"m1msk-word\">Northfield</span><span className=\"m1msk-cover\" aria-hidden=\"true\"></span></span>\n  </h2>\n  <span className=\"m1msk-rule\" aria-hidden=\"true\"></span>\n  <div className=\"m1msk-cols\">\n    <p>Housing, schools and quiet civic buildings for the north of England.</p>\n    <p><a href=\"#\">Selected projects</a><a href=\"#\">Studio</a></p>\n  </div>\n</div>\n<button type=\"button\" className=\"m1msk-replay\" aria-label=\"Replay logo animation\"><svg viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M4.5 11a5.5 5.5 0 1 0 1.8-4.6\"/><path d=\"M5 3.2v3.6h3.6\"/></svg>Replay</button>\n    </section>\n  );\n}\n"}]}
