/**
 * Folies Secrètes — Sticky header premium (1A)
 * Scope : desktop uniquement, état Panda #st_header.stuck
 * Ne pas modifier mobile (use_mobile_header / #mobile_bar inchangés)
 */

@media (min-width: 992px) {
  /*
   * Correctif moteur sticky Panda (Waypoint.Sticky)
   * Panda : html{height:100%} + scroll sur body.scrollTop → window.scrollY reste à 0
   * Waypoint écoute window → .stuck jamais ajouté sur #st_header
   */
  html:has(body.desktop_device),
  html.desktop_device {
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
  }

  html:has(body.desktop_device) body,
  body.desktop_device {
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  /* Fond ivoire translucide — léger, sans blur fort */
  body.desktop_device #st_header.stuck {
    background: rgba(253, 252, 250, 0.92) !important;
    border-bottom: 1px solid rgba(26, 23, 22, 0.08);
    box-shadow: 0 1px 3px rgba(26, 23, 22, 0.06) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Hauteur compacte ~70–76px (complète STSN_STICKY_HEADER_HEIGHT) */
  body.desktop_device #st_header.stuck #header_primary_container {
    min-height: 74px;
    height: 74px !important;
    display: flex;
    align-items: center;
  }

  body.desktop_device #st_header.stuck #header_primary_row {
    align-items: center;
    min-height: 74px;
  }

  /* Logo réduit ~25–30 % */
  body.desktop_device #st_header.stuck .shop_logo .logo,
  body.desktop_device #st_header.stuck .logo_box .logo {
    max-height: 42px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: none;
  }

  body.desktop_device #st_header.stuck .logo_box .slogan_box_beside,
  body.desktop_device #st_header.stuck .logo_box .slogan_box_under {
    display: none;
  }

  /* Grille : logo gauche | menu centre | utilitaires droite */
  body.desktop_device #st_header.stuck #header_primary_row {
    display: grid;
    grid-template-columns: minmax(140px, 18%) 1fr minmax(200px, 28%);
    gap: 0 1rem;
    width: 100%;
  }

  body.desktop_device #st_header.stuck #header_left {
    grid-column: 1;
    justify-self: start;
  }

  body.desktop_device #st_header.stuck #header_center {
    grid-column: 2;
    justify-self: center;
    width: 100%;
    max-width: 100%;
  }

  body.desktop_device #st_header.stuck #header_center .header_box {
    justify-content: center !important;
    width: 100%;
  }

  body.desktop_device #st_header.stuck #header_right {
    grid-column: 3;
    justify-self: end;
    width: 100%;
  }

  body.desktop_device #st_header.stuck #header_right_top {
    justify-content: flex-end !important;
  }

  /* Menu principal centré, lisible */
  body.desktop_device #st_header.stuck #header_center .st_mega_menu_container,
  body.desktop_device #st_header.stuck #header_center nav {
    width: 100%;
    justify-content: center;
  }

  body.desktop_device #st_header.stuck .st_mega_menu_container .ma_level_0 > a {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
  }

  /* Recherche + compte + panier à droite */
  body.desktop_device #st_header.stuck #header_right_top .flex_box {
    justify-content: flex-end;
    gap: 0.35rem;
  }

  body.desktop_device #st_header.stuck #header_right_top .top_bar_item {
    margin: 0 0.15rem;
  }

  /* Pas de réassurance / nav pleine largeur dans le sticky */
  body.desktop_device #st_header.stuck .hide_when_sticky,
  body.desktop_device #st_header.stuck #displayBanner,
  body.desktop_device #st_header.stuck #top_bar,
  body.desktop_device #st_header.stuck .nav_full_container {
    display: none !important;
  }

  /* Pas d’animation agressive Panda sur le bloc sticky */
  body.desktop_device #st_header.stuck.fadeInDownLarge {
    animation: none !important;
  }

  /* Pas de duplication : un seul header visible */
  body.desktop_device .header-container.has_sticky #st_header.stuck {
    z-index: 500;
  }

  /*
   * Tunnel commande / confirmation : header checkout minimal (#checkout_header_wrap)
   * ou structure différente — le sticky premium (grille 3 col.) vide le bandeau.
   * On neutralise le mode .stuck sur ces pages uniquement.
   */
  body#checkout.desktop_device #st_header.stuck,
  body#order-confirmation.desktop_device #st_header.stuck {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    box-shadow: none !important;
    animation: none !important;
    background: rgba(253, 252, 250, 0.98) !important;
  }

  body#checkout.desktop_device #st_header.stuck #header_primary_container,
  body#order-confirmation.desktop_device #st_header.stuck #header_primary_container {
    height: auto !important;
    min-height: 0 !important;
  }

  body#checkout.desktop_device #st_header.stuck #header_primary_row,
  body#order-confirmation.desktop_device #st_header.stuck #header_primary_row {
    display: flex !important;
    grid-template-columns: unset !important;
    gap: 0 !important;
  }

  body#checkout.desktop_device #st_header.stuck .checkout_header,
  body#order-confirmation.desktop_device #st_header.stuck .checkout_header {
    padding: 1rem 0 !important;
  }

  body#checkout.desktop_device #st_header.stuck #mobile_bar,
  body#order-confirmation.desktop_device #st_header.stuck #mobile_bar {
    display: none !important;
  }
}
