/* The platform wraps each section in div.section; that wrapper must stick for the bar to pin. */
div.section:has(> .split-header) {
  position: sticky;
  top: 0;
  z-index: 80;
}

.kit.split-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(var(--color-background));
  color: inherit;
}

.split-header__nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.split-header__toggle {
  display: none;
}

.split-header__links {
  display: flex;
  gap: 22px;
  align-items: center;
  font-size: 14.5px;
  font-weight: 600;
  flex-wrap: wrap;
}

.split-header .split-header__link {
  color: rgba(var(--color-text));
  text-decoration: none;
  transition: opacity 0.22s ease;
}

.split-header .split-header__link--active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.split-header .split-header__logo {
  text-decoration: none;
  text-align: center;
  line-height: 1;
  color: rgba(var(--color-text));
}

.split-header__logo img {
  height: var(--split-header-logo-height);
  width: auto;
  display: inline-block;
}

.split-header__logo-text {
  font-family: var(--kit-font-display);
  font-weight: 800;
  font-size: 28px;
}

.split-header__tools {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: flex-end;
  color: rgba(var(--color-text));
}

.split-header .split-header__icon {
  display: flex;
  color: rgba(var(--color-text));
}

.split-header__icon svg {
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  cursor: pointer;
}

.split-header__cart {
  display: flex;
}

.split-header .split-header__cart-btn {
  position: relative;
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: rgba(var(--color-text));
  font: inherit;
  line-height: 0;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.split-header__count {
  position: absolute;
  top: -7px;
  right: -8px;
  background: rgba(var(--color-highlight));
  color: rgba(var(--color-text));
  font-size: 10.5px;
  font-weight: 700;
  line-height: normal;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.split-header__count:empty {
  display: none;
}

.split-header__menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(var(--color-text), 0.14);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.split-header__menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(var(--color-text));
  border-radius: 2px;
  transform-origin: center;
  transition:
    transform 0.28s var(--kit-ease),
    opacity 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .split-header .split-header__link:hover {
    opacity: 0.72;
  }
  .split-header__icon:hover svg {
    opacity: 0.8;
    transform: scale(1.08);
  }
  .split-header .split-header__cart-btn:hover {
    transform: scale(1.08);
    opacity: 0.82;
  }
}

@media (max-width: 800px) {
  .split-header__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
    position: relative;
  }
  .split-header .split-header__logo {
    order: 1;
    margin-right: auto;
  }
  .split-header__logo img {
    height: var(--split-header-logo-height-mobile);
  }
  .split-header__tools {
    order: 2;
    gap: 14px;
  }
  .split-header .split-header__hide-sm {
    display: none;
  }
  .split-header__menu-btn {
    display: flex;
    order: 3;
    flex: none;
    transition: background-color 0.22s ease;
  }
  .split-header__toggle:checked ~ .split-header__menu-btn {
    background: rgba(var(--color-text), 0.28);
  }
  .split-header__toggle:checked ~ .split-header__menu-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .split-header__toggle:checked ~ .split-header__menu-btn span:nth-child(2) {
    opacity: 0;
  }
  .split-header__toggle:checked ~ .split-header__menu-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .split-header__links {
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    padding-top: 0;
    padding-bottom: 0;
    transform: translateY(-8px);
    transition:
      max-height 0.42s var(--kit-ease),
      opacity 0.28s ease,
      transform 0.32s var(--kit-ease),
      visibility 0s linear 0.32s,
      padding 0.32s ease;
  }
  .split-header__toggle:checked ~ .split-header__links {
    max-height: 22rem;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 8px 0 16px;
    transform: none;
    transition:
      max-height 0.42s var(--kit-ease),
      opacity 0.28s ease,
      transform 0.32s var(--kit-ease),
      visibility 0s linear 0s,
      padding 0.32s ease;
  }
  .split-header .split-header__link {
    padding: 12px 0;
    border-bottom: 1px solid rgba(var(--color-text), 0.16);
    font-size: 16px;
    opacity: 0;
    transform: translateY(-8px);
    transition:
      opacity 0.28s ease,
      transform 0.32s var(--kit-ease);
  }
  .split-header__toggle:checked ~ .split-header__links .split-header__link {
    opacity: 1;
    transform: none;
  }
  .split-header__toggle:checked ~ .split-header__links .split-header__link:nth-child(1) {
    transition-delay: 0.05s;
  }
  .split-header__toggle:checked ~ .split-header__links .split-header__link:nth-child(2) {
    transition-delay: 0.09s;
  }
  .split-header__toggle:checked ~ .split-header__links .split-header__link:nth-child(3) {
    transition-delay: 0.13s;
  }
  .split-header__toggle:checked ~ .split-header__links .split-header__link:nth-child(4) {
    transition-delay: 0.17s;
  }
  .split-header__toggle:checked ~ .split-header__links .split-header__link:nth-child(5) {
    transition-delay: 0.21s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .split-header__links,
  .split-header .split-header__link,
  .split-header__menu-btn span {
    transition: none;
  }
}
