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

{% block stylesheets %}
<style>
{% if particle.grid_parallax and particle.grid_masonry %}
.{{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}} !important;{% endif %}{% if particle.customize_content_fontsize %} font-size: {{particle.customize_content_fontsize}}px;{% endif %} }
{% endif %}
#{{ id }} .tm-meta li span, #{{ id }} .tm-meta li a { {% if particle.meta_color %}color: {{particle.meta_color}};{% endif %}{% if particle.meta_fontsize %} font-size: {{particle.meta_fontsize}}px; {% else %} font-size: 13px;{% endif %} }
</style>
{% endblock %}

{# Set Title/Meta/Content Text Transform #}
{% set title_text_transform = particle.title_text_transform ? ' jl-text-' ~ particle.title_text_transform|e ~ '' %}
{% set meta_text_transform = particle.meta_text_transform ? ' jl-text-' ~ particle.meta_text_transform|e ~ '' %}
{% set content_text_transform = particle.content_text_transform ? ' jl-text-' ~ particle.content_text_transform|e ~ '' %}

{% set attr_extra = particle.extra|attribute_array %}
{% set article_settings = particle.article %}
{% set filter = article_settings.filter %}
{% set sort = article_settings.sort %}
{% set limit = article_settings.limit %}
{% set display = article_settings.display %}

{# Category Finder #}
{% set category_options = filter.categories ? {id: [filter.categories|split(','), 0]} : {} %}
{% set categories = joomla.finder('category', category_options).published(1).language().limit(0).find() %}

{# Content Finder #}
{% if filter.articles %}
    {% set article_options = filter.articles ? {id: [filter.articles|replace({' ': ''})|split(',')]} : {} %}
    {% set article_finder = joomla.finder('content', article_options).published(1).language() %}
{% else %}
    {% set article_finder = joomla.finder('content').category(categories).published(1).language() %}
{% endif %}

{% set featured = filter.featured|default('include') %}
{% if featured == 'exclude' %}
    {% do article_finder.featured(false) %}
{% elseif featured == 'only' %}
    {% do article_finder.featured(true) %}
{% endif %}

{% set start = limit.start + max(0, ajax.start|int) %}
{% do article_finder.order(sort.orderby, sort.ordering).limit(limit.total).start(start) %}
{% set total = article_finder.count() %}
{% set articles = article_finder.find() %}

{# Set Masonry/Parallax/Scrollspy #}
{% set grid_masonry = particle.grid_masonry ? 'masonry: 1;' %}
{% set grid_parallax = particle.grid_parallax ? 'parallax: ' ~ particle.grid_parallax ~ ';' %}

{# Set Scrollspy Animation #}
{% set scrollspy_cls = particle.animation != 'inherit' ? ' 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 %}"{% endif %}
{% endset %}

{# 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 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 Particle Alignment for Subnav style #}
{% set subnav_alignment %}
{% if particle.align != 'inherit' %} jl-flex-{{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-flex-{{particle.fallback|e}}{% endif %}{% endif %}
{% endset %}

{# 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>{{particle.particle_title|raw}}</span>
{% else %} {{particle.particle_title|raw}}
{% endif %}
</{{particle.particle_title_element|e}}>
{% endif %}
{% endset %}

{# Set Image Width/Height #}
{% set imagewidth = particle.image_width ? ' width="' ~ particle.image_width ~ '"' %}
{% set imageheight = particle.image_height ? ' height="' ~ particle.image_height ~ '"' %}
{% if particle.image_alignment == 'left' or particle.image_alignment == 'right' %}
{% set cover = (particle.image_padding and particle.style != 'blank') ? ' jl-cover' %}
{% endif %}

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

{# Set Button Size #}
{% set button_size %}
{% if display.read_more.button_styles == 'link' or display.read_more.button_styles == 'link-muted' or display.read_more.button_styles == 'link-text' or display.read_more.button_styles == 'text' %}{% else %}{% if particle.link_button_size != 'default' %} jl-button-{{particle.link_button_size|e}}{% endif %}{% endif %}
{% endset %}
{% set title_hover = (particle.title_hover ? ' class="jl-link-'~ particle.title_hover ~'"') %}
{% set link_image_padding = (particle.link_image and particle.image_padding ? ' class="jl-display-block"') %}

{% set check_image_transition = particle.link_card or particle.link_image %}

{# Image Transition #}
{% if check_image_transition %}
{% set image_transition = particle.image_transition != 'none' ? ' jl-transition-' ~ particle.image_transition|e ~ ' jl-transition-opaque' %}
{% endif %}

{# Set Image Margin Top Class #}
{% if ( ( particle.image_alignment == 'bottom' and particle.image_padding == false ) or ( particle.style == 'blank' and particle.image_alignment == 'bottom' ) or particle.image_alignment == 'between' ) %}
{% if check_image_transition and particle.image_transition != 'none' %}
{% set image_top_cls_transition %}
{% if particle.image_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.image_margin_top|e }}-top{% endif %}
{% endset %}
{% else %}
{% set image_top_cls %}
{% if particle.image_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.image_margin_top|e }}-top{% endif %}
{% endset %}
{% endif %}
{% endif %}

{# Set Image Border Class #}
{% if particle.style == 'blank' or ( particle.style != 'blank' and particle.image_padding == false ) %}
{% set image_border_cls = particle.image_border != 'none' ? ' jl-border-' ~ particle.image_border|e ~ '' %}
{% endif %}

{# Image Box Shadow #}
{% if particle.style == 'blank' %}
{% if check_image_transition %}
{% set img_boxshadow = particle.box_shadow != 'none' ? ' jl-box-shadow-' ~ particle.box_shadow|e ~ '' %}
{% set img_boxshadow_hover = particle.box_shadow_hover != 'none' ? ' jl-box-shadow-hover-' ~ particle.box_shadow_hover|e ~ '' %}
{% else %}
{% 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 ~ '' %}
{% endif %}
{% endif %}

{# Set Card Max Width Class #}
{% set card_maxwidth_cls = particle.card_maxwidth != 'none' ? ' jl-margin-auto jl-width-' ~ particle.card_maxwidth|e ~ '' %}
{% set link_transition = particle.link_card and particle.image_transition != 'none' ? ' jl-transition-toggle' %}

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

{% if ( particle.image_grid_column_gap == particle.image_grid_row_gap ) and not (particle.image_grid_column_gap == 'default' and particle.image_grid_row_gap == 'default') %}
    {% set image_grid_cr_gap = ' jl-grid-' ~ particle.image_grid_column_gap ~ '' %}
{% else %}
    {% set image_grid_cr_gap = image_grid_column_gap ~ image_grid_row_gap %}
{% endif %}

{# Set Grid Content #}
{% set content_grid %}
{% for article in articles %}

{% set article_edit_link %}
{% if display.edit and article.edit %}
    <div class="jl-margin-small"><a class="g-array-item-edit" href="{{ article.edit }}"><i class="fa fa-pencil" aria-hidden="true"></i> {{ 'JGLOBAL_EDIT'|trans }}</a></div>
{% endif %}
{% endset %}

{# Set Image Left/Right #}
{% set image_lr %}
    {% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}

    {% if particle.link_image and particle.link_card == false %}<a{{link_image_padding|raw}} href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}">{% if particle.image_transition != 'none' %}<div class="jl-inline-clip jl-transition-toggle{{img_boxshadow}}{{img_boxshadow_hover}}">{% endif %}{% endif %}
    {% if particle.link_card and particle.image_transition != 'none' %}<div class="jl-inline-clip{{img_boxshadow}}{{img_boxshadow_hover}}">{% endif %}

    {% if particle.image_padding %}

    {% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}
    <img class="tm-image{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}{{cover}}>
    {% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
    <img class="tm-image{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}{{cover}}>
    {% endif %}

    {% if particle.style != 'blank' %}

    {% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}
    <img class="tm-image jl-invisible{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
    {% elseif article.images.image_fulltext and display.image.enabled == 'full' %}
    <img class="tm-image jl-invisible{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>
    {% endif %}

    {% endif %}

    {% else %}

    {% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}

    <img{{imagewidth|raw}}{{imageheight|raw}} class="tm-image{{image_border_cls}}{{image_transition}}{{image_boxshadow}}{{image_boxshadow_hover}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>

    {% elseif article.images.image_fulltext and display.image.enabled == 'full' %}

    <img{{imagewidth|raw}}{{imageheight|raw}} class="tm-image{{image_border_cls}}{{image_transition}}{{image_boxshadow}}{{image_boxshadow_hover}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>

    {% endif %}
    {% endif %}

    {% if particle.link_card and particle.image_transition != 'none' %}</div>{% endif %}
    {% if particle.link_image and particle.link_card == false %}{% if particle.image_transition != 'none' %}</div>{% endif %}</a>{% endif %}

    {% endif %}
{% endset %}

{# Set Item Image #}
{% set item_image %}
    {% if display.image.enabled and article.images.image_intro or article.images.image_fulltext %}

    {% if particle.link_image and particle.link_card == false %}<a href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}">{% if particle.image_transition != 'none' %}<div class="jl-inline-clip jl-transition-toggle{{image_top_cls_transition}}">{% endif %}{% endif %}
    {% if particle.link_card and particle.image_transition != 'none' %}<div class="jl-inline-clip{{image_top_cls_transition}}">{% endif %}

    {% if article.images.image_intro and display.image.enabled == 'intro' or display.image.enabled == 'show' %}

    <img{{imagewidth|raw}}{{imageheight|raw}} class="tm-image{{image_top_cls}}{{image_border_cls}}{{image_boxshadow}}{{image_boxshadow_hover}}{{image_transition}}" src="{{ url(article.images.image_intro) }}"{% if article.images.image_intro_alt %} alt="{{article.images.image_intro_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>

    {% elseif article.images.image_fulltext and display.image.enabled == 'full' %}

    <img{{imagewidth|raw}}{{imageheight|raw}} class="tm-image{{image_top_cls}}{{image_border_cls}}{{image_boxshadow}}{{image_boxshadow_hover}}{{image_transition}}" src="{{ url(article.images.image_fulltext) }}"{% if article.images.image_fulltext_alt %} alt="{{article.images.image_fulltext_alt}}"{% else %} alt="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}"{% endif %}>

    {% endif %}

    {% if particle.link_card and particle.image_transition != 'none' %}</div>{% endif %}
    {% if particle.link_image and particle.link_card == false %}{% if particle.image_transition != 'none' %}</div>{% endif %}</a>{% endif %}

    {% endif %}
{% endset %}

{# Set Item Title #}
{% set item_title %}
    {% if display.title.enabled %}
    <{{particle.title_element|e}} class="tm-title jl-margin-remove-bottom{{title_text_transform}}{% if particle.title_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if particle.title_color != 'default' %} jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style != 'default' %} jl-{{particle.title_style|e}}{% endif %}{% if particle.title_decoration != 'none' %} jl-heading-{{particle.title_decoration|e}}{% endif %}">
    {% if particle.title_decoration == 'line' %}
    <span>
    {% endif %}
    {% if particle.link_title and particle.link_card == false %}
    <a{{ title_hover|raw }} href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}">{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}</a>
    {% else %}
    {{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}
    {% endif %}
    {% if particle.title_decoration == 'line' %}
    </span>
    {% endif %}
    </{{particle.title_element|e}}>
    {% endif %}
{% endset %}

{# Set Item Meta #}
{% set item_meta %}
{% if display.date.enabled or display.author.enabled or display.category.enabled or display.hits.enabled %}

{% if particle.meta_styles == 'list' %}
<ul class="tm-meta{{meta_text_transform}}{{subnav_alignment}} jl-subnav{% if particle.meta_subnav_style != 'default' %} jl-subnav-{{particle.meta_subnav_style|e}}{% endif %}{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}{% if particle.meta_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.meta_margin_top|e }}-top{% endif %}">
    {% if display.date.enabled %}
    <li class="g-array-item-date">
    <span>
    {% if display.date.enabled == 'published' %}
    {{ article.publish_up|date(display.date.format) }}
    {% elseif display.date.enabled == 'modified' %}
    {{ article.modified|date(display.date.format) }}
    {% else %}
    {{ article.created|date(display.date.format) }}
    {% endif %}
    </span>
    </li>
    {% endif %}

    {% if display.author.enabled %}
    <li class="g-array-item-author"><span class="g-array-item-author">{{ article.author.name }}</span></li>
    {% endif %}

    {% if display.category.enabled %}
    {% set category_link = display.category.enabled == 'link' %}
    <li class="g-array-item-category">
    {% set cat = article.categories|last %}
    {% if category_link and particle.link_card == false %}
    <a href="{{ cat.route }}">
    {{ cat.title }}
    </a>
    {% else %}
    <span class="g-array-item-category">{{ cat.title }}</span>
    {% endif %}
    </li>
    {% endif %}

    {% if display.hits.enabled %}
    <li class="g-array-item-hits">
    <span><i class="fa fa-eye" aria-hidden="true"></i>{{ article.hits }}</span>
    </li>
    {% endif %}
</ul>
{% else %}
<p class="{% if particle.meta_margin_top == 'default' %}jl-margin-top{% else %}jl-margin-{{ particle.meta_margin_top|e }}-top{% endif %} jl-margin-remove-bottom jl-article-meta{% if particle.pre_meta_color != 'default' %} jl-text-{{particle.pre_meta_color|e}}{% endif %}">

    {% if display.author.enabled %}
        {{ particle.author_meta|default('Written by')|raw}} {{ article.author.name }}
    {% endif %}

    {% if display.author.enabled and display.date.enabled %}
    {% set meta_date = particle.date_meta|default('on')|raw %}
    {% else %}
    {% set meta_date = particle.date_meta|default('Written on')|raw %}
    {% endif %}

    {% if display.date.enabled %}
        {% if display.date.enabled == 'published' %}
            {{ meta_date }} {{ article.publish_up|date(display.date.format) }}{{ '.'|trim }}
        {% elseif display.date.enabled == 'modified' %}
            {{ meta_date }} {{ article.modified|date(display.date.format) }}{{ '.'|trim }}
        {% else %}
            {{ meta_date }} {{ article.created|date(display.date.format) }}{{ '.'|trim }}
        {% endif %}
    {% endif %}

    {% if display.category.enabled %}
        {% set category_link = display.category.enabled == 'link' %}
        {% set cat = article.categories|last %}
        {% if category_link and particle.link_card == false %}
            {{ particle.category_meta|default('Posted in')|raw}} <a href="{{ cat.route }}">{{ cat.title }}</a>
        {% else %}
            {{ particle.category_meta|default('Posted in')|raw}} {{ cat.title }}
        {% endif %}
    {% endif %}

    {% if display.hits.enabled %}
        <span class="g-array-item-hits">
            <i class="fa fa-eye" aria-hidden="true"></i> {{ article.hits }}
        </span>
    {% endif %}

</p>

{% endif %}

{% endif %}

{% endset %}

{# Set Item Content #}
{% set item_content %}
{% if display.text.type %}
    {% set article_text = display.text.type == 'intro' ? display.text.prepare ? article.preparedIntroText : article.introtext : display.text.prepare ? article.preparedText : article.text %}
    <div class="tm-content jl-panel{{content_text_transform}}{% 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 %}">
        {% if display.text.formatting == 'text' %}
            {{ article_text|truncate_text(display.text.limit)|raw }}
        {% else %}
            {{ article_text|truncate_html(display.text.limit)|raw }}
        {% endif %}
    </div>
{% endif %}
{% endset %}

{# Set Button #}
{% set item_button %}
    {% if display.read_more.enabled %}
    <div class="tm-button{% if particle.link_margin_top == 'default' %} jl-margin-top{% else %} jl-margin-{{ particle.link_margin_top|e }}-top{% endif %}">
    {% if particle.link_card %}
    <div class="{{button_cls}}{{button_size}}">{{ display.read_more.label|default('Read More') }}</div>
    {% else %}
    <a class="{{button_cls}}{{button_size}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}" title="{{ display.title.limit ? article.title|truncate_text(display.title.limit) : article.title }}">{{ display.read_more.label|default('Read More') }}</a>
    {% endif %}
    </div>
    {% endif %}
{% endset %}

<div>

{% if particle.image_alignment == 'top' or particle.image_alignment == 'bottom' or particle.image_alignment == 'between' %}

{# Default Style #}

{% if particle.style == 'blank' %}

{# Card Blank #}

{% if particle.link_card %}
<a class="jl-panel jl-margin-remove-first-child jl-display-block jl-link-toggle{{card_maxwidth_cls}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{scrollspy_cls}}>
{% else %}
<div class="jl-panel jl-margin-remove-first-child{{card_maxwidth_cls}}"{{scrollspy_cls}}>
{% endif %}

{% if particle.image_alignment == 'top' %}
    {{item_image}}
{% endif %}

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

{{item_title}}

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

{% if particle.image_alignment == 'between' %}
    {{item_image}}
{% endif %}

{{item_content}}

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

{{item_button}}

{% if particle.link_card == false %}
    {{article_edit_link}}
{% endif %}

{% if particle.image_alignment == 'bottom' %}
    {{item_image}}
{% endif %}

{% if particle.link_card %}
    </a>{{article_edit_link}}
{% else %}
    </div>
{% endif %}

{# End Card Blank #}

{% else %}

{# Card styles #}

{% if particle.image_padding == '1' %}

{% if particle.link_card %}
    <a class="jl-card jl-card-{{ particle.style }}{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %} jl-display-block jl-link-toggle{% if particle.style != 'hover' %} jl-card-hover{% endif %}{{card_maxwidth_cls}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{scrollspy_cls}}>
{% else %}
    <div class="jl-card jl-card-{{ particle.style }}{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %}{{card_maxwidth_cls}}"{{scrollspy_cls}}>
{% endif %}

{% if particle.image_alignment == 'top' %}
    <div class="jl-card-media-top">
        {{item_image}}
    </div>
{% endif %}

<div class="jl-card-body jl-margin-remove-first-child">

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

{{item_title}}

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

{% if particle.image_alignment == 'between' %}
    {{item_image}}
{% endif %}

{{item_content}}

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

{{item_button}}

{% if particle.link_card == false %}
    {{article_edit_link}}
{% endif %}

</div>

{% if particle.image_alignment == 'bottom' %}
    <div class="jl-card-media-bottom">
        {{item_image}}
    </div>
{% endif %}

{% if particle.link_card %}
    </a>{{article_edit_link}}
{% else %}
    </div>
{% endif %}

{% else %}

{% if particle.link_card %}
    <a class="jl-card jl-card-{{ particle.style }} jl-card-body{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %} jl-margin-remove-first-child jl-display-block jl-link-toggle{% if particle.style != 'hover' %} jl-card-hover{% endif %}{{card_maxwidth_cls}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{scrollspy_cls}}>
{% else %}
    <div class="jl-card jl-card-{{ particle.style }} jl-card-body{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %} jl-margin-remove-first-child{{card_maxwidth_cls}}"{{scrollspy_cls}}>
{% endif %}

{% if particle.image_alignment == 'top' %}
    {{item_image}}
{% endif %}

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

{{item_title}}

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

{% if particle.image_alignment == 'between' %}
    {{item_image}}
{% endif %}

{{item_content}}

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

{{item_button}}

{% if particle.link_card == false %}
    {{article_edit_link}}
{% endif %}

{% if particle.image_alignment == 'bottom' %}
    {{item_image}}
{% endif %}

{% if particle.link_card %}
    </a>{{article_edit_link}}
{% else %}
    </div>
{% endif %}

{% endif %}

{# End card style #}

{% endif %}

{# End Default Style #}

{% else %}

{# Grid Style #}

{% if particle.style == 'blank' %}

{# Card Blank #}

{% if particle.link_card %}
    <a class="jl-panel jl-margin-remove-first-child jl-display-block jl-link-toggle{{card_maxwidth_cls}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{scrollspy_cls}}>
{% else %}
    <div class="jl-panel jl-margin-remove-first-child{{card_maxwidth_cls}}"{{scrollspy_cls}}>
{% endif %}

<div class="jl-child-width-expand{{image_grid_cr_gap}}{% if particle.image_vertical_alignment %} jl-flex-middle{% endif %}" jl-grid>

<div class="jl-width-{{ particle.image_grid_width }}{% if particle.image_grid_breakpoint != 'default' %}@{{ particle.image_grid_breakpoint|e }}{% endif %}{% if particle.image_alignment == 'right' %} jl-flex-last{% if particle.image_grid_breakpoint != 'default' %}@{{ particle.image_grid_breakpoint|e }}{% endif %}{% endif %}">
    {{image_lr}}
</div>

<div class="jl-margin-remove-first-child">

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

{{item_title}}

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

{{item_content}}

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

{{item_button}}

{% if particle.link_card == false %}
    {{article_edit_link}}
{% endif %}

</div>

</div>

{% if particle.link_card %}
    </a>{{article_edit_link}}
{% else %}
    </div>
{% endif %}

{# End Card Blank #}

{% else %}

{# Card styles #}

{% if particle.image_padding == '1' %}

{% if particle.link_card %}
    <a class="jl-card jl-card-{{ particle.style }}{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %}{% if particle.style != 'hover' %} jl-card-hover{% endif %} jl-display-block jl-link-toggle{{card_maxwidth_cls}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{scrollspy_cls}}>
{% else %}
    <div class="jl-card jl-card-{{ particle.style }}{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %}{{card_maxwidth_cls}}"{{scrollspy_cls}}>
{% endif %}

{% if particle.image_padding == '1' %}
    <div class="jl-child-width-expand jl-grid-collapse jl-grid-match{% if particle.image_vertical_alignment == '1' %} jl-flex-middle{% endif %}" jl-grid>
{% else %}
    <div class="jl-child-width-expand{{image_grid_cr_gap}}{% if particle.image_vertical_alignment %} jl-flex-middle{% endif %}" jl-grid>
{% endif %}

<div class="jl-width-{{ particle.image_grid_width }}{% if particle.image_grid_breakpoint != 'default' %}@{{ particle.image_grid_breakpoint|e }}{% endif %}{% if particle.image_alignment == 'right' %} jl-flex-last{% if particle.image_grid_breakpoint != 'default' %}@{{ particle.image_grid_breakpoint|e }}{% endif %}{% endif %}">

<div class="jl-cover-container{% if particle.image_alignment == 'right' %} jl-card-media-right{% else %} jl-card-media-left{% endif %}">
    {{image_lr}}
</div>

</div>

<div>
<div class="jl-card-body jl-margin-remove-first-child">

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

{{item_title}}

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

{{item_content}}

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

{{item_button}}

{% if particle.link_card == false %}
    {{article_edit_link}}
{% endif %}

</div>
</div>
</div>

{% if particle.link_card %}
    </a>{{article_edit_link}}
{% else %}
    </div>
{% endif %}

{% else %}

{% if particle.link_card %}
    <a class="jl-card jl-card-{{ particle.style }} jl-card-body{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %} jl-margin-remove-first-child{% if particle.style != 'hover' %} jl-card-hover{% endif %} jl-display-block jl-link-toggle{{card_maxwidth_cls}}{{link_transition}}" href="{{ article.route }}" target="{{ particle.buttontarget|default('_self')|e }}"{{scrollspy_cls}}>
{% else %}
    <div class="jl-card jl-card-{{ particle.style }} jl-card-body{% if particle.cardsize != 'default' %} jl-card-{{ particle.cardsize }}{% endif %}{{card_maxwidth_cls}} jl-margin-remove-first-child"{{scrollspy_cls}}>
{% endif %}

<div class="jl-child-width-expand{{image_grid_cr_gap}}{% if particle.image_vertical_alignment %} jl-flex-middle{% endif %}" jl-grid>

<div class="jl-width-{{ particle.image_grid_width }}{% if particle.image_grid_breakpoint != 'default' %}@{{ particle.image_grid_breakpoint|e }}{% endif %}{% if particle.image_alignment == 'right' %} jl-flex-last{% if particle.image_grid_breakpoint != 'default' %}@{{ particle.image_grid_breakpoint|e }}{% endif %}{% endif %}">

{{image_lr}}

</div>

<div class="jl-margin-remove-first-child">

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

{{item_title}}

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

{{item_content}}

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

{{item_button}}

{% if particle.link_card == false %}
    {{article_edit_link}}
{% endif %}

</div>

</div>

{% if particle.link_card %}
    </a>{{article_edit_link}}
{% else %}
    </div>
{% endif %}

{% endif %}

{# End card style #}

{% endif %}

{# End Grid style #}

{% endif %}

</div>
{% endfor %}
{% endset %}

{# End Grid content #}

{% 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 center_columns = particle.center_columns ? ' jl-flex-center' %}
{% set center_rows = particle.center_rows ? ' jl-flex-middle' %}

{% block particle %}
{% if particle.enabled %}
{{particle_title_style}}
<div id="{{ id }}" class="{{id}}{% if particle.css.class %} {{ particle.css.class }}{% endif %} jl-content-grid{{content_maxwidth}}{{ particle.grid_divider ? ' jl-grid-divider' : '' }}{{ particle.grid_match_height ? ' jl-grid-match' : '' }}{{grid_cr_gap}}{{center_columns}}{{center_rows}}{% 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 %}{{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 %}"{{animation}} jl-grid="{{grid_masonry}}{{grid_parallax}}" {{- attr_extra|raw }}>
{{content_grid}}
</div>
{% endif %}
{% endblock %}