(function () { // Configuración de idioma para LightGallery const lang = document.documentElement.lang || "es"; const translations = { es: { zoom: "Zoom", fullscreen: "Pantalla completa", close: "Cerrar", previous: "Anterior", next: "Siguiente", }, en: { zoom: "Zoom", fullscreen: "Fullscreen", close: "Close", previous: "Previous", next: "Next", }, }; const currentLang = translations[lang] || translations.es; // Esperar a que cargue todo function initGallery() { var galleryItems = document.querySelectorAll(".gallery-item"); if (!galleryItems || galleryItems.length === 0) { console.log("No hay elementos de galería"); return; } // Verificar que lightGallery existe if (typeof lightGallery === "undefined") { console.error("LightGallery no cargado, reintentando..."); setTimeout(initGallery, 500); return; } // Configurar cada item galleryItems.forEach(function (item, index) { item.addEventListener("click", function (e) { e.preventDefault(); // Construir array de imágenes var items = []; galleryItems.forEach(function (el) { var src = el.getAttribute("data-src"); var title = ""; var titleEl = el.querySelector(".gallery-title"); if (titleEl) { title = titleEl.textContent.trim(); } items.push({ src: src, thumb: src, subHtml: '