/* =========================================================================
   Observatoire BSTP — Bloc de recherche
   Reprend le motif du Portail BSTP (/recherche) : une barre unique et bien
   visible, les filtres avances replies derriere un bouton, une barre de
   resultats sobre. Reaccorde aux jetons d'ici (indigo/orange, Segoe UI,
   Font Awesome) et aux derives d'accent accessibles du projet.

   Chargee par acteurs.html et publications.html, comme carte.css l'est par
   cartographie.html. A charger APRES main.css.

   Publications n'emploie que .barre-recherche et .resultats-compte : sa route
   ne connait qu'un filtre (`q`), un panneau « Filtres » y serait une promesse
   vide. Le panneau ne sert donc qu'a la page Acteurs.
   ========================================================================= */

/* ---- Barre de recherche -------------------------------------------------- */
.barre-recherche {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 10px 10px 18px;
}

.barre-recherche__saisie {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.barre-recherche__saisie i { color: var(--muted); font-size: 15px; flex: none; }

.barre-recherche__champ {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 10px 0;
}
.barre-recherche__champ::placeholder { color: var(--muted); }

/* Le focus se pose sur la barre entiere, pas sur le champ nu : celui-ci n'a pas
   de bordure propre, un contour dessus flotterait dans le vide.

   `outline` et non `box-shadow` : c'est la convention deja en place dans
   carte.css, et c'est la seule des deux que le mode contraste eleve de Windows
   conserve — une bague en box-shadow y disparait, laissant le champ sans
   indicateur de focus. */
.barre-recherche:focus-within {
  outline: 2px solid var(--accent-texte);
  outline-offset: 2px;
}

.barre-recherche__actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* ---- Bouton d'ouverture des filtres -------------------------------------- */
.btn-filtres {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ligne-champ);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.btn-filtres:hover { border-color: var(--accent-texte); color: var(--accent-texte); }

/* Etat ouvert : bordure et libelle passent a l'orange lisible (5,18:1 sur blanc).
   Surtout pas --accent, qui ne porte pas de texte (2,86:1). */
.btn-filtres[aria-expanded="true"] { border-color: var(--accent-texte); color: var(--accent-texte); }
.btn-filtres[aria-expanded="true"] .btn-filtres__chevron { transform: rotate(180deg); }
.btn-filtres__chevron { transition: transform .3s cubic-bezier(.23, 1, .32, 1); font-size: 10px; }

/* Pastille du nombre de filtres actifs. */
.btn-filtres__compte {
  display: inline-grid;
  place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-fort);
  color: #fff;                      /* 5,36:1 */
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

/* ---- Panneau des filtres avances ----------------------------------------- */
/* Deplie par defaut. Le repli n'existe QUE si le JS a pris la main (.est-pilote) :
   sans JS, tous les filtres restent visibles et la page reste utilisable. */
.panneau-filtres { overflow: hidden; margin-top: 14px; }

.panneau-filtres.est-pilote {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  transition: max-height .45s cubic-bezier(.23, 1, .32, 1),
              opacity    .45s cubic-bezier(.23, 1, .32, 1),
              margin-top .45s cubic-bezier(.23, 1, .32, 1);
}
.panneau-filtres.est-pilote.est-deplie { max-height: 640px; opacity: 1; margin-top: 14px; }

.panneau-filtres__carte {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panneau-filtres__grille {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.champ-filtre { display: flex; flex-direction: column; gap: 7px; }
.champ-filtre > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Chevron dessine en CSS : on masque celui du navigateur pour que tous les
   selects se ressemblent d'un poste a l'autre. */
.champ-filtre__enveloppe { position: relative; }
.champ-filtre__enveloppe::after {
  content: "";
  position: absolute;
  right: 15px; top: 50%;
  width: 7px; height: 7px;
  margin-top: -5px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.champ-filtre select,
.champ-filtre input {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 2px solid var(--ligne-champ);
  border-radius: var(--radius-sm);
  padding: 11px 38px 11px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.champ-filtre input { padding-right: 14px; cursor: text; font-weight: 400; }
.champ-filtre select:hover { border-color: var(--muted); }
.champ-filtre select:focus,
.champ-filtre input:focus {
  outline: 2px solid var(--accent-texte);
  outline-offset: 2px;
  border-color: var(--accent-texte);
}

/* ---- Pied du panneau ----------------------------------------------------- */
.panneau-filtres__pied {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}
.panneau-filtres__pied .link-reset { margin-left: auto; }

/* ---- Barre de resultats -------------------------------------------------- */
/* Le nombre passe en orange lisible, comme au portail — ou il est la seule
   couleur de toute la ligne.
   Le selecteur porte le parent : main.css declare `.results-info b { color:
   var(--ink) }`, soit une classe ET un element — plus specifique qu'une classe
   seule, qui serait donc ignoree ici. */
.results-info b.resultats-compte {
  color: var(--accent-texte);       /* 5,18:1 sur blanc */
  font-weight: 800;
  font-size: 17px;
}

/* ---- Adaptatif : les paliers du projet (900 px et 560 px) ---------------- */
@media (max-width: 900px) {
  .panneau-filtres__grille { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .barre-recherche { flex-direction: column; align-items: stretch; padding: 14px; }
  .barre-recherche__actions { justify-content: space-between; }
  .btn-filtres, .barre-recherche__actions .btn { flex: 1; justify-content: center; }
  .panneau-filtres__grille { grid-template-columns: 1fr; }
  .panneau-filtres.est-pilote.est-deplie { max-height: 900px; }
}

@media (prefers-reduced-motion: reduce) {
  .panneau-filtres.est-pilote, .btn-filtres, .btn-filtres__chevron { transition-duration: .01ms; }
}
