/* ============================================================
   THE SITE HEADER
   One header for every public page: the mark and wordmark on the
   left, the way in on the right. Markup lives in _site-header.html
   and is injected by scripts/build-header.mjs — edit these two,
   never the copies inside the pages.

   Colour and type come from tokens.css, so the header cannot drift
   from the rest of the product the way two hand-written copies did.
   A page positions the bar (the landing floats it, the essay sticks
   it to the top); everything inside it is owned here.
   ============================================================ */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 64px;
  width: 100%;
  max-width: 1160px;
  /* Not the token surface: the bar floats over live content and needs
     the translucency the blur works against. */
  background: rgba(246, 245, 238, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  padding: 0 8px 0 20px;
  box-shadow: 0 8px 24px rgba(38, 37, 28, 0.07);
  /* The article sets a loose leading for prose, which would otherwise land
     on the call to action and make the bar taller than the same markup on
     the landing page. */
  line-height: normal;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-medium);
  font-size: var(--text-md);
  color: var(--color-ink);
  text-decoration: none;
}

.site-header .brand-mark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  color: var(--color-primary);
  animation:
    pinBounceIn .8s cubic-bezier(.34, 1.56, .64, 1) both,
    pinFloat 2.6s ease-in-out .8s infinite;
}

.site-header .brand-mark svg { width: 100%; height: 100%; }

/* The mark arrives like a pin dropping onto the map. */
@keyframes pinBounceIn {
  0%   { transform: translateY(-16px) scale(.5); opacity: 0; }
  55%  { transform: translateY(3px) scale(1.14); opacity: 1; }
  75%  { transform: translateY(-2px) scale(.95); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes pinFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .brand-mark { animation: none; }
}

.site-header .nav-links {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-ink-2);
}

.site-header .nav-links a {
  padding: 9px 16px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
  transition: border-color .2s;
}

.site-header .nav-links a:hover { border-color: var(--color-border-strong); }

.site-header .nav-cta {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-tight);
  color: var(--color-primary-text);
  background: var(--color-primary-dark);
  padding: 11px 18px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  text-decoration: none;
  transition: background .2s;
}

.site-header .nav-cta:hover { background: var(--color-primary); }

/* The section links go first: they are the least of what the bar carries,
   and a phone has room for the mark and the way in, nothing else. */
@media (max-width: 820px) {
  .site-header .nav-links { display: none; }
}

/* The bar tightens before it drops anything: a 375pt phone keeps the whole
   brand. */
@media (max-width: 420px) {
  .site-header { padding: 0 6px 0 14px; }
  .site-header .brand { font-size: var(--text-base); gap: 6px; }
  .site-header .nav-cta { padding: 10px 14px; font-size: 12.5px; }
}

/* Only then does the wordmark go, and only the wordmark — never the mark.
   Hiding every span in .brand also hid .brand-mark, which is why the logo
   disappeared entirely on a phone. */
@media (max-width: 330px) {
  .site-header .brand-word { display: none; }
}
