{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"slow-tide-on-wet-sand-with-receding-sheen-background","type":"registry:block","title":"Slow Tide on Wet Sand","description":"","dependencies":[],"files":[{"path":"components/we-inc/slow-tide-on-wet-sand-with-receding-sheen-background.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// A thin sheet of sea runs up the sand, pauses, and slides back, leaving a darker wet band\n// with a glassy sheen that fades after it. The swash is one translateY on a sliding SVG.\nconst SAND_TOP = \"#e6d7ba\";\nconst SAND_BOTTOM = \"#d2bd97\";\nconst SECONDS = 12; // one full run up and back\nconst EDGE = [[14,2,0.6],[8,5,2.2],[4,9,0.9]];\n\n// One wave edge across 2880 units: two copies of a 1440-unit period, so sliding the SVG left by\n// half its width loops with no seam. Each harm entry is [amplitude, waves per period, phase,\n// sharpness?]; with a sharpness the crests come to narrow peaks over broad troughs, like real swell.\nfunction wavePath(base: number, harm: number[][], h: number, close: \"bottom\" | \"top\" | \"none\" = \"bottom\", step = 36, env?: [number, number]) {\n  const pts: number[][] = [];\n  for (let x = -step; x <= 2880 + step; x += step) {\n    const e = env ? 1 - env[0] + env[0] * Math.abs(Math.sin((Math.PI * env[1] * x) / 1440)) : 1;\n    let y = base;\n    for (const [a, c, ph, k] of harm) {\n      const t = (2 * Math.PI * c * x) / 1440 + ph;\n      y += k ? e * (a - 2 * a * Math.pow((1 + Math.cos(t)) / 2, k)) : a * e * Math.sin(t);\n    }\n    pts.push([x, y]);\n  }\n  const r = (n: number) => Math.round(n * 10) / 10;\n  let d = \"M0 \" + r(pts[1][1]);\n  for (let i = 1; i < pts.length - 2; i++) {\n    const [p0, p1, p2, p3] = [pts[i - 1], pts[i], pts[i + 1], pts[i + 2]];\n    d += \"C\" + r(p1[0] + (p2[0] - p0[0]) / 6) + \" \" + r(p1[1] + (p2[1] - p0[1]) / 6) + \" \" + r(p2[0] - (p3[0] - p1[0]) / 6) + \" \" + r(p2[1] - (p3[1] - p1[1]) / 6) + \" \" + r(p2[0]) + \" \" + r(p2[1]);\n  }\n  if (close === \"bottom\") d += \"L2880 \" + h + \"L0 \" + h + \"Z\";\n  if (close === \"top\") d += \"L2880 0L0 0Z\";\n  return d;\n}\n\nfunction useOnScreen<T extends Element>() {\n  const ref = useRef<T>(null);\n  const [onScreen, setOnScreen] = useState(true);\n  useEffect(() => {\n    const el = ref.current;\n    if (!el || !(\"IntersectionObserver\" in window)) return;\n    const io = new IntersectionObserver(([e]) => setOnScreen(e.isIntersecting));\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n  return [ref, onScreen] as const;\n}\n\nconst css = `\n@keyframes swtd-swash { 0% { transform: translate3d(0,50%,0); } 38% { transform: translate3d(0,14%,0); } 48% { transform: translate3d(0,17%,0); } 86% { transform: translate3d(0,54%,0); } 100% { transform: translate3d(0,50%,0); } }\n@keyframes swtd-wet { 0% { opacity: .35; } 38% { opacity: 1; } 60% { opacity: .9; } 100% { opacity: .35; } }\n@keyframes swtd-drift { from { transform: translate3d(0,0,0); } to { transform: translate3d(-50%,0,0); } }\n.swtd-swash { animation: swtd-swash ${SECONDS}s cubic-bezier(.45,.05,.4,1) -4s infinite; }\n.swtd-wet { animation: swtd-wet ${SECONDS}s ease-in-out -4s infinite; }\n.swtd-drift { animation: swtd-drift 70s linear infinite; }\n.swtd-root[data-paused=\"true\"] .swtd-swash, .swtd-root[data-paused=\"true\"] .swtd-wet, .swtd-root[data-paused=\"true\"] .swtd-drift { animation-play-state: paused; }\n@media (prefers-reduced-motion: reduce) { .swtd-swash, .swtd-wet, .swtd-drift { animation: none !important; } .swtd-swash { transform: translate3d(0,26%,0); } }\n`;\n\nexport default function SlowTideOnWetSand() {\n  const [ref, onScreen] = useOnScreen<HTMLElement>();\n  return (\n    <section ref={ref} data-paused={!onScreen} className=\"swtd-root relative isolate min-h-[700px] overflow-hidden\" style={{ background: `linear-gradient(180deg, ${SAND_TOP}, ${SAND_BOTTOM})` }}>\n      <style>{css}</style>\n      <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0 -z-10\">\n        <div className=\"absolute inset-x-0 bottom-0 h-[52%] min-h-[260px]\">\n          <svg className=\"swtd-wet absolute inset-y-0 left-0 h-full w-full min-w-[900px]\" viewBox=\"0 0 1440 400\" preserveAspectRatio=\"none\">\n            <defs>\n              <linearGradient id=\"swtd-wetg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n                <stop offset=\"0\" stopColor=\"#b59d76\" stopOpacity=\"0\" />\n                <stop offset=\".12\" stopColor=\"#ae9670\" stopOpacity=\".9\" />\n                <stop offset=\".3\" stopColor=\"#c7b598\" />\n                <stop offset=\".42\" stopColor=\"#a68e68\" />\n                <stop offset=\"1\" stopColor=\"#9c845f\" />\n              </linearGradient>\n            </defs>\n            <path d={wavePath(80, [[16, 2, 0.5], [9, 5, 2.4]], 400)} fill=\"url(#swtd-wetg)\" />\n          </svg>\n          <div className=\"swtd-swash absolute inset-0\">\n            <svg className=\"swtd-drift absolute inset-y-0 left-0 h-full w-[200%] min-w-[1800px]\" viewBox=\"0 0 2880 400\" preserveAspectRatio=\"none\">\n              <defs>\n                <linearGradient id=\"swtd-water\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n                  <stop offset=\"0\" stopColor=\"#f4f2ea\" stopOpacity=\".7\" />\n                  <stop offset=\".1\" stopColor=\"#b9d0c8\" stopOpacity=\".3\" />\n                  <stop offset=\".4\" stopColor=\"#8fb3ad\" stopOpacity=\".45\" />\n                  <stop offset=\".78\" stopColor=\"#5d918f\" stopOpacity=\".88\" />\n                  <stop offset=\"1\" stopColor=\"#3f6f74\" />\n                </linearGradient>\n              </defs>\n              <path d={wavePath(60, EDGE, 400)} fill=\"url(#swtd-water)\" />\n              <path d={wavePath(60, EDGE, 400, \"none\")} fill=\"none\" stroke=\"#fbfaf5\" strokeOpacity=\".22\" strokeWidth=\"9\" vectorEffect=\"non-scaling-stroke\" />\n              <path d={wavePath(60, EDGE, 400, \"none\")} fill=\"none\" stroke=\"#fbfaf5\" strokeOpacity=\".85\" strokeWidth=\"1.8\" strokeDasharray=\"90 5 20 9 160 7\" vectorEffect=\"non-scaling-stroke\" />\n              <path d={wavePath(74, [[12, 2, 0.9], [7, 5, 2.0], [5, 11, 1.4]], 400, \"none\")} fill=\"none\" stroke=\"#fbfaf5\" strokeOpacity=\".35\" strokeWidth=\"1\" strokeDasharray=\"30 14 8 22\" vectorEffect=\"non-scaling-stroke\" />\n            </svg>\n          </div>\n        </div>\n        <svg className=\"absolute inset-0 h-full w-full opacity-60 mix-blend-multiply\">\n          <filter id=\"swtd-grain\"><feTurbulence type=\"fractalNoise\" baseFrequency=\".85\" numOctaves=\"3\" stitchTiles=\"stitch\"/><feColorMatrix values=\"0 0 0 0 .35  0 0 0 0 .26  0 0 0 0 .16  0 0 0 .55 0\"/></filter>\n          <rect width=\"100%\" height=\"100%\" filter=\"url(#swtd-grain)\" />\n        </svg>\n      </div>\n      <div className=\"mx-auto max-w-5xl px-6 pb-[350px] pt-20 sm:pt-24\">\n        <p className=\"text-sm font-semibold uppercase tracking-[0.16em] text-[#5a4127]\">Dune Row Cottages</p>\n        <h1 className=\"mt-4 max-w-2xl text-4xl font-semibold leading-[1.08] tracking-tight text-[#2e1f10] sm:text-6xl\">Wake up a short walk from the tide line.</h1>\n        <p className=\"mt-5 max-w-xl text-lg leading-relaxed text-[#4a3722]\">Six timber cottages on the dunes, open all year with wood stoves and outdoor showers.</p>\n        <a href=\"#\" className=\"mt-8 inline-flex h-12 items-center rounded-md bg-[#2e1f10] px-7 text-sm font-semibold text-[#f5ecdc] transition hover:bg-[#4a3420] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2e1f10] focus-visible:ring-offset-2 focus-visible:ring-offset-[#e6d7ba]\">Check availability</a>\n      </div>\n    </section>\n  );\n}\n"}]}
