/* ───────────────────────────────────────────────────────────────────────────
   Sysonaut site header — the single shared top bar used on every page except
   the editor. Rendered as React (<SiteHeader>) on /pricing & /dashboard and
   injected as the same markup by shared-layout.js on the static landing/presales
   pages. Hover mega-menus are CSS-only (no JS), so both contexts behave alike.

   Theme: dark is signalled by `.dark` on <html> (the app's Carbon convention;
   shared-layout.js also adds/removes `.dark` on the static pages). Light is the
   base; `.dark` overrides. Class-prefixed `.sy-hdr*` so it never collides with
   the landing page's own `nav {}` rules. Carbon flavour: IBM Plex, blue-60
   accent, square corners, layer panels, subtle hairline borders.
   ─────────────────────────────────────────────────────────────────────────── */

.sy-hdr {
  --sy-bg: #ffffff;
  --sy-fg: #0a0a0a;
  --sy-fg2: #666666;
  --sy-accent: #0f62fe;
  --sy-accent-hover: #0353e9;
  --sy-border: #e5e5e5;
  --sy-layer: #ffffff;
  --sy-layer-2: #f4f4f4;
  --sy-shadow: rgba(0, 0, 0, 0.12);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 1000;
  background: var(--sy-bg);
  /* No divider until the page is scrolled. */
  border-bottom: 1px solid transparent;
  transition: border-color 150ms ease;
  font-family:
    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  color: var(--sy-fg);
}

.sy-hdr--scrolled {
  border-bottom-color: var(--sy-border);
}

.dark .sy-hdr {
  --sy-bg: #0a0a0a;
  --sy-fg: #ededed;
  --sy-fg2: #a1a1a1;
  --sy-border: #1e1e1e;
  --sy-layer: #161616;
  --sy-layer-2: #262626;
  --sy-shadow: rgba(0, 0, 0, 0.5);
}

.sy-hdr-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
}

/* ── Brand ──────────────────────────────────────────────────────────────── */
.sy-hdr-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--sy-fg);
  margin-right: 16px;
}
.sy-hdr-logo {
  font-family: 'Material Symbols Outlined';
  font-size: 26px;
  line-height: 1;
  color: var(--sy-fg);
}
.sy-hdr-brandname {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Menu ───────────────────────────────────────────────────────────────── */
.sy-hdr-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.sy-hdr-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
}
.sy-hdr-trigger,
.sy-hdr-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 12px;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.875rem;
  color: var(--sy-fg2);
  text-decoration: none;
  cursor: pointer;
  transition: color 120ms;
}
.sy-hdr-trigger:hover,
.sy-hdr-link:hover,
.sy-hdr-item:hover .sy-hdr-trigger {
  color: var(--sy-fg);
}
.sy-hdr-caret {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 150ms;
}
.sy-hdr-item:hover .sy-hdr-caret {
  transform: rotate(180deg);
}

/* ── Hover popup (CSS-only) ─────────────────────────────────────────────── */
.sy-hdr-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0;
  padding: 8px;
  min-width: 280px;
  background: var(--sy-layer);
  border: 1px solid var(--sy-border);
  box-shadow: 0 12px 32px var(--sy-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 140ms;
  pointer-events: none;
}
.sy-hdr-item:hover .sy-hdr-popup,
.sy-hdr-item:focus-within .sy-hdr-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.sy-hdr-popup--wide {
  min-width: 340px;
}

.sy-hdr-pop-heading {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sy-fg2);
  opacity: 0.7;
  padding: 8px 12px 4px;
}
.sy-hdr-pop-link {
  display: flex;
  flex-direction: row;
  /* Center the icon across both text lines (title + description). */
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--sy-fg);
  transition: background 120ms;
}
.sy-hdr-pop-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  /* Square, almost-transparent backing; monochrome glyph follows the text. */
  background: rgba(141, 141, 141, 0.14);
  color: inherit;
  transition: background 120ms, color 120ms;
}
.sy-hdr-pop-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
/* Hover INVERTS the mono style — the square fills with the fg colour and the
   glyph turns the bg colour (white-on-black in dark, black-on-white in light).
   The muted description line switches to the fg colour too. No row highlight. */
.sy-hdr-pop-link:hover .sy-hdr-pop-icon {
  background: var(--sy-fg);
  color: var(--sy-bg);
}
.sy-hdr-pop-link:hover .sy-hdr-pop-desc {
  color: var(--sy-fg);
}
.sy-hdr-pop-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sy-hdr-pop-title {
  font-size: 0.875rem;
  font-weight: 500;
}
.sy-hdr-pop-desc {
  font-size: 0.78rem;
  color: var(--sy-fg2);
  line-height: 1.4;
}

/* ── Right side ─────────────────────────────────────────────────────────── */
.sy-hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.sy-hdr-theme {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  /* Subtle fill, no border. */
  background: var(--sy-layer-2);
  border: none;
  color: var(--sy-fg2);
  cursor: pointer;
  transition:
    color 120ms,
    background 120ms;
}
.sy-hdr-theme:hover {
  color: var(--sy-fg);
  background: var(--sy-border);
}
.sy-hdr-theme svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
/* Show the icon for the action the click performs: moon in light (→ dark),
   sun in dark (→ light). */
.sy-hdr-theme .ico-sun {
  display: none;
}
.dark .sy-hdr-theme .ico-sun {
  display: block;
}
.dark .sy-hdr-theme .ico-moon {
  display: none;
}

.sy-hdr-account {
  font-size: 0.875rem;
  color: var(--sy-fg2);
  text-decoration: none;
  padding: 8px 12px;
  transition: color 120ms;
}
.sy-hdr-account:hover {
  color: var(--sy-fg);
}
.sy-hdr-cta {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: var(--sy-accent);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms;
}
.sy-hdr-cta:hover {
  background: var(--sy-accent-hover);
}

/* Logged-in: a discreet "Workspaces" link + the editor's grid icon. */
.sy-hdr-workspaces {
  font-size: 0.875rem;
  color: var(--sy-fg2);
  text-decoration: none;
  padding: 8px 12px;
  transition: color 120ms;
}
.sy-hdr-workspaces:hover {
  color: var(--sy-fg);
}
.sy-hdr-grid {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--sy-layer-2);
  border: none;
  color: var(--sy-fg2);
  text-decoration: none;
  cursor: pointer;
  transition: color 120ms, background 120ms;
}
.sy-hdr-grid:hover {
  color: var(--sy-fg);
  background: var(--sy-border);
}
.sy-hdr-grid svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Logged-out: a single primary Login button. */
.sy-hdr-login {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: var(--sy-accent);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms;
}
.sy-hdr-login:hover {
  background: var(--sy-accent-hover);
}

@media (max-width: 900px) {
  .sy-hdr-nav,
  .sy-hdr-account {
    display: none;
  }
}
