{% extends "base.html" %}

{% block content %}
<div class="galleries-grid">
  {% for galleries_line in galleries|reverse|batch(3)|reverse %}
  <div class="galleries-line covers-{{ galleries_line|length }}">
    {% for gallery in galleries_line|reverse %}<!-- comment tricks against space between inline-block
    --><div class="gallery-square">
      <a href="{{ gallery.link }}">
        <div class="gallery-title">
          <h2>{{ gallery.title }}</h2>
          {% if gallery.sub_title %}<h3>{{ gallery.sub_title }}</h3>{% endif %}
          {% if gallery.date %}<div class="gallery-datetime">{{ gallery.date.strftime("%d %B %Y") }}</div>{% endif %}
        </div>
      </a>
      {% set cover = Image(gallery.cover) %}
      {{ cover.copy() }}
      <div class="gallery-cover" style="background-image: url('{{ cover.generate_thumbnail("x900") }}');"></div>
    </div><!-- comment tricks against space between inline-block
    -->{% endfor %}
  </div>
  {% endfor %}
</div>

<p style="visibility: hidden">.</p>
{% endblock %}
