.site-header,
.site-header * {
  box-sizing: border-box;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 58px);
  overflow: visible;
  isolation: isolate;
  background: transparent;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

/* Keep the fixed blur layer covered during desktop overscroll. */
@media (hover: hover) and (pointer: fine) {
  html {
    overscroll-behavior-y: none;
  }
}

.site-header::before {
  content: "";
  position: absolute;
  top: -18px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(217, 226, 220, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-header > * {
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 20px rgba(18, 53, 35, 0.12);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  color: #66736b;
  font-size: 13px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.top-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  color: #17211b;
  border-radius: 999px;
  text-decoration: none;
}

.cart-link {
  position: relative;
  min-width: 42px;
  justify-content: flex-end;
  padding-right: 0;
}

.cart-link svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-link.cart-bump svg {
  animation: cartIconBump 520ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.cart-link.cart-bump .cart-count {
  animation: cartCountBump 520ms cubic-bezier(0.2, 0.72, 0.2, 1);
  transform-origin: center;
}

@keyframes cartIconBump {
  0% {
    transform: translateY(0) scale(1);
  }

  34% {
    transform: translateY(-3px) scale(1.08);
  }

  68% {
    transform: translateY(1px) scale(0.98);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes cartCountBump {
  0% {
    transform: scale(1);
  }

  36% {
    transform: scale(1.24);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes cartCountBumpMobile {
  0% {
    transform: scale(1);
  }

  36% {
    transform: scale(1.14);
  }

  100% {
    transform: scale(1);
  }
}

.cart-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #b34e64;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 11px;
  font-weight: 850;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cart-count[hidden] {
  display: none;
}

@media (max-width: 680px), (hover: none) and (pointer: coarse) and (max-width: 1180px), (orientation: portrait) and (max-width: 1180px) {
  body:not(.home-page) {
    padding-top: 50px;
  }

  .site-header {
    gap: 10px;
    padding: 8px 10px;
  }

  .top-nav a {
    -webkit-tap-highlight-color: transparent;
  }

  .brand {
    flex: 0 0 auto;
    gap: 6px;
  }

  .brand > span {
    display: grid;
    gap: 2px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    box-shadow: 0 6px 14px rgba(18, 53, 35, 0.12);
  }

  .brand strong {
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .brand small {
    font-size: 9px;
    line-height: 1.08;
  }

  .top-nav {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 2px;
    min-width: 0;
    overflow: visible;
  }

  .top-nav a {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 34px;
    padding: 7px 8px;
    overflow-wrap: anywhere;
    color: #17211b;
    font-size: 14px;
    -webkit-text-fill-color: #17211b;
  }

  .top-nav a:visited {
    color: #17211b;
    -webkit-text-fill-color: #17211b;
  }

  .cart-link {
    min-width: 50px;
    justify-content: flex-start;
    overflow: visible;
    padding-left: 5px;
    padding-right: 21px;
  }

  .cart-link svg {
    width: 20px;
    height: 20px;
  }

  .cart-count {
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    line-height: 16px;
  }

  .cart-link.cart-bump .cart-count {
    animation-name: cartCountBumpMobile;
  }
}

@media (max-width: 430px) {
  .site-header {
    gap: 6px;
    padding: 7px 8px;
  }

  .brand strong {
    max-width: 66px;
    font-size: 12px;
    line-height: 1.05;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .top-nav {
    gap: 1px;
  }

  .top-nav a {
    min-height: 33px;
    padding: 6px 7px;
    font-size: 13px;
  }

  .cart-link {
    min-width: 48px;
    padding-left: 4px;
    padding-right: 20px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .cart-link.cart-bump svg,
  .cart-link.cart-bump .cart-count {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }
}
