/* Site-wide mega header.
 *
 * Shipped as one shared file (/site-header.css) that every page links, so the
 * bytes are paid for once and cached across the whole site.
 *
 * EVERY selector is prefixed .bmh- and every custom property --bmh-*. The 260
 * pages this lands on were each written standalone and between them already
 * define .header, .nav, .btn, --green, --purple and more. Without the prefix the
 * header would inherit whichever page it happened to be on and look different on
 * every one. Nothing here selects a bare element outside .bmh-root either, for
 * the same reason.
 *
 * Tokens mirror public/home/styles.css so the header reads as the same product
 * as the homepage. Change them in both places or the site stops matching.
 */

/* 175 of the pre-rendered pages set `overflow-x: hidden` on html or body to tame
 * a wide hero. That turns the element into a scroll container, and a scroll
 * container is exactly what stops `position: sticky` sticking — the header would
 * scroll away on two thirds of the site.
 *
 * `clip` does the same visual job without creating that scroll container, so
 * sticky keeps working. Browsers that predate `overflow: clip` simply drop this
 * declaration and keep the page's own `hidden`, which is today's behaviour — so
 * the worst case is a header that scrolls, never a broken layout. */
html:has(.bmh-root),
html:has(.bmh-root) body {
  overflow-x: clip;
}

.bmh-root {
  --bmh-bg: #ffffff;
  --bmh-panel: #f5f5f7;
  --bmh-border: rgb(0 0 0 / 10%);
  --bmh-text: #141416;
  --bmh-muted: #55555f;
  --bmh-subtle: #86868f;
  --bmh-purple: #b15af8;
  --bmh-orange: #ff8951;
  --bmh-grad: linear-gradient(104deg, #b15af8 12%, #ff8951 94%);
  --bmh-purple-dim: rgb(177 90 248 / 10%);
  --bmh-font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bmh-shell: 1300px;
  --bmh-gutter: clamp(1rem, 4vw, 2.5rem);
  --bmh-h: 64px;
  --bmh-radius: 10px;
  --bmh-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bmh-shadow: 0 24px 60px rgb(20 20 22 / 12%);

  position: sticky;
  top: 0;
  /* Near the maximum on purpose. 109 of the pre-rendered pages already carry a
     z-index: 9999 of their own (progress bars, floating CTAs, chat launchers),
     and any of them would otherwise punch through an open dropdown. The site
     header has to win against every page it lands on. */
  z-index: 2147483000;
  font-family: var(--bmh-font);
  color: var(--bmh-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bmh-root *,
.bmh-root *::before,
.bmh-root *::after { box-sizing: border-box; }

.bmh-root a { color: inherit; text-decoration: none; }
.bmh-root button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Keyboard focus must stay visible: this is the primary nav of the whole site. */
.bmh-root :focus-visible {
  outline: 2px solid var(--bmh-purple);
  outline-offset: 2px;
  border-radius: 6px;
}

.bmh-bar {
  height: var(--bmh-h);
  display: flex;
  align-items: center;
  background: rgb(255 255 255 / 88%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bmh-border);
}

.bmh-shell {
  width: 100%;
  max-width: var(--bmh-shell);
  margin: 0 auto;
  padding: 0 var(--bmh-gutter);
  display: flex;
  align-items: center;
  gap: 12px;
}

.bmh-logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.bmh-logo img { display: block; height: 30px; width: auto; }

/* ---------------------------------------------------------------- desktop nav */

.bmh-nav {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: 32px;
  flex: 1 1 auto;
}

.bmh-item { position: relative; }

.bmh-trigger,
.bmh-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bmh-muted);
  white-space: nowrap;
  transition: color 0.15s var(--bmh-ease), background-color 0.15s var(--bmh-ease);
}

.bmh-trigger:hover,
.bmh-link:hover,
.bmh-item[data-open='true'] .bmh-trigger {
  color: var(--bmh-text);
  background: var(--bmh-panel);
}

.bmh-caret { transition: transform 0.2s var(--bmh-ease); }
.bmh-item[data-open='true'] .bmh-caret { transform: rotate(180deg); }

/* The panel is hidden with visibility, not display, so the fade can animate and
   so its links stay out of the tab order while closed. */
.bmh-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s var(--bmh-ease), transform 0.18s var(--bmh-ease), visibility 0.18s;
  background: var(--bmh-bg);
  border: 1px solid var(--bmh-border);
  border-radius: 16px;
  box-shadow: var(--bmh-shadow);
  padding: 22px;
  display: grid;
  gap: 26px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(182px, auto);
  /* Last line of defence if JS has not run: never wider than the screen. */
  max-width: calc(100vw - 32px);
}

.bmh-item[data-open='true'] .bmh-panel {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.bmh-col-h {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bmh-subtle);
  margin: 0 0 10px;
}

.bmh-col ul { list-style: none; margin: 0; padding: 0; }
.bmh-col li + li { margin-top: 2px; }

.bmh-entry {
  display: block;
  padding: 7px 9px;
  margin: 0 -9px;
  border-radius: 8px;
  transition: background-color 0.15s var(--bmh-ease);
}

.bmh-entry:hover { background: var(--bmh-panel); }
.bmh-entry b { display: block; font-size: 0.85rem; font-weight: 600; color: var(--bmh-text); }
.bmh-entry span { display: block; font-size: 0.75rem; color: var(--bmh-subtle); margin-top: 1px; }

.bmh-feature {
  /* Fills its grid track instead of a fixed 232px: when the panel is capped at
     the viewport width the tracks shrink, and a fixed-width card would spill
     over the first column. */
  width: 100%;
  max-width: 232px;
  padding: 18px;
  border-radius: 12px;
  background: var(--bmh-panel);
  display: flex;
  flex-direction: column;
}

.bmh-feature-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bmh-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bmh-feature b { display: block; font-size: 0.98rem; font-weight: 700; margin: 8px 0 6px; }
.bmh-feature p { margin: 0 0 14px; font-size: 0.8rem; color: var(--bmh-muted); }
.bmh-feature-cta { margin-top: auto; font-size: 0.82rem; font-weight: 600; color: var(--bmh-purple); }

.bmh-viewall {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid var(--bmh-border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bmh-purple);
}

/* -------------------------------------------------------------------- actions */

.bmh-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }

.bmh-login { display: none; padding: 8px 10px; font-size: 0.875rem; font-weight: 500; color: var(--bmh-muted); }
.bmh-login:hover { color: var(--bmh-text); }

.bmh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.15s var(--bmh-ease), box-shadow 0.15s var(--bmh-ease);
}

.bmh-btn:hover { transform: translateY(-1px); }
.bmh-btn-ghost { border: 1px solid var(--bmh-border); color: var(--bmh-text); }
.bmh-btn-ghost:hover { border-color: var(--bmh-purple); }
.bmh-btn-primary { background: var(--bmh-text); color: var(--bmh-bg) !important; }
.bmh-btn-primary:hover { background: #2b2b31; }
html[data-theme='dark'] .bmh-btn-primary:hover { background: #e4e4e8; }

.bmh-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 36px;
  border: 1px solid var(--bmh-border);
  border-radius: 8px;
}

/* --------------------------------------------------------------------- drawer */

.bmh-drawer {
  position: fixed;
  inset: var(--bmh-h) 0 0;
  background: var(--bmh-bg);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px var(--bmh-gutter) 48px;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s var(--bmh-ease), visibility 0.25s;
}

.bmh-root[data-drawer='true'] .bmh-drawer { transform: translateX(0); visibility: visible; }

.bmh-acc { border-bottom: 1px solid var(--bmh-border); }

.bmh-acc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 2px;
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
}

.bmh-acc-btn .bmh-caret { transition: transform 0.2s var(--bmh-ease); }
.bmh-acc[data-open='true'] .bmh-acc-btn .bmh-caret { transform: rotate(180deg); }

.bmh-acc-body { display: none; padding: 0 2px 14px; }
.bmh-acc[data-open='true'] .bmh-acc-body { display: block; }

.bmh-acc-body .bmh-col + .bmh-col { margin-top: 16px; }
.bmh-acc-body .bmh-entry { padding: 9px 9px; }

.bmh-drawer-cta { display: grid; gap: 10px; margin-top: 24px; }
.bmh-drawer-cta .bmh-btn { height: 46px; justify-content: center; font-size: 0.9rem; }

/* ------------------------------------------------------------- announcement */
/* Outside .bmh-root (it scrolls away while the bar stays sticky), so it cannot
   read the --bmh-* tokens and carries literal values instead. */

.bmh-announce {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 8px 16px;
  background: linear-gradient(104deg, #b15af8 12%, #ff8951 94%);
  color: #fff !important;
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none !important;
}
.bmh-announce b { font-weight: 700; white-space: nowrap; }
/* Phones get the two facts that matter most on one line. */
@media (max-width: 600px) {
  .bmh-announce { font-size: 12px; padding: 7px 12px; }
  .bmh-announce .bmh-announce-extra, .bmh-announce b { display: none; }
}
.bmh-announce:hover b { text-decoration: underline; }

@media print {
  .bmh-announce { display: none !important; }
}

/* ----------------------------------------------------------------- breakpoints */

/* Six short links, a text link and one button fit comfortably from 1024px. */
@media (min-width: 1024px) {
  .bmh-nav { display: flex; }
  .bmh-login { display: inline-flex; }
  .bmh-burger { display: none; }
  .bmh-drawer { display: none; }
}

/* Phones: the bar is just logo, dashboard button and menu. */
@media (max-width: 420px) {
  .bmh-actions .bmh-btn { padding: 0 11px; font-size: 0.78rem; }
}

@media (max-width: 339px) {
  .bmh-logo img { height: 26px; }
  .bmh-actions { gap: 6px; }
}

/* Respect a reduced-motion preference: the header still opens, just without the
   slide and fade. */
@media (prefers-reduced-motion: reduce) {
  .bmh-root *,
  .bmh-root *::before,
  .bmh-root *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* The pre-rendered SEO pages are light-only documents, so the header does not
   follow the OS dark preference on them. It does follow a page that explicitly
   opts in by setting data-theme="dark" on <html>, which is how the app shell
   marks itself. */
html[data-theme='dark'] .bmh-root {
  --bmh-bg: #0f0f14;
  --bmh-panel: #16161d;
  --bmh-border: rgb(255 255 255 / 12%);
  --bmh-text: #f4f4f4;
  --bmh-muted: #a3a3ad;
  --bmh-subtle: #86868f;
}

html[data-theme='dark'] .bmh-bar { background: rgb(15 15 20 / 88%); }
