/* ------------------------------------------------------------------ *
 *  Recherche à facettes blog-projets : champ, autocomplétion, facettes
 * ------------------------------------------------------------------ */

/* Barre d'outils : les 4 facettes à gauche + le moteur à droite, sur une seule ligne. */
.blog-projet-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  justify-content: space-between;
  padding: 0 20px 60px;
}

.blog-projet-toolbar .filters {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: flex-start;
  padding: 0;
}

/* Puces resserrées pour tenir sur une ligne (annule les marges du style de base). */
.blog-projet-toolbar .filters .filter {
  flex: 0 0 auto;
  margin: 0;
}

.blog-projet-toolbar .filters .facet .filter_content {
  padding: 6px 14px;
  white-space: nowrap;
}

.blog-projet-toolbar .filters .facet .ico {
  margin: 0 6px 0 0;
}

/* Le moteur s'étire pour occuper tout l'espace laissé par les facettes. */
.blog-projet-search {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 280px;
}

.search-articles {
  position: relative;
  width: 100%;
  max-width: 540px;
}

.blog-projet-toolbar .search-articles {
  max-width: none;
}

.search-articles_field {
  align-items: center;
  background-color: #fff;
  border: 2px solid #c2e0f3;
  border-radius: 32px;
  box-shadow: 0 6px 18px rgba(0, 61, 165, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Étiquettes (mots choisis) à l'intérieur du champ. */
.search-articles_chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-articles_chips:empty {
  display: none;
}

.search-chip {
  align-items: center;
  background: var(--blue-500);
  border-radius: 20px;
  color: #fff;
  display: inline-flex;
  font-family: Lato-Bold;
  font-size: 14px;
  gap: 6px;
  line-height: 1;
  padding: 6px 8px 6px 12px;
}

.search-chip_remove {
  align-items: center;
  background: rgba(255, 255, 255, 0.25);
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 16px;
  height: 18px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 18px;
}

.search-chip_remove:hover {
  background: rgba(255, 255, 255, 0.4);
}

.search-articles_field:focus-within {
  border-color: var(--blue-500);
  box-shadow: 0 8px 24px rgba(0, 61, 165, 0.16);
}

.search-articles_icon {
  background-color: var(--blue-500);
  flex: 0 0 auto;
  height: 22px;
  width: 22px;
  -webkit-mask: url("../../../components/filters/img/ico_search-jFPssK-.svg") no-repeat center / contain;
  mask: url("../../../components/filters/img/ico_search-jFPssK-.svg") no-repeat center / contain;
}

.search-articles_input {
  background: transparent;
  border: 0;
  color: var(--blue-500);
  flex: 1 1 120px;
  font-family: Lato-Regular;
  font-size: 18px;
  min-width: 0;
  outline: 0;
}

.search-articles_input::placeholder {
  color: #7fa8c6;
  opacity: 1;
}

.search-articles_input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* ------------------------------ Autocomplétion ------------------------------ */

.search-autocomplete {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 61, 165, 0.18);
  left: 0;
  list-style: none;
  margin: 8px 0 0;
  overflow: hidden;
  padding: 8px 0;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
}

.search-autocomplete[hidden] { display: none; }

.ac-heading {
  color: #7fa8c6;
  font-family: Lato-Bold;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 8px 22px 4px;
  text-transform: uppercase;
}

.ac-item {
  cursor: pointer;
  font-family: Lato-Regular;
  font-size: 16px;
  padding: 9px 22px;
}

.ac-item:hover { background: #eef6fc; }

/* Suggestions de mots : complètent la saisie en cliquant. */
.ac-word {
  color: var(--blue-500);
  font-family: Lato-Bold;
}

/* Articles : lien vers la page, précédé d'un picto signalant un lien. */
.ac-article a {
  align-items: center;
  color: var(--blue-500);
  display: flex;
  gap: 10px;
  text-decoration: none;
}

.ac-link-ico {
  color: #7fa8c6;
  flex: 0 0 auto;
}

/* --------------------------------- Facettes --------------------------------- */
/* Réutilise le style .filter (puce bleue) défini dans components/filters/filters.css */

.filters .facet {
  background: transparent;
  border: 0;
  font-family: inherit;
}

/* Couleurs iso-site : facette au repos = gris ; sélectionnée = bleu clair.
   Le texte reste bleu foncé dans les deux états. */
.filters .facet .filter_content {
  align-items: center;
  background-color: var(--grey-50);
  color: var(--blue-500);
  display: inline-flex;
  gap: 8px;
  padding: 8px 18px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.filters .facet.is-active .filter_content {
  background-color: #c2e0f3;
  color: var(--blue-500);
}

/* Croix de désactivation, affichée sur une facette sélectionnée (remplace le
   compteur d'articles). Spécificité ≥ `.filters .filter .filter_content span`
   (filters.css) sinon height:35px déforme le cercle en ellipse. */
.filters .facet .filter_content .facet_close {
  align-items: center;
  background: rgba(0, 61, 165, 0.16);
  border-radius: 50%;
  box-sizing: border-box;
  color: var(--blue-500);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 16px;
  height: 22px;
  justify-content: center;
  line-height: 1;
  min-width: 0;
  padding: 0 0 2px;
  width: 22px;
}

.filters .facet.is-empty {
  cursor: default;
  opacity: 0.45;
}

/* ------------------------------- Résultats ---------------------------------- */

/* `.grid { display: grid }` (spécificité de classe) masque l'attribut [hidden] natif :
   on rend la règle de masquage plus spécifique pour basculer éditorial ↔ résultats. */
.articles.grid[hidden] { display: none; }

.search-results_empty {
  color: var(--blue-500);
  font-family: Lato-Bold;
  font-size: 20px;
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
}

/* Sous 900px : plus la place pour une ligne, la barre s'empile (moteur en premier). */
@media (max-width: 900px) {
  .blog-projet-toolbar {
    flex-direction: column;
    gap: 16px;
  }

  .blog-projet-toolbar .filters {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  .blog-projet-search {
    justify-content: center;
    margin: 0 auto;
    max-width: 540px;
    order: -1;
    width: 100%;
  }
}

@media (max-width: 470px) {
  .blog-projet-toolbar { padding: 0 16px 25px; }

  .search-articles_field { padding: 9px 18px; }

  .search-articles_input { font-size: 15px; }
}
