/* ==========================================================================
   HEADER
   ========================================================================== */
.ev-header {
  --ev-header-h: 104px;
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--ev-header-h);
  color: var(--ev-white);
  transition: background-color 0.4s, height 0.4s;
}
/* the blur sits on a pseudo-element: backdrop-filter on the header itself would trap the fixed mobile menu inside it */
.ev-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transition: background-color 0.4s, backdrop-filter 0.4s;
}
.ev-header.is-scrolled { --ev-header-h: 80px; }
.ev-header.is-scrolled::before {
  background: rgba(14, 14, 14, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.admin-bar .ev-header { top: 32px; }
.ev-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  /* Figma: the bar is 104 px but its content is centred on y 62 */
  padding-top: 20px;
  transition: padding-top 0.4s;
}
.ev-header.is-scrolled .ev-header__inner { padding-top: 0; }
/* below ~1310 px the links would run into the logo: links move closer and the bar uses a narrower gutter than the content */
.ev-header__nav { display: flex; gap: clamp(28px, min(4.479vw, 9.5vw - 69px), 86px); }
.ev-header__nav:not(.ev-header__nav--right) { margin-left: -2px; }
.ev-header__nav .ev-btn--corners { padding-inline: 18px; translate: 0 -2px; }
@media (min-width: 1025px) {
  .ev-header__inner { width: min(100% - 2 * clamp(32px, 33.68vw - 313px, var(--ev-gutter)), var(--ev-container)); }
}
.ev-header__end { display: flex; justify-content: flex-end; align-items: center; gap: clamp(16px, 1.46vw, 28px); min-width: 0; }
/* two links, the button and the cart share this side: its links sit closer than on the left, so the first one
   keeps its distance from the logo, and reach the 86 px of the left side at 1920 */
.ev-header__nav--right { justify-content: flex-end; align-items: center; gap: clamp(18px, max(6.5vw - 54px, 20vw - 298px), 86px); }
.ev-header__link {
  position: relative;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ev-header__link::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -3px;
  width: 8px; height: 1px;
  background: currentColor;
  opacity: 0;
  translate: -50% 0;
  transition: width 0.3s ease-out, opacity 0.3s ease-out;
}
.ev-header__link:hover::after,
.ev-header__link[aria-current="page"]::after { width: 50px; opacity: 1; }
/* the wordmark (top 18 px of the 35 px logo) sits on the nav text line, the HEALTH line hangs below it */
.ev-header__logo { position: relative; display: block; margin-top: 15px; }
.ev-header__logo img { width: 191px; height: auto; }
/* Figma: HEALTH fades in 2 s after load (smart animate 500 ms ease-out) */
.ev .ev-header__logo-health {
  position: absolute;
  inset: 0;
  animation: ev-fade-in 0.5s ease-out 2s both;
}

/* --- Cart button: not in the Figma file. A thin bag icon on the nav text line, count in a small white disc. --- */
.ev-header__cart {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px; height: 44px;
  margin-right: -12px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  translate: 0 -2px;
}
.ev-header__cart svg { display: block; fill: none; stroke: currentColor; stroke-width: 1; transition: opacity 0.3s; }
.ev-header__cart:hover svg { opacity: 0.7; }
.ev-cart-count {
  position: absolute;
  right: 4px; top: 5px;
  display: grid;
  place-items: center;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--ev-white);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.ev-cart-count[data-count="0"] { display: none; }
/* "only when the cart has items": the button appears with the first product */
.ev-header__cart[data-mode="items"]:has(.ev-cart-count[data-count="0"]) { display: none; }

.ev-header__toggle {
  display: none;
  flex: none;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
/* Figma mobile header: two 32 x 2 px bars, 4 px apart */
.ev-header__toggle span:first-child { position: relative; display: block; width: 32px; height: 8px; margin-inline: auto; }
.ev-header__toggle span:first-child::before,
.ev-header__toggle span:first-child::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%; height: 2px;
  background: currentColor;
  transition: transform 0.3s;
}
.ev-header__toggle span:first-child::before { top: 0; }
.ev-header__toggle span:first-child::after { bottom: 0; }
.ev-header.is-open .ev-header__toggle span:first-child::before { transform: translateY(3px) rotate(45deg); }
.ev-header.is-open .ev-header__toggle span:first-child::after { transform: translateY(-3px) rotate(-45deg); }

.ev-header__mobile {
  display: none;
  position: fixed;
  inset: var(--ev-header-h) 0 0;
  padding: 24px var(--ev-gutter) 40px;
  background: var(--ev-bg);
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  overflow-y: auto;
}
.admin-bar .ev-header__mobile { top: calc(var(--ev-header-h) + 32px); }
.ev-header__mobile a { display: flex; align-items: center; min-height: 52px; font-size: 22px; font-weight: 300; }
/* the quote link is the one action in the menu */
.ev-header__mobile .ev-header__mobile-cta {
  min-height: 48px;
  margin-top: 20px;
  padding: 0 28px;
  border: 1px solid var(--ev-white);
  border-radius: 70px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.ev-header.is-open .ev-header__mobile { display: flex; }

/* --- Minimal variant (checkout): way back on the left, logo, reassurance on the right --- */
.ev-header__back { display: inline-flex; align-items: center; min-height: 44px; }
.ev-header__back-arrow { display: inline-block; margin-right: 10px; transition: translate 0.3s ease-out; }
.ev-header__back:hover .ev-header__back-arrow { translate: -4px 0; }
.ev-header--minimal .ev-header__link::after { content: none; }
.ev-header__secure {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .ev-header.is-open { background: var(--ev-bg); }
  .ev-header__inner { grid-template-columns: auto 1fr; }
  .ev-header__nav { display: none; }
  .ev-header__end { gap: 4px; }
  .ev-header__cart { margin-right: 0; translate: 0 -3px; }
  /* the 32 px bars sit in a 44 px touch target: pull it out so the bars end at the gutter; Figma: bars centred on y 59 */
  .ev-header__toggle { display: block; margin-right: -6px; translate: 0 -3px; }

  .ev-header--minimal .ev-header__inner { grid-template-columns: 1fr auto 1fr; }
  .ev-header--minimal .ev-header__nav { display: flex; }
  .ev-header--minimal .ev-header__logo img { width: 150px; }
}

@media (max-width: 782px) {
  .admin-bar .ev-header { top: 46px; }
  .admin-bar .ev-header__mobile { top: calc(var(--ev-header-h) + 46px); }
}

@media (max-width: 600px) {
  .ev-header__inner { width: calc(100% - 64px); }
  /* #wpadminbar is not fixed at this width */
  .admin-bar .ev-header { position: absolute; }
  /* no room for words beside the logo: arrow and lock stay, the labels are kept for screen readers */
  .ev-header--minimal .ev-header__secure { font-size: 0; gap: 0; }
  .ev-header__back-arrow { margin-right: 0; font-size: 18px; }
  .ev-header__back-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* jump straight to the final frame */
  .ev .ev-header__logo-health { animation-duration: 1ms !important; animation-delay: 0s !important; animation-play-state: running !important; }
}
