/* Hidden Reef Lab navigation.
   Nav row: Home + store topics, with the cart (and the phone Menu button) in
   .main-nav__tools at the end. Search has its own centered row (.shop-bar)
   directly below. tools/apply-nav.mjs writes both into every page and
   reef-background.js wires them up. Selectors carry
   nav.main-nav.lab-nav so they outrank site-masthead.css and showroom.css. */

/* ---- Desktop: brand, seven topics, cart ---- */
@media (min-width: 981px) {
  html .header.masthead + nav.main-nav.lab-nav,
  html.has-compact-masthead .header.masthead + nav.main-nav.lab-nav {
    grid-template-columns: minmax(112px, auto) repeat(7, minmax(0, 1fr)) auto !important;
  }
}

@media (min-width: 981px) and (max-width: 1180px) {
  html .header.masthead + nav.main-nav.lab-nav > a {
    padding-left: 6px !important;
    padding-right: 6px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }
}

.main-nav.lab-nav .main-nav__tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  padding: 4px 8px;
  border-left: 1px solid rgba(116, 205, 235, 0.18);
}

html .header.masthead + nav.main-nav.lab-nav .nav-cart {
  position: relative;
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center !important;
  gap: 7px;
  width: auto;
  min-width: 0 !important;
  height: 32px;
  min-height: 0 !important;
  margin: 0;
  padding: 0 12px 0 6px !important;
  border: 1px solid rgba(116, 205, 235, 0.3) !important;
  border-radius: 999px;
  color: #dff8ff !important;
  background: rgba(5, 28, 45, 0.72) !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 12px !important;
  font-weight: 850 !important;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap !important;
  cursor: pointer;
}

.main-nav.lab-nav .nav-cart span {
  position: static;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  color: #02111f;
  background: #40d9ff;
  font-size: 10px;
  font-weight: 950;
}

.main-nav.lab-nav .nav-cart strong {
  font: inherit;
}

html .header.masthead + nav.main-nav.lab-nav .nav-cart:hover,
html .header.masthead + nav.main-nav.lab-nav .nav-cart:focus-visible {
  border-color: rgba(116, 205, 235, 0.6) !important;
  background: rgba(18, 83, 108, 0.82) !important;
}

/* Spoken cart status ("Shopping list, 2 items"); the badge shows the count. */
.cart-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The Menu button now lives inside the tools group. */
.main-nav.lab-nav .main-nav__tools .main-nav__menu {
  min-height: 32px;
  border-left: 0;
  border-radius: 6px;
}

/* ---- Collapsed nav (tablet and phone): brand | cart + Menu ---- */
@media (max-width: 980px) {
  html .header.masthead + nav.main-nav.lab-nav .main-nav__compact-brand {
    order: -2;
  }

  html .header.masthead + nav.main-nav.lab-nav .main-nav__tools {
    order: -1;
    padding: 4px 6px;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  html .header.masthead + nav.main-nav.lab-nav.is-open > a:last-of-type {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 760px) {
  html .header.masthead + nav.main-nav.lab-nav.is-open {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html .header.masthead + nav.main-nav.lab-nav.is-open > a:last-of-type {
    grid-column: 1 / -1 !important;
  }
}

/* Until the nav detaches on scroll, it and the search row read as one unit. */
html:not(.has-compact-masthead) .header.masthead + nav.main-nav.lab-nav.has-shop-bar {
  margin-bottom: 0 !important;
  border-radius: 0 !important;
}

/* ---- Search row ---- */
.shop-bar {
  --thr-page-gutter: clamp(12px, 2.5vw, 28px);
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: calc(100% + var(--thr-page-gutter) + var(--thr-page-gutter));
  max-width: 1180px;
  margin: 0 calc(var(--thr-page-gutter) * -1) 18px;
  padding: 9px 12px;
  border: 1px solid rgba(116, 205, 235, 0.24);
  border-top-color: rgba(116, 205, 235, 0.12);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, rgba(2, 21, 35, 0.96) 0%, rgba(7, 23, 51, 0.96) 48%, rgba(2, 21, 35, 0.96) 100%);
  box-shadow: -10px 14px 18px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body > .shop-bar {
  width: min(1180px, calc(100% - var(--thr-page-gutter) - var(--thr-page-gutter)));
  margin-left: auto;
  margin-right: auto;
}

.shop-bar__search {
  display: flex;
  flex: 0 1 640px;
  min-width: 0;
  margin: 0;
}

.shop-bar__search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid rgba(116, 205, 235, 0.3);
  border-right: 0;
  border-radius: 999px 0 0 999px;
  color: #f0fbff;
  background: rgba(1, 12, 22, 0.72);
  font: inherit;
  font-size: 14px;
}

.shop-bar__search input::placeholder {
  color: #89aab8;
}

.shop-bar__search button {
  flex: 0 0 auto;
  height: 40px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid rgba(116, 205, 235, 0.3);
  border-radius: 0 999px 999px 0;
  color: #fff;
  background: linear-gradient(135deg, #00a7b7, #2a6fd6);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.shop-bar__search input:focus-visible,
.shop-bar__search button:focus-visible {
  outline: 2px solid #40d9ff;
  outline-offset: 2px;
}

.shop-bar__search button:hover {
  border-color: rgba(116, 205, 235, 0.6);
  filter: brightness(1.12);
}

.shop-bar__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .shop-bar,
  body > .shop-bar {
    width: 100%;
    margin: 0 0 12px;
    padding: 7px 8px;
  }

  .shop-bar__search {
    flex-basis: 100%;
  }

  .shop-bar__search button {
    padding: 0 14px;
  }
}
