<?php snippet('header') ?>

<main class="project">
  <article class="project__content">
    <!-- Gallery -->
    <div class="project__gallery">
      <?php if ($cover = $page->cover()->toFile()): ?>
        <img src="<?= $cover->url() ?>" alt="<?= $page->title() ?>" class="project__cover">
      <?php endif ?>

      <?php foreach ($page->files()->filterBy('template', 'image') as $image): ?>
        <img src="<?= $image->url() ?>" alt="" class="project__image">
      <?php endforeach ?>
    </div>

    <!-- Info -->
    <div class="project__info">
      <h1 class="project__title"><?= $page->title() ?></h1>

      <?php if ($page->tagline()->isNotEmpty()): ?>
        <p class="project__tagline"><?= $page->tagline() ?></p>
      <?php endif ?>

      <?php if ($page->description()->isNotEmpty()): ?>
        <div class="project__description">
          <?= $page->description()->kt() ?>
        </div>
      <?php endif ?>

      <!-- Meta -->
      <div class="project__meta">
        <?php if ($page->impact()->isNotEmpty()): ?>
          <div class="project__impact">
            <span class="label">Impact:</span>
            <?= $page->impact()->join(', ') ?>
          </div>
        <?php endif ?>

        <?php if ($page->category()->isNotEmpty()): ?>
          <div class="project__category">
            <span class="label">Catégorie:</span>
            <?= $page->category()->value() ?>
          </div>
        <?php endif ?>

        <?php if ($page->platforms()->isNotEmpty()): ?>
          <div class="project__platforms">
            <span class="label">Plateformes:</span>
            <?= $page->platforms()->join(' / ') ?>
          </div>
        <?php endif ?>

        <?php if ($page->client_name()->isNotEmpty()): ?>
          <div class="project__client">
            <span class="label">Client:</span>
            <?= $page->client_name() ?>
          </div>
        <?php endif ?>
      </div>

      <!-- Links -->
      <div class="project__links">
        <?php if ($page->apple_link()->isNotEmpty()): ?>
          <a href="<?= $page->apple_link() ?>" class="btn btn--apple" target="_blank">
            App Store
          </a>
        <?php endif ?>

        <?php if ($page->android_link()->isNotEmpty()): ?>
          <a href="<?= $page->android_link() ?>" class="btn btn--android" target="_blank">
            Play Store
          </a>
        <?php endif ?>

        <?php if ($page->web_link()->isNotEmpty()): ?>
          <a href="<?= $page->web_link() ?>" class="btn btn--web" target="_blank">
            Voir le site
          </a>
        <?php endif ?>
      </div>
    </div>
  </article>

  <!-- Navigation -->
  <nav class="project__nav">
    <?php if ($prev = $page->prev()): ?>
      <a href="<?= $prev->url() ?>" class="project__nav-prev">
        &larr; <?= $prev->title() ?>
      </a>
    <?php endif ?>

    <a href="<?= $page->parent()->url() ?>" class="project__nav-back">
      Tous les projets
    </a>

    <?php if ($next = $page->next()): ?>
      <a href="<?= $next->url() ?>" class="project__nav-next">
        <?= $next->title() ?> &rarr;
      </a>
    <?php endif ?>
  </nav>
</main>

<?php snippet('footer') ?>
