/* En-tête, méga-menus, menu mobile — composants Figma « Header », « Sous-menu Solutions / Besoins / Fitem »,
   « Header - Mobile », écrans 01.2 et 01.3 */

.logo--sombre { --fi-logo-1: var(--lavande); --fi-logo-2: var(--noir); } /* le logo servi par <use> lit ces variables */
.logo--sombre [fill="#6066B0"] { fill: var(--lavande); }
.logo--sombre [fill="#6F6F6F"] { fill: var(--noir); }

.entete {
  position: relative;
  z-index: 1000;
  background: var(--blanc);
  box-shadow: 0 1px 0 var(--gris-entete);
}

/* Pré-en-tête */
.preentete { background: var(--noir); color: var(--blanc); font: 400 14px/20px var(--police-texte); }
.preentete__ligne {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 40px;
}
/* Sans sélecteur de langue, le bandeau de livraison reste centré et le lien pro à droite. */
.preentete__ligne:not(:has(.preentete__langue)) { grid-template-columns: 1fr auto 1fr; }
.preentete__ligne:not(:has(.preentete__langue)) .bandeau { grid-column: 2; }
/* Plus de 3 messages : ils partent de la gauche et prennent la place libre, Espace pro reste à droite. */
.preentete__ligne:not(:has(.preentete__langue)):has(.bandeau--nombreux) { grid-template-columns: minmax(0, 1fr) auto; column-gap: 40px; }
.preentete__ligne:not(:has(.preentete__langue)) .bandeau--nombreux { grid-column: 1; justify-self: stretch; }
.preentete__ligne:not(:has(.preentete__langue)):has(.bandeau--nombreux) .preentete__pro { grid-column: 2; }
.preentete__ligne:not(:has(.preentete__langue)) .preentete__pro { grid-column: 3; }
.preentete__langue { display: inline-flex; align-items: center; gap: 2px; justify-self: start; }
.preentete__langue .icone { width: 24px; height: 24px; }
/* Bandeau de messages (menu « Bandeau du haut — messages »). */
.bandeau { min-width: 0; overflow: hidden; }
.bandeau__liste { display: flex; align-items: center; width: max-content; margin: 0; padding: 0; list-style: none; }
.bandeau__message { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.bandeau__message::after { content: "·"; margin-inline: 14px; opacity: .55; }
.bandeau__message:last-child::after { display: none; }
.bandeau__message > a { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.bandeau__message > a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.bandeau__message .icone { flex: none; width: 16px; height: 16px; }
/* Messages trop nombreux pour la ligne (bureau étroit) : un à la fois, en fondu, calés à gauche. Jamais de défilement. */
.bandeau--rotation .bandeau__liste { display: grid; width: 100%; }
.bandeau--rotation .bandeau__message { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s linear .45s; }
.bandeau--rotation .bandeau__message.est-actif { opacity: 1; visibility: visible; transition: opacity .45s ease; }
.bandeau--rotation .bandeau__message::after { display: none; }
.preentete__pro { justify-self: end; }
.preentete__pro:hover, .preentete__langue:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Barre principale (bureau) */
.entete__barre {
  display: grid;
  grid-template-columns: clamp(190px, 17vw, 244.5px) minmax(0, 1fr);
  grid-template-rows: 40px 52px;
  row-gap: 12px;
  padding-block: 17px 19px;
}
.entete__burger { display: none; }
.entete__logo { grid-column: 1; grid-row: 1 / 3; align-self: start; margin: 4px 0 0 -4px; width: 165px; }
.entete__logo .logo { width: 165px; height: 97px; }

.recherche {
  grid-column: 2; grid-row: 1;
  position: relative;
  width: 508px;
  max-width: calc(100% - 180px);
  margin-left: clamp(24px, 10.2vw, 146.5px);
}
.recherche__champ {
  width: 100%;
  height: 40px;
  padding: 0 52px 0 22px;
  border: 0;
  border-radius: 4px;
  background: var(--gris-champ);
  font: 400 14px/20px var(--police-texte);
  -webkit-appearance: none;
  appearance: none;
}
.recherche__champ::placeholder { color: rgba(35, 35, 35, .5); opacity: 1; }
.recherche__champ::-webkit-search-cancel-button { -webkit-appearance: none; }
.recherche__bouton { position: absolute; top: 0; right: 13px; height: 40px; display: grid; place-items: center; width: 24px; }
.recherche__bouton .icone { width: 19px; height: 19px; }

.entete__actions {
  grid-column: 2; grid-row: 1;
  justify-self: end;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 3px;
  margin-right: -1px;
}
.entete__action { position: relative; display: grid; place-items: center; color: var(--noir); transition: color .2s ease; }
.entete__action:hover { color: var(--violet); }

/* Pastille du nombre d'articles (non dessinée par Cath) : masquée à 0 par site.js */
.pastille-panier {
  position: absolute;
  top: -7px;
  right: -10px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--blanc);
  border-radius: 10px;
  background: var(--corail);
  color: var(--blanc);
  font: 600 11px/15px var(--police-texte);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.entete__action--recherche, .entete__icone-mobile { display: none; }
.entete__action--compte .entete__icone-bureau { width: 28px; height: 28px; }
.entete__action--panier .entete__icone-bureau { width: 25px; height: 28px; }

.navigation {
  grid-column: 2; grid-row: 2;
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.74vw, 25px);
}
.navigation__liste { display: flex; align-items: center; gap: clamp(8px, 1.74vw, 25px); }
.navigation__item { position: relative; }
.navigation__item--mega { position: static; }
.navigation__lien {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  font: 400 16px/24px var(--police-texte);
  color: var(--noir);
  white-space: nowrap;
}
.navigation__lien .icone { width: 11px; height: 9px; padding-top: 3px; box-sizing: content-box; transition: transform .2s ease; }
.navigation__lien:hover { color: var(--violet); }
.navigation__lien[aria-expanded="true"] .icone { transform: rotate(180deg); }
.navigation__cta { flex: none; }

/* Sous-menu « Fitem » */
.sous-menu {
  position: absolute;
  top: calc(100% + 23px);
  left: -31px;
  width: 193px;
  padding: 51px 0 47px 31px;
  background: var(--blanc);
  box-shadow: var(--ombre-popin);
  display: grid;
  gap: 8px;
}
.sous-menu__lien { display: inline-block; padding: 10px; font: 500 18px/24px var(--police-texte); color: var(--noir); }
.sous-menu__lien:hover { color: var(--corail); }

/* Méga-menus */
.mega {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-height: 462px;
  background: var(--blanc);
  border: 1px solid rgba(73, 71, 66, .2);
  box-shadow: var(--ombre-menu);
}
.mega__grille { display: flex; justify-content: space-between; gap: 50px; }
.mega__colonnes {
  display: grid;
  grid-template-columns: 230px 230px;
  column-gap: 30px;
  align-content: start;
  padding-top: 43px;
}
.mega__rubrique { font: 300 20px/26px var(--police-texte); color: var(--corail); margin-bottom: 16px; }
.mega__lien { display: inline-block; padding: 10px 0; font: 500 18px/24px var(--police-texte); color: #000; }
.mega__lien:hover { color: var(--corail); }
.mega__cta { grid-column: 1 / -1; justify-self: start; margin-top: 40px; }
.mega--besoins .mega__cta { margin-top: 17px; }
.mega__phares { width: 739px; padding-top: 38px; }
.mega__titre-phares { font: 600 24px/28.8px var(--police-titre); color: var(--titre); margin-bottom: 17px; }
/* Les cartes sont calées sur 1440 px : en dessous, elles se partagent la place restante
   plutôt que de sortir du panneau. */
.mega__cartes { display: grid; grid-template-columns: repeat(3, minmax(0, 233px)); gap: 20px; min-width: 0; }
.mega--besoins .mega__cartes { max-width: 739px; padding-top: 38px; }
.mega__grille { min-width: 0; }
.mega__colonnes { min-width: 0; }
.carte-menu { display: block; width: 100%; max-width: 233px; }
.carte-menu__visuel { position: relative; display: block; height: 290px; border-radius: var(--r-bloc); overflow: hidden; }
.carte-menu__visuel::after { content: ""; position: absolute; inset: 0; background: transparent; }
.carte-menu__visuel--voile-5::after { background: rgba(0, 0, 0, .05); }
.carte-menu__visuel--voile-8::after { background: rgba(0, 0, 0, .08); }
.carte-menu__visuel--voile-10::after { background: rgba(0, 0, 0, .1); }
.carte-menu__visuel .photo { transition: scale .4s ease; }
.carte-menu:hover .photo { scale: 1.03; }
/* Produits phares : packshots carrés sur fond blanc, montrés entiers (le cadre en portrait les rognait). */
.mega__phares .carte-menu__visuel { background: #fff; }
.mega__phares .carte-menu__visuel .photo { object-fit: contain; }
.carte-menu__nom { display: block; padding: 10px; font: 600 18px/24px var(--police-texte); color: #000; text-align: center; }
.pastille-techno {
  position: absolute;
  z-index: 1;
  top: 11px;
  left: 15px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--violet);
  color: var(--blanc);
  display: grid;
  place-content: center;
  text-align: center;
  font: 400 11px/18px var(--police-texte);
}
.pastille-techno strong { font-size: 14px; font-weight: 400; }

/* Menu mobile */
.menu-mobile { display: none; }

@media (max-width: 1199px) {
  .preentete__ligne { grid-template-columns: 1fr; justify-items: center; min-height: 36px; padding-block: 8px; }
  .preentete__langue, .preentete__pro { display: none; }
  /* Téléphone : un message à la fois, en fondu (site.js). */
  .preentete__ligne:not(:has(.preentete__langue)):has(.bandeau--nombreux) { grid-template-columns: 1fr; column-gap: 0; }
  .bandeau, .preentete__ligne:not(:has(.preentete__langue)) .bandeau--nombreux { grid-column: auto; justify-self: stretch; width: 100%; }
  .bandeau__liste { display: grid; width: 100%; }
  .bandeau__message { grid-area: 1 / 1; justify-content: center; white-space: normal; text-align: center; opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s linear .45s; }
  .bandeau__message.est-actif { opacity: 1; visibility: visible; transition: opacity .45s ease; }
  .bandeau__message::after { display: none; }

  .entete__barre {
    grid-template-columns: auto auto 1fr;
    grid-template-rows: 60px;
    align-items: center;
    column-gap: 17px;
    padding-block: 0;
    padding-inline: 16px;
  }
  .entete__burger { display: grid; place-items: center; width: 24px; height: 24px; grid-column: 1; }
  .entete__burger .icone { width: 24px; height: 24px; }
  .entete__logo { grid-row: 1; grid-column: 2; margin: 0; width: auto; align-self: center; }
  .entete__logo .logo { width: 71px; height: 42px; }
  .recherche, .navigation, .mega { display: none; }
  .entete__actions { grid-column: 3; grid-row: 1; align-self: center; margin: 0; gap: 19px; }
  .entete__action--recherche, .entete__icone-mobile { display: block; }
  .entete__icone-bureau { display: none; }
  .entete__action--recherche .icone { width: 25px; height: 26px; }
  .entete__action--compte .icone { width: 26px; height: 26px; }
  .entete__action--panier .icone { width: 22.5px; height: 26px; }

  /* Ouverture : glissement depuis la gauche, voile sombre sur la page pendant le mouvement */
  .menu-mobile {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: var(--blanc);
    overflow: hidden;
    transform: translateX(-100%);
    box-shadow: 0 0 0 100vmax rgba(35, 35, 35, 0);
    transition: transform .28s cubic-bezier(.4, 0, 1, 1), box-shadow .28s ease;
  }
  .menu-mobile.est-ouvert {
    transform: none;
    box-shadow: 0 0 0 100vmax rgba(35, 35, 35, .35);
    /* Courbe symétrique de la fermeture (même durée, accélération inversée) : même ressenti de vitesse */
    transition: transform .28s cubic-bezier(0, 0, .6, 1), box-shadow .28s ease;
  }
  .menu-mobile[hidden] { display: none; }
  .menu-mobile__barre {
    flex: none;
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    column-gap: 17px;
    height: 60px;
    padding-inline: 16px;
    box-shadow: 0 1px 0 var(--gris-entete);
  }
  .menu-mobile__barre .entete__actions { justify-self: end; }
  .menu-mobile__fermer .icone { width: 22px; height: 22px; }

  /* Deux positions seulement : l'écran principal, et le sous-menu demandé posé juste à sa droite.
     Les sous-menus partagent la même case : un seul glissement, quel que soit le sous-menu. */
  .menu-mobile__rail {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 100% 100%;
    grid-template-rows: minmax(0, 1fr);
    transition: transform .34s cubic-bezier(.16, 1, .3, 1);
  }
  .menu-mobile__rail.vers-sous-menu { transform: translateX(-100%); }
  .menu-mobile__rail.sans-transition { transition: none; }
  .menu-mobile__ecran[data-ecran="principal"] { grid-column: 1; grid-row: 1; }
  .menu-mobile__ecran:not([data-ecran="principal"]) { grid-column: 2; grid-row: 1; }
  .menu-mobile__ecran {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .menu-mobile__ecran[data-ecran="principal"] { justify-content: space-between; }

  .menu-mobile__haut { padding: 16px 0 32px; }
  .menu-mobile__recherche {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 16px 16px;
    height: 44px;
    padding: 0 16px;
    border-radius: 100px;
    background: var(--gris-champ);
  }
  .menu-mobile__recherche .icone { width: 14px; height: 14px; }
  .menu-mobile__recherche input { flex: 1; min-width: 0; border: 0; background: transparent; font: 400 14px/20px var(--police-texte); }
  .menu-mobile__recherche input::placeholder { color: rgba(35, 35, 35, .6); opacity: 1; }
  .menu-mobile__recherche input:focus { outline: none; }
  .menu-mobile__recherche:focus-within { outline: 2px solid var(--violet); outline-offset: 2px; }
  .menu-mobile__liste > li { border-bottom: 1px solid #F0F0F0; padding-block: 2px; }
  .menu-mobile__liste > li:first-child { border-top: 1px solid #F0F0F0; }
  .menu-mobile__ligne {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font: 400 18px/26px var(--police-texte);
    color: var(--noir);
  }
  .menu-mobile__ligne .icone { width: 10px; height: 12px; }

  .menu-mobile__cta { padding: 24px 16px; }
  .menu-mobile__cta .bouton { width: 100%; }
  .menu-mobile__cta .icone { width: 20px; height: 20px; }
  .menu-mobile__tuiles { display: flex; justify-content: space-between; gap: 13px; padding: 16px; }
  .menu-mobile__tuile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--r-petit);
    background: var(--gris-champ);
    font: 400 18px/26px var(--police-texte);
    white-space: nowrap;
  }
  .menu-mobile__tuile .icone { width: 24px; height: 24px; }
  .menu-mobile__pied {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    padding: 0 21px;
    background: var(--noir);
    color: var(--blanc);
    font: 400 14px/20px var(--police-texte);
  }
  .menu-mobile__pied .preentete__langue { display: inline-flex; }

  .menu-mobile__sous { padding: 12px 16px 0; }
  .menu-mobile__retour {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 16px;
    border-radius: var(--r-pilule);
    background: rgba(126, 130, 186, .3);
    font: 400 14px/20px var(--police-texte);
    color: var(--violet);
    margin-bottom: 4px;
  }
  .menu-mobile__retour .icone { width: 10px; height: 12px; transform: rotate(180deg); }
  .menu-mobile__rubrique { display: flex; align-items: center; height: 48px; margin-bottom: 4px; font: 300 20px/26px var(--police-texte); color: var(--corail); }
  .menu-mobile__rubrique--separee { margin-top: 16px; border-top: 1px solid #F0F0F0; padding-top: 4px; height: 53px; box-sizing: border-box; }
  .menu-mobile__sous-liste { display: grid; gap: 4px; }
  .menu-mobile__sous-liste a { display: flex; align-items: center; min-height: 36px; padding: 0 16px; font: 400 18px/26px var(--police-texte); color: var(--noir); }
  .menu-mobile__phares { margin-top: 12px; padding: 12px 16px 0; border-top: 1px solid #F0F0F0; }
  .menu-mobile__titre-phares { font: 600 20px/24px var(--police-titre); color: var(--titre); margin-bottom: 17px; }
  .menu-mobile__phares ul { display: grid; grid-template-columns: repeat(2, minmax(0, 165px)); justify-content: center; gap: 20px; }
  .menu-mobile__phare-photo { display: block; aspect-ratio: 1; border-radius: var(--r-bloc); overflow: hidden; }
  .menu-mobile__phares a > span:last-child { display: block; padding: 10px; font: 500 16px/20.2px var(--police-texte); text-align: center; color: #000; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .entete__barre { padding-inline: var(--gouttiere); }
}

/* ——— Recherche instantanée ——— */
.recherche, .menu-mobile__recherche { position: relative; }
.rech-panneau {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: max(100%, 560px); max-height: min(70vh, 620px); overflow-y: auto;
  padding: 8px 0; border: 1px solid var(--gris-bordure); border-radius: var(--r-bloc);
  background: var(--blanc); box-shadow: var(--ombre-popin);
  text-align: left;
}
.rech-groupe + .rech-groupe { margin-top: 4px; padding-top: 4px; border-top: 1px solid #F0F0F0; }
.rech-groupe__titre { padding: 8px 16px 4px; font: 600 12px/16px var(--police-texte); letter-spacing: .06em; text-transform: uppercase; color: rgba(58, 57, 53, .55); }
.rech-res a { display: flex; align-items: center; gap: 12px; padding: 8px 16px; color: var(--noir); text-decoration: none; }
.rech-res[aria-selected="true"] a { background: var(--gris-champ); }
.rech-res__visuel { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-petit); background: var(--gris-champ); overflow: hidden; }
.rech-res__visuel img { width: 100%; height: 100%; object-fit: cover; }
.rech-res--p .rech-res__visuel img { object-fit: contain; }
.rech-res__texte { display: flex; flex-direction: column; min-width: 0; }
.rech-res__titre { font: 500 15px/20px var(--police-texte); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.rech-res__titre mark { background: none; color: inherit; font-weight: 700; }
.rech-res__detail { margin-top: 2px; font: 400 13px/18px var(--police-texte); color: #6B6B6B; }
.rech-res__detail del { margin-right: 4px; }
.rech-res__prix { font-weight: 600; color: var(--titre); }
.rech-res__note { margin-left: 6px; color: #B8860B; }
.rech-res__note span { color: #6B6B6B; }
.rech-res__rupture { margin-left: 6px; color: var(--corail); }
.rech-tous { display: block; margin-top: 4px; padding: 12px 16px 6px; border-top: 1px solid #F0F0F0; font: 500 14px/20px var(--police-texte); color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }
.rech-vide { padding: 14px 16px; font: 400 14px/21px var(--police-texte); color: var(--noir); }
.rech-vide a { color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }

/* Dans le menu mobile, le panneau prend la largeur du menu et suit le champ. */
.menu-mobile__recherche .rech-panneau { left: 0; right: 0; width: auto; max-height: calc(100dvh - 190px); }
