/**
 * Folies Secrètes — Header desktop menu width fix
 * Lot: STBLOG_GUIDES_MAIN_MENU_WIDTH_FIX
 * Cause: grille customer-s1 fixe 260|1fr|260 + 9e entrée Guides
 *        → menu nowrap déborde sur logo / recherche / compte
 * Scope: body.desktop_device #st_header + stmegamenu level-0 uniquement
 * Ne modifie pas: stmegamenu PHP, Panda parent, menu mobile, entrées menu
 */

@media (min-width: 992px) {
  /* 1) Libérer la piste centrale (override customer-s1 260|1fr|260) */
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row,
  body.desktop_device #header_primary_row.flex_container,
  body.desktop_device #header_primary_row.flex_container.logo_left {
    /* Colonne logo élargie (présence marque) — menu conserve minmax(0,1fr) */
    grid-template-columns: minmax(135px, 155px) minmax(0, 1fr) minmax(120px, 160px) !important;
    column-gap: 10px !important;
  }

  /* 2) Colonnes latérales respectent la piste grille (neutralise max-width:260 / margin-right:36) */
  body.desktop_device #st_header #header_left,
  body.desktop_device #header_left {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    margin-right: 0 !important;
    justify-self: start !important;
  }

  body.desktop_device #st_header #header_right,
  body.desktop_device #header_right {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    justify-self: end !important;
  }

  body.desktop_device #st_header #header_center,
  body.desktop_device #header_center {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  /* 3) Logo contenu dans la colonne gauche (sticky + non-sticky) */
  body.desktop_device #st_header #header_left .shop_logo,
  body.desktop_device #st_header #header_left .logo_box,
  body.desktop_device #st_header #header_left a {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  body.desktop_device #st_header #header_left img,
  body.desktop_device #st_header #header_left .logo,
  body.desktop_device #st_header .shop_logo .logo,
  body.desktop_device #st_header .logo_box .logo {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }

  body.desktop_device #st_header:not(.stuck) #header_left img,
  body.desktop_device #st_header:not(.stuck) #header_left .logo,
  body.desktop_device #st_header:not(.stuck) .shop_logo .logo,
  body.desktop_device #st_header:not(.stuck) .logo_box .logo {
    /* Ratio logo 1000×320 → ~68px h pour ~210px w ; pas de transform/scale */
    max-height: 68px !important;
  }

  body.desktop_device #st_header.stuck #header_left img,
  body.desktop_device #st_header.stuck #header_left .logo,
  body.desktop_device #st_header.stuck .shop_logo .logo,
  body.desktop_device #st_header.stuck .logo_box .logo {
    max-height: 42px !important;
  }

  /* 4) Recherche: icône seule (libellé « Rechercher » masqué) — icône reste accessible */
  body.desktop_device #st_header .search_widget_simple .header_icon_btn_text {
    display: none !important;
  }

  body.desktop_device #st_header .search_widget_simple .mar_r4 {
    margin-right: 0 !important;
  }

  /* 5) Zone icônes ne déborde pas hors colonne droite */
  body.desktop_device #st_header #header_right_top,
  body.desktop_device #st_header #header_right .flex_box,
  body.desktop_device #st_header #header_right .header_box {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: flex-end !important;
    gap: 0.2rem !important;
  }

  body.desktop_device #st_header #header_right .top_bar_item {
    padding-left: 4px !important;
    padding-right: 4px !important;
    margin: 0 !important;
  }

  /* 6) Menu peut se contracter dans le centre */
  body.desktop_device #st_header #header_center .header_box,
  body.desktop_device #st_header #st_mega_menu_wrap,
  body.desktop_device #st_header #st_mega_menu_wrap .st_mega_menu_ul {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Sticky: même philosophie de pistes */
  body.desktop_device #st_header.stuck #header_primary_row {
    grid-template-columns: minmax(100px, 140px) minmax(0, 1fr) minmax(120px, 160px) !important;
    column-gap: 10px !important;
  }

  body.desktop_device #st_header.stuck #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
}

/* Sticky étroit : plus de place au menu (évite overflow item → icônes) */
@media (min-width: 992px) and (max-width: 1279px) {
  body.desktop_device #st_header.stuck #header_primary_row {
    grid-template-columns: minmax(80px, 100px) minmax(0, 1fr) minmax(100px, 130px) !important;
    column-gap: 6px !important;
  }

  body.desktop_device #st_header.stuck #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 12.5px !important;
  }
}

/* ≥1600 : logo ~190–210 px ; padding menu proche du natif */
@media (min-width: 1600px) {
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row {
    grid-template-columns: minmax(190px, 205px) minmax(0, 1fr) minmax(125px, 150px) !important;
    column-gap: 12px !important;
  }

  body.desktop_device #st_header #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* 1440–1599 : logo ~190–195 px — spare menu sécurisé */
@media (min-width: 1440px) and (max-width: 1599px) {
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row {
    grid-template-columns: minmax(190px, 195px) minmax(0, 1fr) minmax(115px, 140px) !important;
    column-gap: 10px !important;
  }

  body.desktop_device #st_header #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 5px !important;
    padding-right: 5px !important;
  }
}

/* 1280–1439 : logo ~175–190 px */
@media (min-width: 1280px) and (max-width: 1439px) {
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row {
    grid-template-columns: minmax(170px, 190px) minmax(0, 1fr) minmax(110px, 135px) !important;
    column-gap: 8px !important;
  }

  body.desktop_device #st_header #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 3px !important;
    padding-right: 3px !important;
    font-size: 14.5px !important;
  }
}

/* 1100–1279 : logo ~155–165 px */
@media (min-width: 1100px) and (max-width: 1279px) {
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row {
    grid-template-columns: minmax(150px, 160px) minmax(0, 1fr) minmax(100px, 125px) !important;
    column-gap: 6px !important;
  }

  body.desktop_device #st_header #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 3px !important;
    padding-right: 3px !important;
    font-size: 13.5px !important;
  }
}

/* 992–1023 : logo ~115–120 px (contrainte physique menu+icônes) */
@media (min-width: 992px) and (max-width: 1023px) {
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row {
    grid-template-columns: minmax(112px, 120px) minmax(0, 1fr) minmax(118px, 128px) !important;
    column-gap: 6px !important;
  }

  body.desktop_device #st_header #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 12.5px !important;
  }

  body.desktop_device #st_header.stuck #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 12.5px !important;
  }
}

/* 1024–1099 : logo ~128–135 px */
@media (min-width: 1024px) and (max-width: 1099px) {
  body.desktop_device #st_header #header_primary_row,
  body.desktop_device #header_primary_row {
    grid-template-columns: minmax(128px, 135px) minmax(0, 1fr) minmax(120px, 130px) !important;
    column-gap: 6px !important;
  }

  body.desktop_device #st_header #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 12.5px !important;
  }

  body.desktop_device #st_header.stuck #st_mega_menu_wrap li.ml_level_0 > a.ma_level_0 {
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 12.5px !important;
  }
}
