(function(){function init(){ document.documentElement.lang="ko"; document.body.classList.add('ppf-page'); document.body.classList.remove('overview-page'); const isEnglish=document.documentElement.lang==='en'; const tr=(ko,en)=>isEnglish?en:ko; const menu=document.querySelector('.menu'),nav=document.querySelector('#nav'); menu?.addEventListener('click',()=>{const open=nav.classList.toggle('open');menu.setAttribute('aria-expanded',String(open));menu.textContent=open?tr('닫기','Close'):tr('메뉴','Menu')}); document.addEventListener('keydown',e=>{if(e.key==='Escape'&&nav?.classList.contains('open')){nav.classList.remove('open');menu.setAttribute('aria-expanded','false');menu.textContent=tr('메뉴','Menu');menu.focus()}}); const video=document.querySelector('#heroVideo'),play=document.querySelector('#play'); if(video&&play){const sync=()=>{play.innerHTML=video.paused?'▶ PLAY':'Ⅱ PAUSE';play.setAttribute('aria-label',video.paused?tr('배경 영상 재생','Play background video'):tr('배경 영상 일시정지','Pause background video'))};play.addEventListener('click',()=>{if(video.paused)video.play().catch(sync);else video.pause()});video.addEventListener('pause',sync);video.addEventListener('play',sync);if(matchMedia('(prefers-reduced-motion: reduce)').matches){video.autoplay=false;video.pause()}sync()} const filters=[...document.querySelectorAll('[data-filter]')],cards=[...document.querySelectorAll('.catalog-card')],search=document.querySelector('#productSearch');let selected='All'; function filterProducts(){const query=(search?.value||'').trim().toLowerCase();let count=0;cards.forEach(card=>{const show=(selected==='All'||card.dataset.finish===selected)&&card.dataset.name.toLowerCase().replace(/\s/g,'').includes(query.replace(/\s/g,''));card.hidden=!show;if(show)count++});document.querySelector('#resultCount').textContent=isEnglish?count+' product'+(count===1?'':'s'):count+'개 제품';document.querySelector('#noResults').hidden=count>0;filters.forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.filter===selected)))} filters.forEach(b=>b.addEventListener('click',()=>{selected=b.dataset.filter;filterProducts()}));search?.addEventListener('input',filterProducts); const form=document.querySelector('#inquiryForm');if(form){const params=new URLSearchParams(location.search);for(const name of ['product','topic']){const raw=params.get(name),val=({G1PRO:'G1 PRO',G2PRO:'G2 PRO',M1PRO:'M1'})[raw]||raw,field=form.elements.namedItem(name);if(val&&[...field.options].some(x=>x.value===val))field.value=val}form.addEventListener('submit',e=>{e.preventDefault();const data=new FormData(form),topic=form.elements.topic.selectedOptions[0].textContent;const body=isEnglish?`Inquiry type: ${topic}\nVehicle: ${data.get('car')||'-'}\nProduct: ${data.get('product')}\nArea: ${data.get('region')||'-'}\n\nMessage:\n${data.get('message')}`:`문의 유형: ${topic}\n차량 모델: ${data.get('car')||'-'}\n관심 제품: ${data.get('product')}\n희망 지역: ${data.get('region')||'-'}\n\n문의 내용:\n${data.get('message')}`;location.href='mailto:kmk@pontree.co.kr?subject='+encodeURIComponent(tr('힐링쉴드 PPF ','Healing Shield PPF ')+topic)+'&body='+encodeURIComponent(body);document.querySelector('#emailStatus').textContent=tr('이메일 앱에서 내용을 확인하고 전송해 주세요. 앱이 열리지 않으면 kmk@pontree.co.kr로 직접 문의하실 수 있습니다.','Review and send your message in your email app. If it does not open, email kmk@pontree.co.kr directly.')})} // One-time section reveals only; no scroll-jacking, looping or parallax. const motionPreference=matchMedia('(prefers-reduced-motion: reduce)'); let revealObserver; function revealAll(){revealObserver?.disconnect();document.querySelectorAll('.reveal-pending').forEach(el=>{el.classList.remove('reveal-pending');el.classList.add('is-visible')})} if(!motionPreference.matches&&'IntersectionObserver' in window){ const targets=document.querySelectorAll('main .intro-grid,main .section-head,main .features,main .product-grid,main .coverage-grid,main .steps,main .faq-grid,main .catalog-grid,main .detail-section,main .guide-list,main .support-cards'); revealObserver=new IntersectionObserver(entries=>{entries.forEach(({target,isIntersecting})=>{if(isIntersecting){target.classList.add('is-visible');target.classList.remove('reveal-pending');revealObserver.unobserve(target)}})},{threshold:0,rootMargin:'0px 0px -32px 0px'}); targets.forEach(el=>{if(el.getBoundingClientRect().top>window.innerHeight){el.classList.add('reveal-ready','reveal-pending');revealObserver.observe(el)}}); } motionPreference.addEventListener('change',e=>{if(e.matches){revealAll();video?.pause()}}); window.addEventListener('beforeprint',revealAll); document.querySelectorAll('.language-switch a').forEach(a=>{const u=new URL(a.href);const current=new URL(location.href);['product','topic'].forEach(k=>{if(current.searchParams.has(k))u.searchParams.set(k,current.searchParams.get(k));});u.hash=location.hash;a.href=u.href;}); }if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init,{once:true});}else{init();}})();