{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"walking-routes-with-a-postcard-pair-fanning-out","type":"registry:block","title":"Walking Routes With A Postcard Pair","description":"","dependencies":[],"files":[{"path":"components/we-inc/walking-routes-with-a-postcard-pair-fanning-out.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\nconst DELAY = 2000; // ms between idle reveals while nobody is pointing or tabbing\n\nconst walks = [\n  { name: \"Fog meadow huts\", dist: \"9 km\", climb: \"320 m climb\", time: \"3 hours\", img: \"https://images.pexels.com/photos/5865768/pexels-photo-5865768.jpeg?auto=compress&cs=tinysrgb&w=500\", alt: \"Dark wooden huts in a misty meadow below a pine forest\" },\n  { name: \"Headland lighthouse\", dist: \"12 km\", climb: \"180 m climb\", time: \"4 hours\", img: \"https://images.pexels.com/photos/5736585/pexels-photo-5736585.jpeg?auto=compress&cs=tinysrgb&w=500\", alt: \"A white lighthouse on a wooded headland above rocks and surf\" },\n  { name: \"Old town lanes\", dist: \"5 km\", climb: \"60 m climb\", time: \"2 hours\", img: \"https://images.pexels.com/photos/18587007/pexels-photo-18587007.jpeg?auto=compress&cs=tinysrgb&w=500\", alt: \"A narrow street curving between old houses with red tiled roofs\" },\n];\n\nconst css = `\n.w8wlk-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 30px 4px; border-top: 1px solid #c9c6b6; color: #23261f; text-decoration: none; outline: none; }\n.w8wlk-row:focus-visible { outline: 2px solid #4b5d2e; outline-offset: 2px; border-radius: 6px; }\n.w8wlk-name { display: inline-block; transition: transform .5s cubic-bezier(.2,.8,.2,1); }\n.w8wlk-fan { position: absolute; z-index: 2; right: 170px; top: 50%; width: 168px; height: 128px; margin-top: -64px; pointer-events: none; }\n.w8wlk-card { position: absolute; inset: 0; border-radius: 4px; opacity: 0; transform: translate(-40px, 24px) rotate(-12deg) scale(.9); transition: opacity .3s ease, transform .65s cubic-bezier(.2,.9,.3,1.1); }\n.w8wlk-back { background: #f7f4ea; box-shadow: 0 10px 24px -14px rgba(30,30,20,.6); padding: 12px 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; text-align: right; font-size: 12px; color: #3c4234; }\n.w8wlk-front { background: #fff; padding: 6px; box-shadow: 0 16px 30px -14px rgba(30,30,20,.65); transition-delay: .06s; }\n.w8wlk-mask { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 2px; }\n.w8wlk-mask img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.3) translateX(-12%); transition: transform .8s cubic-bezier(.2,.8,.2,1); }\n.w8wlk-row[data-on] .w8wlk-back, .w8wlk-row:hover .w8wlk-back, .w8wlk-row:focus-visible .w8wlk-back { opacity: 1; transform: translate(96px, -8px) rotate(8deg); }\n.w8wlk-row[data-on] .w8wlk-front, .w8wlk-row:hover .w8wlk-front, .w8wlk-row:focus-visible .w8wlk-front { opacity: 1; transform: translateX(-24px) rotate(-5deg); }\n.w8wlk-row[data-on] .w8wlk-mask img, .w8wlk-row:hover .w8wlk-mask img, .w8wlk-row:focus-visible .w8wlk-mask img { transform: none; }\n.w8wlk-row[data-on] .w8wlk-name, .w8wlk-row:hover .w8wlk-name, .w8wlk-row:focus-visible .w8wlk-name { transform: translateX(10px); }\n.w8wlk-thumb { display: none; }\n@media (max-width: 767px), (prefers-reduced-motion: reduce) {\n  .w8wlk-fan { display: none; }\n  .w8wlk-name { transform: none !important; transition: none; }\n  .w8wlk-row { justify-content: flex-start; padding: 16px 0; }\n  .w8wlk-thumb { display: block; flex: none; width: 92px; height: 70px; object-fit: cover; border: 4px solid #fff; border-radius: 3px; transform: rotate(-3deg); box-shadow: 0 6px 14px -8px rgba(30,30,20,.6); }\n}\n`;\n\nexport default function WalkingRoutesWithAPostcardPairFanningOut() {\n  const root = useRef<HTMLElement>(null);\n  const [on, setOn] = useState(0);\n\n  useEffect(() => {\n    const el = root.current;\n    if (!el || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    let timer = 0, visible = true, live = true;\n    const run = () => {\n      window.clearInterval(timer);\n      timer = 0;\n      if (live && visible) timer = window.setInterval(() => setOn((n) => (n + 1) % walks.length), DELAY);\n    };\n    // a real mouse or keyboard takes over from the idle demo\n    const stop = () => { live = false; setOn(-1); run(); };\n    const enter = (e: PointerEvent) => { if (e.pointerType === \"mouse\") stop(); };\n    const io = new IntersectionObserver(([en]) => { visible = en.isIntersecting; run(); });\n    io.observe(el);\n    el.addEventListener(\"pointerenter\", enter);\n    el.addEventListener(\"focusin\", stop);\n    run();\n    return () => {\n      window.clearInterval(timer);\n      io.disconnect();\n      el.removeEventListener(\"pointerenter\", enter);\n      el.removeEventListener(\"focusin\", stop);\n    };\n  }, []);\n\n  return (\n    <section ref={root} className=\"bg-[#e9e7df] px-5 py-16 text-[#23261f] sm:py-20\">\n      <style>{css}</style>\n      <div className=\"mx-auto max-w-4xl\">\n        <p className=\"text-xs font-semibold uppercase tracking-[0.3em] text-[#4b5d2e]\">Fieldnote Walks</p>\n        <h2 className=\"mt-3 font-serif text-3xl sm:text-4xl\">Three routes for this weekend</h2>\n        <p className=\"mt-3 max-w-md text-base text-[#4f5446]\">Each route opens a printable map with the turns, water stops and the bus home.</p>\n        <ul className=\"mt-10 border-b border-[#c9c6b6]\">\n          {walks.map((w, i) => (\n            <li key={w.name}>\n              <a href=\"#\" className=\"w8wlk-row\" data-on={on === i ? \"\" : undefined}>\n                <img className=\"w8wlk-thumb\" src={w.img} alt={w.alt} width={92} height={70} loading=\"lazy\" decoding=\"async\" />\n                <span className=\"mr-auto\">\n                  <span className=\"w8wlk-name font-serif text-2xl sm:text-4xl\">{w.name}</span>\n                  <span className=\"mt-1 block text-sm text-[#4f5446]\">{w.dist}, {w.climb}</span>\n                </span>\n                <span className=\"w8wlk-fan\" aria-hidden=\"true\">\n                  <span className=\"w8wlk-card w8wlk-back\">\n                    <span className=\"font-semibold\">Route {i + 1}</span>\n                    <span>{w.dist} · {w.time}</span>\n                  </span>\n                  <span className=\"w8wlk-card w8wlk-front\">\n                    <span className=\"w8wlk-mask\"><img src={w.img} alt=\"\" width={500} height={380} loading=\"lazy\" decoding=\"async\" /></span>\n                  </span>\n                </span>\n                <span className=\"hidden text-sm text-[#4f5446] md:block\">{w.time}</span>\n              </a>\n            </li>\n          ))}\n        </ul>\n      </div>\n    </section>\n  );\n}\n"}]}
