<!-- DEBUG: Config loaded: Array
(
    [calendly_url] => https://calendly.com/alaskabydesign/arrange-a-call-with-an-alaska-travel-designer?text_color=444444&primary_color=004071&a2=
    [recaptcha_sitekey] => 6Ldg9oorAAAAAOr7TWVO-D9ECU7NqtyWLdYWwlA_
    [cdn_url] => https://cdn.discoverholidays.io/
    [bridge_site_id] => 1
    [klaviyo_company_id] => UCcbUh
)
 --><script>
    //  DEBUG: Add quotes and check values
    const CALENDLY_URL = 'https://calendly.com/alaskabydesign/arrange-a-call-with-an-alaska-travel-designer?text_color=444444&primary_color=004071&a2=';
    const RECAPTCHA_SITEKEY = '6Ldg9oorAAAAAOr7TWVO-D9ECU7NqtyWLdYWwlA_';
    
    
    //  VALIDATION: Check if sitekey is valid before using
    if (!RECAPTCHA_SITEKEY || RECAPTCHA_SITEKEY.length < 10) {
        console.error('Invalid reCAPTCHA sitekey:', RECAPTCHA_SITEKEY);
    }

    function addCaptchaLayer() {

        let calendlyTriggers = document.getElementsByClassName("btn_calendly");

        function handleCalendlyClick(e) {
            e.preventDefault();

            let calendlyOverlay = document.getElementsByClassName("calendly-overlay");

            if (calendlyOverlay.length > 0) {
                calendlyOverlay[0].style.display = "none";
            }

            //----- Render a modal at the center of the page ---
            let modal = document.createElement('div');
            modal.id = "customModal";
            modal.style.position = "fixed";
            modal.style.top = "0";
            modal.style.left = "0";
            modal.style.width = "100vw";
            modal.style.height = "100vh";
            modal.style.background = "rgba(0,0,0,0.5)";
            modal.style.display = "flex";
            modal.style.alignItems = "center";
            modal.style.justifyContent = "center";
            modal.style.zIndex = "9999";

            // ----- Modal Content with reCAPTCHA -----
            let modalContent = document.createElement('div');
            modalContent.style.background = "#fff";
            modalContent.style.padding = "40px";
            modalContent.style.borderRadius = "8px";
            modalContent.style.textAlign = "center";
            modalContent.style.minWidth = "400px";

            let modalText = document.createElement('p');
            modalText.innerText = "Please verify that you're not a robot to continue.";
            modalText.style.marginBottom = "20px";
            modalText.style.fontSize = "16px";
            modalText.style.color = "#333";

            // Create reCAPTCHA container
            let recaptchaContainer = document.createElement('div');
            recaptchaContainer.id = "recaptcha-container";
            recaptchaContainer.style.display = "flex";
            recaptchaContainer.style.justifyContent = "center";
            recaptchaContainer.style.marginBottom = "20px";

            // Create error message element
            let errorMessage = document.createElement('div');
            errorMessage.id = "captcha-error";
            errorMessage.style.color = "#e74c3c";
            errorMessage.style.fontSize = "14px";
            errorMessage.style.marginBottom = "10px";
            errorMessage.style.display = "none";

            // Load and render reCAPTCHA
            function loadRecaptcha() {
                if (typeof grecaptcha !== 'undefined') {
                    //  VALIDATION: Check sitekey before rendering
                    if (!RECAPTCHA_SITEKEY || RECAPTCHA_SITEKEY.length < 10) {
                        console.error('Cannot render reCAPTCHA: Invalid sitekey');
                        errorMessage.textContent = "reCAPTCHA configuration error. Please contact support.";
                        errorMessage.style.display = "block";
                        return;
                    }
                    
                    
                    try {
                        grecaptcha.render(recaptchaContainer, {
                            'sitekey': RECAPTCHA_SITEKEY,
                            'callback': function(response) {

                                // Fade out the modal
                                modal.style.transition = "opacity 0.5s ease-out";
                                modal.style.opacity = "0";

                                setTimeout(() => {
                                    // Remove the modal
                                    document.body.removeChild(modal);

                                    // Trigger Calendly popup directly
                                    if (typeof Calendly !== 'undefined' && Calendly.initPopupWidget) {
                                        Calendly.initPopupWidget({
                                            url: CALENDLY_URL
                                        });
                                    } else {
                                        // Fallback: show the original Calendly overlay if Calendly API not available
                                        if (calendlyOverlay.length > 0) {
                                            calendlyOverlay[0].style.display = "block";
                                        }
                                    }
                                }, 500); // Wait for fade out animation
                            },
                            'expired-callback': function() {
                                errorMessage.textContent = "reCAPTCHA expired. Please try again.";
                                errorMessage.style.display = "block";
                            },
                            'error-callback': function() {
                                console.error('reCAPTCHA error occurred');
                                errorMessage.textContent = "reCAPTCHA error. Please try again.";
                                errorMessage.style.display = "block";
                            }
                        });
                    } catch (e) {
                        console.error('Error rendering reCAPTCHA:', e);
                        errorMessage.textContent = "reCAPTCHA failed to load. Please try again.";
                        errorMessage.style.display = "block";
                    }
                } else {
                    let script = document.createElement('script');
                    script.src = 'https://www.google.com/recaptcha/api.js';
                    script.onload = function() {
                        setTimeout(() => loadRecaptcha(), 500);
                    };
                    script.onerror = function() {
                        console.error('Failed to load reCAPTCHA API');
                        errorMessage.textContent = "Failed to load reCAPTCHA. Please check your internet connection.";
                        errorMessage.style.display = "block";
                    };
                    document.head.appendChild(script);
                }
            }

            modalContent.appendChild(modalText);
            modalContent.appendChild(recaptchaContainer);
            modalContent.appendChild(errorMessage);
            modal.appendChild(modalContent);
            document.body.appendChild(modal);

            setTimeout(() => loadRecaptcha(), 100);
        }

        // Assign onclick to all calendly triggers
        for (let i = 0; i < calendlyTriggers.length; i++) {
            calendlyTriggers[i].onclick = handleCalendlyClick;
        }
    }
</script>
	.color_primary { color: #88704c; }
	.color_secondary { color: #00346b; }
	.color_tertiary { color: #a38e6d; }
	.color_text_headline { color: #000000; }
	.color_text_body { color: #444444; }
	.color_text_minor { color: #666666; }
	.color_text_link { color: #06f; }
	.color_text_link_rm { color: #88704c; }
	.color_footer_main_bg { color: #31313a; }
	.color_footer_top_bg { color: #f7f7ff; }
	.color_btn_primary_dark { color: #af9367; }
	.color_btn_primary_light { color: #af9367; }
	.color_btn_secondary_dark { color: #fac800; }
	.color_btn_secondary_light { color: #fac800; }
	.color_btn_tertiary_dark { color: #555555; }
	.color_btn_tertiary_light { color: #888888; }
	.color_nav_desktop_dark { color: #31313a; }
	.color_nav_desktop_light { color: #31313a; }
	.color_promo_banner { color: #31313a; }
		a { color: #88704c; }
	.text_gold, .color_gold {color: #88704c !important;}
	.btn_rm_txt,
	.lsts .p_read_more a,
	.page_text_cta .p_read_more a,
	.lsts .p_rm a,
	.page_home_text .p_rm a,
	.product .p_rm a {color: #88704c !important;}
		.top_banner div.txt,
	.page_home_text h1,
	.page_home_text h2,
	.pageText h1,
	.pageText h2,
	.lsts h3.sectionTitle,
	.lsts h4.sectionTitle,
	.lsts h5.sectionTitle,
	.placeNamesLinks h4,
	.placeNamesLinks h5,
	h5,
	h6,
	label.css-label,
	form label {color:#000000!important;}
	p,
	header .container_header_navigation li.active > a,
	header .headerItineraryItem p strong,
	.product h3, .product h5.header, .product p.header, .page_text_cta p.header,
	.product .desc p,
	.lsts .desc p,
	.product .layout_hotel .imageMap_ski_data table tr td,
	.pageProduct .desc h2.intro,
	.pageProduct .desc h3.inline,
	.pageProduct .desc ul,
	.pageProduct .productPricing span,
	.page_listings_description p,
	.page_listings_description h2.inline,
	.page_listings_description h3.inline,
	.page_listings_description h5.listingKeywords,
	.page_text h2.inline,
	.page_text h3.inline,
	.page_listings_refine p,
	.page_home_text h3.intro_text,
	.psri_intro p a.noColor,
	.page_home_text p,
	.breadcrumb>li,
	.product .pageProductCTA h5.titleCTA,
	.product .pageProductDepatureDates p,
	.product .hdr p,
	.product .hdr .duration_departs,
	.product .desc table.pricing_table,
	.product .desc table.pricing_table .table_class_price p,
	.pageProduct .desc strong,
	.pageProduct .desc .itineraryGlance,
	.product .layout_hotel .incl ul li,
	.pageProduct .desc .glance p em,
	.pageProduct .productPricingBottom,
	.page_staff_desc p,
	.page_staff_desc h2.inline,
	.page_staff_extra_text .text,
	.page_staff_testimonial blockquote {color:#444444;}
	.psr_fil div span {color:#666666;}
	header .container_header_call_to_action li.phone_number,
	p.titleHeader,
	p.titleHeaderSearch > span,
	.pageText h1,
	.pageProduct .productHeader h1,
	p.title,
	.modal-header h2,
	.pageAboutStaff h3,
	.page_staff_extra_text .title,
	.page_staff_cta_container_nocta .page_staff_cta_container_top p,
	.slider_home_testimonials p.testimonial_title,
	.pageItineraryRowInfo p.title a,
	.modal-header div.title,
	.modalRemove h2,
	.modalEdit p.title,
	.psr_fil p,
	.product .desc p em,
	.product .desc table.pricing_table .table_class_name,
	.product .pageProductCTA .CTAproductHeader,
	.product .staff p.staffName,
	.pageProductCTA .productHeader h5,
	.pageProduct .desc .glance .itineraryHeader em,
	.page_about_staff_container > h3 { color:#88704c!important }
	.page_staff_extra_text .text:before,.page_staff_extra_text .text:after { color:#a38e6d; }
	.pageProduct .productHeader label,
	.pageProduct .desc .glance .bull .day::after { background-color: #88704c; }
	.top_banner div.txt a {color:#06f;}
	#ftr_t {background-color:#f7f7ff;}
	#ftr_m, #ftr_b {background-color:#31313a;}
		.nav2021 { background:#31313a!important; background:-moz-linear-gradient(top,#31313a 0%,#31313a 100%)!important; background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#31313a),color-stop(100%,#31313a))!important; background:-webkit-linear-gradient(top,#31313a 0%,#31313a 100%)!important; background:-o-linear-gradient(top,#31313a 0%,#31313a 100%)!important; background:-ms-linear-gradient(top,#31313a 0%,#31313a 100%)!important; background:linear-gradient(to bottom,#31313a 0%,#31313a 100%)!important }
	.header_base {background-color: #31313a;}
	.ban.promo {background-color: #31313a;}
		.btn{font-weight:500;}
					.btn_psri,
	.btn_load_posts {background:-moz-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#af9367),color-stop(100%,#af9367)) ;background:-webkit-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:-o-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:-ms-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:linear-gradient(to bottom,#af9367 0%,#af9367 100%);border:1px solid #af9367;}
	.btn_psri:hover, .btn_load_posts:hover {color:#FFF!important;background:#88704c!important;}
	.btn-plus{background:-moz-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#af9367),color-stop(100%,#af9367)) ;background:-webkit-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:-o-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:-ms-linear-gradient(top,#af9367 0%,#af9367 100%) ;background:linear-gradient(to bottom,#af9367 0%,#af9367 100%);border:1px solid #af9367 ;}
	.btn-plus:hover{color:#FFF!important;background-color:#88704c;}
	.btn-success { background:-moz-linear-gradient(top,#fac800 0%,#fac800 100%)!important; background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#fac800),color-stop(100%,#fac800))!important; background:-webkit-linear-gradient(top,#fac800 0%,#fac800 100%)!important; background:-o-linear-gradient(top,#fac800 0%,#fac800 100%)!important; background:-ms-linear-gradient(top,#fac800 0%,#fac800 100%)!important; background:linear-gradient(to bottom,#fac800 0%,#fac800 100%)!important; background-color:#fac800!important; border:1px solid #fac800;}
	.btn-success:hover {color:#FFF!important;background:#fbad0f!important; }
	.btn-close,
	.btn-productFeature,
	.btn-viewMap,
	.btn-quickView,
	.btn-print { color:#fff!important; text-decoration:none!important;background:#555555!important;background:-moz-linear-gradient(top,#888888 0%,#555555 100%)!important; background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#888888),color-stop(100%,#555555))!important; background:-webkit-linear-gradient(top,#888888 0%,#555555 100%)!important; background:-o-linear-gradient(top,#888888 0%,#555555 100%)!important; background:-ms-linear-gradient(top,#888888 0%,#555555 100%)!important; background:linear-gradient(to bottom,#888888 0%,#555555 100%)!important; border:1px solid #888888!important;}
	.btn-close:hover,
	.btn-productFeature:hover,
	.btn-viewMap:hover,
	.btn-quickView:hover,
	.btn-print:hover {color:#FFF!important;background:#555555!important }
	#ftr_cta,
	.btn-action { color:#fff!important; text-decoration:none!important;background:#df252e!important;background:-moz-linear-gradient(top,#df252e 0%,#df252e 100%)!important; background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#df252e),color-stop(100%,#df252e))!important; background:-webkit-linear-gradient(top,#df252e 0%,#df252e 100%)!important; background:-o-linear-gradient(top,#df252e 0%,#df252e 100%)!important; background:-ms-linear-gradient(top,#df252e 0%,#df252e 100%)!important; background:linear-gradient(to bottom,#df252e 0%,#df252e 100%)!important; border:1px solid #df252e!important;}
	.btn-action:hover {color:#FFF!important;background:#ba141d!important }
	.btn-black {color:#FFF!important;background:#000!important }
	.btn-black:hover {color:#FFF!important;background:#333!important }
	.btn.btn-larger {font-size:1.2em;padding:7px 12px 9px 12px;}
	.btn.btn-bold {font-weight:bold;}
	.nav.nav_dd > li.favs a .favs {background-color:#df252e!important;}
