{# Section partial: Image Gallery #}
{#
    Parameters:
    - gallery: dict with enabled, title, images (list of {src, alt, caption})
    - lang: Current language code
    - default_lang: Fallback language
#}

{% macro render_gallery(gallery, lang, default_lang) %}
{% if gallery and gallery.enabled %}
<section class="py-16 lg:py-24 bg-white dark:bg-gray-800">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        {# Section header #}
        <div class="text-center mb-12">
            {% set title = gallery.title.translations.get(lang) or gallery.title.translations.get(default_lang) or '' %}
            {% if title %}
            <h2 class="text-3xl md:text-4xl font-bold text-gray-900 dark:text-white mb-4">
                {{ title }}
            </h2>
            {% endif %}
        </div>

        {# Image grid #}
        {% if gallery.images %}
        <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
            {% for image in gallery.images %}
            <div class="relative group overflow-hidden rounded-lg aspect-square">
                <img src="{{ image.src }}"
                     alt="{{ image.alt or '' }}"
                     class="w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"
                     loading="lazy">
                {% if image.caption %}
                <div class="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 to-transparent p-4 opacity-0 group-hover:opacity-100 transition-opacity">
                    <p class="text-sm text-white">{{ image.caption }}</p>
                </div>
                {% endif %}
            </div>
            {% endfor %}
        </div>
        {% endif %}
    </div>
</section>
{% endif %}
{% endmacro %}
