{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"pinned-boat-restoration-timeline-drawing-sideways","type":"registry:block","title":"Pinned Boat Restoration Timeline Drawing Sideways","description":"","dependencies":[],"files":[{"path":"components/we-inc/pinned-boat-restoration-timeline-drawing-sideways.tsx","type":"registry:component","content":"import { useEffect, useRef } from \"react\";\n\nconst stages = [\n  {\n    \"n\": \"Stage 1\",\n    \"side\": \"up\",\n    \"title\": \"Survey on the hard\",\n    \"text\": \"We lift her out, sound every plank with a mallet and mark the soft wood in chalk.\"\n  },\n  {\n    \"n\": \"Stage 2\",\n    \"side\": \"down\",\n    \"title\": \"Strip back to bare cedar\",\n    \"text\": \"Old paint comes off by scraper and low heat, so the timber is never scorched.\"\n  },\n  {\n    \"n\": \"Stage 3\",\n    \"side\": \"up\",\n    \"title\": \"Steam new oak frames\",\n    \"text\": \"Cracked frames are steamed soft, bent to the curve of the hull and riveted in copper.\"\n  },\n  {\n    \"n\": \"Stage 4\",\n    \"side\": \"down\",\n    \"title\": \"Plank lap over lap\",\n    \"text\": \"New larch planks are cut from patterns of the old ones and fastened one over the next.\"\n  },\n  {\n    \"n\": \"Stage 5\",\n    \"side\": \"up\",\n    \"title\": \"Fair, prime and paint\",\n    \"text\": \"Coat after coat above the waterline, sanded between each, with antifouling below.\"\n  },\n  {\n    \"n\": \"Stage 6\",\n    \"side\": \"down\",\n    \"title\": \"Back in on a spring tide\",\n    \"text\": \"She takes up water for a day or two at the mooring, then sails the following week.\"\n  }\n];\n\nconst css = `\n.w5tml-root { --w5tml-h: 600px; --w5tml-run: 1600px; position: relative; height: var(--w5tml-h); overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }\n.w5tml-root *, .w5tml-root *::before, .w5tml-root *::after { box-sizing: border-box; }\n.w5tml-track { height: calc(var(--w5tml-h) + var(--w5tml-run)); }\n.w5tml-stage { position: sticky; top: 0; height: var(--w5tml-h); overflow: hidden; container-type: inline-size; }\n.w5tml-row { position: relative; display: flex; width: max-content; will-change: transform; }\n.w5tml-hint { position: absolute; top: 12px; left: 0; right: 0; z-index: 5; display: flex; justify-content: center; pointer-events: none; transition: opacity .4s ease; }\n.w5tml-hint span { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }\n.w5tml-root[data-scrolled] .w5tml-hint { opacity: 0; }\n@keyframes w5tml-slide { to { transform: translateX(calc(-100% + 100cqi)); } }\n@supports (animation-timeline: view()) {\n  @media (min-width: 640px) and (prefers-reduced-motion: no-preference) {\n    .w5tml-track { view-timeline: --w5tml-tl block; }\n    .w5tml-row { animation: w5tml-slide linear both; animation-timeline: --w5tml-tl; animation-range: contain 0% contain 100%; }\n  }\n}\n@media (max-width: 639px), (prefers-reduced-motion: reduce) {\n  .w5tml-track { height: auto; }\n  .w5tml-stage { position: static; height: auto; min-height: var(--w5tml-h); overflow: visible; }\n  .w5tml-hint { display: none; }\n  .w5tml-row { width: auto; overflow-x: auto; scroll-snap-type: x mandatory; transform: none !important; animation: none !important; scrollbar-width: thin; scroll-padding-inline: clamp(20px, 5cqi, 64px); }\n  .w5tml-panel { scroll-snap-align: start; }\n}\n.w5tml-root { --w5tml-navy: #0e1d30; --w5tml-brass: #d9b56c; --w5tml-col: 300px; background: radial-gradient(120% 90% at 20% 0%, #183150 0%, var(--w5tml-navy) 60%); color: #efe9dd; font-family: ui-sans-serif, system-ui, sans-serif; scrollbar-color: #2e4868 transparent; }\n.w5tml-root:focus-visible { outline: 3px solid var(--w5tml-brass); outline-offset: -3px; }\n.w5tml-hint span { background: var(--w5tml-brass); color: var(--w5tml-navy); }\n.w5tml-stage { display: flex; flex-direction: column; justify-content: center; gap: 8px; }\n.w5tml-head { padding: 0 clamp(20px, 5cqi, 64px); }\n.w5tml-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--w5tml-brass); }\n.w5tml-title { margin: 8px 0 0; max-width: 18ch; font-family: Georgia, \"Times New Roman\", serif; font-weight: 400; font-size: clamp(28px, 3.8cqi, 42px); line-height: 1.12; }\n.w5tml-row { padding: 0 clamp(20px, 5cqi, 64px); }\n.w5tml-list { display: flex; margin: 0; padding: 0; list-style: none; }\n.w5tml-panel { position: relative; flex: 0 0 var(--w5tml-col); height: 400px; }\n.w5tml-line { position: absolute; top: 200px; left: calc(clamp(20px, 5cqi, 64px) + 25px); right: calc(clamp(20px, 5cqi, 64px) + 280px + var(--w5tml-col) - 25px); height: 2px; background: rgba(239, 233, 221, .16); }\n.w5tml-ink { position: absolute; inset: 0; background: var(--w5tml-brass); transform: scaleX(0); transform-origin: 0 50%; }\n.w5tml-dot { position: absolute; top: 193px; left: 17px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--w5tml-brass); background: var(--w5tml-navy); }\n.w5tml-dot::after { content: \"\"; position: absolute; inset: 2px; border-radius: 50%; background: var(--w5tml-brass); opacity: 0; transform: scale(.4); transition: opacity .35s ease, transform .35s cubic-bezier(.3, 1.6, .5, 1); }\n.w5tml-panel[data-on] .w5tml-dot::after { opacity: 1; transform: scale(1); }\n.w5tml-card { position: absolute; left: 0; width: calc(var(--w5tml-col) - 36px); padding: 0 0 0 24px; border-left: 1px solid rgba(217, 181, 108, .45); }\n.w5tml-up .w5tml-card { bottom: 228px; }\n.w5tml-down .w5tml-card { top: 228px; }\n.w5tml-n { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--w5tml-brass); }\n.w5tml-h { margin: 6px 0 0; font-family: Georgia, \"Times New Roman\", serif; font-weight: 400; font-size: 22px; line-height: 1.25; }\n.w5tml-text { margin: 8px 0 0; font-size: 15px; line-height: 1.6; color: #c9c3b8; }\n.w5tml-end { flex-basis: 280px; }\n.w5tml-cta { top: 150px; border-left: 0; padding: 0; }\n.w5tml-btn { display: inline-flex; align-items: center; min-height: 44px; margin-top: 16px; padding: 0 20px; border-radius: 999px; background: var(--w5tml-brass); color: var(--w5tml-navy); font-size: 14px; font-weight: 600; text-decoration: none; }\n.w5tml-btn:hover { background: #ecd29a; }\n.w5tml-btn:focus-visible { outline: 3px solid #efe9dd; outline-offset: 3px; }\n@keyframes w5tml-draw { to { transform: scaleX(1); } }\n@supports (animation-timeline: view()) {\n  @media (min-width: 640px) and (prefers-reduced-motion: no-preference) {\n    .w5tml-ink { animation: w5tml-draw linear both; animation-timeline: --w5tml-tl; animation-range: contain 0% contain 100%; }\n  }\n}\n@media (max-width: 639px), (prefers-reduced-motion: reduce) {\n  .w5tml-stage { justify-content: center; gap: 24px; padding: 32px 0; }\n  .w5tml-row { padding: 0; }\n  .w5tml-list { gap: 16px; padding: 0 20px 12px; }\n  .w5tml-line, .w5tml-dot { display: none; }\n  .w5tml-panel, .w5tml-end { flex: 0 0 min(80%, 300px); height: auto; scroll-snap-align: start; }\n  .w5tml-card, .w5tml-cta { position: static; width: auto; height: 100%; padding: 20px; border: 1px solid rgba(217, 181, 108, .4); border-radius: 14px; background: rgba(255, 255, 255, .04); }\n}\n@media (max-width: 639px), (prefers-reduced-motion: reduce) {\n  .w5tml-row { overflow: visible; }\n  .w5tml-list { overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 20px; scrollbar-width: thin; }\n}\n`;\n\n// Same script as the HTML version. It also checks prefers-reduced-motion itself.\nfunction init(root: HTMLElement): () => void {\n  // The box scrolls itself. For page scroll: remove height and overflow from .w5tml-root, set --w5tml-h to 100vh,\n  // then use window scroll events and (scrollY minus the track's page top) instead of root.scrollTop.\n  var AUTO = 80; // demo scroll speed in px per second until someone scrolls; 0 turns it off\n  var $ = function (s: string): any { return root.querySelector(s); };\n  var track = $(\".w5tml-track\"), stage = $(\".w5tml-stage\"), row = $(\".w5tml-row\");\n  var still = matchMedia(\"(prefers-reduced-motion: reduce), (max-width: 639px)\");\n  var css = window.CSS && CSS.supports(\"animation-timeline: view()\"); // CSS moves the row itself there\n  var af = requestAnimationFrame, caf = cancelAnimationFrame, raf = 0, demo = 0, last = 0, pos = 0, seen = true, done = !AUTO;\n  var ink = $(\".w5tml-ink\"), dots = root.querySelectorAll(\".w5tml-dot\"), n = dots.length;\n  function cl(x: number) { return Math.min(1, Math.max(0, x)) || 0; }\n  function span() { return track.offsetHeight - root.clientHeight; }\n  function shift(el: any, p: number, flat: boolean) {\n    if (!css) el.style.transform = flat ? \"\" : \"translateX(\" + -p * Math.max(0, el.offsetWidth - stage.clientWidth) + \"px)\";\n  }\n  function paint() {\n    raf = 0;\n    var p = cl((root.scrollTop - track.offsetTop) / span()), flat = still.matches;\n    root.toggleAttribute(\"data-scrolled\", root.scrollTop > 160);\n    shift(row, p, flat);\n    if (!css) ink.style.transform = flat ? \"\" : \"scaleX(\" + p + \")\";\n    dots.forEach(function (d: any, i: number) { d.parentNode.toggleAttribute(\"data-on\", flat || p >= i / (n - 1) - 0.02); });\n  }\n  function queue() { if (!raf) raf = af(paint); }\n  function step(now: number) {\n    var dt = last ? Math.min(now - last, 50) : 0;\n    last = now;\n    pos += (AUTO * dt) / 1000;\n    if (pos >= root.scrollHeight - root.clientHeight) { done = true; demo = 0; return; }\n    root.scrollTop = pos;\n    demo = af(step);\n  }\n  function start() { if (!done && seen && !demo && !still.matches) { last = 0; pos = root.scrollTop; demo = af(step); } }\n  function stop() { caf(demo); demo = 0; }\n  function hand() { done = true; stop(); }\n  // Tabbing to a card off to the side scrolls the box to the point where that card is in view.\n  function focusIn(e: any) {\n    var card = e.target.closest(\".w5tml-panel\");\n    stage.scrollLeft = 0;\n    if (!card || still.matches) return;\n    hand();\n    var w = stage.clientWidth;\n    root.scrollTop = track.offsetTop + span() * cl((card.offsetLeft - (w - card.offsetWidth) / 2) / (row.offsetWidth - w));\n  }\n  var ac = new AbortController(), o = { passive: true, signal: ac.signal };\n  var io = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; seen ? start() : stop(); });\n  io.observe(root);\n  [\"wheel\", \"touchstart\", \"pointerdown\", \"keydown\"].forEach(function (ev) { root.addEventListener(ev, hand, o); });\n  root.addEventListener(\"scroll\", queue, o);\n  row.addEventListener(\"focusin\", focusIn, o);\n  row.addEventListener(\"scroll\", queue, o);\n  window.addEventListener(\"resize\", queue, o);\n  paint();\n  start();\n  return function () {\n    stop();\n    caf(raf);\n    io.disconnect();\n    ac.abort();\n\n  };\n}\n\nexport default function PinnedBoatRestorationTimelineDrawingSideways() {\n  const ref = useRef<HTMLElement>(null);\n  useEffect(() => (ref.current ? init(ref.current) : undefined), []);\n  return (\n    <section ref={ref} className=\"w5tml-root\" data-w5tml tabIndex=\"0\" aria-label=\"Restoration timeline, scroll to move along it\">\n    <style>{css}</style>\n      <div className=\"w5tml-track\">\n        <div className=\"w5tml-stage\">\n          <div className=\"w5tml-hint\" aria-hidden=\"true\"><span>Scroll inside</span></div>\n          <div className=\"w5tml-head\">\n            <p className=\"w5tml-label\">Merrow Boatworks</p>\n            <h2 className=\"w5tml-title\">How we bring a wooden dayboat back</h2>\n          </div>\n          <div className=\"w5tml-row\">\n            <span className=\"w5tml-line\" aria-hidden=\"true\"><span className=\"w5tml-ink\"></span></span>\n            <ol className=\"w5tml-list\">\n              {stages.map((it, i) => (\n    <li key={i} className={`w5tml-panel w5tml-${it.side}`}>\n                <span className=\"w5tml-dot\" aria-hidden=\"true\"></span>\n                <div className=\"w5tml-card\">\n                  <p className=\"w5tml-n\">{it.n}</p>\n                  <h3 className=\"w5tml-h\">{it.title}</h3>\n                  <p className=\"w5tml-text\">{it.text}</p>\n                </div>\n              </li>\n    ))}\n              <li className=\"w5tml-panel w5tml-end\">\n                <div className=\"w5tml-card w5tml-cta\">\n                  <h3 className=\"w5tml-h\">Have a boat that needs this?</h3>\n                  <a href=\"#\" className=\"w5tml-btn\">Book a hull survey</a>\n                </div>\n              </li>\n            </ol>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
