/*
 * GooeyNav — vanilla CSS port from React Bits.
 * Source: https://reactbits.dev/components/gooey-nav
 *
 * Bulsulabs adaptation:
 *   - White-bg site: nav text is dark slate, active pill is brand blue
 *   - Active text becomes white when pill is active
 *   - Gooey particles use brand palette (blue + cyan)
 *   - Only enabled on desktop (≥901px). Mobile keeps the existing
 *     accordion menu in <nav class="nav-mobile"> — no changes there.
 */

:root {
  --linear-ease: linear(
    0, 0.068, 0.19 2.7%, 0.804 8.1%, 1.037, 1.199 13.2%, 1.245,
    1.27 15.8%, 1.274, 1.272 17.4%, 1.249 19.1%, 0.996 28%, 0.949,
    0.928 33.3%, 0.926, 0.933 36.8%, 1.001 45.6%, 1.013, 1.019 50.8%,
    1.018 54.4%, 1 63.1%, 0.995 68%, 1.001 85%, 1
  );

  /* Brand particle palette */
  --gooey-color-1: #0a3eff;   /* brand blue */
  --gooey-color-2: #1e90ff;   /* light blue */
  --gooey-color-3: #03b3c3;   /* cyan */
  --gooey-color-4: #4f7bff;   /* lighter blue */
}

.gooey-nav-container {
  position: relative;
  display: inline-flex;
  isolation: isolate;
  /* Match the original .nav-links typography so the GooeyNav pill stays
     proportionate to the rest of the nav. Without this it inherits body
     16px and the active pill looks oversized. */
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.gooey-nav-container nav {
  display: flex;
  position: relative;
  transform: translate3d(0, 0, 0.01px);
}

.gooey-nav-container nav ul {
  display: flex;
  gap: 0.4em;
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 3;
  /* dark text on white-bg site */
  color: var(--ink, #0a0a14);
}

.gooey-nav-container nav ul li {
  border-radius: 100vw;
  position: relative;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow: 0 0 0.5px 1.5px transparent;
  color: inherit;
}

.gooey-nav-container nav ul li a {
  display: inline-block;
  /* Tighter pill: 8px vert / 14px horiz at 12px font.
     Was 0.55em/0.95em which felt too puffy at the upscaled 16px. */
  padding: 0.65em 1.15em;
  text-decoration: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
}

.gooey-nav-container nav ul li:focus-within:has(:focus-visible) {
  box-shadow: 0 0 0.5px 1.5px var(--brand, #0a3eff);
}

.gooey-nav-container nav ul li::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 100vw;
  /* active pill bg: brand blue (was white in source) */
  background: var(--brand, #0a3eff);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
  z-index: -1;
}

.gooey-nav-container nav ul li.active {
  /* active text → white (contrast against brand-blue pill) */
  color: white;
}

.gooey-nav-container nav ul li.active::after {
  opacity: 1;
  transform: scale(1);
}

.gooey-nav-container .effect {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  opacity: 1;
  pointer-events: none;
  display: grid;
  place-items: center;
  z-index: 1;
}

.gooey-nav-container .effect.text {
  color: white;
  transition: color 0.3s ease;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
}

.gooey-nav-container .effect.text.active {
  color: white;
}

.gooey-nav-container .effect.filter {
  /* Lower contrast on white-bg site so the filter doesn't fight the page bg.
     The blur still creates the gooey morph between particles + pill. */
  filter: blur(6px) contrast(20) blur(0);
  mix-blend-mode: multiply;
}

.gooey-nav-container .effect.filter::before {
  content: '';
  position: absolute;
  /* Tighter than the source's -75px so the blur/glow halo stays close to
     the pill on a small 12px nav (the source nav was much larger). */
  inset: -25px;
  z-index: -2;
  /* Source had `background: black` for dark navs to clip the blur+contrast
     filter's low-luminance noise. On a white-bg site, painting white here
     covers the surrounding nav items because mix-blend-mode:lighten can't
     "lighten" past white. Transparent is fine — the gooey particles still
     burst on click; we just lose the heavy blob-merge that black gave. */
  background: transparent;
}

.gooey-nav-container .effect.filter::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand, #0a3eff);   /* was white — flipped */
  transform: scale(0);
  opacity: 0;
  z-index: -1;
  border-radius: 100vw;
}

.gooey-nav-container .effect.active::after {
  animation: gooey-pill 0.3s ease both;
}

@keyframes gooey-pill {
  to { transform: scale(1); opacity: 1; }
}

.gooey-nav-container .particle,
.gooey-nav-container .point {
  display: block;
  opacity: 0;
  width: 20px;
  height: 20px;
  border-radius: 100%;
  transform-origin: center;
}

.gooey-nav-container .particle {
  --time: 5s;
  position: absolute;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
  animation: gooey-particle calc(var(--time)) ease 1 -350ms;
}

.gooey-nav-container .point {
  background: var(--color);
  opacity: 1;
  animation: gooey-point calc(var(--time)) ease 1 -350ms;
}

@keyframes gooey-particle {
  0% {
    transform: rotate(0deg) translate(calc(var(--start-x)), calc(var(--start-y)));
    opacity: 1;
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }
  70% {
    transform: rotate(calc(var(--rotate) * 0.5)) translate(calc(var(--end-x) * 1.2), calc(var(--end-y) * 1.2));
    opacity: 1;
    animation-timing-function: ease;
  }
  85% {
    transform: rotate(calc(var(--rotate) * 0.66)) translate(calc(var(--end-x)), calc(var(--end-y)));
    opacity: 1;
  }
  100% {
    transform: rotate(calc(var(--rotate) * 1.2)) translate(calc(var(--end-x) * 0.5), calc(var(--end-y) * 0.5));
    opacity: 1;
  }
}

@keyframes gooey-point {
  0% {
    transform: scale(0);
    opacity: 0;
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }
  25% { transform: scale(calc(var(--scale) * 0.25)); }
  38% { opacity: 1; }
  65% {
    transform: scale(var(--scale));
    opacity: 1;
    animation-timing-function: ease;
  }
  85% { transform: scale(var(--scale)); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

/* Mobile: hide the gooey desktop nav, defer to existing .nav-mobile drawer.
   The existing site already does this — we just make sure our gooey wrapper
   inherits the same behavior as the .nav-links it replaces. */
@media (max-width: 900px) {
  .gooey-nav-container {
    display: none;
  }
}
