/*
 * Section « agenda » — liste des prochains événements.
 *
 * Écarts volontaires à la maquette :
 *
 * 1. Chaque ligne est cliquable par un vrai lien posé sur le titre, étendu à la
 *    ligne par un pseudo-élément. La maquette se contentait de « cursor: pointer ».
 *
 * 2. Bordure des boutons de filtre : --ink-3 au lieu de --line. 1.25:1 → 5.09:1.
 *    Ce sont des composants d'interface, le seuil de 3:1 s'y applique.
 *
 * 3. Les filtres sont posés avec l'attribut « hidden » et révélés par le script :
 *    sans JavaScript, ils resteraient inertes. La liste complète, elle, s'affiche
 *    toujours — c'est l'état par défaut du filtre « Tout ».
 *
 * 4. Hauteur de cible des filtres portée à 44 px (la maquette en donnait 40).
 */

.agenda {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
}

/* ==========================================================================
   Filtres
   ========================================================================== */

.agenda-filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* Écart n° 3. */
.agenda-filters[hidden] { display: none; }

/* Écarts n° 2 et 4. */
.agenda-filter {
  min-height: var(--touch);
  padding: 8px 16px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-pill);
  background: var(--paper);
  font-size: 0.84375rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: background .2s, color .2s, border-color .2s;
}

.agenda-filter:hover { border-color: var(--ink); color: var(--ink); }

.agenda-filter.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* ==========================================================================
   Liste
   ========================================================================== */

.agenda-list {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: var(--r-card-sm);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

/*
 * Colonne des pastilles à largeur fixe : en « auto », chaque ligne étant sa
 * propre grille, la colonne suivait la longueur de SA pastille (« Vie
 * citoyenne » contre « Fête ») et les titres ne s'alignaient pas d'une ligne à
 * l'autre. 168 px tiennent la plus longue.
 */
.agenda-row {
  position: relative;
  display: grid;
  grid-template-columns: 110px 168px 2fr 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .2s;
}

.agenda-row:last-child { border-bottom: none; }
.agenda-row:hover { background: var(--bg); }
.agenda-row.hidden { display: none; }

/* Le focus vit sur le lien du titre : on le remonte à la ligne entière. */
.agenda-row:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.agenda-title a:focus-visible { outline: none; }

/* --------------------------------------------------------------------------
   Date
   -------------------------------------------------------------------------- */

.agenda-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-right: 1px solid var(--line-soft);
  padding-right: 20px;
}

.agenda-day {
  font-family: var(--serif);
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.agenda-month {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Pastille de type
   -------------------------------------------------------------------------- */

.agenda-tag {
  padding: 5px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.agenda-tag svg { width: 13px; height: 13px; --icon-boost: 6px; }

/* --------------------------------------------------------------------------
   Titre et informations
   -------------------------------------------------------------------------- */

.agenda-title {
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}

/* Écart n° 1 : le lien du titre couvre toute la ligne. */
.agenda-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.agenda-info {
  font-size: 0.84375rem;
  color: var(--ink-3);
}

.agenda-info strong { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 2px; }

.agenda-until {
  display: block;
  margin-top: 4px;
  font-style: italic;
}

.agenda-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: background .2s, border-color .2s;
}

.agenda-arrow svg {
  width: 13px;
  height: 13px;
  color: var(--ink);
  transition: color .2s;
  --icon-boost: 6px;
}

.agenda-row:hover .agenda-arrow { background: var(--terra); border-color: var(--terra); }
.agenda-row:hover .agenda-arrow svg { color: #fff; }

/* ==========================================================================
   Sous 980 px — la ligne se replie
   ========================================================================== */

@media (max-width: 980px) {
  /*
   * Deux colonnes : la date à gauche, le reste empilé à droite.
   *
   * Écart assumé — la maquette masque ici l'horaire ET le lieu. Sur un agenda
   * communal consulté majoritairement au téléphone, ce sont les deux informations
   * qu'on vient chercher : elles passent sous le titre au lieu de disparaître.
   * Seule la flèche est retirée, la ligne entière étant déjà cliquable.
   */
  .agenda-row {
    grid-template-columns: 76px 1fr;
    gap: 6px 16px;
    padding: 18px 20px;
    align-items: start;
  }

  .agenda-row > *:nth-child(1) { grid-row: 1 / span 3; align-self: center; }
  .agenda-row > *:nth-child(2) { grid-column: 2; }
  .agenda-row > *:nth-child(3) { grid-column: 2; }
  .agenda-row > *:nth-child(4) { grid-column: 2; margin-top: 2px; }
  .agenda-row > *:nth-child(5) { display: none; }

  /* Empilé, l'horaire n'a plus besoin d'être sur sa propre ligne. */
  .agenda-info strong { display: inline; margin-bottom: 0; }
  .agenda-info strong::after { content: " · "; color: var(--ink-3); }

  .agenda-date { border-right: none; padding-right: 0; }
  .agenda-day { font-size: 2.125rem; }
  .agenda-title { font-size: 1.1875rem; }
}
