<?php function itactics_child_enqueue_styles_and_assets(){//Enqueue Parent Theme Style wp_enqueue_style('parent-style',get_template_directory_uri() . '/style.css');//Child Theme Style — fixed version string (NOT time(),which breaks browser caching) wp_enqueue_style('child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style'),'1.0.2');//Calendly assets — only on pages that actually use a Calendly shortcode global $post;if (is_a($post,'WP_Post') && (has_shortcode($post->post_content,'calendly_badge') || has_shortcode($post->post_content,'calendly_button'))){wp_enqueue_style('calendly-badge-css','https://assets.calendly.com/assets/external/widget.css',array(),null);wp_enqueue_script('calendly-badge-js','https://assets.calendly.com/assets/external/widget.js',array(),null,true)}}add_action('wp_enqueue_scripts','itactics_child_enqueue_styles_and_assets');add_filter('aos_init',function($script){//Disable AOS completely — it hides elements with opacity:0 via CSS//which causes NO_LCP/blank page in Lighthouse (desktop + mobile).//The hero/banner section is the LCP element and AOS was keeping it invisible. return 'var aoswp_params = {
        "offset":"50",
        "duration":"400",
        "easing":"ease",
        "delay":"0",
        "disable":true,
        "once":true};'});function itactics_child_calendly_generic_trigger_script(){global $post;if (! is_a($post,'WP_Post') || (! has_shortcode($post->post_content,'calendly_badge') && ! has_shortcode($post->post_content,'calendly_button'))){return}$script="
    document.addEventListener('DOMContentLoaded', function() {
        function fixPopupStructure() {
            var checkExist = setInterval(function() {
                var overlay = document.querySelector('.calendly-overlay');
                var popup = document.querySelector('.calendly-overlay .calendly-popup');
                var closeBtn = document.querySelector('.calendly-overlay .calendly-popup-close');
                if (overlay && popup && closeBtn) {
                    clearInterval(checkExist);
                    popup.appendChild(closeBtn);
                }
            }, 50);
            setTimeout(function() { clearInterval(checkExist); }, 4000);
        }
        var triggers = document.querySelectorAll('.calendly-trigger');
        triggers.forEach(function(btn) {
            btn.addEventListener('click', function(e) {
                e.preventDefault();
                var url = btn.getAttribute('data-url') || 'https://calendly.com/hi-activeroute/30min?hide_event_type_details=1&hide_gdpr_banner=1';
                Calendly.initPopupWidget({url: url});
                fixPopupStructure();
            });
        });
    });
    ";wp_add_inline_script('calendly-badge-js',$script);}add_action('wp_enqueue_scripts','itactics_child_calendly_generic_trigger_script');//[calendly_badge] function itactics_child_calendly_badge_shortcode($atts){$a=shortcode_atts(array('url'=>'https://calendly.com/hi-activeroute/30min?hide_event_type_details=1&hide_gdpr_banner=1','text'=>'Schedule time with me','color'=>'#0069ff','text_color'=>'#ffffff','branding'=>'true',),$atts,'calendly_badge');$script=<<<HTML <link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet"><script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript" async></script><script type="text/javascript">window.onload=function(){Calendly.initBadgeWidget({url:'{$a['url']}',text:'{$a['text']}',color:'{$a['color']}',textColor:'{$a['text_color']}',branding:{$a['branding']}});};</script>HTML;return $script;}add_shortcode('calendly_badge','itactics_child_calendly_badge_shortcode');//[calendly_button] function itactics_child_calendly_button_shortcode($atts){$a=shortcode_atts(array('url'=> 'https://calendly.com/hi-activeroute/30min?hide_event_type_details=1&hide_gdpr_banner=1','button_text'=> 'Schedule time with me','color'=> '#0069ff','text_color'=> '#ffffff','branding'=> 'true',),$atts,'calendly_button');$button='<button class="calendly-trigger" data-url="' . esc_url(//activeroute.io/wp-content/themes/itactics-child/$a['url']) . '" style="background-color:' . $a['color'] . ';color:' . $a['text_color'] . ';border:none;padding:8px 16px;border-radius:4px;cursor:pointer;">' . esc_html($a['button_text']) . '</button>';return $button}add_shortcode('calendly_button','itactics_child_calendly_button_shortcode');