.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 48px 10px;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 300ms ease;
  gap: 18px;
  --scroll-progress: 0;
}

.site-header.scrolled {
  background: transparent;
  border-bottom-color: transparent;
}

.header-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: box-shadow 300ms ease, background 300ms ease, border-color 300ms ease, transform 300ms ease;
}

.site-header.scrolled .header-shell {
  background: var(--panel-strong);
  border-color: var(--outline);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.logo-wrap {
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 200ms ease;
}

.brand:hover {
  opacity: 0.85;
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 8px;
}

.header-logo {
  height: 44px;
  width: auto;
  display: block;
  opacity: 0;
  transform: translateY(calc(6px - 4px * var(--scroll-progress)))
    scale(calc(1 - 0.08 * var(--scroll-progress)));
  animation: brand-in 700ms ease forwards;
  transition: transform 320ms ease;
}
/* Show only the logo that matches the active theme. Dark themes = midnight,
   carbon; anything else falls through to light. */
.header-logo-dark { display: none; }
html[data-theme="midnight"] .header-logo-light,
html[data-theme="carbon"] .header-logo-light,
body[data-theme="midnight"] .header-logo-light,
body[data-theme="carbon"] .header-logo-light { display: none; }
html[data-theme="midnight"] .header-logo-dark,
html[data-theme="carbon"] .header-logo-dark,
body[data-theme="midnight"] .header-logo-dark,
body[data-theme="carbon"] .header-logo-dark { display: block; }

.brand-text {
  display: grid;
  gap: 2px;
  line-height: 1;
}

.brand-name {
  font-size: clamp(0.98rem, 1.7vw, 1.2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: 0;
  transform: translateY(calc(6px - 4px * var(--scroll-progress)));
  animation: brand-in 700ms ease forwards;
  animation-delay: 80ms;
  transition: transform 320ms ease;
}

.brand-zaro {
  color: var(--ink);
}

.brand-hr {
  color: var(--brand-yellow);
  transition: text-shadow 240ms ease, color 240ms ease;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: lowercase;
  /* Stretch tagline to exactly match the brand-name width above it: the grid
     column auto-sizes to the wider child (brand-name), and justify spreads
     this single line across that full width so start/end align. */
  width: 100%;
  text-align: justify;
  text-align-last: justify;
  opacity: 0;
  transform: translateY(calc(6px - 4px * var(--scroll-progress)));
  animation: brand-in 700ms ease forwards;
  animation-delay: 140ms;
  transition: transform 320ms ease;
}

.brand:hover .brand-hr {
  text-shadow: 0 0 12px rgba(240, 194, 77, 0.45);
  color: var(--brand-yellow);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-links {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.header-search-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.header-search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

.header-search-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
}

.header-search-icon svg {
  width: 100%;
  height: 100%;
}

.header-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-search-input {
  width: 0;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--outline);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  transition: width 220ms ease, opacity 200ms ease;
}

.header-search.is-open .header-search-input {
  width: 200px;
  opacity: 1;
  pointer-events: auto;
}

.header-policy {
  display: grid;
  gap: 4px;
  text-align: center;
  justify-items: center;
}

.header-policy .policy-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.header-policy .policy-total {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.header-ctas {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-ctas .btn {
  padding: 9px 18px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: none;
  min-height: 38px;
}

.header-ctas .btn.ghost {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
}

.header-ctas .btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
}

.header-ctas .btn.primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.header-ctas .btn.ghost:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.link {
  position: relative;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 220ms ease;
}

.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 260ms ease;
}

.link:hover {
  color: var(--ink);
}

.link:hover::after {
  transform: scaleX(1);
}

@media (max-width: 980px) {
  .site-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .header-shell {
    border-radius: 28px;
    padding: 18px 20px;
  }

  .header-nav {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .header-links {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 10px 12px 8px;
  }

  .header-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 12px 14px;
    border-radius: 20px;
  }

  .header-logo {
    max-width: 150px;
    height: 38px;
  }

  .header-nav {
    display: contents;
  }

  .header-links {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }

  .header-ctas {
    grid-column: 2;
    grid-row: 1;
  }

  .header-ctas .header-policy {
    display: none;
  }

  .header-ctas .btn {
    padding: 8px 13px;
    min-height: 36px;
  }
}
