class CustomFooter extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` `; // Initialize after rendering setTimeout(() => { this.initializeFooter(); }, 0); } initializeFooter() { // Back to top functionality const backToTop = this.shadowRoot.getElementById('backToTop'); window.addEventListener('scroll', () => { if (window.scrollY > 300) { backToTop.classList.add('visible'); } else { backToTop.classList.remove('visible'); } }); if (backToTop) { backToTop.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } // Initialize Feather icons in shadow DOM this.initializeIcons(); } initializeIcons() { // Wait for feather to be available if (typeof feather !== 'undefined') { const icons = this.shadowRoot.querySelectorAll('[data-feather]'); icons.forEach(icon => { feather.replace(icon); }); } else { // Retry after a short delay setTimeout(() => this.initializeIcons(), 100); } } } customElements.define('custom-footer', CustomFooter);