/* ============================================================================
   FB-APP HEADER — clean custom header (2026-05-01 architectural reset).
   Renders from partials/fb-header.php. Salient's #header-outer is hidden.
   No CSS conflicts: this owns the header from scratch.

   Visual rhythm (from prototype):
     • locked dark (#0a0a0b) in all themes — brand mark, not a content surface
     • 64px tall · 36px horizontal padding · 32px gap between regions
     • logo · centered nav (13px / 500 / 22px gap) · search · credits · avatar
   ============================================================================ */

/* Reset — kill Salient's header and any leftover top-bar.
   IMPORTANT: do NOT hide #search-outer (Salient's search overlay) — fb-app-search
   triggers it via #search-btn click, and fb-search-override.js hijacks its input. */
#header-outer,
#header-outer-bg,
#header-space,
#nectar_fullscreen_rows #page-header-bg-overlay,
.ascend #header-outer .span_9 > .slide-out-widget-area-toggle {
  display: none !important;
  height: 0 !important;
  visibility: hidden !important;
}
/* But keep #search-btn rendered (just hidden via parent #header-outer) so JS can click it */
#search-outer { visibility: visible !important; }

/* Force WP admin bar offset compatibility — push our header below it if present */
body.admin-bar .fb-app-header { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .fb-app-header { top: 46px; }
}

/* ── The header itself ───────────────────────────────────────────────────── */
.fb-app-header {
  position: sticky;
  top: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
  padding: 0 36px;
  background: #0a0a0b;
  border-bottom: 1px solid #1a1a1e;
  font-family: var(--font-body, 'DM Sans', -apple-system, sans-serif);
  -webkit-font-smoothing: antialiased;
  color: #f4f4f6;
}
.fb-app-header * { box-sizing: border-box; }

/* Push the page content below the sticky header */
body .fb-app-header + * { /* immediate page wrapper */ }

/* ── Logo (real animated SVG via fb_logo()) ──────────────────────────────── */
.fb-app-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: #f4f4f6;
}
.fb-app-logo:hover { color: #f4f4f6; text-decoration: none; }

/* fb_logo() outputs <span class="fb-logo">...<svg .fb-logo__mark>...<span .fb-logo__wordmark>... */
.fb-app-header .fb-logo {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
}
.fb-app-header .fb-logo__mark { height: 30px !important; width: auto !important; flex-shrink: 0 !important; }
.fb-app-header .fb-logo__letter { fill: #ffffff !important; }
.fb-app-header .fb-logo__bar    { fill: none !important; stroke: #ffffff !important; stroke-width: 40; stroke-miterlimit: 10; }
.fb-app-header .fb-logo__wordmark {
  font-family: var(--font-display, 'Montserrat', sans-serif) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}
.fb-app-header .fb-logo__word-fund  { color: #ffffff !important; }
.fb-app-header .fb-logo__word-bench { color: #c9a962 !important; }

/* Logo entrance animation — chase strokes race the perimeter, then fade */
.fb-logo__chase {
  opacity: 0;
  stroke-dasharray: 80 2400;
  stroke-dashoffset: 0;
  stroke-linecap: round;
}
.fb-logo-stop1 { stop-color: #c9a962; }
.fb-logo-stop2 { stop-color: #60a5fa; }
.fb-logo-stop3 { stop-color: #a78bfa; }
.fb-logo-stop4 { stop-color: #77DB89; }
.fb-logo-stop5 { stop-color: #f472b6; }

.fb-logo--animate .fb-logo__letter { fill: transparent; animation: fb-logo-fill 0.6s ease 2.2s forwards; }
.fb-logo--animate .fb-logo__bar    { stroke: transparent; animation: fb-logo-stroke 0.6s ease 2.2s forwards; }
.fb-logo--animate .fb-logo__chase  { opacity: 1; animation: fb-logo-chase 2s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards; }
.fb-logo--animate .fb-logo__chase--bar { stroke-dasharray: 60 1800; animation-duration: 1.8s; }
.fb-logo--animate .fb-logo-stop1 { animation: fb-logo-cycle1 2s ease 0.2s forwards; }
.fb-logo--animate .fb-logo-stop2 { animation: fb-logo-cycle2 2s ease 0.2s forwards; }
.fb-logo--animate .fb-logo-stop3 { animation: fb-logo-cycle3 2s ease 0.2s forwards; }
.fb-logo--animate .fb-logo-stop4 { animation: fb-logo-cycle4 2s ease 0.2s forwards; }
.fb-logo--animate .fb-logo-stop5 { animation: fb-logo-cycle5 2s ease 0.2s forwards; }
.fb-logo--animate .fb-logo__wordmark {
  opacity: 0;
  animation: fb-logo-wordmark 0.5s ease 2.4s forwards;
}

@keyframes fb-logo-chase {
  0%   { stroke-dashoffset: 0;     opacity: 1; stroke-width: 6; }
  70%  { stroke-dashoffset: -2800; opacity: 1; stroke-width: 6; }
  95%  { stroke-dashoffset: -3600; opacity: 0.3; stroke-width: 3; }
  100% { stroke-dashoffset: -4000; opacity: 0; stroke-width: 0; }
}
@keyframes fb-logo-fill   { to { fill: #ffffff; } }
@keyframes fb-logo-stroke { to { stroke: #ffffff; } }
@keyframes fb-logo-wordmark {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fb-logo-cycle1 {
  0% { stop-color: #c9a962; } 20% { stop-color: #60a5fa; } 40% { stop-color: #a78bfa; }
  60% { stop-color: #f472b6; } 80% { stop-color: #77DB89; } 100% { stop-color: #ffffff; }
}
@keyframes fb-logo-cycle2 {
  0% { stop-color: #60a5fa; } 20% { stop-color: #a78bfa; } 40% { stop-color: #f472b6; }
  60% { stop-color: #77DB89; } 80% { stop-color: #c9a962; } 100% { stop-color: #ffffff; }
}
@keyframes fb-logo-cycle3 {
  0% { stop-color: #a78bfa; } 20% { stop-color: #f472b6; } 40% { stop-color: #77DB89; }
  60% { stop-color: #c9a962; } 80% { stop-color: #60a5fa; } 100% { stop-color: #ffffff; }
}
@keyframes fb-logo-cycle4 {
  0% { stop-color: #77DB89; } 20% { stop-color: #c9a962; } 40% { stop-color: #60a5fa; }
  60% { stop-color: #a78bfa; } 80% { stop-color: #f472b6; } 100% { stop-color: #ffffff; }
}
@keyframes fb-logo-cycle5 {
  0% { stop-color: #f472b6; } 20% { stop-color: #77DB89; } 40% { stop-color: #c9a962; }
  60% { stop-color: #60a5fa; } 80% { stop-color: #a78bfa; } 100% { stop-color: #ffffff; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-logo--animate .fb-logo__bar,
  .fb-logo--animate .fb-logo__letter,
  .fb-logo--animate .fb-logo__chase,
  .fb-logo--animate .fb-logo__wordmark,
  .fb-logo--animate .fb-logo-stop1,
  .fb-logo--animate .fb-logo-stop2,
  .fb-logo--animate .fb-logo-stop3,
  .fb-logo--animate .fb-logo-stop4,
  .fb-logo--animate .fb-logo-stop5 {
    animation: none !important;
    opacity: 1 !important;
  }
  .fb-logo--animate .fb-logo__letter { fill: #ffffff !important; }
  .fb-logo--animate .fb-logo__bar    { fill: none !important; stroke: #ffffff !important; }
  .fb-logo--animate .fb-logo__chase  { opacity: 0 !important; }
}

/* ── Theme toggle pill ───────────────────────────────────────────────────── */
.fb-app-theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 50px;
  height: 28px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #2a2a2f;
  padding: 0 5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-app-theme-toggle:hover {
  border-color: rgba(201, 169, 98, 0.45);
  background: rgba(255, 255, 255, 0.06);
}
.fb-app-theme-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  z-index: 1;
}
.fb-app-theme-toggle__icon svg {
  width: 12px; height: 12px;
  stroke-width: 2.4;
  fill: none;
  transition: stroke 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-app-theme-toggle__icon--sun  svg { stroke: rgba(255, 255, 255, 0.42); }
.fb-app-theme-toggle__icon--moon svg { stroke: rgba(255, 255, 255, 0.42); }
.fb-app-theme-toggle:hover .fb-app-theme-toggle__icon--sun  svg { stroke: #e8c97a; }
.fb-app-theme-toggle:hover .fb-app-theme-toggle__icon--moon svg { stroke: rgba(255, 255, 255, 0.7); }
.fb-app-theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a962 0%, #a68b3d 100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .fb-app-theme-toggle__thumb { transform: translateX(22px); }

/* ── Primary nav — !important is intentional: header is brand chrome,
   never themed by parent CSS. Salient + WordPress globals fight us here. ─ */
.fb-app-header .fb-app-nav {
  display: flex !important;
  align-items: center !important;
  gap: 22px !important;
  flex: 1;
  min-width: 0;
}
.fb-app-header .fb-app-nav a,
html body .fb-app-header .fb-app-nav a {
  font-family: var(--font-body, 'DM Sans', sans-serif) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #c4c4cc !important;
  text-decoration: none !important;
  transition: color 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: nowrap !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  background: transparent !important;
  padding: 0 !important;
}
.fb-app-header .fb-app-nav a:hover,
.fb-app-header .fb-app-nav a.is-active,
html body .fb-app-header .fb-app-nav a:hover,
html body .fb-app-header .fb-app-nav a.is-active {
  color: #c9a962 !important;
  text-decoration: none !important;
}

/* ── Right region: search + credits + avatar ──────────────────────────────── */
.fb-app-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Search box (triggers Salient's #search-outer overlay via fbAppSearchTrigger JS) */
.fb-app-header .fb-app-search {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 240px !important;
  height: 36px !important;
  padding: 0 12px !important;
  background: #1c1c1f !important;
  border: 1px solid #2a2a2f !important;
  border-radius: 9px !important;
  color: #8a8a94 !important;
  cursor: pointer !important;
  font-family: inherit !important;
  font-size: 13px !important;
  text-align: left !important;
  text-decoration: none !important;
  transition: border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.fb-app-header .fb-app-search:hover { border-color: rgba(201, 169, 98, 0.4) !important; }
.fb-app-header .fb-app-search svg {
  width: 14px !important; height: 14px !important; flex-shrink: 0 !important;
  stroke: currentColor !important; fill: none !important; stroke-width: 2 !important;
}
.fb-app-header .fb-app-search__placeholder {
  flex: 1;
  text-align: left;
  color: #8a8a94 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User avatar */
.fb-app-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a962 0%, #a68b3d 100%);
  color: #0a0a0b;
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  border: 0;
  padding: 0;
}
.fb-app-avatar:hover { transform: scale(1.06); color: #0a0a0b; text-decoration: none; }
.fb-app-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .fb-app-header { padding: 0 20px; gap: 16px; }
  .fb-app-nav { display: none; }
  .fb-app-search { width: auto; padding: 0 10px; }
  .fb-app-search__placeholder { display: none; }
  .fb-app-logo__word { font-size: 15px; }
}
