/* ============================================================
   李磨来咖啡 · GooeyNav 样式（适配自 React Bits）
   深色导航胶囊 + 液体融合白色滑块 + 咖啡色气泡。
   移动端降级为普通竖向菜单。
   ============================================================ */

: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
  );
}

/* 导航胶囊（深色，让 gooey 融合效果可见） */
.gooey-nav-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--color-bg-dark);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 100vw;
  padding: 5px;
  box-shadow: var(--shadow-sm);
  /* overflow:hidden 切掉黑色底片外溢，避免在 header 浅背景上形成矩形黑边 */
  overflow: hidden;
  /* 液体融合色板（米色族）—— hover 飞溅的小气泡颜色 */
  --color-1: #E8DFCF;
  --color-2: #EFE6D6;
  --color-3: #DCCFB8;
  --color-4: #F2EADB;
}

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

.gooey-nav-container nav ul {
  display: flex;
  gap: 1.4em;
  list-style: none;
  padding: 0 .5em;
  margin: 0;
  position: relative;
  z-index: 3;
  color: #fff;
  text-shadow: 0 1px 1px hsl(205deg 30% 10% / 0.25);
}

.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: #fff;
}

.gooey-nav-container nav ul li a {
  display: inline-block;
  padding: 0.55em 1.1em;
  color: inherit;
  font-size: .92rem;
  font-weight: 500;
  white-space: nowrap;
}

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

.gooey-nav-container nav ul li::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 100vw;
  background: #E8DFCF;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
  z-index: -1;
}

.gooey-nav-container nav ul li.active {
  /* 文字保持白色（继承 nav ul 默认色）：li 文字在白滑块上隐形（白底白字），
     激活态的"深字"由克隆文字层 .effect.text.active 显示在白滑块上 */
  color: inherit;
  text-shadow: none;
}

.gooey-nav-container nav ul li.active::after {
  /* 桌面端 li 自身 ::after 永远隐藏，米色液珠统一由 .effect.filter::after 提供，避免双胶囊叠加 */
  opacity: 0;
  transform: scale(0);
}

/* 屏蔽父级 .site-nav 的下划线动画与 hover 染色，避免冲突 */
.gooey-nav-container a::after { display: none !important; }
.gooey-nav-container nav ul li a:hover,
.gooey-nav-container nav ul li a:focus { color: inherit; }

.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: #fff;
  transition: color 0.3s ease;
}

.gooey-nav-container .effect.text.active {
  color: #1A0F0E;
}

.gooey-nav-container .effect.filter {
  /* 改用 SVG goo filter（url(#gooey-filter)，由 gooey-nav.js 注入）：
     只对 alpha 通道做 blur+threshold，不动 RGB 色相 —— 米色粒子零彩边 fringe。
     替代 React 原版的 CSS blur+contrast（那套在米色中间灰度上必然产生红/橙彩边）。 */
  filter: url(#gooey-filter);
  mix-blend-mode: lighten;
}

.gooey-nav-container .effect.filter::before {
  content: "";
  position: absolute;
  /* 黑色画布恢复纯黑：飞溅对比度更明显（SVG filter 不动色相，无 fringe）。
     外延加大到 -110px 匹配飞溅距离 [120, 20]，外溢由容器 overflow:hidden 切掉避免黑边框。 */
  inset: -110px;
  z-index: -2;
  background: #000;
}

.gooey-nav-container .effect.filter::after {
  content: "";
  position: absolute;
  inset: 0;
  /* 滑块恢复米色 —— 与粒子色族一致，激活态形成整片米色液珠 */
  background: #E8DFCF;
  transform: scale(0);
  opacity: 0;
  z-index: -1;
  border-radius: 100vw;
}

.gooey-nav-container .effect.active::after {
  /* 延长到 0.5s，与飞溅粒子同步到位，融合更连贯 */
  animation: pill 0.5s ease both;
}

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

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

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

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

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

/* ============================================================
   移动端：降级为普通竖向菜单（胶囊与气泡隐藏）
   ============================================================ */
@media (max-width: 899px) {
  .gooey-nav-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }
  .gooey-nav-container nav { width: 100%; }
  .gooey-nav-container nav ul {
    flex-direction: column;
    gap: 4px;
    padding: 0;
    width: 100%;
    color: var(--color-text-dark);
    text-shadow: none;
  }
  .gooey-nav-container nav ul li {
    width: 100%;
    border-radius: 12px;
    color: var(--color-text-dark);
  }
  .gooey-nav-container nav ul li a {
    display: block;
    padding: .85em 1em;
    color: var(--color-text-dark);
    font-size: 1rem;
  }
  /* 移动端 .effect 整体隐藏，激活高亮完全交给 li::after（米色液珠 + 圆角卡片） */
  .gooey-nav-container nav ul li.active { color: #1A0F0E; }
  .gooey-nav-container nav ul li.active::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #E8DFCF;
    border-radius: 12px;
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease;
    z-index: -1;
  }
  .gooey-nav-container .effect { display: none; }
}

/* ============================================================
   减少动态偏好：隐藏气泡（粒子已在 JS 中跳过）
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .gooey-nav-container .effect.filter { filter: none; mix-blend-mode: normal; }
  .gooey-nav-container .particle { display: none; }
}
