/* SPBC unified site header — used by index + calculator */
:root {
  --spbc-green: #006600;
  --spbc-green-deep: #004d00;
  --spbc-gold: #FDD700;
  --spbc-header-pad-y: 0.85rem;
  --spbc-header-pad-x: 0.75rem;
}

.site-header {
  --spbc-header-pad-y: 0.75rem;
  background: linear-gradient(180deg, #007a00 0%, var(--spbc-green) 55%, var(--spbc-green-deep) 100%);
  border-bottom: 4px solid var(--spbc-gold);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: max(var(--spbc-header-pad-y), env(safe-area-inset-top));
  padding-bottom: var(--spbc-header-pad-y);
  /* Only visual chrome transitions — avoid layout-shifting size changes */
  transition:
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    backdrop-filter 0.2s ease;
  isolation: isolate;
}

/* Gold accent rail */
.site-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(253, 215, 0, 0.15) 15%,
    var(--spbc-gold) 50%,
    rgba(253, 215, 0, 0.15) 85%,
    transparent 100%
  );
  opacity: 0.9;
  pointer-events: none;
  z-index: 2;
}

/* Soft vignette / depth */
.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 120% at 50% -20%, rgba(253, 215, 0, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 80% at 100% 50%, rgba(0, 0, 0, 0.12), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.site-header.is-scrolled {
  /* Keep padding/type size stable so sticky height does not fight scrollY */
  background: rgba(0, 80, 0, 0.92);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(253, 215, 0, 0.12);
  border-bottom-color: rgba(253, 215, 0, 0.85);
}

.site-header__inner {
  position: relative;
  z-index: 1;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--spbc-header-pad-x);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .site-header__inner {
    flex-direction: row;
    padding: 0 1.5rem;
    gap: 1rem;
  }
}

.site-header__brand {
  text-decoration: none;
  display: inline-block;
  border-radius: 0.5rem;
  transition: transform 0.2s ease, filter 0.2s ease;
  touch-action: manipulation;
}

.site-header__brand:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.site-header__brand:active {
  transform: translateY(0);
}

.site-header__brand:focus-visible {
  outline: 2px solid var(--spbc-gold);
  outline-offset: 3px;
}

.site-header__brand-text {
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: 0.01em;
  display: inline-block;
}

@media (min-width: 640px) {
  .site-header__brand-text { font-size: 1.45rem; }
}

@media (min-width: 768px) {
  .site-header__brand-text { font-size: 1.7rem; }
}

.site-header__brand-gold {
  color: var(--spbc-gold);
  text-shadow: 0 0 18px rgba(253, 215, 0, 0.25);
}

.site-header__brand-white {
  color: #fff;
  margin-left: 0.3rem;
}

/* Stack brand on very narrow phones for balance */
@media (max-width: 380px) {
  .site-header__brand-white {
    display: block;
    margin-left: 0;
    margin-top: 0.1rem;
  }
  .site-header__brand-text {
    text-align: center;
  }
}

.site-header__nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  justify-content: center;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(253, 215, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-link {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  /* No tilt / transform on menu — only color + border glow */
  transform: none !important;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  touch-action: manipulation;
  text-decoration: none;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .nav-link {
    font-size: 0.72rem;
    padding: 0.5rem 0.85rem;
    min-height: 2.5rem;
  }
}

/* Hover: gold border lights up + soft flash */
.nav-link:hover:not(.active) {
  color: #fff;
  border-color: rgba(253, 215, 0, 0.75);
  background: rgba(253, 215, 0, 0.08);
  box-shadow:
    0 0 0 1px rgba(253, 215, 0, 0.25),
    0 0 14px rgba(253, 215, 0, 0.35);
  animation: nav-border-flash 0.7s ease-out 1;
}

.nav-link:focus-visible {
  outline: 2px solid var(--spbc-gold);
  outline-offset: 2px;
}

/* Active tab: filled gold + living border glow (no tilt) */
.nav-link.active {
  color: #000;
  background: linear-gradient(180deg, #ffe44d 0%, var(--spbc-gold) 45%, #e6c200 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    0 0 0 1px rgba(253, 215, 0, 0.5),
    0 0 16px rgba(253, 215, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  animation: nav-active-flash 1.1s ease-out 1;
}

/* Sliding pill hidden — border glow replaces it */
.nav-pill {
  display: none !important;
}

@keyframes nav-border-flash {
  0% {
    box-shadow:
      0 0 0 0 rgba(253, 215, 0, 0),
      0 0 0 0 rgba(253, 215, 0, 0);
  }
  35% {
    box-shadow:
      0 0 0 2px rgba(253, 215, 0, 0.55),
      0 0 22px rgba(253, 215, 0, 0.65);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(253, 215, 0, 0.25),
      0 0 14px rgba(253, 215, 0, 0.35);
  }
}

@keyframes nav-active-flash {
  0% {
    box-shadow:
      0 0 0 0 rgba(253, 215, 0, 0),
      0 0 0 0 rgba(253, 215, 0, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
  40% {
    box-shadow:
      0 0 0 3px rgba(253, 215, 0, 0.65),
      0 0 28px rgba(253, 215, 0, 0.8),
      inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(253, 215, 0, 0.5),
      0 0 16px rgba(253, 215, 0, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .site-header__brand,
  .site-header__brand-text,
  .nav-link {
    transition: none !important;
  }
  .nav-link:hover:not(.active),
  .nav-link.active {
    animation: none !important;
  }
  .site-header__brand:hover {
    transform: none;
  }
}
