/* Header / brand bar. Themed via .theme-dark or .theme-light on the element.
   Anchored → floating: from brief "WAAGS Nav Flotante" (Claude Design,
   2026-09-23). .nav-shell is a fixed-height sticky slot that reserves its
   space in the page (so content below never jumps); .site-header is the
   element that actually detaches into a floating pill once scrolled past
   24px, via js/nav.js toggling .is-floating. */

/* Registered so --ring-angle can be animated smoothly by the browser
   (see .site-header::after below) instead of jumping between keyframes. */
@property --ring-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.nav-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 60px;
}

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  overflow: hidden; /* clips the gradient bar's square corners once the pill rounds */
  background: var(--header-bg);
  border: 1px solid transparent;
  border-radius: 0;
  --logo-w: 76px;
  transition:
    top 0.42s, left 0.42s, right 0.42s, height 0.42s,
    border-radius 0.42s, background-color 0.42s, border-color 0.42s,
    box-shadow 0.42s, padding 0.42s;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* Signature gradient strip, overlaid on the header's own top edge. Drifts
   very slowly (9s, near-imperceptible) — it's the brand's signature mark,
   so a hint of life without ever calling attention to itself. The gradient
   repeats twice across double width so shifting exactly one pattern-width
   loops seamlessly, no jump. Fades out once floating: the ring below
   (::after) carries the mark instead, since a straight top edge doesn't
   read on a pill. */
.site-header.theme-dark::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-sky), var(--color-lime), var(--color-sky), var(--color-lime));
  background-size: 200% 100%;
  animation: header-bar-drift 9s linear infinite;
  transition: opacity 0.3s;
}
.site-header.is-floating::before { opacity: 0; }

/* Floating state: the gradient persists as a thin ring traced around the
   pill's own contour instead of just vanishing, rotating slowly (same 9s
   character as the bar above) at reduced brightness so it reads as a
   quiet edge-light, not a second bar. Classic gradient-border technique —
   a padded, masked layer showing only the outline, not the fill. The angle
   animates via the registered --ring-angle custom property (@property
   above), not a transform: rotate() on this element — combining transform
   with mask-composite here rendered broken (confirmed in isolation: the
   mask stopped clipping to the ring and the raw gradient bled through as
   diagonal streaks across the whole pill, a real compositor bug, not a
   syntax mistake). Animating the gradient's own angle sidesteps it. */
.site-header::after {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: 0;
  background: conic-gradient(from var(--ring-angle), var(--color-sky), var(--color-lime), var(--color-sky), var(--color-lime));
  -webkit-mask-image: linear-gradient(#fff 0 0), linear-gradient(#fff 0 0);
  -webkit-mask-origin: content-box, border-box;
  -webkit-mask-clip: content-box, border-box;
  -webkit-mask-composite: xor;
  mask-image: linear-gradient(#fff 0 0), linear-gradient(#fff 0 0);
  mask-origin: content-box, border-box;
  mask-clip: content-box, border-box;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  animation: header-ring-rotate 9s linear infinite;
  transition: opacity 0.3s, border-radius 0.42s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.site-header.is-floating::after {
  border-radius: var(--radius-pill);
  opacity: 0.55; /* dimmer than the anchored bar — an edge-light, not a headline */
}

@keyframes header-bar-drift {
  from { background-position: 0% 0; }
  to { background-position: -100% 0; }
}
@keyframes header-ring-rotate {
  to { --ring-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .site-header.theme-dark::before,
  .site-header::after { animation: none; }
}

.site-header.is-floating {
  top: 10px;
  left: 10px;
  right: 10px;
  height: 56px;
  padding: 0 6px 0 14px;
  border-radius: var(--radius-pill);
  background: rgb(32 54 39 / 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-color: rgb(157 196 213 / 0.22);
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.6);
}
/* The pill has its own padding; the container's gutter would double it up. */
.site-header.is-floating .site-header__inner { padding-inline: 0; }

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .site-header.theme-dark::before,
  .site-header::after { transition: none; }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* The wordmark is a single black SVG used as a mask, so the theme sets its color. */
.logo {
  display: block;
  flex-shrink: 0;
  width: var(--logo-w);
  height: 44px; /* tap target; the mark itself is drawn at the top of the mask size */
  background-color: var(--logo-color);
  -webkit-mask: url(../../assets/brand/wordmark-black.svg) left center / var(--logo-w) auto no-repeat;
  mask: url(../../assets/brand/wordmark-black.svg) left center / var(--logo-w) auto no-repeat;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

/* Section links appear on wider screens. */
.site-nav {
  display: none;
  gap: var(--space-8);
}

.site-nav__link {
  padding-block: var(--space-3);
  font-size: 1rem;
  font-weight: var(--fw-regular);
  color: var(--nav-link);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-nav__link:hover { color: var(--nav-link-hover); }

@media (min-width: 900px) {
  .nav-shell { height: 76px; }
  .site-header { --logo-w: 90px; }
  .site-nav { display: flex; }

  .site-header.is-floating {
    top: 14px;
    height: 64px;
    padding: 0 8px 0 24px;
    left: max(16px, calc((100% - 1040px) / 2));
    right: max(16px, calc((100% - 1040px) / 2));
  }
}
