/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme-child/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 2.0.0
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/* Add your custom styles here */
add_action( 'wp_footer', function () {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function () {
        if (typeof jQuery === 'undefined') {
            console.error('jQuery not loaded — check enqueue.');
            return;
        }
        jQuery(function($){
            $('.serviceContainer').each(function(){
                if ($(this).find('.card-overlay').length) return;
                var link = $(this).find('a').first().attr('href');
                if (link){
                    $(this).css('position','relative');
                    $(this).append('<a class="card-overlay" href="'+link+'"></a>');
                }
            });
        });
    });
    </script>
    <style>
    .serviceContainer{
        position:relative;
    }
    .serviceContainer .card-overlay{
        position:absolute;
        inset:0;
        z-index:9;
        display:block;
    }
    </style>
    <?php
}, 100 ); // higher priority = runs later, after jQuery's own script tag