.elementor-kit-7{--e-global-color-primary:#6EC1E4;--e-global-color-secondary:#54595F;--e-global-color-text:#7A7A7A;--e-global-color-accent:#61CE70;--e-global-color-c6218cc:#8D876E;--e-global-color-0167d46:#A95335;--e-global-color-0a9f3b9:#D6CBB5;--e-global-color-4929408:#33373A;--e-global-typography-primary-font-family:"Roboto";--e-global-typography-primary-font-weight:600;--e-global-typography-secondary-font-family:"Roboto Slab";--e-global-typography-secondary-font-weight:400;--e-global-typography-text-font-family:"Roboto";--e-global-typography-text-font-weight:400;--e-global-typography-accent-font-family:"Roboto";--e-global-typography-accent-font-weight:500;}.elementor-kit-7 e-page-transition{background-color:#FFBC7D;}.elementor-section.elementor-section-boxed > .elementor-container{max-width:1140px;}.e-con{--container-max-width:1140px;}.elementor-widget:not(:last-child){--kit-widget-spacing:20px;}.elementor-element{--widgets-spacing:20px 20px;--widgets-spacing-row:20px;--widgets-spacing-column:20px;}{}h1.entry-title{display:var(--page-title-display);}@media(max-width:1024px){.elementor-section.elementor-section-boxed > .elementor-container{max-width:1024px;}.e-con{--container-max-width:1024px;}}@media(max-width:767px){.elementor-section.elementor-section-boxed > .elementor-container{max-width:767px;}.e-con{--container-max-width:767px;}}/* Start custom CSS */<script>
(function($){
  const POPUP_ID = 391; // tu popup
  const TARGET_ID = '#popup-acf-gallery';

  function getGalleryHtml($trigger){
    const $card = $trigger.closest('.e-loop-item, [data-elementor-type="loop-item"], .elementor-post, .elementor-grid-item');
    if(!$card.length) return '';
    const $gal = $card.find('.acf-gallery-hidden').first();
    return $gal.length ? $gal.html() : '';
  }

  function injectWhenReady(html, tries=0){
    const $target = $(TARGET_ID);
    if ($target.length){
      $target.empty().append(html);
      if (window.elementorFrontend && elementorFrontend.elementsHandler) {
        elementorFrontend.elementsHandler.runReadyTrigger($(TARGET_ID));
      }
      return;
    }
    if (tries < 60) { setTimeout(function(){ injectWhenReady(html, tries+1); }, 50); }
  }

  $(document).on('click', '.open-acf-gallery', function(e){
    e.preventDefault();
    const html = getGalleryHtml($(this));
    if (window.elementorProFrontend && elementorProFrontend.modules && elementorProFrontend.modules.popup){
      elementorProFrontend.modules.popup.showPopup({ id: POPUP_ID });
    }
    if (html && html.trim()){
      injectWhenReady(html);
    } else {
      injectWhenReady('<p style="text-align:center;margin:2rem 0">No se encontró la galería en esta tarjeta.</p>');
    }
  });

})(jQuery);
</script>/* End custom CSS */