/* reactbits.dev "GooeyNav" port, theme-following. The gooey merge uses an SVG
 * alpha-contrast filter (blur + feColorMatrix) instead of the CSS
 * blur+contrast trick, so colored particles survive on any surface: the pill
 * and ink follow the host theme via [data-theme]. */

.container {
  --gooey-time: 1500ms;
  --gooey-color-1: #5227ff;
  --gooey-color-2: #ff9ffc;
  --gooey-color-3: #b19eef;
  --gooey-color-4: #22d3ee;
  /* light surface (default): dark ink pill, white text */
  --gooey-pill: #17171c;
  --gooey-pill-ink: #ffffff;
  --gooey-ink: #5b5e6b;
  position: relative;
  max-width: 100%;
  font-size: 13px;
}

.container[data-theme='dark'] {
  --gooey-pill: #ffffff;
  --gooey-pill-ink: #17171c;
  --gooey-ink: #ffffff;
}

.gooSvg {
  position: absolute;
  width: 0;
  height: 0;
}

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

.container nav ul {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0 4px;
  margin: 0;
  position: relative;
  z-index: 3;
}

.container nav li {
  border-radius: 100vw;
  position: relative;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
  color: var(--gooey-ink);
}

.container nav li button {
  display: inline-block;
  padding: 5px 13px;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.container nav li.active {
  color: var(--gooey-pill-ink);
}

.container nav li::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--gooey-pill);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
  z-index: -1;
}

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

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

.effectText {
  color: var(--gooey-ink);
  transition: color 0.3s ease;
  font-size: 13px;
}

.effectText.active {
  color: var(--gooey-pill-ink);
}

.effectFilter {
  filter: url(#dsh-gooey-nav-goo);
}

.effectFilter::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gooey-pill);
  transform: scale(0);
  opacity: 0;
  z-index: -1;
  border-radius: 100vw;
}

.effectFilter.active::after {
  animation: gooeyPill 0.3s ease both;
}

@keyframes gooeyPill {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

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

.particle {
  --time: 1500ms;
  position: absolute;
  top: calc(50% - 7px);
  left: calc(50% - 7px);
  animation: gooeyParticle calc(var(--time)) ease 1 -350ms;
}

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

@keyframes gooeyParticle {
  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 gooeyPoint {
  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;
  }
}

@media (prefers-reduced-motion: reduce) {
  .particle,
  .point {
    animation: none;
  }
}

@media (max-width: 760px) { .container { overflow-x: auto; scrollbar-width: none; } .container nav { width: max-content; } }
