<?php /* Grille filtrable des 8 filières (accueil + page Filières) */
$icones = [
    'RH' => '<path d="M16 11a3 3 0 1 0-3-3 3 3 0 0 0 3 3ZM8 11a3 3 0 1 0-3-3 3 3 0 0 0 3 3Zm0 2c-2.3 0-7 1.2-7 3.5V19h14v-2.5C15 14.2 10.3 13 8 13Zm8 0h-1a4.2 4.2 0 0 1 2 3.5V19h6v-2.5c0-2.3-4.7-3.5-7-3.5Z"/>',
    'GES' => '<path d="M7 18a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm10 0a2 2 0 1 0 2 2 2 2 0 0 0-2-2ZM5.2 4H2V2h4.6l.9 2H22l-3.5 8H8.1l-1 2H20v2H4l2.4-4.5Z"/>',
    'FIN' => '<path d="M3 3h2v16h16v2H3Zm4 10h3v4H7Zm5-5h3v9h-3Zm5-4h3v13h-3Z"/>',
    'TH' => '<path d="M3 6h2v7h7V8h6a4 4 0 0 1 4 4v7h-2v-3H5v3H3Zm5 2a2.5 2.5 0 1 1-2.5 2.5A2.5 2.5 0 0 1 8 8Z"/>',
    'INFO' => '<path d="m8.6 16.6-4.6-4.6 4.6-4.6L7.2 6 1.2 12l6 6Zm6.8 0 4.6-4.6-4.6-4.6L16.8 6l6 6-6 6Z"/>',
    'BTP' => '<path d="M2 21V9l7-5 7 5v2h6v10Zm2-2h3v-4h4v4h3v-9L9 6.5 4 10Zm12 0h4v-6h-4Z"/>',
    'ATPV' => '<path d="M17 8C8 10 5.9 16.2 3.8 21.3l1.9.7 1-2.3c.5.2 1 .3 1.3.3C19 20 22 3 22 3c-1 2-8 2.3-13 3.3S2 11.5 2 13.5s1.8 3.8 1.8 3.8C7 8 17 8 17 8Z"/>',
    'ATPA' => '<path d="M4 3 2 7l3 2v4c0 3 2 6 7 6s7-3 7-6V9l3-2-2-4-4 3H8Zm5 9a1.3 1.3 0 1 1 0 2.6A1.3 1.3 0 0 1 9 12Zm6 0a1.3 1.3 0 1 1 0 2.6 1.3 1.3 0 0 1 0-2.6Zm-5 4h4v1.5h-4Z"/>',
];
$photos = ['RH' => 'admin.jpg', 'GES' => 'couloir.jpg', 'FIN' => 'classe.jpg', 'TH' => 'visite.jpg', 'INFO' => 'labo.jpg', 'BTP' => 'campus.jpeg'];
$domaines = domaines_filieres();
?>
<div class="filters" role="group" aria-label="Filtrer les filières">
  <button class="chip" type="button" data-f="all" aria-pressed="true">Toutes</button>
  <?php foreach ($domaines as $cle => $libelle): ?>
    <button class="chip" type="button" data-f="<?= $cle ?>" aria-pressed="false"><?= htmlspecialchars($libelle) ?></button>
  <?php endforeach; ?>
</div>
<div class="grid-f" id="cards">
  <?php foreach (filieres() as $code => $f): ?>
    <a class="card reveal" href="/filieres/<?= htmlspecialchars($code) ?>" id="f-<?= htmlspecialchars($code) ?>" data-d="<?= $f['domaine'] ?>">
      <div class="visuel<?= $f['domaine'] === 'agro' ? ' agro' : '' ?>">
        <?php if (isset($photos[$code])): ?>
          <img src="/assets/img/<?= $photos[$code] ?>" alt="" loading="lazy">
        <?php else: ?>
          <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><?= $icones[$code] ?? '' ?></svg>
        <?php endif; ?>
      </div>
      <div class="corps">
        <span class="dom"><?= htmlspecialchars($domaines[$f['domaine']]) ?></span>
        <h3><?= htmlspecialchars($f['nom']) ?></h3>
        <p><?= htmlspecialchars($f['resume']) ?></p>
        <span class="lien">Programme et débouchés →</span>
      </div>
    </a>
  <?php endforeach; ?>
</div>
