{% extends '@nucleus/partials/particle.html.twig' %}

{% block stylesheets %}
<style>
{% if particle.gallery_masonry and particle.gallery_parallax %}
#{{id}} {box-sizing: content-box;}
{% endif %}
{% if particle.particle_title_color or particle.particle_title_fontsize %}
#{{ id }}.g5-particle-title { {% if particle.particle_title_color %}color: {{ particle.particle_title_color }};{% endif %}{% if particle.particle_title_fontsize %}font-size: {{particle.particle_title_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.customize_title_color or particle.customize_title_fontsize %}
#{{ id }} .tm-title { {% if particle.customize_title_color %}color: {{particle.customize_title_color}}; {% endif %}{% if particle.customize_title_fontsize %}font-size: {{particle.customize_title_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.customize_content_color or particle.customize_content_fontsize %}
#{{ id }} .tm-content { {% if particle.customize_content_color %}color: {{particle.customize_content_color}};{% endif %}{% if particle.customize_content_fontsize %} font-size: {{particle.customize_content_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.meta_color or particle.meta_fontsize %}
#{{ id }} .tm-meta { {% if particle.meta_color %}color: {{particle.meta_color}};{% endif %}{% if particle.meta_fontsize %} font-size: {{particle.meta_fontsize}}px;{% endif %} }
{% endif %}
</style>
{% endblock %}

{# Set Viewport Height #}
{% if particle.viewport_height == 'full' %}
    {% set viewport_height = 'jl-height-viewport="offset-top: true;"' %}
{% elseif particle.viewport_height == 'percent' %}
    {% set viewport_height = 'jl-height-viewport="offset-top: true; offset-bottom: 20;"' %}
{% elseif particle.viewport_height == 'section' %}
    {% set viewport_height = 'jl-height-viewport="offset-top: true; offset-bottom: 50;"' %}
{% elseif particle.viewport_height == 'expand' %}
    {% set viewport_height = 'jl-height-viewport="expand: true;"' %}
{% endif %}

{# Set Max-Width Content Section #}
{% set container_maxwidth = particle.container_maxwidth != 'default' ? 'jl-container jl-container-' ~ particle.container_maxwidth|e ~ '' : 'jl-container' %}

{# Set Padding #}
{% if particle.padding == 'default' %}
    {% set padding = ' jl-section' %}
{% elseif particle.padding == 'none' %}
    {% set padding = ' jl-section jl-padding-remove-vertical' %}
{% else %}
    {% set padding = ' jl-section jl-section-' ~ particle.padding|e ~ '' %}
{% endif %}

{# Set Background color #}
{% set parallax_bg_color = particle.parallax_bg_color ? 'style="background-color: ' ~ particle.parallax_bg_color ~ ';"' %}
{% set parallax_overlay = (particle.parallax_bg_overlay ? '<div class="jl-position-cover" style="background-color: '~ particle.parallax_bg_overlay ~';"></div>') %}
{% set parallax_easing = particle.parallax_easing ? 'easing:' ~ particle.parallax_easing / 10 ~ '' %}

{# Set Max-Width Content #}
{% set content_maxwidth %}
{% if particle.g_maxwidth != 'inherit' %} jl-width-{{particle.g_maxwidth}}{% if particle.g_maxwidth_breakpoint != 'always' %}@{{particle.g_maxwidth_breakpoint}}{% endif %}{% if particle.g_maxwidth_alignment == 'left' %}{% elseif particle.g_maxwidth_alignment == 'center' %} jl-margin-auto{% else %} jl-margin-auto-left{% endif %}{% endif %}
{% endset %}

{# Set Parallax Background #}
{% set parallaxbackground %}
{% if particle.parallax_image %}
<div data-src="{{ url(particle.parallax_image)|e }}" class="jl-background-norepeat{{ particle.parallax_bg_overlay ? ' jl-position-relative' : '' }}{{padding}} jl-background-{{particle.background_image_position|e}}{% if particle.background_image_size != 'auto' %} jl-background-{{particle.background_image_size|e}}{% endif %}{% if particle.parallax_bg_visibility != 'always' %} jl-background-image@{{particle.parallax_bg_visibility|e}}{% endif %}{% if particle.vertical_alignment != 'none' %} jl-flex jl-flex-{{particle.vertical_alignment|e}}{% endif %}{% if particle.parallax_text_color != 'default' %} jl-{{particle.parallax_text_color|e}}{% endif %}{% if particle.blendmode != 'inherit' %} jl-background-blend-{{particle.blendmode|e}}{% endif %}" {{parallax_bg_color|default('')|raw}}{% if particle.horizontal_start or particle.horizontal_end or particle.vertical_start or particle.vertical_end or particle.parallax_easing %} jl-parallax="{% if particle.horizontal_start or particle.horizontal_end %}bgx: {{particle.horizontal_start|e}},{{particle.horizontal_end|e}};{% endif %}{% if particle.vertical_start or particle.vertical_end %}bgy: {{particle.vertical_start|e}},{{particle.vertical_end|e}};{% endif %}{% if particle.parallax_bg_breakpoint != 'always' %} media: @{{particle.parallax_bg_breakpoint|e}};{% endif %}{{parallax_easing}}" {% endif %} jl-img {{viewport_height|raw}}>
{{parallax_overlay|raw}}
{% if particle.container_maxwidth != 'none' %}
<div class="{{container_maxwidth}}">
{% endif %}
{% endif %}
{% endset %}

{# End Parallax Background #}
{% set endparallaxbackground %}
{% if particle.parallax_image %}
{% if particle.container_maxwidth != 'none' %}
</div>
{% endif %}
</div>
{% endif %}
{% endset %}

{# Set Horizontal #}
{% set pahorizontal %}
{% if particle.pa_horizontal_start or particle.pa_horizontal_end %}x: {% if particle.pa_horizontal_start == '' %}0{% else %}{{particle.pa_horizontal_start }}{% endif %},{% if particle.pa_horizontal_end == '' %}0{% else %}{{particle.pa_horizontal_end }}{% endif %};{% endif %}
{% endset %}

{# Set Vertical #}
{% set pavertical %}
{% if particle.pa_vertical_start or particle.pa_vertical_end %}y: {% if particle.pa_vertical_start == '' %}0{% else %}{{particle.pa_vertical_start }}{% endif %},{% if particle.pa_vertical_end == '' %}0{% else %}{{particle.pa_vertical_end }}{% endif %};{% endif %}
{% endset %}

{# Set Scale #}
{% set scale %}
{% if particle.scale_start or particle.scale_end %}scale: {% if particle.scale_start == '' %}1{% else %}{{particle.scale_start / 100 }}{% endif %},{% if particle.scale_end == '' %}1{% else %} {{particle.scale_end / 100 }}{% endif %};{% endif %}
{% endset %}

{# Set Rotate #}
{% set rotate %}{% if particle.rotate_start or particle.rotate_end %}
rotate: {% if particle.rotate_start == '' %}0{% else %}{{particle.rotate_start}}{% endif %},{% if particle.rotate_end == '' %}0{% else %}{{particle.rotate_end}}{% endif %};{% endif %}
{% endset %}

{# Set Opacity #}
{% set opacity %}
{% if particle.opacity_start or particle.opacity_end %}opacity: {% if particle.opacity_start == '' %}1{% else %}{{particle.opacity_start / 100 }}{% endif %},{% if particle.opacity_end == '' %}1{% else %}{{particle.opacity_end / 100 }}{% endif %};{% endif %}
{% endset %}

{# Set Scrollspy Animation #}
{% set scrollspy_cls = particle.animation != 'inherit' and particle.animation != 'parallax' ? ' jl-scrollspy-class' %}

{# Set Animation #}
{% set animation %}
{% if particle.animation != 'inherit' and particle.animation != 'parallax' %} jl-scrollspy="target: [jl-scrollspy-class]; cls: jl-animation-{{particle.animation|e}};{% if particle.animation_repeat == 'enabled' %} repeat: true;{% endif %} delay:{% if particle.delay_element_animations %} {{particle.animation_delay|default('200')|e}};{% else %} false;{% endif %}"
{% elseif particle.animation == 'parallax' %}
{% if particle.pa_horizontal_start or particle.pa_horizontal_end or particle.pa_vertical_start or particle.pa_vertical_end or particle.scale_start or particle.scale_end or particle.rotate_start or particle.rotate_end or particle.opacity_start or particle.opacity_end or particle.easing or particle.pa_viewport or particle.pa_breakpoint %} jl-parallax="{{pahorizontal}}{{pavertical}}{{scale}}{{rotate}}{{opacity}}{% if particle.easing == '' %}{% else %}easing: {{ particle.easing / 100 }};{% endif %}{% if particle.pa_viewport != '' %}viewport:{{ particle.pa_viewport / 100 }};{% endif %}{% if particle.pa_breakpoint != 'always' %}media: @{{particle.pa_breakpoint|e}}{% endif %}"{% endif %}
{% endif %}
{% endset %}

{# Set Particle Alignment #}
{% set particle_alignment %}
{% if particle.align != 'inherit' %} jl-text-{{particle.align|e}}{% if particle.breakpoint != 'always' %}@{{particle.breakpoint|e}}{% endif %}{% endif %}{% if particle.align != 'inherit' and particle.breakpoint != 'always' %}{% if particle.fallback != 'inherit' %} jl-text-{{particle.fallback|e}}{% endif %}{% endif %}
{% endset %}

{# Set Item Max Width Class #}
{% set item_maxwidth_cls = particle.item_maxwidth != 'none' ? ' jl-margin-auto jl-width-' ~ particle.item_maxwidth|e ~ '' %}

{# Set Transition for title/meta/content/link if overlay on hover is set #}
{% if particle.overlay_hover %}
{% set title_transition = particle.title_transition != 'none' ? ' jl-transition-' ~ particle.title_transition|e ~ '' %}
{% set meta_transition = particle.meta_transition != 'none' ? ' jl-transition-' ~ particle.meta_transition|e ~ '' %}
{% set content_transition = particle.content_transition != 'none' ? ' jl-transition-' ~ particle.content_transition|e ~ '' %}
{% set link_transition = particle.link_transition != 'none' ? ' jl-transition-' ~ particle.link_transition|e ~ '' %}
{% endif %}

{# Overlay Transition #}
{% set overlay_transition = particle.overlay_hover ? ' jl-transition-' ~ particle.overlay_transition|e ~ '' %}

{# Image Transition #}
{% set image_transition = particle.image_transition != 'none' ? ' jl-transition-' ~ particle.image_transition|e ~ ' jl-transition-opaque' %}
{% set image_hover_transition = particle.image_transition == 'none' ? ' jl-transition-fade' : ' jl-transition-' ~ particle.image_transition|e ~ '' %}

{# Image Box Shadow #}
{% set image_boxshadow = particle.box_shadow != 'none' ? ' jl-box-shadow-' ~ particle.box_shadow|e ~ '' %}
{% set image_boxshadow_hover = particle.box_shadow_hover != 'none' ? ' jl-box-shadow-hover-' ~ particle.box_shadow_hover|e ~ '' %}

{# set Particle Title Style #}
{% set particle_title_style %}
{% if particle.particle_title %}
<{{particle.particle_title_element|e}} id="{{ id }}" class="g5-particle-title{% if particle.particle_title_align != 'inherit' %} jl-text-{{particle.particle_title_align|e}}{% endif %}{% if particle.particle_predefined_color != 'default' %} jl-text-{{particle.particle_predefined_color|e}}{% endif %}{% if particle.particle_title_style != 'default' %} jl-{{particle.particle_title_style|e}}{% endif %}{% if particle.particle_title_decoration != 'none' %} jl-heading-{{particle.particle_title_decoration|e}}{% endif %}">
{% if particle.particle_title_decoration == 'line' %} 
<span>
{% endif %}
{{particle.particle_title|raw}}
{% if particle.particle_title_decoration == 'line' %} 
</span>
{% endif %}
</{{particle.particle_title_element|e}}>
{% endif %}
{% endset %}

{# Set Lightbox/Masonry/Parallax #}
{% set gallery_lightbox = particle.gallery_lightbox ? 'jl-lightbox="toggle: a[data-type]"' %}
{% set gallery_masonry = particle.gallery_masonry ? 'masonry: 1;' %}
{% set gallery_parallax = particle.gallery_parallax ? ' parallax: ' ~ particle.gallery_parallax ~ ';' %}

{# Set Button Class #}
{% set button_cls %}
{% if particle.buttonclass == 'link' %}jl-link{% elseif particle.buttonclass == 'link-muted' or particle.buttonclass == 'link-text' %}jl-{{particle.buttonclass|e}}{% else %}jl-button jl-button-{{particle.buttonclass|e}}{% endif %}
{% endset %}

{# Set Button Size #}
{% set button_size %}
{% if particle.buttonclass == 'link' or particle.buttonclass == 'link-muted' or particle.buttonclass == 'link-text' or particle.buttonclass == 'text' %}{% else %}{% if particle.link_button_size != 'default' %} jl-button-{{particle.link_button_size|e}}{% endif %}{% endif %}
{% endset %}

{% if particle.filter_alignment != 'left' %}
{% set filter_alignment = particle.filter_alignment != 'justify' ? ' jl-flex-' ~ particle.filter_alignment|e ~ '' : ' jl-child-width-expand' %}
{% endif %}

{# Set Nav Filter Style #}
{% set filter_primary = particle.filter_primary ? 'jl-nav-primary' : 'jl-nav-default' %}

{# Set Filter Style #}
{% set filterstyle %}
{% if particle.filter_style == 'tab' %}
    <ul class="jl-tab{{filter_alignment}}{% if particle.filter_margin == 'default' %} jl-margin{% else %} jl-margin-{{ particle.filter_margin|e }}{% endif %}">
{% else %}
    <ul class="jl-subnav{% if particle.filter_style != 'subnav' %} jl-{{particle.filter_style|e}}{% endif %}{{filter_alignment}}{% if particle.filter_margin == 'default' %} jl-margin{% else %} jl-margin-{{ particle.filter_margin|e }}{% endif %}">
{% endif %}
{% endset %}

{# Set Grid Filter Style #}
{% set grid_filter %}
{% if particle.filter_style == 'tab' %}
    <ul class="jl-tab-{{ particle.filter_position }} jl-tab" jl-tab="media: @{{ particle.filter_grid_breakpoint|e }}">
{% else %}
    <ul class="jl-nav {{filter_primary}}" jl-toggle="cls: jl-nav {{filter_primary}} jl-tex-left jl-subnav{% if particle.filter_style != 'subnav' %} jl-{{particle.filter_style|e}}{% endif %}; mode: media; media: @{{ particle.filter_grid_breakpoint|e }}">
{% endif %}
{% endset %}

{# Set title hover #}
{% set title_hover = (particle.title_hover ? ' class="jl-link-'~ particle.title_hover ~'"') %}

{% set grid_column_gap = particle.grid_column_gap != 'default' ? ' jl-grid-column-' ~ particle.grid_column_gap ~ '' %}
{% set grid_row_gap = particle.grid_row_gap != 'default' ? ' jl-grid-row-' ~ particle.grid_row_gap ~ '' %}

{% if ( particle.grid_column_gap == particle.grid_row_gap ) and not (particle.grid_column_gap == 'default' and particle.grid_row_gap == 'default') %}
    {% set grid_cr_gap = ' jl-grid-' ~ particle.grid_column_gap ~ '' %}
{% else %}
    {% set grid_cr_gap = grid_column_gap ~ grid_row_gap %}
{% endif %}

{# Set Content #}
{% set gallery_content %}
{% for item in particle.items %}

{# Set Link Scroll #}
{% set linkscroll = item.link|e matches '/#/' ? ' jl-scroll' %}

{% set overlay_color %}
{% if item.item_color %} jl-{{ item.item_color|e }}{% elseif particle.overlay_color != 'default' %} jl-{{ particle.overlay_color|e }}{% endif %}
{% endset %}

{% set captiontitle = (particle.show_title == 'default' or particle.show_title == 'lightbox' ? '<h4 class="jl-margin-remove">'~ item.title|raw ~'</h4>') %}
{% set captioncontent = (particle.show_content == 'default' or particle.show_content == 'lightbox' ? item.content|raw ) %}
{% set caption %}
{% if item.title or item.content %} data-caption="{{ captiontitle }}{{ captioncontent }}"{% endif %}
{% endset %}

{# Set Meta Content #}
{% set item_meta %}
{% if item.meta %}
<div class="tm-meta{% if particle.meta_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.meta_margin_top|e }}-top{% endif %}{% if particle.pre_meta_color == 'default' %}{% else %} jl-text-{{ particle.pre_meta_color|e }}{% endif %}{% if particle.meta_style != 'default' %} jl-{{ particle.meta_style|e }}{% endif %}{{meta_transition}}">
    {{item.meta|raw}}
</div>
{% endif %}
{% endset %}

{% set tab_transition = particle.overlay_hover or item.hover_image or particle.image_transition != 'none' ? ' tabindex="0"' %}
{% set toggle_transition = particle.overlay_hover or item.hover_image or particle.image_transition != 'none' ? ' jl-transition-toggle' %}

{% set item_data_tags %}
{% set tags = item.tags|split(',') %}
{% for tag in tags %}{{tag|e|capitalize|trim|replace({" " : "-"})}} {% endfor %}
{% endset %}

{% if item.tags != '' %}
    <div data-tag="{{item_data_tags|trim}}">
{% else %}
    <div>
{% endif %}

{% if particle.link_overlay %}

{% if particle.gallery_lightbox %}

{% if item.link %}
    <a class="tm-item jl-inline-clip{{toggle_transition}}{{item_maxwidth_cls}}{{image_boxshadow}}{{image_boxshadow_hover}} jl-link-toggle{% if item.item_class %} {{ item.item_class }}{% endif %}" data-type="iframe" href="{{item.link|e}}" title="{{ item.title|e }}"{{tab_transition|raw}}{{scrollspy_cls}}{{caption}}>
{% else %}
    <a class="tm-item jl-inline-clip{{toggle_transition}}{{item_maxwidth_cls}}{{image_boxshadow}}{{image_boxshadow_hover}} jl-link-toggle{% if item.item_class %} {{ item.item_class }}{% endif %}" data-type="image" href="{{ url(item.glrimg)|e }}" title="{{ item.title|e }}"{{tab_transition|raw}}{{scrollspy_cls}}{{caption}}>
{% endif %}

{% else %}

{% if item.link %}
    <a class="tm-item jl-inline-clip{{toggle_transition}}{{item_maxwidth_cls}}{{image_boxshadow}}{{image_boxshadow_hover}} jl-link-toggle{% if item.item_class %} {{ item.item_class }}{% endif %}" href="{{item.link|e}}" target="{{ particle.buttontarget|default('_self')|e }}" title="{{ item.title|e }}"{{tab_transition|raw}}{{scrollspy_cls}}{{linkscroll}}>
{% else %}
    <div class="tm-item jl-inline-clip{{toggle_transition}}{{item_maxwidth_cls}}{{image_boxshadow}}{{image_boxshadow_hover}}{% if item.item_class %} {{ item.item_class }}{% endif %}"{{tab_transition|raw}}{{scrollspy_cls}}>
{% endif %}

{% endif %}

{% else %}

    <div class="tm-item jl-inline-clip{{toggle_transition}}{{item_maxwidth_cls}}{{image_boxshadow}}{{image_boxshadow_hover}}{% if item.item_class %} {{ item.item_class }}{% endif %}"{{tab_transition|raw}}{{scrollspy_cls}}>

{% endif %}

{% if item.hover_image != '' %}

{% if item.glrimg %}
    <img class="tm-image" src="{{ url(item.glrimg)|e }}"{% if item.altimg %} alt="{{item.altimg|e}}"{% endif %}>
{% endif %}

{% if item.hover_image %}
    <div class="jl-position-cover{{image_hover_transition}}">
        <img class="tm-image" src="{{ url(item.hover_image)|e }}"{% if item.altimg %} alt="{{item.altimg|e}}"{% endif %} jl-cover>
    </div>
{% endif %}

{% else %}

{% if item.glrimg %}
    <img class="tm-image{{image_transition}}" src="{{ url(item.glrimg)|e }}"{% if item.altimg %} alt="{{item.altimg|e}}"{% endif %}>
{% endif %}

{% endif %}

{# Load Overlay Style #}
{% if item.title or item.meta or item.content %}

{% if particle.overlay_style == 'none' %}
<div class="{% if particle.overlay_position %}jl-position-{{ particle.overlay_position|e }}{% endif %}">

<div class="jl-panel{{overlay_color}}{% if particle.overlay_padding == 'default' %} jl-padding{% else %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{{overlay_transition}} jl-margin-remove-first-child">

{% else %}

{% if particle.overlay_mode == 'cover' %}
    <div class="jl-position-cover{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}{% if particle.overlay_style %} {{ particle.overlay_style|e }}{% endif %}{{overlay_transition}}"></div>
{% endif %}

<div class="{% if particle.overlay_position %}jl-position-{{ particle.overlay_position|e }}{% endif %}{% if particle.overlay_margin != 'none' %} jl-position-{{ particle.overlay_margin|e }}{% endif %}">

{% if particle.overlay_mode == 'cover' %}
    <div class="jl-overlay{{overlay_color}}{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.animate_background != true %}{{overlay_transition}}{% endif %} jl-margin-remove-first-child">
{% else %}
    <div class="jl-overlay{{overlay_color}}{% if particle.overlay_padding != 'default' %} jl-padding-{{ particle.overlay_padding|e }}{% endif %}{% if particle.overlay_maxwidth != 'none' %} jl-width-{{ particle.overlay_maxwidth|e }}{% endif %}{% if particle.overlay_style %} {{ particle.overlay_style|e }}{% endif %}{{overlay_transition}} jl-margin-remove-first-child">
{% endif %}

{% endif %}

{% if particle.meta_alignment == 'top' %}
    {{item_meta}}
{% endif %}

{% if item.title %}
<{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_style != 'default' %} jl-{{ particle.title_style|e }}{% endif %}{% if particle.title_color != 'default' %} jl-text-{{ particle.title_color|e }}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}{{title_transition}}">
{% if particle.title_decoration == 'line' %}
<span>
{% endif %}
{% if particle.link_title == true and particle.link_overlay == false %}
{% if particle.gallery_lightbox %}
{% if item.link %}
<a{{ title_hover|raw }} data-type="iframe" href="{{item.link|e}}" title="{{ item.title|e }}"{{caption}}>{{ item.title|raw }}</a>
{% else %}
<a{{ title_hover|raw }} data-type="image" href="{{ url(item.glrimg)|e }}" title="{{ item.title|e }}"{{caption}}>{{ item.title|raw }}</a>
{% endif %}
{% else %}
{% if item.link %}
<a{{ title_hover|raw }} href="{{item.link|e}}" target="{{ particle.buttontarget|default('_self')|e }}" title="{{ item.title|e }}"{{linkscroll}}>{{ item.title|raw }}</a>
{% else %}
{{ item.title|raw }}
{% endif %}
{% endif %}
{% else %}
{{ item.title|raw }}
{% endif %}
{% if particle.title_decoration == 'line' %}
</span>
{% endif %}
</{{particle.title_element|e}}>
{% endif %}

{% if particle.meta_alignment == 'bottom' %}
    {{item_meta}}
{% endif %}

{% if item.content %}
<div class="tm-content jl-panel{% if particle.content_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.content_margin_top|e }}-top{% endif %}{% if particle.content_style != 'default' %} jl-text-{{ particle.content_style|e }}{% endif %}{% if particle.content_text_color != 'default' %} jl-text-{{ particle.content_text_color|e }}{% endif %}{{content_transition}}">
    {{item.content|raw}}
</div>
{% endif %}

{% if particle.meta_alignment == 'content' %}
    {{item_meta}}
{% endif %}

{# Button #}

{% if particle.buttontext %}

{% if particle.link_overlay %}

{% if item.link %}
<div class="{% if particle.link_margin_top == 'default' %}jl-margin-top{% else %}jl-margin-{{ particle.link_margin_top|e }}-top{% endif %}{{link_transition}}">
    <div class="{{button_cls}}{{button_size}}">{{ particle.buttontext|e }}</div>
</div>
{% endif %}

{% else %}

{% if particle.gallery_lightbox %}
<div class="{% if particle.link_margin_top == 'default' %}jl-margin-top{% else %}jl-margin-{{ particle.link_margin_top|e }}-top{% endif %}{{link_transition}}">
    {% if item.link %}
        <a data-type="iframe" href="{{item.link|e}}" title="{{ particle.buttontext|e }}" class="{{button_cls}}{{button_size}}"{{caption}}>{{ particle.buttontext|e }}</a>
    {% else %}
        <a data-type="image" href="{{ url(item.glrimg)|e }}" class="{{button_cls}}{{button_size}}"{{caption}}>{{ particle.buttontext|e }}</a>
    {% endif %}
</div>
{% else %}

{% if item.link %}
<div class="{% if particle.link_margin_top == 'default' %}jl-margin-top{% else %}jl-margin-{{ particle.link_margin_top|e }}-top{% endif %}{{link_transition}}">
    <a href="{{item.link|e}}" target="{{ particle.buttontarget|default('_self')|e }}" title="{{ item.title|e }}" class="{{button_cls}}{{button_size}}"{{linkscroll}}>{{ particle.buttontext|e }}</a>
</div>
{% endif %}

{% endif %}

{% endif %}

{% endif %}

{# End Button #}

</div>

</div>
{% endif %}

{# End Overlay Style #}

{% if particle.link_overlay %}
{% if particle.gallery_lightbox or item.link %}
</a>
{% else %}
</div>
{% endif %}
{% else %}
</div>
{% endif %}

{# End Link Type #}

</div>

{% endfor %}

{% endset %}

{% set filter_grid_column_gap = particle.filter_grid_column_gap != 'default' ? ' jl-grid-column-' ~ particle.filter_grid_column_gap ~ '' %}
{% set filter_grid_row_gap = particle.filter_grid_row_gap != 'default' ? ' jl-grid-row-' ~ particle.filter_grid_row_gap ~ '' %}

{% if ( particle.filter_grid_column_gap == particle.filter_grid_row_gap ) and not (particle.filter_grid_column_gap == 'default' and particle.filter_grid_row_gap == 'default') %}
    {% set filter_grid_cr_gap = ' jl-grid-' ~ particle.filter_grid_column_gap ~ '' %}
{% else %}
    {% set filter_grid_cr_gap = filter_grid_column_gap ~ filter_grid_row_gap %}
{% endif %}

{% block particle %}
{% if particle.enabled %}
{{parallaxbackground}}
{{particle_title_style}}
<div id="{{ id }}" class="{{id}}{{content_maxwidth}}{% if particle.class %} {{ particle.class }}{% endif %}{{particle_alignment}}{% if particle.margin == 'inherit' %}{% elseif particle.margin == 'default' %} jl-margin{% else %} jl-margin-{{particle.margin|e}}{% endif %}{% if particle.visibility != 'inherit' %} jl-visible@{{particle.visibility|e}}{% endif %}" jl-filter=".js-{{id}}">

{% set tags = {} %}
{% set alltags = {} %}
{% set counts = {} %}
{% set numb = 1 %}
{% for item in particle.items %}
{% set items = item.tags | split(',') %}
{% for i in items %}
{% set alltags = alltags | merge([i | capitalize | trim]) %}
{% if i | capitalize | trim not in tags %}
{% set tags = tags | merge([i | capitalize | trim]) | sort %}
{% endif %}
{% endfor %}
{% endfor %}
{% set countitems = particle.items|length %}

{% if particle.filter_position == 'top' %}

{{filterstyle}}

{% if particle.filter_control %}
    <li class="jl-active" jl-filter-control><a href="#" target="_self"{% if particle.tooltip %} jl-tooltip="title:{{countitems}}; pos: {{particle.tooltip_position}}"{% endif %}>{{ particle.filter_text|default('All')|raw }}</a></li>
{% endif %}

{% if particle.reverse_tags %}
{% set tags = tags|reverse %}
{% endif %}
{% for t in tags %}
{% set c = 0 %}
{% for tag in alltags if tag == t %}
{% set c = c + 1 %}
{% endfor %}
{% set counts = counts | merge([c]) %}

{% if t != '' %}
<li jl-filter-control="[data-tag~='{{t|replace({' ': '-'})}}']">
    <a href="#"{% if particle.tooltip %} jl-tooltip="title:{{c}}; pos: {{particle.tooltip_position}}"{% endif %}>{{t|capitalize}}</a>
</li>
{% endif %}

{% endfor %}

</ul>

<div class="js-{{id}}{{ particle.divider ? ' jl-grid-divider' : '' }}{{grid_cr_gap}}{% if particle.phone_portrait %} jl-child-width-1-{{ particle.phone_portrait|e }}{% endif %}{% if particle.phone_landscape != 'inherit' %} jl-child-width-1-{{ particle.phone_landscape|e }}@s{% endif %}{% if particle.tablet_landscape != 'inherit' %} jl-child-width-1-{{ particle.tablet_landscape|e }}@m{% endif %}{% if particle.desktop != 'inherit' %} jl-child-width-1-{{ particle.desktop|e }}@l{% endif %}{% if particle.large_desktop != 'inherit' %} jl-child-width-1-{{ particle.large_desktop|e }}@xl{% endif %}" jl-grid="{{gallery_masonry}}{{gallery_parallax}}"{{gallery_lightbox|raw}}{{animation}}>

{{gallery_content}}

</div>

{% else %}

<div class="jl-child-width-expand{{filter_grid_cr_gap}}" jl-grid>

<div class="jl-width-{{ particle.filter_grid_width }}@{{ particle.filter_grid_breakpoint|e }}{% if particle.filter_position == 'right' %} jl-flex-last@{{ particle.filter_grid_breakpoint|e }}{% endif %}">

{{grid_filter}}

{% if particle.filter_control %}
    <li class="jl-active" jl-filter-control><a href="#" target="_self"{% if particle.tooltip %} jl-tooltip="title:{{countitems}}; pos: {{particle.tooltip_position}}"{% endif %}>{{ particle.filter_text|default('All')|raw }}</a></li>
{% endif %}

{% if particle.reverse_tags %}
{% set tags = tags|reverse %}
{% endif %}
{% for t in tags %}
{% set c = 0 %}
{% for tag in alltags if tag == t %}
{% set c = c + 1 %}
{% endfor %}
{% set counts = counts | merge([c]) %}

{% if t != '' %}
<li jl-filter-control="[data-tag~='{{t|replace({' ': '-'})}}']">
    <a href="#"{% if particle.tooltip %} jl-tooltip="title:{{c}}; pos: {{particle.tooltip_position}}"{% endif %}>{{t|capitalize}}</a>
</li>
{% endif %}

{% endfor %}

</ul>

</div>

<div>

{% set center_columns = particle.center_columns ? ' jl-flex-center' %}
{% set center_rows = particle.center_rows ? ' jl-flex-middle' %}

<div class="js-{{id}}{{grid_cr_gap}}{{center_columns}}{{center_rows}}{{ particle.divider ? ' jl-grid-divider' : '' }}{% if particle.phone_portrait %} jl-child-width-1-{{ particle.phone_portrait|e }}{% endif %}{% if particle.phone_landscape != 'inherit' %} jl-child-width-1-{{ particle.phone_landscape|e }}@s{% endif %}{% if particle.tablet_landscape != 'inherit' %} jl-child-width-1-{{ particle.tablet_landscape|e }}@m{% endif %}{% if particle.desktop != 'inherit' %} jl-child-width-1-{{ particle.desktop|e }}@l{% endif %}{% if particle.large_desktop != 'inherit' %} jl-child-width-1-{{ particle.large_desktop|e }}@xl{% endif %}" jl-grid="{{gallery_masonry}}{{gallery_parallax}}"{{gallery_lightbox|raw}}{{animation}}>

{{gallery_content}}

</div>

</div>
</div>

{% endif %}

</div>

{{endparallaxbackground}}
{% endif %}
{% endblock %}