{% load i18n highlight thumbnail cms_tags util_tags %}

{% if not search and not title and not text %}
    {% page_attribute 'page_title' page as title %}
    {% page_attribute 'meta_description' page as text %}
{% endif %}

<li class="page_item__frame{% if subpage %} subpage{% endif %}{% if index != Null %} reveal_self reveal reveal_animation data_delay_{{ index }}{% endif %}">
    <a href="{% if url %}{{ url }}{% else %}{{ page.url|default:page.get_public_url }}{% endif %}" class="page_item"
       {% if target %}target="{{ target }}"{% endif %}>
        <div class="page_item__image">
            {% if image %}
                {% thumbnail image 1000x600 box=cropping crop detail as thumb %}
                <div class="page_item__image__main scroll" data-ease-multiplier="-2"
                     style="background-image: url({{ thumb.url|media_bridge }})"></div>
            {% endif %}
            <span class="page_item__image__title">{% if search %}{{ page.title }}{% else %}{{ title }}{% endif %}</span>
        </div>
        <div class="page_item__content">
            {% if subpage %}
                <h3 class="h2">{% if search %}{{ page.title }}{% else %}{{ title }}{% endif %}</h3>
            {% else %}
                <h2>{% if search %}{{ page.title }}{% else %}{{ title }}{% endif %}</h2>
            {% endif %}

            {% if search %}
                <p>{% highlight page.text with request.GET.q %}</p>
            {% elif text and text != 'None' %}
                <p>{{ text }}</p>
            {% endif %}

            <div class="page_item__button">
                <span class="button">
                    <span class="button__icon">{% include 'project/assets/arrow-right-long.svg' %}</span>
                    <span class="button__text">{% trans 'Mehr' %}</span>
                </span>
            </div>
        </div>
    </a>
</li>