header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 90;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(16px, 2vw, 24px);
  min-height: 5rem;
  padding-block: clamp(1rem, 2vw, 1.5rem);
  padding-inline: calc(var(--inset) + var(--inner));
}

/* The badge has white lettering, so it sits on a charcoal chip: legible over
   the off-white sections, and a quiet outline on the dark ones. */
header > a:first-of-type {
  justify-self: start;
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  background: var(--charcoal);
  line-height: 0;
}

header > a:first-of-type img {
  width: auto;
  height: clamp(1.25rem, 1.9vw, 1.625rem);
}

header nav ul {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

header nav li + li::before {
  content: "/";
  margin-inline: clamp(0.65rem, 1.25vw, 1rem);
  color: rgba(var(--crimson-rgb), 0.45);
  font-size: 11px;
  letter-spacing: 0.14em;
  pointer-events: none;
}

header nav a {
  color: var(--charcoal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
  transition: color var(--duration-normal) var(--ease-out);
}

header nav a:hover,
header nav a:focus-visible {
  color: var(--crimson);
}

/* Call to action: one rounded rectangle holding the label and the arrow. */
header > a:last-of-type {
  --h: 1.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
  min-height: var(--h);
  padding-inline: 0.85rem 0.7rem;
  border-radius: 0.5rem;
  background: var(--dark-crimson);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform var(--duration-fast) var(--ease-out),
    background-color var(--duration-normal) var(--ease-out);
}

header > a:last-of-type svg {
  flex-shrink: 0;
  width: 0.875rem;
  height: 0.875rem;
}

header > a:last-of-type:hover {
  background: color-mix(in srgb, var(--dark-crimson) 80%, #fff);
  transform: translateY(-1px);
}

header :is(a, button):focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 4px;
}

/* Over a dark hero the header turns light. The page sets data-line-theme. */
header[data-line-theme="dark"] nav li + li::before {
  color: rgba(var(--light-crimson-rgb), 0.6);
}

header[data-line-theme="dark"] nav a {
  color: #fff;
}

header[data-line-theme="dark"] nav a:hover,
header[data-line-theme="dark"] nav a:focus-visible {
  color: var(--light-crimson);
}

header[data-line-theme="dark"] :is(a, button):focus-visible {
  outline-color: var(--light-crimson);
}

@media (max-width: 992px) {
  header {
    grid-template-columns: auto 1fr;
  }

  header nav {
    justify-self: end;
  }

  header > a:last-of-type {
    display: none;
  }
}

@media (max-width: 480px) {
  header {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-block: 16px;
  }

  header nav {
    justify-self: start;
  }
}
