/* ---------------------------------------------
   Search engine (barre)
   ----------------------------------------------- */

/* Loupe UNE SEULE FOIS */
:root{
  --search-magnifier-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23172142' d='M10 18a8 8 0 1 1 5.29-14.01A8 8 0 0 1 10 18Zm0-2a6 6 0 1 0-6-6a6 6 0 0 0 6 6Zm9.71 4.29l-4.1-4.1l1.42-1.42l4.1 4.1l-1.42 1.42Z'/%3E%3C/svg%3E");
}

.search-engine-input{
  border-radius: 50px;
  padding: 5px 20px 20px 80px;
  background: #fff;
  display: inline-block;

  background-repeat: no-repeat;
  background-position: 14px 50%;
  background-size: 60px 60px;
  background-image: var(--search-magnifier-svg);

  position: relative;
  overflow: visible;
}

/* Variante results (barre Google-like) */
.search-engine-input.results{
  border: 1px solid #dadce0;
  padding: 5px 20px 5px 80px;
  margin-bottom: 20px;
  box-shadow: 0px 3px 10px 0px rgba(31, 31, 31, 0.08);
}

/* Champ */
.search-engine-input input[type="text"]{
  border: 0;
  padding: 0;
  font-size: 40px;
  font-weight: bold;
  background: transparent;
  outline: none;
}

/* Placeholder (couleur + transition) */
.search-engine-input input[type="text"]::placeholder{
  color: #172142;
  opacity: 1;
  transition: opacity .15s ease;
}

/* Cache le submit natif */
.search-engine-input input[type="submit"],
.search-engine-popup input[type="submit"]{
  display: none;
}


/************************************************************************
*
* Triggers (loupe + titre)
*
*************************************************************************/

/* Zone cliquable sur la loupe */
.search-engine-input .search-magnifier-hit{
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 70px;
  height: 70px;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 60;
}

/* Titre cliquable */
.search-engine-input .search-title-hit{
  position: absolute;
  left: 80px;
  top: 50%;
  transform: translateY(-50%); /* centré par défaut */
  z-index: 60;

  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;

  font-size: 40px;
  font-weight: bold;
  color: #172142;
  line-height: 1;
  text-align: left;

  transition: transform .18s ease; /* pour le "monte un peu" */
}

/* HOME: input "technique" (évite collision visuelle) */
.search-engine-input:not(.results) input#s{
  color: transparent;
  caret-color: transparent;
}

/* HOME: placeholder invisible (titre overlay = UI) */
.search-engine-input:not(.results) input#s::placeholder{
  opacity: 0;
}

/* RESULTS: tapable */
.search-engine-input.results input#s{
  color: #172142;
  caret-color: #172142;
}

/* RESULTS: placeholder visible */
.search-engine-input.results input#s::placeholder{
  opacity: 1;
}

/* RESULTS: on cache le titre overlay pour ne pas bloquer la saisie */
.search-engine-input.results .search-title-hit{
  display: none;
}


/************************************************************************
*
* HOME ONLY — au hover: le titre monte, la phrase apparaît
* (sans étirer le blanc)
*
*************************************************************************/

/* HOME ONLY — Sous-titre toujours visible (comme avant) */
body.home .search-engine-input:not(.results) .search-subtitle-hover{
  position: absolute;
  left: 80px;
  top: 50%;
  transform: translateY(10px);
  z-index: 60;

  font-size: 16px;
  color: #172142;
  opacity: .85;
  white-space: nowrap;

  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;

  font-weight:400;
  letter-spacing:0.2px;
}

/* On annule l’animation qui montait le titre */
body.home .search-engine-input:not(.results) .search-title-hit{
  transition: none;
  transform: translateY(calc(-50% - 12px));
}

/************************************************************************
*
* Popup (overlay + carte)
*
*************************************************************************/

/* Garde l'espace du header pendant que le form est déplacé */
.search-popup-open .search-engine-input{
  visibility: hidden;      /* garde l’espace */
  pointer-events: none;
}

/* Overlay aligné en haut à gauche */
.search-engine-popup-overlay{
  position: fixed;
  inset: 0;
  z-index: 999999;

  display: none;
  align-items: flex-start;
  justify-content: flex-start;

  padding: 0px;
  background: rgba(0,0,0,0);
}
.search-popup-open .search-engine-popup-overlay{
  display: flex;
}

/* Carte blanche */
.search-engine-popup{
  position: relative;
  max-width: 980px;
  width: min(980px, calc(100vw - 80px));
  background: #fff;

  border-radius: 0px;
  border-bottom-right-radius: 50px;

  padding: 34px 38px 38px;
  box-shadow: 0 18px 60px rgba(0,0,0,.12);

  max-height: calc(100vh - 80px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Bouton fermer */
.search-engine-popup__close{
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(23,33,66,.06);
  color: #172142;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  opacity: .9;
}
.search-engine-popup__close:hover{
  background: rgba(23,33,66,.10);
}

/* Titres */
.search-engine-popup__title{
  margin: 0 0 18px 0;
  font-weight: 600;
  color: #172142;
  font-size: clamp(28px, 3.2vw, 44px);
}
.search-engine-popup__subtitle{
  font-size: 20px;
  font-weight: 500;
  color: #172142;
  margin: 18px 0 10px;
}

/* Input dans le popup (vrai #s déplacé ici) */
.search-engine-popup input#s{
  width: 100%;
  background: #e6e6e6;
  border: 0;
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 500;
  outline: none;
  min-height: auto;

  color: #172142;
  caret-color: #172142;
}
.search-engine-popup input#s::placeholder{
  color: rgba(23,33,66,.55);
  opacity: 1;
}

/* Suggestions */
.search-engine-popup__list{
  list-style: none;
  padding: 0;
  margin: 0;
}
.search-engine-popup__item{ margin: 6px 0; }

.search-engine-popup__suggestion{
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #172142;
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 500;
  padding: 4px 0 4px 52px;
  position: relative;
}

/* Flèche identique (coin + diagonale) */
.search-engine-popup__suggestion::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0.08em;
  width: 40px;
  height: 40px;
  background-repeat: no-repeat;
  background-size: 40px 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6H18V18' fill='none' stroke='%23172142' stroke-width='2' stroke-linecap='butt' stroke-linejoin='miter'/%3E%3Cpath d='M6 18L18 6' fill='none' stroke='%23172142' stroke-width='2' stroke-linecap='butt' stroke-linejoin='miter'/%3E%3C/svg%3E");
  opacity: .95;
}
.search-engine-popup__suggestion:hover{ opacity: .85; }


/*****************************************************
*
* Google-Like snippets
*
*****************************************************/
body.search-results .g-result,
body.search-results .g-result * {
  font-family: "Roboto", Arial, sans-serif;
}

.g-search-header { margin: 0 0 18px; }
.g-search-title { font-size: 18px; font-weight: 500; margin: 0 0 8px; }
.g-search-term { font-weight: 700; }

.g-dym { margin: 0; font-size: 16px; }
.g-dym a { color: #1a0dab; text-decoration: none; }
.g-dym a:hover { text-decoration: underline; }

.g-result { margin: 0 0 26px; padding: 0; border: 0; }
.g-title { font-size: 20px; line-height: 1.3; font-weight: 400; margin: 0; }
.g-title-link { color: #1a0dab; text-decoration: none; }
.g-title-link:hover { text-decoration: underline; }

.g-url { margin-top: 2px; font-size: 14px; line-height: 1.4; }
.g-url-link { color: #006621; text-decoration: none; }
.g-url-link:hover { text-decoration: underline; }
.g-url-cite { font-style: normal; }

.g-snippet { margin-top: 4px; font-size: 14px; line-height: 1.58; color: #4d5156; }
.g-snippet p { margin: 0 0 6px; }

.relevanssi-query-term { font-weight: 700; background: transparent; }
.g-pagination { margin-top: 18px; }


/************************************************************************
*
* Mobile + fix results ≤768px
*
*************************************************************************/
@media (max-width: 768px){
  .search-engine-input input[type="text"]{
    font-size: 0.7em;
    max-width: 325px;
  }

  .search-engine-input .search-title-hit{
    font-size: 0.7em;
  }

  .search-engine-popup-overlay{ padding: 14px; }

  .search-engine-popup{
    width: calc(100vw - 28px);
    max-width: none;
    border-radius: 26px;
    padding: 18px 16px 18px;
    max-height: calc(100vh - 28px);
  }

  .search-engine-popup__title{
    font-size: 26px;
    margin-bottom: 12px;
  }

  .search-engine-popup input#s{
    font-size: 16px;
    padding: 12px 12px;
  }

  .search-engine-popup__subtitle{
    font-size: 16px;
    margin-top: 12px;
  }

  .search-engine-popup__suggestion{
    font-size: 18px;
  }

  /* Fix mobile pour la barre .results */
  .search-engine-input.results{
    line-height: normal;
    padding: 10px 16px 10px 64px;
    border-radius: 999px;
    background-size: 44px 44px;
    background-position: 12px 50%;
  }
  
  .search-engine-input.results input#s{
    font-size: 16px !important;
    line-height: 24px;
    max-width: none;
    width: 100%;
  }
  
  body.home .search-engine-input:not(.results) .search-subtitle-hover { 
	display:none;
  }
  .search-engine-input .search-title-hit {
	transform: translateY(-50%) !important;
  }
  
}


@media (max-width: 425px){
  .search-engine-popup__title { font-size: 1.6em; }

  .search-engine-input input[type="text"]{
    font-size: 0.5em;
    max-width: 225px;
  }

  .search-engine-input .search-title-hit{
    font-size: 0.5em;
  }

  .search-engine-input{ line-height: 0.7em; }
  

}

/************************************************************************
*
* Micro-interaction au hover — HOME seulement
*
*************************************************************************/

/* Prépare l’animation */
body.home .search-engine-input:not(.results){
  transform-origin: center center;
  transition:
	  transform .28s ease,
	  box-shadow .28s ease;  
/*
  transition:
    transform .22s ease,
    box-shadow .22s ease;
	*/
}

/* Petit zoom élégant au survol */
@media (hover:hover){
  body.home .search-engine-input:not(.results):hover{
	transform: scale(1.035);
    box-shadow: 0 8px 24px rgba(23, 33, 66, 0.12);
  }
}

/* Accessibilité clavier */
body.home .search-engine-input:not(.results):focus-within{
  transform: scale(1.035);
  box-shadow: 0 8px 24px rgba(23, 33, 66, 0.12);
}

/* Ne jamais appliquer sur la page résultats */
.search-engine-input.results{
  transform: none !important;
}
