/* ==========================================================================
   CandleTime — en-tête (DESIGN.md §5.1 et §5.2)
   Bandeau d'annonce, ligne du logo, menu des rayons.
   ========================================================================== */

/* --- Bandeau d'annonce (top bar de Flatsome, élément HTML) -------------- */

#top-bar.header-top {
  min-height: 0;
  background-color: var(--ls-encre);
}

#top-bar > .flex-row {
  max-width: none;
  padding: 0;
}

#top-bar .flex-col {
  flex: 1 1 100%;
}

#top-bar .flex-col:not(.flex-center):not(.show-for-medium) {
  display: none;
}

#top-bar .nav {
  justify-content: center;
}

#top-bar .nav > li.html {
  margin: 0;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: none;
  white-space: normal;
  color: var(--ls-trait);
}

/* --- Ligne du logo ------------------------------------------------------ */

.header-wrapper,
.header-bg-color {
  background-color: var(--ls-blanc);
}

#masthead.header-main {
  height: auto;
}

#masthead .header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  height: auto;
  min-height: var(--ls-header-h);
}

/* Le « clearfix » de .container deviendrait une 2e ligne de grille et décalerait tout vers le haut. */
#masthead .header-inner::before,
#masthead .header-inner::after {
  content: none;
}

/* Un seul jeu d'icônes pour toutes les largeurs : les colonnes « ordinateur » de Flatsome
   restent affichées en mobile, ses colonnes « mobile » (vides) sont masquées. */
#masthead .header-inner > .flex-col.hide-for-medium {
  display: block !important;
}

#masthead .header-inner > .flex-col.show-for-medium {
  display: none !important;
}

#masthead .header-inner > #logo {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  margin: 0;
}

#masthead .header-inner > .flex-left {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

#masthead .header-inner > .flex-right {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

/* Logo typographique */

#logo a.ls-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  text-align: center;
  text-transform: none;
  color: var(--ls-encre);
}

.ls-logo__nom {
  padding-left: var(--ls-ls-logo);
  font-family: var(--ls-font-titre);
  font-size: clamp(17px, 4.4vw, 30px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: var(--ls-ls-logo);
  text-transform: uppercase;
  white-space: nowrap;
}

.ls-logo__signature {
  font-family: var(--ls-font-texte);
  font-size: clamp(6.3px, 1.75vw, 9.5px);
  font-weight: 500;
  line-height: normal;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ls-pierre);
}

/* Icônes : cibles de 44 px, glyphes de Flatsome remplacés par les SVG de la maquette */

#masthead .nav {
  flex-wrap: nowrap;
  gap: 2px;
  width: auto;
}

#masthead .nav > li {
  margin: 0;
}

#masthead .nav > li > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ls-cible);
  height: var(--ls-cible);
  padding: 0;
  font-size: var(--ls-fs-base);
  color: var(--ls-encre);
}

#masthead .nav > li > a > i {
  display: block;
  width: 21px;
  height: 21px;
  min-width: 0;
  font-size: 0 !important;
  line-height: 0;
  background: center / contain no-repeat;
}

#masthead .nav > li > a > i::before {
  content: none;
}

#masthead .nav > li > a > i.icon-search {
  width: 20px;
  height: 20px;
  background-image: url('../icons/search.svg');
}

#masthead .nav > li > a > i.icon-user {
  background-image: url('../icons/user.svg');
}

#masthead .nav > li > a > i[class*='icon-shopping'] {
  background-image: url('../icons/bag.svg');
}

/* Nombre d'articles du panier : petite pastille encre (masquée à 0 par Flatsome) */

#masthead .nav > li > a > i[data-icon-label]::after {
  top: -7px;
  right: -9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-family: var(--ls-font-texte) !important;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0;
  background-color: var(--ls-encre);
  box-shadow: none;
  opacity: 1;
}

/* Bouton ☰ (navigation mobile) : affiché sous 850 px quand JavaScript est actif */

#masthead .nav > li.ls-menu-item {
  display: none;
}

#masthead button.ls-menu-ouvrir {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ls-cible);
  min-width: 0;
  height: var(--ls-cible);
  min-height: 0;
  margin: 0;
  padding: 0;
  line-height: 1;
  color: var(--ls-encre);
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Petits écrans : cinq éléments sur une ligne (☰, loupe, logo, compte, panier).
   Largeurs vérifiées avec les métriques des polices : logo de 175 px à 390, 162 px à 360,
   149 px à 320, pour 206, 176 et 156 px disponibles. */

@media (max-width: 479px) {
  #masthead .header-inner {
    gap: 4px;
    padding-right: 8px;
    padding-left: 8px;
  }

  #masthead .nav {
    gap: 0;
  }

  #masthead .nav > li > a,
  #masthead button.ls-menu-ouvrir {
    width: 40px;
  }
}

@media (max-width: 359px) {
  #masthead .header-inner {
    padding-right: 6px;
    padding-left: 6px;
  }

  #masthead .nav > li > a,
  #masthead button.ls-menu-ouvrir {
    width: 36px;
  }

  .ls-logo__nom {
    font-size: 16px;
  }

  .ls-logo__signature {
    font-size: 6px;
    letter-spacing: 0.14em;
  }
}

/* --- Menu des rayons ---------------------------------------------------- */

.ls-nav {
  position: relative;
  z-index: 9;
  overflow-x: auto;
  background-color: var(--ls-blanc);
  border-top: 1px solid var(--ls-trait-doux);
  border-bottom: 1px solid var(--ls-trait);
  scrollbar-width: none;
}

.ls-nav::-webkit-scrollbar {
  display: none;
}

.ls-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ls-nav li {
  margin: 0;
}

.ls-nav__liste {
  display: flex;
  width: max-content;
  margin: 0 auto !important;
  padding: 0 6px !important;
}

.ls-nav__liste > li {
  position: relative;
}

.ls-nav__liste > li > a {
  display: block;
  padding: 15px 10px;
  font-size: var(--ls-fs-nav);
  font-weight: 600;
  line-height: normal;
  letter-spacing: var(--ls-ls-nav);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ls-encre);
}

.ls-nav__liste > li > a:hover,
.ls-nav__liste > li.ls-nav-cadeaux > a {
  color: var(--ls-bronze);
}

.ls-nav__liste > li.ls-actif > a {
  color: var(--ls-bronze);
  box-shadow: inset 0 -2px 0 var(--ls-bronze);
}

/* Sous-menus : masqués dans la bande défilante, déroulants quand le menu tient sur une ligne */

.ls-nav .sub-menu {
  display: none;
}

@media (min-width: 1280px) {
  .ls-nav {
    overflow: visible;
  }

  .ls-nav .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 220px;
    padding: 6px 0;
    background-color: var(--ls-blanc);
    border: 1px solid var(--ls-trait);
  }

  .ls-nav__liste > li:hover > .sub-menu,
  .ls-nav__liste > li:focus-within > .sub-menu {
    display: block;
  }

  .ls-nav .sub-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    color: var(--ls-encre);
  }

  .ls-nav .sub-menu a:hover,
  .ls-nav .sub-menu li.ls-actif > a {
    color: var(--ls-bronze);
  }
}

/* --- Navigation mobile : tiroir (moins de 850 px) ------------------------
   Remplace la bande défilante des rayons. Sans JavaScript, la bande reste affichée. */

.ls-menu {
  display: none;
}

body.ls-sans-defilement-menu {
  overflow: hidden;
}

@media (max-width: 849px) {
  .ls-js-menu .ls-nav {
    display: none;
  }

  .ls-js-menu #masthead .nav > li.ls-menu-item {
    display: block;
  }

  .ls-js-menu .ls-menu {
    display: block;
  }

  .ls-menu__fond {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background-color: rgba(28, 25, 23, 0.5);
  }

  .ls-menu__fond[hidden] {
    display: none;
  }

  .ls-menu__panneau {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100001;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    box-sizing: border-box;
    width: min(88vw, 360px);
    max-width: 100vw;
    height: 100%;
    overflow: hidden;
    visibility: hidden;
    background-color: var(--ls-blanc);
    transform: translateX(-100%);
    transition: transform var(--ls-transition-fondu), visibility 0s linear 0.25s;
  }

  .ls-menu--ouvert .ls-menu__panneau {
    visibility: visible;
    transform: none;
    transition: transform var(--ls-transition-fondu);
  }

  .ls-menu__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 8px 8px 8px 20px;
    border-bottom: 1px solid var(--ls-trait);
  }

  .ls-menu__titre {
    margin: 0;
    font-family: var(--ls-font-titre);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--ls-encre);
  }

  .ls-menu button.ls-menu__fermer {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ls-cible);
    min-width: var(--ls-cible);
    height: var(--ls-cible);
    min-height: 0;
    margin: 0;
    padding: 0;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    color: var(--ls-encre);
    background: transparent;
    border: 0;
  }

  /* Défilement vertical classique */
  .ls-menu__corps {
    min-width: 0;
    padding-bottom: 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .ls-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ls-menu li {
    margin: 0;
  }

  .ls-menu__rayon {
    border-bottom: 1px solid var(--ls-trait);
  }

  .ls-menu__ligne {
    display: flex;
    align-items: stretch;
  }

  .ls-menu__rayon > a,
  .ls-menu__ligne > a {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-width: 0;
    min-height: 52px;
    padding: 12px 20px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: var(--ls-ls-nav);
    text-transform: uppercase;
    color: var(--ls-encre);
  }

  .ls-menu__rayon--cadeaux > a,
  .ls-menu__rayon.ls-actif > a,
  .ls-menu__rayon.ls-actif > .ls-menu__ligne > a {
    color: var(--ls-bronze);
  }

  /* Rayon actif : filet bronze à gauche */
  .ls-menu__rayon.ls-actif {
    box-shadow: inset 3px 0 0 var(--ls-bronze);
  }

  .ls-menu button.ls-menu__deplier {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    min-width: 0;
    min-height: 52px;
    margin: 0;
    padding: 0;
    color: var(--ls-encre);
    background: transparent;
    border: 0;
    border-left: 1px solid var(--ls-trait);
    border-radius: 0;
    box-shadow: none;
  }

  .ls-menu__deplier::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--ls-transition-fondu);
  }

  .ls-menu__deplier[aria-expanded='true']::before {
    margin-top: 4px;
    transform: rotate(-135deg);
  }

  .ls-menu__sous {
    padding: 0 0 8px !important;
  }

  .ls-menu__sous[hidden] {
    display: none;
  }

  .ls-menu__sous a {
    display: flex;
    align-items: center;
    min-height: var(--ls-cible);
    padding: 6px 20px 6px 34px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
    color: var(--ls-encre);
  }

  .ls-menu__sous-rayon.ls-actif > a,
  .ls-menu__sous a[aria-current='page'] {
    font-weight: 600;
    color: var(--ls-bronze);
  }

  .ls-menu__liens {
    padding-top: 12px !important;
  }

  .ls-menu__liens a {
    display: flex;
    align-items: center;
    min-height: var(--ls-cible);
    padding: 6px 20px;
    font-size: 14px;
    line-height: 1.35;
    color: var(--ls-pierre);
  }

  .ls-menu__liens a[aria-current='page'] {
    color: var(--ls-bronze);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ls-menu__panneau,
  .ls-menu--ouvert .ls-menu__panneau {
    transition: none;
  }
}

/* --- En-tête collant, version compacte (réglage Flatsome « Sticky Header ») ---
   Au défilement, Flatsome ajoute .stuck à .header-wrapper (position fixe) après avoir figé la
   hauteur de <header> : le contenu ne se décale pas. Le bandeau d'annonce est masqué, la ligne
   du logo et le menu des rayons (ordinateur) restent, en plus petit. */

.header-wrapper.stuck {
  box-shadow: 0 1px 0 var(--ls-trait);
}

.header-wrapper.stuck #masthead .header-inner {
  min-height: 56px;
}

.header-wrapper.stuck .ls-logo__nom {
  font-size: clamp(16px, 4vw, 22px);
}

.header-wrapper.stuck .ls-logo__signature {
  display: none;
}

.header-wrapper.stuck .ls-nav {
  border-bottom: 0;
}

.header-wrapper.stuck .ls-nav__liste > li > a {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Une ancre atteinte par un lien (#moins-de-60, #tab-…) ne passe pas sous l'en-tête collant. */
:target,
.ls-budget {
  scroll-margin-top: 120px;
}

@media (prefers-reduced-motion: reduce) {
  .header-wrapper.stuck {
    animation: none !important;
  }
}
