(() => { const hero = document.querySelector('.dbc-particle-hero#home'); if (!hero) return; const reducedMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; const compactViewport = window.matchMedia && window.matchMedia('(max-width: 760px)').matches; const dbcMessageDelay = compactViewport ? 360 : 420; const completionFallbackDelay = compactViewport ? 4600 : 5600; let dbcMessageTimer = null; let completionFallbackTimer = null; hero.classList.add('is-v283-motion-active'); hero.dataset.copyStage = 'waiting'; const revealDbcMessage = () => { if (!hero.classList.contains('is-dbc-message-ready')) { hero.classList.add('is-dbc-message-ready'); } if (!hero.classList.contains('is-bioten-phase-ready')) { hero.dataset.copyStage = 'dbc'; } }; const revealBiotenPhase = () => { revealDbcMessage(); if (!hero.classList.contains('is-bioten-phase-ready')) { hero.classList.add('is-bioten-phase-ready'); } if (!hero.classList.contains('is-bioten-product-ready')) { hero.dataset.copyStage = 'bioten'; } }; const markComplete = (fallback = false) => { revealBiotenPhase(); if (!hero.classList.contains('is-bioten-product-ready')) { hero.classList.add('is-bioten-product-ready'); } hero.dataset.copyStage = fallback ? 'fallback-complete' : 'complete'; if (completionFallbackTimer) { window.clearTimeout(completionFallbackTimer); completionFallbackTimer = null; } }; const syncParticleState = () => { if (hero.dataset.particleMode === 'bioten') { revealBiotenPhase(); } if ( hero.classList.contains('is-bioten-product-ready') && hero.dataset.copyStage !== 'complete' && hero.dataset.copyStage !== 'fallback-complete' ) { markComplete(false); } }; if (reducedMotion || hero.classList.contains('is-reduced-motion')) { markComplete(false); return; } dbcMessageTimer = window.setTimeout(revealDbcMessage, dbcMessageDelay); completionFallbackTimer = window.setTimeout( () => markComplete(true), completionFallbackDelay ); const observer = new MutationObserver(syncParticleState); observer.observe(hero, { attributes: true, attributeFilter: ['class', 'data-particle-mode'] }); syncParticleState(); window.addEventListener('pageshow', syncParticleState); })();