/* =========================================================
   Adrian Hu — 个人主页自定义样式
   极简黑白 + 青蓝强调色;动画走 transform/opacity,避免重排
   ========================================================= */

/* ----- 基础 ----- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-feature-settings: 'cv11', 'ss01';
  letter-spacing: -0.011em;
}

/* 平滑的主题色过渡 */
body,
#nav,
article,
a,
span,
button,
footer {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* ----- 导航:滚动后毛玻璃背景 ----- */
#nav.scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(229, 229, 229, 0.6);
}

/* 亮色模式:导航整行常驻毛玻璃(含页面顶部),滚动后略加深 */
html:not(.dark) #nav {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(229, 229, 229, 0.45);
}

html:not(.dark) #nav.scrolled {
  background: rgba(255, 255, 255, 0.72);
  border-bottom-color: rgba(229, 229, 229, 0.6);
}

.dark #nav.scrolled {
  background: rgba(9, 9, 11, 0.72);
  border-bottom: 1px solid rgba(38, 38, 38, 0.6);
}

/* ----- 头像呼吸环 ----- */
@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.45;
  }
  50% {
    transform: scale(1.09);
    opacity: 0.75;
  }
}

.animate-breathe {
  animation: breathe 3.5s ease-in-out infinite;
}

/* ----- Hero 底图淡入 ----- */
.hero-bg {
  opacity: 0;
  animation: heroFade 1.6s ease-out 0.05s forwards;
}

@keyframes heroFade {
  to {
    opacity: 1;
  }
}

/* 暗色主题:压暗降饱和,让暖沙色调融入冷色暗底 */
.hero-bg img {
  transition: opacity 0.5s ease, filter 0.5s ease;
}

.dark .hero-bg img {
  filter: brightness(0.72) saturate(0.82) contrast(1.02) !important;
  opacity: 0.65 !important;
}

/* ----- Hero 入场动画 ----- */
.hero-card {
  opacity: 0;
  animation: heroCardIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
  will-change: opacity, transform;
}

@keyframes heroCardIn {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- 滚动 reveal ----- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ----- 焦点可达性 ----- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ----- 降级动画:尊重 prefers-reduced-motion ----- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero-avatar,
  .hero-name,
  .hero-bio,
  .hero-tags,
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}
