import{r as c,c as R,bs as k,bt as b,bu as I,j as s,m as w,t as O}from"./index-CxGMQRP8.js";import{u as F}from"./useIOSAudioContext-DSBnluc9.js";let d=!1;const P=()=>{const i=c.useRef(null),m=c.useRef(-1),f=c.useRef(0),{getContext:T}=F(),{t:p}=R("landing"),h="Marlon the mouse looked up at the dark clouds in hope of rain.".split(" "),x=h.reduce((t,e)=>t+e.length,0),{scrollYProgress:l}=k({target:i,offset:["start start","end end"]}),[j,v]=c.useState(0),g=b(l,[0,.15],[0,1]),y=b(l,[0,.15],[30,0]),N=()=>{const t=Date.now();if(!(t-f.current<40)){f.current=t;try{const e=T();if(!e)return;const n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination),n.type="sine",n.frequency.setValueAtTime(1e3,e.currentTime),n.frequency.exponentialRampToValueAtTime(400,e.currentTime+.08),r.gain.setValueAtTime(.1,e.currentTime),r.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),n.start(e.currentTime),n.stop(e.currentTime+.08)}catch{}}};c.useEffect(()=>{if(d||!i.current)return;const t=new IntersectionObserver(([e])=>{e.isIntersecting&&!d&&(d=!0,t.disconnect(),I().then(n=>{n.filter(a=>a.format==="woff2").forEach(a=>{const o=a.name.includes("Bold");new FontFace("OpenDyslexic",`url(${a.url}) format('woff2')`,{weight:o?"700":"400",style:"normal",display:"swap"}).load().then(E=>document.fonts.add(E)).catch(()=>{})})}))},{rootMargin:"200% 0px"});return t.observe(i.current),()=>t.disconnect()},[]),c.useEffect(()=>{const t=l.on("change",e=>{v(e);const n=.15,a=Math.max(0,Math.min(1,(e-n)/(.85-n))),o=Math.floor(a*x);o!==m.current&&(N(),m.current=o)});return()=>t()},[l,x]);const S=t=>{const r=.15+t/x*.7;return j>=r};return s.jsx("section",{ref:i,className:"h-[200vh] relative",style:{background:"#FCE7F3"},children:s.jsxs("div",{className:"sticky top-14 h-[calc(100vh-3.5rem)] flex flex-col items-center justify-between py-16 lg:py-24 overflow-hidden",children:[s.jsx(w.div,{style:{opacity:g,y},className:"text-center",children:s.jsx("h2",{className:"section-header text-[22px] lg:text-[32px]",children:p("dyslexia.heading")})}),s.jsx("div",{className:"flex-1 flex items-center justify-center max-w-4xl px-6",children:s.jsx("p",{className:"text-2xl sm:text-3xl lg:text-4xl xl:text-5xl text-center flex flex-wrap justify-center gap-x-3 gap-y-2",children:(()=>{let t=0;return h.map((e,n)=>s.jsx("span",{className:"inline-flex whitespace-nowrap",children:e.split("").map((r,a)=>{const o=t;t++;const u=S(o);return s.jsx("span",{className:`inline-block transition-all duration-300 ease-out ${u?"font-dyslexic tracking-wider bg-amber-100 rounded-sm":"font-noto tracking-normal bg-transparent"}`,style:{lineHeight:u?"2":"1.5",padding:u?"0 1px":"0"},children:r},a)})},n))})()})}),s.jsxs(w.div,{style:{opacity:g,y},className:"text-center max-w-xl px-6 flex flex-col items-center gap-8",children:[s.jsx("p",{className:"section-subtext text-sm lg:text-xl",children:p("dyslexia.subtext")}),s.jsx(O,{})]})]})})};export{P as default};
//# sourceMappingURL=DyslexiaSection-HxytKai5.js.map