/* ==========================================================
   BUBUBU – DESKTOP FIRST-PAINT STABILITY

   This file is active only while the tiny HEAD preflight class exists.
   It reserves the geometry that the existing deferred Bububu scripts create.
   Once those scripts finish, the class is removed and all established live
   header and campaign styles remain fully authoritative.
   ========================================================== */

@media (min-width: 992px) {
  html.bb-cls-preflight body #header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 132px !important;
    overflow: visible !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: 0 1px 0 rgba(33, 31, 29, .08) !important;
  }

  html.bb-cls-preflight body #header .navigation-wrapper {
    width: calc(100% - 48px) !important;
    max-width: none !important;
    margin: 0 24px !important;
    padding: 0 !important;
  }

  html.bb-cls-preflight body #header .header-top {
    display: flex !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 82px !important;
    min-height: 82px !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 32px !important;
    padding: 8px 20px !important;
  }

  html.bb-cls-preflight body #header .site-name-wrapper {
    display: flex !important;
    width: auto !important;
    height: 66px !important;
    align-items: center !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  html.bb-cls-preflight body #header .site-name,
  html.bb-cls-preflight body #header .site-name a {
    display: inline-flex !important;
    width: 220px !important;
    height: 66px !important;
    align-items: center !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  html.bb-cls-preflight body #header .site-name img {
    display: block !important;
    width: 220px !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
  }

  /* The live search is moved into its drawer by bububu-global.js. */
  html.bb-cls-preflight body #header .header-top > .search {
    display: none !important;
  }

  /* Reserve the exact final width of search, account and cart actions. */
  html.bb-cls-preflight body #header .header-top > .navigation-buttons,
  html.bb-cls-preflight body #header .bb-header-actions {
    box-sizing: border-box !important;
    width: 176px !important;
    min-width: 176px !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    margin: 0 !important;
  }

  html.bb-cls-preflight body #navigation,
  html.bb-cls-preflight body #navigation > .navigation-in,
  html.bb-cls-preflight body #navigation .menu-level-1 {
    box-sizing: border-box !important;
    height: 50px !important;
    min-height: 50px !important;
    overflow: visible !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  html.bb-cls-preflight body #navigation .menu-level-1 {
    display: flex !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: clamp(12px, 1.45vw, 22px) !important;
  }

  html.bb-cls-preflight body #navigation .menu-level-1 > li,
  html.bb-cls-preflight body #navigation .menu-level-1 > li.splitted {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  html.bb-cls-preflight body #navigation .menu-level-1 > li > a {
    min-height: 50px !important;
    padding: 0 !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  html.bb-cls-preflight body #header > .navigation-wrapper > .menu-helper {
    display: none !important;
  }

  /*
   * The campaign hero is inserted after the header at DOMContentLoaded.
   * Until it exists, its exact desktop height is represented by top margin on
   * the first native content wrapper. As soon as the hero becomes the header's
   * next sibling, this selector stops matching and the occupied space is
   * exchanged one-for-one without moving the page content.
   */
  html.bb-cls-preflight body.type-index #header + #content-wrapper {
    margin-top: clamp(600px, 38vw, 680px) !important;
  }
}

@media (min-width: 1320px) {
  html.bb-cls-preflight body #header {
    min-height: 84px !important;
  }

  html.bb-cls-preflight body #header .navigation-wrapper {
    display: grid !important;
    grid-template-columns: minmax(205px, 235px) minmax(0, 1fr) 176px !important;
    align-items: center !important;
    column-gap: clamp(24px, 2.4vw, 44px) !important;
    min-height: 84px !important;
  }

  html.bb-cls-preflight body #header .header-top {
    display: contents !important;
  }

  html.bb-cls-preflight body #header .site-name-wrapper {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  html.bb-cls-preflight body #header #navigation {
    position: relative !important;
    z-index: 4 !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
    height: 84px !important;
    min-height: 84px !important;
    margin: 0 !important;
  }

  html.bb-cls-preflight body #header #navigation > .navigation-in,
  html.bb-cls-preflight body #header #navigation .menu-level-1 {
    width: 100% !important;
    height: 84px !important;
    min-height: 84px !important;
  }

  html.bb-cls-preflight body #header #navigation .menu-level-1 {
    justify-content: center !important;
    gap: clamp(16px, 1.45vw, 29px) !important;
  }

  html.bb-cls-preflight body #header #navigation .menu-level-1 > li > a {
    min-height: 84px !important;
  }

  html.bb-cls-preflight body #header .header-top > .navigation-buttons,
  html.bb-cls-preflight body #header .bb-header-actions {
    display: flex !important;
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
  }
}
