{"version":3,"file":"CaseBackdrop.C1ADExme.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","ce","init_jsx_runtime","J","c","p","_e","de","window","addPropertyControls","init_framer_BL70qLPA","ControlType","CaseBackdrop","props","solid","mode","root","layers","srcs","setSrcs","el","wrap","raf","items","collect","list","img","it","prev","mo","tick","vh","F","fade","layer","i","top","n","s","blur","scale","shade","withInnerParallax","local","frame","r","max","d","y","setRef","ref","Component","init_CaseBackdrop"],"sources":["https:/framerusercontent.com/modules/OmQ5XDu1hduRgIWxKoxE/1Xqg5eAgGPLF8MX484ix/CaseBackdrop.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,forwardRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Crossfading blurred backdrop for the \"Case studies\" parallax section.\n * Reads each project's image from the list and fades between them as you scroll.\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CaseBackdrop(props){const{mode=\"blur\",blur=28,scale=1.2,shade=\"rgba(6, 8, 14, 0.35)\",fade=.45,background=\"rgb(0, 0, 0)\"}=props;const solid=mode===\"solid\";const root=useRef(null);const layers=useRef([]);const[srcs,setSrcs]=useState([]);useEffect(()=>{const el=root.current;if(!el||typeof window===\"undefined\")return;const wrap=el.closest('[data-framer-name=\"Projects Wrap\"]');if(!wrap)return;let raf=0;let items=[];const collect=()=>{items=Array.from(wrap.querySelectorAll('[data-framer-name=\"Project\"]'));const list=items.map(it=>{const img=it.querySelector('[data-framer-name=\"Project Image\"] img');return img?img.currentSrc||img.src:\"\";});setSrcs(prev=>prev.join(\"|\")===list.join(\"|\")?prev:list);};collect();const mo=new MutationObserver(collect);mo.observe(wrap,{childList:true,subtree:true,attributes:true,attributeFilter:[\"src\",\"srcset\"]});const tick=()=>{const vh=window.innerHeight;const c=vh/2;const F=Math.max(1,vh*fade);items.forEach((it,i)=>{const layer=layers.current[i];if(!layer)return;const top=it.getBoundingClientRect().top;const o=i===0?1:Math.min(1,Math.max(0,(c-top+F/2)/F));layer.style.opacity=String(o);});raf=requestAnimationFrame(tick);};raf=requestAnimationFrame(tick);return()=>{cancelAnimationFrame(raf);mo.disconnect();};},[fade]);return /*#__PURE__*/_jsxs(\"div\",{ref:root,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",background},children:[!solid&&srcs.map((s,i)=>/*#__PURE__*/_jsx(\"div\",{ref:n=>{layers.current[i]=n;},style:{position:\"absolute\",inset:0,opacity:i===0?1:0,willChange:\"opacity\"},children:s?/*#__PURE__*/_jsx(\"img\",{src:s,alt:\"\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",filter:\"blur(\"+blur+\"px)\",transform:\"scale(\"+scale+\")\"}}):null},i)),!solid&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,background:shade,pointerEvents:\"none\"}})]});}addPropertyControls(CaseBackdrop,{mode:{type:ControlType.Enum,title:\"Background\",options:[\"blur\",\"solid\"],optionTitles:[\"Blurred image\",\"Solid color\"],defaultValue:\"blur\",displaySegmentedControl:true},blur:{type:ControlType.Number,title:\"Blur\",min:0,max:80,defaultValue:28,hidden:p=>p.mode===\"solid\"},scale:{type:ControlType.Number,title:\"Scale\",min:1,max:2,step:.05,defaultValue:1.2,hidden:p=>p.mode===\"solid\"},shade:{type:ControlType.Color,title:\"Shade\",defaultValue:\"rgba(6, 8, 14, 0.35)\",hidden:p=>p.mode===\"solid\"},fade:{type:ControlType.Number,title:\"Fade zone\",min:.05,max:1,step:.05,defaultValue:.45,hidden:p=>p.mode===\"solid\"},background:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgb(0, 0, 0)\"}});/** Parallax override: the frame stays fixed, only the image inside moves. */export function withInnerParallax(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const local=useRef(null);useEffect(()=>{const el=local.current;if(!el||typeof window===\"undefined\")return;const isTouchSmall=window.innerWidth<810||window.matchMedia&&window.matchMedia(\"(hover: none) and (pointer: coarse)\").matches;if(isTouchSmall){el.style.transform=\"none\";return;}let raf=0;const tick=()=>{let frame=el.parentElement;while(frame&&frame.offsetHeight===0&&frame.parentElement)frame=frame.parentElement;if(frame){const r=frame.getBoundingClientRect();const vh=window.innerHeight;const max=Math.max(0,(el.offsetHeight-frame.offsetHeight)/2);const d=(r.top+r.height/2-vh/2)/(vh/2+r.height/2);const y=Math.max(-max,Math.min(max,-d*max));el.style.transform=\"translate3d(0,\"+y.toFixed(2)+\"px,0)\";}raf=requestAnimationFrame(tick);};raf=requestAnimationFrame(tick);return()=>cancelAnimationFrame(raf);},[]);const setRef=n=>{local.current=n;if(typeof ref===\"function\")ref(n);else if(ref)ref.current=n;};return /*#__PURE__*/_jsx(Component,{...props,ref:setRef});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withInnerParallax\":{\"type\":\"reactHoc\",\"name\":\"withInnerParallax\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"CaseBackdrop\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseBackdrop.map"],"mappings":"A,oNAKG,SAAwBgB,EAAa,EAAM,CAAC,GAAK,CAAC,OAAK,OAAO,OAAK,GAAG,QAAM,IAAI,QAAM,uBAAuB,OAAK,IAAI,aAAW,gBAAgBC,EAAYC,EAAMC,IAAO,QAAcC,EAAKpB,EAAO,IAAI,EAAQqB,EAAOrB,EAAO,CAAC,CAAC,EAAO,CAACsB,EAAKC,GAAStB,EAAS,CAAC,CAAC,EAAkgC,OAAhgCI,MAAc,CAAC,IAAMmB,EAAGJ,EAAK,QAAQ,GAAG,CAACI,GAAWZ,IAAS,OAAY,OAAO,IAAMa,EAAKD,EAAG,QAAQ,o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