.home-top-nav {
  --glass-x: 50%;
  --glass-y: 0%;
  position: fixed;
  z-index: var(--portfolio-nav-z, 5);
  top: 20px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  isolation: isolate;
  border: 1px solid rgba(232, 236, 255, .34);
  border-radius: 999px;
  background: rgba(35, 30, 67, .3);
  box-shadow: 0 12px 34px rgba(7, 4, 36, .34), inset 0 1px 0 rgba(255, 255, 255, .42), inset 0 -1px 0 rgba(195, 192, 255, .14), inset 1px 0 0 rgba(255, 255, 255, .16);
  backdrop-filter: blur(22px) saturate(180%) contrast(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(180%) contrast(1.08);
  transform: translateX(-50%);
  transition: opacity .65s ease, transform .85s ease, filter .85s ease, visibility .65s ease;
}
.home-top-nav.is-dispersing,
.portfolio-home-link.is-dispersing {
  opacity: 0;
  filter: blur(9px);
  pointer-events: none;
}
.home-top-nav.is-dispersing { transform: translate(-50%, -13px) scale(.97); }
.portfolio-home-link.is-dispersing { transform: translateY(-13px) scale(.97); }
.home-top-nav.is-idle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -16px);
}
.portfolio-home-link.is-idle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-16px);
}
.home-top-nav__particles {
  position: fixed;
  z-index: calc(var(--portfolio-nav-z, 50) + 1);
  pointer-events: none;
  overflow: visible;
}
.home-top-nav__particle {
  position: absolute;
  left: var(--particle-x);
  top: var(--particle-y);
  width: var(--particle-size);
  height: var(--particle-size);
  border-radius: 1px;
  background: rgba(245, 248, 255, .88);
  box-shadow: 0 0 8px rgba(210, 217, 255, .62);
  animation: nav-particle-dispersal var(--particle-duration) ease-out var(--particle-delay) both;
}
.home-top-nav__particle:nth-child(3n) { background: rgba(166, 205, 255, .9); }
.home-top-nav__particle:nth-child(4n) { border-radius: 50%; background: rgba(211, 185, 255, .82); }
@keyframes nav-particle-dispersal {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(1); }
  12% { opacity: .9; }
  100% { opacity: 0; transform: translate3d(var(--particle-dx), var(--particle-dy), 0) scale(.2); }
}
body[data-project-page] { --portfolio-nav-z: 50; }
.home-top-nav::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse 180px 70px at var(--glass-x) var(--glass-y), rgba(255, 255, 255, .34), transparent 75%), linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(171, 185, 255, .045) 42%, rgba(11, 8, 36, .12));
  opacity: .85;
  pointer-events: none;
}
.home-top-nav::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .27), inset 0 -2px 3px rgba(188, 203, 255, .13);
  pointer-events: none;
}
.portfolio-home-link {
  position: fixed;
  z-index: var(--portfolio-nav-z, 5);
  top: 20px;
  left: 20px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 72px;
  padding: 0 24px;
  border: 1px solid rgba(232, 236, 255, .34);
  border-radius: 999px;
  background: rgba(35, 30, 67, .3);
  box-shadow: 0 12px 34px rgba(7, 4, 36, .34), inset 0 1px 0 rgba(255, 255, 255, .42), inset 0 -1px 0 rgba(195, 192, 255, .14), inset 1px 0 0 rgba(255, 255, 255, .16);
  backdrop-filter: blur(22px) saturate(180%) contrast(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(180%) contrast(1.08);
  color: rgba(255, 255, 255, .87);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 30px;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease, opacity .65s ease, transform .85s ease, filter .85s ease, visibility .65s ease;
}
.portfolio-home-link[aria-current="page"] {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, .26), rgba(189, 192, 255, .12) 48%, rgba(81, 93, 193, .12));
  box-shadow: inset 0 0 0 1px rgba(244, 248, 255, .48), inset 0 1px 0 rgba(255, 255, 255, .52), 0 5px 16px rgba(5, 3, 30, .18);
}
.portfolio-home-link:hover:not([aria-current="page"]),
.portfolio-home-link:focus-visible:not([aria-current="page"]) {
  color: #fff;
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  outline: none;
}
.portfolio-home-link:focus-visible { box-shadow: inset 0 0 0 2px rgba(170, 220, 255, .8); }
.home-top-nav::-webkit-scrollbar { display: none; }
.home-top-nav__toggle { display: none; }
.home-top-nav__lens {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 8px;
  width: 0;
  height: 54px;
  border: 1px solid rgba(244, 248, 255, .48);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .26), rgba(189, 192, 255, .12) 48%, rgba(81, 93, 193, .12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .52), inset 0 -1px 0 rgba(193, 213, 255, .17), 0 5px 16px rgba(5, 3, 30, .18);
  backdrop-filter: blur(9px) saturate(145%);
  -webkit-backdrop-filter: blur(9px) saturate(145%);
  opacity: 0;
  pointer-events: none;
  transition: left .42s cubic-bezier(.2, 1.35, .3, 1), top .42s cubic-bezier(.2, 1.35, .3, 1), width .42s cubic-bezier(.2, 1.35, .3, 1), height .42s cubic-bezier(.2, 1.35, .3, 1), opacity .2s ease;
}
.home-top-nav.has-glass-lens .home-top-nav__lens { opacity: 1; }
.home-top-nav a {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 12px 20px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .87);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 30px;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease, border-radius .2s ease;
}
.home-top-nav a[aria-current="page"] {
  color: #fff;
}
.home-top-nav a:hover:not([aria-current="page"]),
.home-top-nav a:focus-visible:not([aria-current="page"]) {
  color: #fff;
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  outline: none;
}
.home-top-nav a:focus-visible { box-shadow: inset 0 0 0 2px rgba(170, 220, 255, .8); }

@media (max-width: 1200px) {
  .portfolio-home-link { top: 12px; left: 12px; height: 56px; padding: 0 18px; }
  .home-top-nav { top: 80px; }
}

@media (max-width: 600px) {
  .portfolio-home-link { top: max(12px, env(safe-area-inset-top)); height: 52px; padding: 0 14px; font-size: 16px; font-weight: 600; line-height: 24px; }
  .home-top-nav { top: max(12px, env(safe-area-inset-top)); right: 12px; left: auto; width: min(290px, calc(100vw - 100px)); max-width: calc(100vw - 100px); box-sizing: border-box; flex-direction: column; align-items: stretch; gap: 2px; padding: 5px; overflow: hidden; border-radius: 22px; transform: none; }
  .home-top-nav.is-dispersing { transform: translateY(-13px) scale(.97); }
  .home-top-nav.is-idle { transform: translateY(-16px); }
  .home-top-nav__toggle { position: relative; z-index: 2; display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border: 0; border-radius: 18px; background: rgba(255,255,255,.12); color: #fff; font: 600 16px/24px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; text-align: left; cursor: pointer; }
  .home-top-nav__chevron { flex: none; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
  .home-top-nav.is-mobile-open .home-top-nav__chevron { transform: translateY(2px) rotate(225deg); }
  .home-top-nav a { display: none; padding: 9px 14px; font-size: 15px; line-height: 23px; white-space: normal; }
  .home-top-nav.is-mobile-open { max-height: calc(100dvh - 95px); overflow-y: auto; }
  .home-top-nav.is-mobile-open a { display: block; }
  .home-top-nav.is-mobile-open a[aria-current="page"] { background: rgba(255,255,255,.14); }
  .home-top-nav__lens { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .home-top-nav__particles { display: none; }
  .home-top-nav, .home-top-nav__lens, .home-top-nav a, .portfolio-home-link { transition-duration: .01ms; }
}
