/* =========================================================
   404 页面 (css/404.css)
   主题风格:卡片 + 强调色 + 圆角;含漂浮/摇摆/呼吸动效;全响应式。
   ========================================================= */

.notfound-page {
  position: relative;
  min-height: calc(100vh - var(--header-height, 64px));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: calc(var(--header-height, 64px) + 24px) 20px 120px;
}

/* ---------- 漂浮装饰 ---------- */
.nf-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.nf-cloud {
  position: absolute;
  width: 120px;
  height: 38px;
  /* 亮色模式下用淡云灰蓝(原为白色,在白色页面背景上不可见) */
  background: #dfe6ec;
  border-radius: 999px;
  opacity: 0.7;
  filter: blur(1px);
  animation: nf-drift 26s linear infinite;
}

body.dark-mode .nf-cloud {
  background: #33363c; /* 暗色:比页面背景稍亮 */
}

.nf-cloud::before,
.nf-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.nf-cloud::before {
  width: 56px;
  height: 56px;
  top: -26px;
  left: 20px;
}

.nf-cloud::after {
  width: 40px;
  height: 40px;
  top: -18px;
  right: 22px;
}

.nf-cloud.c1 { top: 14%; left: -140px; animation-duration: 34s; }
.nf-cloud.c2 { top: 34%; left: -140px; animation-duration: 46s; animation-delay: -18s; transform: scale(0.7); }
.nf-cloud.c3 { top: 8%;  left: -140px; animation-duration: 26s; animation-delay: -9s;  transform: scale(1.25); }

@keyframes nf-drift {
  from { left: -160px; }
  to   { left: calc(100% + 40px); }
}

.nf-star {
  position: absolute;
  color: var(--accent-color, #ff6b6b);
  opacity: 0.55;
  animation: nf-twinkle 2.6s ease-in-out infinite;
}

.nf-star.s1 { top: 18%; right: 16%; font-size: 1.4rem; }
.nf-star.s2 { top: 62%; right: 10%; font-size: 1rem; animation-delay: 0.7s; }
.nf-star.s3 { top: 26%; left: 10%;  font-size: 1.1rem; animation-delay: 1.2s; }
.nf-star.s4 { top: 70%; left: 16%;  font-size: 1.5rem; animation-delay: 1.9s; }

@keyframes nf-twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85) rotate(0deg); }
  50%      { opacity: 0.9;  transform: scale(1.15) rotate(18deg); }
}

/* ---------- 主卡片 ---------- */
.nf-card {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 100%;
  /* 融入背景:去掉卡片底色/边框/阴影,只保留内容排版 */
  background: transparent;
  border: none;
  border-radius: var(--radius-lg, 20px);
  padding: 2.4rem 2rem 2.6rem;
  text-align: center;
  animation: nf-card-in 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes nf-card-in {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 迷路的桌宠 ---------- */
.nf-pet {
  position: relative;
  width: 96px;
  height: 84px;
  margin: 0 auto 0.6rem;
}

.nf-pet-body {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 72px;
  height: 62px;
  margin-left: -36px;
  background: var(--accent-color, #ff6b6b);
  border-radius: 36px 36px 30px 30px;
  animation: nf-bob 2.4s ease-in-out infinite;
  transform-origin: 50% 100%;
}

@keyframes nf-bob {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(4deg) translateY(-6px); }
}

.nf-pet-face {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.nf-eye {
  width: 9px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  animation: nf-blink 3.2s infinite;
}

@keyframes nf-blink {
  0%, 91%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.1); }
}

.nf-mouth {
  position: absolute;
  top: 32px;
  left: 50%;
  width: 14px;
  height: 7px;
  margin-left: -7px;
  border: 2px solid #fff;
  border-top: none;
  border-radius: 0 0 12px 12px;
}

.nf-pet-arm {
  position: absolute;
  top: 34px;
  width: 14px;
  height: 30px;
  background: var(--accent-color, #ff6b6b);
  border-radius: 8px;
}

.nf-pet-arm.left  { left: -8px;  transform: rotate(24deg);  animation: nf-wave-l 2.4s ease-in-out infinite; }
.nf-pet-arm.right { right: -8px; transform: rotate(-24deg); animation: nf-wave-r 2.4s ease-in-out infinite; }

@keyframes nf-wave-l {
  0%, 100% { transform: rotate(14deg); }
  50%      { transform: rotate(48deg); }
}

@keyframes nf-wave-r {
  0%, 100% { transform: rotate(-14deg); }
  50%      { transform: rotate(-48deg); }
}

.nf-shadow {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 64px;
  height: 10px;
  margin-left: -32px;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 50%;
  animation: nf-shadow-pulse 2.4s ease-in-out infinite;
}

@keyframes nf-shadow-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.16; }
  50%      { transform: scale(0.82); opacity: 0.1; }
}

/* ---------- 404 数字(逐个摇摆入场) ---------- */
.nf-code {
  margin: 0.4rem 0 0.2rem;
  font-family: var(--font-secondary, inherit);
  font-size: 4.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary-color, #333);
  display: flex;
  justify-content: center;
  gap: 4px;
}

.nf-code span {
  display: inline-block;
  animation: nf-wobble 3s ease-in-out infinite;
}

.nf-code .d0 { animation-delay: 0.25s; color: var(--accent-color, #ff6b6b); }
.nf-code .d2 { animation-delay: 0.5s; }

@keyframes nf-wobble {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%      { transform: translateY(-8px) rotate(-4deg); }
  60%      { transform: translateY(0) rotate(3deg); }
}

.nf-title {
  margin: 0.6rem 0 0.4rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-color, #333);
}

.nf-desc {
  margin: 0 0 1.6rem;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--secondary-color, #888);
}

/* ---------- 按钮 ---------- */
.nf-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.nf-btn i { font-size: 0.9em; }

.nf-btn.primary {
  background: var(--accent-color, #ff6b6b);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.nf-btn.primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.nf-btn.ghost {
  background: transparent;
  color: var(--text-color, #333);
  border: 1.5px solid var(--border-color, rgba(0, 0, 0, 0.15));
}

.nf-btn.ghost:hover {
  border-color: var(--accent-color, #ff6b6b);
  color: var(--accent-color, #ff6b6b);
  transform: translateY(-3px);
}

.nf-btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .notfound-page {
    padding-bottom: 90px;
  }

  .nf-card {
    padding: 1.8rem 1.2rem 2rem;
    max-width: 94%;
  }

  .nf-code {
    font-size: 3.4rem;
  }

  .nf-title {
    font-size: 1.15rem;
  }

  .nf-desc {
    font-size: 0.86rem;
  }

  .nf-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .nf-btn {
    justify-content: center;
  }

  .nf-waves {
    height: 10vh;
    min-height: 60px;
  }
}

/* ---------- 动画偏好:减弱 ---------- */
@media (prefers-reduced-motion: reduce) {
  .nf-cloud,
  .nf-star,
  .nf-pet-body,
  .nf-pet-arm,
  .nf-shadow,
  .nf-eye,
  .nf-code span,
  .nf-waves .parallax > use {
    animation: none;
  }
}
