<script>
(function () {

    function loadExternalSite() {

        // Prevent loading inside the Squarespace editor
        if (
            window.self !== window.top ||
            window.location.pathname.startsWith('/config') ||
            document.body.classList.contains('sqs-edit-mode') ||
            document.body.classList.contains('sqs-edit-mode-active')
        ) {
            return;
        }

        // Prevent duplicate iframes
        if (document.getElementById('vfx-external-site')) {
            return;
        }

        // Create iframe
        const iframe = document.createElement('iframe');

        iframe.id = 'vfx-external-site';
        iframe.src = 'https://halcyon-sf.com/ben-voltron-temp/vfx-technologies-site-prototype.html';
        iframe.title = 'VFX Technologies';
        iframe.allowFullscreen = true;

        // Full-screen styling
        Object.assign(iframe.style, {
            position: 'fixed',
            top: '0',
            left: '0',
            width: '100%',
            height: '100%',
            border: 'none',
            margin: '0',
            padding: '0',
            overflow: 'hidden',
            backgroundColor: '#000000',
            zIndex: '999999'
        });

        // Disable underlying page scrolling
        document.documentElement.style.overflow = 'hidden';
        document.body.style.overflow = 'hidden';

        // Load external website
        document.body.appendChild(iframe);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', loadExternalSite);
    } else {
        loadExternalSite();
    }

})();
</script>