/* Shared by the storefront, glove catalog, and bat designer. */
header:has(> div > a[aria-label="KNOK Baseball Co. home"]) {
  --knok-gutter: clamp(.75rem, 2.5vw, 2.5rem);
  --knok-row-gap: clamp(.75rem, 1.65vw, 1.75rem);
  margin-block: 0;
  padding-block: 0;

  & > div:first-child {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--knok-row-gap);
    max-width: 90rem;
    height: 4.25rem;
    margin: 0 auto;
    padding: 0 var(--knok-gutter);
  }
  & > div:first-child > a { flex: none; }
  & > div:first-child > nav {
    display: flex;
    align-items: center;
    flex: none;
    gap: .75rem;
    width: max-content;
  }
  & > div:first-child > nav > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    padding: .5rem .8rem;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    text-transform: capitalize;
  }
  & > div:first-child > div {
    display: flex;
    flex: none;
    align-items: center;
    gap: .5rem;
  }
  & > div:first-child > div > * { flex: none; }
  & > div:first-child > div > a[href="/build"],
  & > div:nth-child(2) a.bg-gold[href="/build"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding-inline: 1.1rem;
    color: #0c0c0d;
    background-color: #d4af37;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    transition-property: color, background-color, border-color, box-shadow;
  }
  & > div:first-child > div > button { display: none; }
  &[data-knok-cta-in-menu] > div:first-child > div > a[href="/build"] {
    position: absolute;
    inset-inline-start: 0;
    visibility: hidden;
  }
  & > div:nth-child(2) {
    display: none;
    max-height: var(--knok-menu-height, 65dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  & > div:nth-child(2) > div {
    max-width: 90rem;
    padding: .5rem var(--knok-gutter) .85rem;
  }
  & > div:nth-child(2) a:not(.bg-gold) {
    padding-block: .7rem;
    font-size: .9375rem;
    line-height: 1.25;
    text-transform: capitalize;
  }
  &[data-knok-menu="compact"] {
    & > div:first-child > nav {
      position: absolute;
      inset-inline-start: 0;
      width: 0;
      overflow: hidden;
      visibility: hidden;
    }
    & > div:first-child > div > button { display: inline-flex; }
    & > div:nth-child(2).block { display: block; }
  }
}

/* Let an open drawer or a large-text phone header sit above the floating sale notice. */
header[data-knok-cta-in-menu],
header[data-knok-menu="compact"]:has(button[aria-expanded="true"]),
div.sticky:has(> header[data-knok-cta-in-menu]),
div.sticky:has(> header[data-knok-menu="compact"] button[aria-expanded="true"]) {
  z-index: 61;
}
/* Keep the first paint compact until the actual links and fonts can be measured. */
@media (max-width: 76rem) {
  header:has(> div > a[aria-label="KNOK Baseball Co. home"]):not([data-knok-menu]) {
    & > div:first-child > nav { position: absolute; width: 0; overflow: hidden; visibility: hidden; }
    & > div:first-child > div > button { display: inline-flex; }
    & > div:nth-child(2).block { display: block; }
  }
}
@media (max-width: 36rem) {
  header:has(> div > a[aria-label="KNOK Baseball Co. home"]) {
    & > div:first-child { height: 3.75rem; gap: .4rem; }
    & > div:first-child > div { gap: .3rem; }
    & > div:first-child > div > a[href="/build"] { padding-inline: .78rem; }
    & > div:first-child img { height: 2.125rem; }
  }
}
@media (max-width: 22.5rem) {
  header:has(> div > a[aria-label="KNOK Baseball Co. home"]) {
    & > div:first-child { padding-inline: .5rem; }
    & > div:first-child > div { gap: .2rem; }
    & > div:first-child > div > a[href="/build"] { padding-inline: .55rem; }
    & > div:first-child img { height: clamp(28px, 1.875rem, 40px); }
    & > div:first-child > div > :is(a[aria-label], button) {
      width: clamp(40px, 2.5rem, 44px);
      height: clamp(40px, 2.5rem, 44px);
    }
  }
}
/* The running promotion owns the copy, code, end time, and four timer units. */
div:has(+ header a[aria-label="KNOK Baseball Co. home"]):has(> div > .tabular-nums) > div {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: .45rem 1.15rem;
  max-width: 90rem;
  padding: .48rem clamp(.75rem, 2.5vw, 2.5rem);
  & > p { flex: 1 1 28rem; min-width: 0; margin: 0; }
  & > .tabular-nums { flex: none; align-items: center; white-space: nowrap; }
  & > .tabular-nums > span { min-width: min(2.6rem, 18vw); }
}
@media (max-width: 47rem) {
  div:has(+ header a[aria-label="KNOK Baseball Co. home"]):has(> div > .tabular-nums) > div {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    & > p { flex: none; }
  }
}
