/* ============================================================
   页面切换丝滑过渡 + 背景氛围特效
   ============================================================ */

/* ---------- 页面切换：淡入 + 轻微上移 + 模糊消除 ---------- */
.page {
  opacity: 0;
  transform: translateY(14px) scale(.995);
  filter: blur(4px);
  transition:
    opacity .38s cubic-bezier(.22, 1, .36, 1),
    transform .44s cubic-bezier(.22, 1, .36, 1),
    filter .34s cubic-bezier(.22, 1, .36, 1);
  will-change: opacity, transform;
}
.page.is-active {
  opacity: 1;
  transform: none;
  filter: none;
}

/* 旧页面淡出时不要占位，避免叠加 */
.page:not(.is-active) {
  pointer-events: none;
}

/* 切页瞬间顶部一道扫光 */
.page-sweep {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 55;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #8ce22a, transparent);
  opacity: 0;
}
.page-sweep.run {
  animation: sweepDown .55s cubic-bezier(.22, 1, .36, 1);
}
@keyframes sweepDown {
  0% { opacity: .9; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(70vh); }
}

/* ---------- 背景氛围层 ---------- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.ambient .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  animation: floatSlow linear infinite;
}
.ambient .b1 {
  width: 420px; height: 420px;
  left: -8%; top: -10%;
  background: radial-gradient(circle, rgba(140, 226, 42, .28), transparent 70%);
  animation-duration: 26s;
}
.ambient .b2 {
  width: 520px; height: 520px;
  right: -12%; top: 22%;
  background: radial-gradient(circle, rgba(47, 126, 230, .22), transparent 70%);
  animation-duration: 34s;
  animation-direction: reverse;
}
.ambient .b3 {
  width: 460px; height: 460px;
  left: 30%; bottom: -16%;
  background: radial-gradient(circle, rgba(140, 226, 42, .16), transparent 72%);
  animation-duration: 42s;
}
@keyframes floatSlow {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(40px, -30px, 0) scale(1.06); }
  66% { transform: translate3d(-30px, 26px, 0) scale(.96); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* 细网格 */
.ambient .grid-lines {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(140, 226, 42, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 226, 42, .055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 10%, transparent 78%);
  animation: gridDrift 40s linear infinite;
}
@keyframes gridDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-46px, -46px, 0); }
}

/* 漂浮微粒 */
.ambient .dust {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #8ce22a;
  box-shadow: 0 0 8px rgba(140, 226, 42, .9);
  opacity: 0;
  animation: dustRise linear infinite;
}
@keyframes dustRise {
  0% { opacity: 0; transform: translateY(0) scale(.6); }
  12% { opacity: .75; }
  80% { opacity: .45; }
  100% { opacity: 0; transform: translateY(-78vh) scale(1); }
}

/* 页面内容层级 */
main, header, footer { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .page, .ambient .blob, .ambient .grid-lines, .ambient .dust, .page-sweep.run {
    animation: none !important;
    transition: none !important;
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
