/* =========================================================
   Uprise Bikes "Local"-style header
   Everything here is scoped to html.ub-hdr, which ub-header.js adds.
   If the script is switched off, none of these rules apply.
   ========================================================= */

/* ---------- Shared (all screen sizes) ---------- */
html.ub-hdr {
  --ub-dark: #1d1d1d;
  --ub-line: rgba(29, 29, 29, 0.12);
}

html.ub-hdr body { padding-top: var(--ub-hdr-h) !important; }

/* The old banners are shown inside the new announcement bar instead */
html.ub-hdr #TopBanner1_CSSFacetNavsub_BannerCollectionDisplaySubBanner_bannerCollectionPanel,
html.ub-hdr #TopBanner1_CSSFacetNavsub_BannerCollectionDisplayCTA_bannerCollectionPanel { display: none !important; }

/* White header background */
html.ub-hdr .masthead,
html.ub-hdr .masthead .grid.fixed,
html.ub-hdr .masthead .container { background: #fff !important; }
html.ub-hdr .masthead .container,
html.ub-hdr .masthead .col-1 { height: auto !important; }

/* The logo file is black, but the site turns it white for the old dark header
   (".color-bg2 .logo { filter: invert(1) }"). Turn that off on the new white header. */
html.ub-hdr .masthead .logo { filter: none !important; }

/* Announcement bar */
html.ub-hdr .ub-ann {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--ub-ann-h);
  background: #1f1f1f;
  color: #fff;
}
html.ub-hdr .ub-ann__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 920px;
  padding: 0 16px;
}
html.ub-hdr .ub-ann__track { flex: 1; min-width: 0; position: relative; height: var(--ub-ann-h); overflow: hidden; text-align: center; }
html.ub-hdr .ub-ann__item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}
html.ub-hdr .ub-ann__item.is-active { opacity: 1; visibility: visible; transform: none; }
html.ub-hdr .ub-ann__item:hover { text-decoration: underline; }
html.ub-hdr .ub-ann__item--promo { color: #f0fc00; }
html.ub-hdr .ub-ann__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 1;
  background: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
}
html.ub-hdr .ub-ann__btn:hover { opacity: 1; }
html.ub-hdr .ub-ann__btn svg { width: 18px; height: 18px; }

/* =========================================================
   Desktop (1025px and up)
   ========================================================= */
@media screen and (min-width: 1025px) {
  html.ub-hdr {
    --ub-ann-h: 40px;
    --ub-main-h: 90px;
    --ub-nav-h: 52px;
    --ub-hdr-h: calc(var(--ub-ann-h) + var(--ub-main-h) + var(--ub-nav-h) + 1px);
  }

  html.ub-hdr .masthead .navIcons {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-rows: var(--ub-main-h) var(--ub-nav-h);
    grid-template-areas: "logo search acc bag" "nav nav nav nav";
    align-items: center;
    column-gap: 12px;
    row-gap: 0 !important;
    height: auto !important;
    padding: 0 max(24px, calc((100% - 1560px) / 2));
    background: linear-gradient(to bottom, transparent var(--ub-main-h), var(--ub-line) var(--ub-main-h), var(--ub-line) calc(var(--ub-main-h) + 1px), transparent calc(var(--ub-main-h) + 1px)), #fff !important;
    border-bottom: 1px solid var(--ub-line);
    color: var(--ub-dark);
  }
  html.ub-hdr .masthead .menu-icons-header { display: contents !important; }

  /* Logo */
  html.ub-hdr .masthead .logoContainer { grid-area: logo; width: auto; padding: 0 28px 0 0; }
  html.ub-hdr .masthead .logo { width: 170px; max-width: 170px; height: 52px; min-width: 0; }

  /* Search */
  html.ub-hdr .masthead #search {
    grid-area: search;
    width: auto !important;
    padding: 0 !important;
    line-height: normal !important;
    text-align: left;
    cursor: auto;
  }
  html.ub-hdr .masthead #TopBanner1_clSearch1_containerSearch { position: relative; height: 46px; }
  html.ub-hdr .masthead #txtTerm {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 46px;
    padding: 0 20px 0 52px !important;
    border: 1px solid var(--ub-line) !important;
    border-radius: 30px !important;
    background: #fff !important;
    color: var(--ub-dark);
    font-size: 16px;
    box-shadow: none !important;
  }
  html.ub-hdr .masthead #txtTerm:focus { border-color: var(--ub-dark) !important; outline: none; }
  html.ub-hdr .masthead #search .icon-search {
    left: 4px;
    right: auto;
    top: 0;
    z-index: 1;
    width: 46px !important;
    height: 46px;
    line-height: 46px !important;
    background: transparent !important;
    border-radius: 30px !important;
    font-size: 18px;
  }
  html.ub-hdr .masthead #search .icon-search::before { color: var(--ub-dark) !important; }

  /* Account + Basket pills */
  html.ub-hdr .masthead .icon-head,
  html.ub-hdr .masthead .icon-bag {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    width: auto !important;
    height: 50px;
    padding: 0 22px;
    border: 1px solid var(--ub-dark);
    border-radius: 30px;
    font-size: 17px !important;
    font-weight: 500;
    line-height: 1 !important;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  html.ub-hdr .masthead .icon-head { grid-area: acc; background: #fff; color: var(--ub-dark); border-color: rgba(29, 29, 29, 0.3); }
  html.ub-hdr .masthead .icon-head:hover { border-color: var(--ub-dark); }
  html.ub-hdr .masthead .icon-bag { grid-area: bag; background: var(--ub-dark); color: #fff; }
  html.ub-hdr .masthead .icon-bag:hover { background: #3a3a3a; }
  html.ub-hdr .masthead .icon-head::before,
  html.ub-hdr .masthead .icon-bag::before { color: inherit !important; font-size: 18px; }
  html.ub-hdr .masthead .icon-bag .basketPip { display: none !important; }
  html.ub-hdr .masthead .icon-head #loggedInPip { position: static; }
  html.ub-hdr .masthead .ub-lbl { font-family: aktiv-grotesk, sans-serif; font-size: 16px; font-weight: 500; color: inherit; }

  /* Nav row */
  html.ub-hdr .masthead .ctrNavigation { grid-area: nav; align-self: stretch; display: flex; align-items: center; margin-left: -16px; }
  html.ub-hdr .masthead .ctrNavigation > .CSSFacetNavModules { justify-content: flex-start !important; flex-wrap: nowrap; }
  html.ub-hdr .masthead .NodeLevel0 { margin: 0; }
  html.ub-hdr .masthead .NodeLevel0 > a {
    display: flex;
    align-items: center;
    height: var(--ub-nav-h);
    padding: 0 30px 0 16px;
    font-size: 16px;
    font-weight: 600;
  }
  html.ub-hdr .masthead .NodeLevel0 > a:hover { text-decoration: underline; text-underline-offset: 5px; }
  html.ub-hdr #navi .NodeLevel1[data-nodename*="brand" i] { background: #f3f3f3 !important; }

  html.ub-hdr .masthead .NodeLevel0 > .CSSFacetNavModules {
    top: calc(var(--ub-main-h) + var(--ub-nav-h) + 1px) !important;
    max-height: calc(100vh - var(--ub-hdr-h)) !important;
  }

  /* Utility links (right of nav row) */
  html.ub-hdr .masthead .navIcons > .ub-utils {
    position: absolute;
    top: calc(var(--ub-main-h) + 1px);
    right: max(24px, calc((100% - 1560px) / 2));
    display: flex;
    align-items: center;
    gap: 28px;
    width: auto;
    height: var(--ub-nav-h);
    line-height: normal;
    text-align: left;
    cursor: auto;
  }
  html.ub-hdr .ub-util { display: flex; align-items: center; gap: 10px; color: var(--ub-dark); text-decoration: none; line-height: 1.15; cursor: pointer; }
  html.ub-hdr .ub-util svg { width: 30px; height: 30px; flex: none; stroke: currentColor; }
  html.ub-hdr .ub-util small { display: block; font-size: 12px; color: rgba(29, 29, 29, 0.65); }
  html.ub-hdr .ub-util strong { display: block; font-size: 15px; font-weight: 500; }
  html.ub-hdr .ub-util:hover strong { text-decoration: underline; }
}

@media screen and (min-width: 1025px) and (max-width: 1360px) {
  html.ub-hdr .masthead .NodeLevel0 > a { padding: 0 24px 0 10px; font-size: 15px; }
  html.ub-hdr .ub-util small { display: none; }
  html.ub-hdr .masthead .navIcons > .ub-utils { gap: 18px; }
}

@media screen and (min-width: 1025px) and (max-width: 1200px) {
  html.ub-hdr .masthead .navIcons > .ub-utils { display: none; }
}

/* =========================================================
   Mobile + tablet (1024px and below)
   Row 1: announcement bar
   Row 2: menu | logo | ... | account | basket
   Row 3: full-width search
   ========================================================= */
@media screen and (max-width: 1024px) {
  html.ub-hdr {
    --ub-ann-h: 36px;
    --ub-main-h: 60px;
    --ub-search-h: 56px;
    --ub-hdr-h: calc(var(--ub-ann-h) + var(--ub-main-h) + var(--ub-search-h) + 1px);
  }

  /* Things only used on desktop */
  html.ub-hdr .ub-utils,
  html.ub-hdr .masthead .ub-lbl { display: none !important; }

  /* Announcement bar: a little smaller */
  html.ub-hdr .ub-ann__inner { padding: 0 4px; }
  html.ub-hdr .ub-ann__item { font-size: 13px; padding: 0 8px; }
  html.ub-hdr .ub-ann__btn { width: 36px; height: 36px; }
  html.ub-hdr .ub-ann__btn svg { width: 16px; height: 16px; }

  /* Header grid */
  html.ub-hdr .masthead .navIcons {
    display: grid !important;
    grid-template-columns: 44px auto minmax(0, 1fr) 44px 44px;
    grid-template-rows: var(--ub-main-h) var(--ub-search-h);
    grid-template-areas: "menu logo . acc bag" "search search search search search";
    align-items: center;
    column-gap: 4px;
    row-gap: 0 !important;
    height: auto !important;
    padding: 0 12px !important;
    background: #fff !important;
    border-bottom: 1px solid var(--ub-line) !important;
    color: var(--ub-dark);
  }
  html.ub-hdr .masthead .menu-icons-header { display: contents !important; }

  /* Icon buttons: menu, account, basket */
  html.ub-hdr .masthead .menu-icons-header > .icon-menu,
  html.ub-hdr .masthead .menu-icons-header > .icon-head,
  html.ub-hdr .masthead .menu-icons-header > .icon-bag {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    float: none !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 44px !important;
    border-radius: 50%;
    font-size: 20px !important;
    color: var(--ub-dark) !important;
    background: transparent !important;
  }
  html.ub-hdr .masthead .menu-icons-header > [class*="icon-"]::before { color: inherit !important; }
  html.ub-hdr .masthead .menu-icons-header > .icon-menu { grid-area: menu; margin-left: -8px !important; }
  html.ub-hdr .masthead .menu-icons-header > .icon-head { grid-area: acc; }
  html.ub-hdr .masthead .menu-icons-header > .icon-bag { grid-area: bag; }
  html.ub-hdr .masthead .menu-icons-header > .icon-search { display: none !important; }
  html.ub-hdr .masthead .icon-head #loggedInPip { position: absolute; }

  /* Basket count badge (only when there is something in the basket) */
  html.ub-hdr .masthead .icon-bag .basketPip { display: none !important; }
  html.ub-hdr .masthead .icon-bag.ub-has-items .basketPip {
    display: block !important;
    position: absolute;
    top: 4px;
    right: 0;
    bottom: auto;
    left: auto;
    transform: none;
    min-width: 18px;
    width: auto;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--ub-dark);
    color: #fff;
    font-family: aktiv-grotesk, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
  }

  /* Logo */
  html.ub-hdr .masthead .logoContainer {
    grid-area: logo;
    display: flex;
    align-items: center;
    width: auto !important;
    height: var(--ub-main-h) !important;
    padding: 0 0 0 4px !important;
    line-height: normal !important;
  }
  html.ub-hdr .masthead .logo {
    top: 0;
    width: 112px;
    min-width: 0;
    max-width: 112px;
    height: 34px !important;
    min-height: 0;
    line-height: normal !important;
    background-position: left center;
  }

  /* Search row */
  html.ub-hdr .masthead #search {
    grid-area: search;
    display: block !important;
    align-self: start;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    padding: 0 !important;
    line-height: normal !important;
    text-align: left;
    opacity: 1 !important;
    cursor: auto;
  }
  html.ub-hdr .masthead #TopBanner1_clSearch1_containerSearch {
    position: relative;
    display: block !important;
    width: 100%;
    height: 44px !important;
  }
  html.ub-hdr .masthead #txtTerm {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 44px !important;
    line-height: 44px !important;
    padding: 0 16px 0 44px !important;
    border: 1px solid var(--ub-line) !important;
    border-radius: 30px !important;
    background: #f5f5f5 !important;
    color: var(--ub-dark) !important;
    font-size: 16px !important; /* 16px stops iPhones zooming in when tapped */
    opacity: 1 !important;
    box-shadow: none !important;
  }
  html.ub-hdr .masthead #txtTerm:focus { border-color: var(--ub-dark) !important; background: #fff !important; outline: none; }
  html.ub-hdr .masthead #txtTerm::-webkit-input-placeholder { color: rgba(29, 29, 29, 0.55) !important; }
  html.ub-hdr .masthead #txtTerm::placeholder { color: rgba(29, 29, 29, 0.55) !important; }
  html.ub-hdr .masthead #search .icon-search {
    position: absolute !important;
    top: 0 !important;
    left: 2px !important;
    right: auto !important;
    z-index: 1;
    display: block !important;
    float: none !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 44px !important;
    line-height: 44px !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--ub-dark) !important;
    font-size: 16px !important;
    text-align: center;
    pointer-events: none;
  }
  html.ub-hdr .masthead #search .icon-search::before { color: var(--ub-dark) !important; }

  /* Slide-out menu: starts under the search row and fills the rest of the screen.
     #navi is listed too because the site sets "#navi { background: #000 !important }". */
  html.ub-hdr .masthead .ctrNavigation,
  html.ub-hdr .masthead #navi {
    position: absolute !important;
    top: calc(var(--ub-main-h) + var(--ub-search-h)) !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - var(--ub-hdr-h)) !important;
    min-height: calc(100vh - var(--ub-hdr-h)) !important;
    max-height: calc(100vh - var(--ub-hdr-h)) !important;
    border-top: 1px solid var(--ub-line);
    background: #fff !important;
    overflow-y: auto;
  }
  html.ub-hdr .masthead .NodeLevel0 > .CSSFacetNavModules { max-height: calc(100vh - var(--ub-hdr-h)) !important; }
}

/* Small phones */
@media screen and (max-width: 360px) {
  html.ub-hdr .masthead .logo { width: 96px; max-width: 96px; }
  html.ub-hdr .ub-ann__item { font-size: 12px; }
}
