/* Noise Factor site header — the stylesheet half of <nf-header>.
   Markup and the header DSL program live in js/nf-header.js; every
   Noise Factor page (noisefactor.io, downloads.noisefactor.io,
   forum.noisefactor.io) loads both. This file must stay
   self-contained: it is loaded on pages that do not load index.css.
   Pages may extend the header by specificity in their own stylesheets
   (page-supplied nav extras), but the core header is styled only here. */

/* Before the component upgrades, its page-supplied children would render
   as stray content at the top of the page. Hide pre-upgrade; if the
   script never loads, the header stays hidden rather than half-rendered. */
nf-header:not(:defined) {
  display: none;
}

/* The host element is the sticky bar. A sticky element only sticks
   within its parent, so stickiness lives on the component itself —
   a direct child of <body> on every page that uses it — and not on
   the inner row. */
nf-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nf-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  /* Lime fallback matches the shader output (#aad604) so the dark/light
     text on the header stays readable before the WebGL shader paints. */
  background: oklch(80% 0.196 128);
  border-bottom: 1px solid var(--hf-border-subtle);
  overflow: hidden;
}

.nf-header-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.nf-logo {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  line-height: 0;
  color: var(--hf-bg-base);
  opacity: 0.9;
  text-decoration: none;
  flex-shrink: 0;
}

.nf-logo:hover {
  opacity: 1;
  color: var(--hf-bg-base);
  text-decoration: none;
}

/* Inline SVG so fill="currentColor" inherits from .nf-logo's
   color — the previous <img src=".svg"> rendered the SVG in an
   isolated context where currentColor resolved to default black
   regardless of theme. */
.nf-logo-mark {
  width: 56px;
  height: 56px;
  display: block;
  margin: -8px 0;
}

.nf-logo-wordmark {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--hf-bg-base);
  white-space: nowrap;
}

.nf-nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nf-nav a {
  margin-left: 1.5rem;
  color: var(--hf-bg-base);
  opacity: 0.8;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.nf-nav a:hover {
  opacity: 1;
  color: var(--hf-bg-base);
  text-decoration: none;
}

.nf-nav a.nf-nav-current {
  opacity: 1;
  font-weight: 700;
}

/* At phone widths only the built-in back-nav links collapse (the logo
   still links home, and the current section stays). Page-supplied
   extras may contain nested links, so target the built-in links directly. */
@media (max-width: 540px) {
  .nf-nav a.nf-nav-core:not(.nf-nav-current) {
    display: none;
  }
}

@media (max-width: 720px) {
  .nf-header {
    padding: 0.75rem 1rem;
  }
  .nf-logo-mark {
    width: 44px;
    height: 44px;
    margin: -6px 0;
  }
  .nf-logo-wordmark {
    font-size: 1rem;
  }
  .nf-nav a {
    margin-left: 1rem;
    text-decoration: none;
  }
}
