/* Tailwind 本地静态文件（static/vendor/tailwind.min.css），
   在 base.html 中以 <link> 引入，避免 CDN @import 串行阻塞渲染。 */

/* ── 设计令牌：极光玻璃 + 深色模式 ── */
:root {
  --primary: #FF7A59;
  --primary-2: #FF9E7D;
  --primary-3: #F2603C;
  --accent: #8B5CF6;
  --accent-2: #A78BFA;
  --bg-1: #FFF7F2;
  --bg-2: #FFFFFF;
  --bg-dark-1: #0F172A;
  --bg-dark-2: #1E293B;
  --text-1: #2C3038;
  --text-2: #6B7280;
  --text-dark-1: #F1F5F9;
  --text-dark-2: #94A3B8;
  --ok: #10B981;
  --err: #EF4444;
  --warn: #F59E0B;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-dark: rgba(30, 41, 59, 0.55);
  --glass-dark-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(242, 96, 60, 0.12);
  --shadow-lg: 0 25px 50px -12px rgba(242, 96, 60, 0.25);
  --shadow-dark: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text-1);
  background: var(--bg-1);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .5s ease, color .5s ease;
}

/* 极光渐变背景 */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(255, 122, 89, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(139, 92, 246, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(255, 158, 125, 0.15) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}

/* 粒子光斑层 */
.particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: float 20s infinite ease-in-out;
}

.particle:nth-child(1) {
  width: 400px; height: 400px;
  background: rgba(255, 122, 89, 0.3);
  top: -10%; left: -5%;
  animation-delay: 0s;
}

.particle:nth-child(2) {
  width: 350px; height: 350px;
  background: rgba(139, 92, 246, 0.25);
  top: 20%; right: -5%;
  animation-delay: -5s;
}

.particle:nth-child(3) {
  width: 300px; height: 300px;
  background: rgba(255, 158, 125, 0.2);
  bottom: 10%; left: 20%;
  animation-delay: -10s;
}

.particle:nth-child(4) {
  width: 250px; height: 250px;
  background: rgba(167, 139, 250, 0.2);
  bottom: -5%; right: 15%;
  animation-delay: -15s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -50px) scale(1.1); }
  50% { transform: translate(-30px, 30px) scale(0.9); }
  75% { transform: translate(40px, 20px) scale(1.05); }
}

/* 深色模式 */
body.dark {
  --text-1: var(--text-dark-1);
  --text-2: var(--text-dark-2);
  --glass: var(--glass-dark);
  --glass-border: var(--glass-dark-border);
  --shadow: var(--shadow-dark);
  color: var(--text-dark-1);
  background: var(--bg-dark-1);
}

body.dark .aurora-bg {
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(255, 122, 89, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(255, 158, 125, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-dark-1) 0%, var(--bg-dark-2) 100%);
}

body.dark .particle {
  opacity: 0.25;
}

/* 玻璃卡片 */
.glass {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  border-radius: 24px;
  transition: background .3s ease, border-color .3s ease;
}

.glass:hover {
  border-color: rgba(255, 122, 89, 0.3);
}

/* 渐变文字/按钮 */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-3), var(--primary), var(--accent));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-3));
  color: #fff;
  border: none;
  border-radius: 999px;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  opacity: 0;
  transition: opacity .3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(242, 96, 60, 0.35);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0) scale(.97);
  box-shadow: 0 6px 14px rgba(242,96,60,.22);
}

/* 卡片悬停 3D 倾斜 */
.card-hover {
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-hover:hover {
  transform: translateY(-8px) rotateX(2deg) rotateY(2deg);
  box-shadow: var(--shadow-lg);
}

.card-img {
  transition: transform .5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover .card-img {
  transform: scale(1.06);
}

/* 导航链接下划线滑入 */
.nav-link {
  position: relative;
  transition: color .2s ease;
  padding: 4px 2px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after {
  transform: scaleX(1);
}

/* 入场动画 */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.fade-up {
  animation: fadeUp .6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: none; }
}

.slide-in-left {
  animation: slideInLeft .5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.scale-in {
  animation: scaleIn .4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* 首页卡片流：逐个错开入场 */
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .12s; }
.stagger > *:nth-child(3) { animation-delay: .19s; }
.stagger > *:nth-child(4) { animation-delay: .26s; }
.stagger > *:nth-child(5) { animation-delay: .33s; }
.stagger > *:nth-child(n+6) { animation-delay: .4s; }

/* 滚动显现 */
.reveal-init {
  opacity: 0;
  transform: translateY(20px);
}

.reveal-shown {
  opacity: 1;
  transform: none;
  transition: opacity .6s cubic-bezier(0.4, 0, 0.2, 1), transform .6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 时间轴圆点呼吸 */
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 89, .4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 122, 89, 0); }
}

.timeline-dot {
  animation: dotPulse 2s ease-in-out infinite;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

/* 时间轴线条 */
.timeline-line {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* flash 消息 */
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.flash {
  animation: flashIn .4s cubic-bezier(0.4, 0, 0.2, 1) both;
  transition: opacity .5s ease, transform .5s ease;
}

.flash-hide {
  opacity: 0;
  transform: translateY(-12px) scale(0.95);
}

/* Markdown 正文排版 */
.prose {
  line-height: 1.8;
}

.prose img {
  border-radius: 16px;
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform .3s ease, box-shadow .3s ease;
}

.prose img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.prose a {
  color: var(--primary-3);
  text-decoration: none;
  position: relative;
  transition: color .2s ease;
}

.prose a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}

.prose a:hover::after {
  transform: scaleX(1);
}

.prose pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 16px;
  border-radius: 16px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.prose code {
  background: rgba(255, 122, 89, 0.1);
  color: var(--primary-3);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.9em;
}

.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* 深色模式切换按钮 */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all .3s ease;
  font-size: 18px;
}

.theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
  border-color: rgba(255, 122, 89, 0.4);
}

/* 加载进度条 */
.loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 9999;
  transition: width .3s ease;
}

/* 按钮涟漪效果 */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple .6s linear;
  pointer-events: none;
}

/* 输入框聚焦发光 */
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.15) !important;
  transition: box-shadow .3s ease;
}

/* 页面切换动画 */
.page-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-enter-active {
  opacity: 1;
  transform: none;
  transition: opacity .4s ease, transform .4s ease;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-3), var(--accent));
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* 系统开启"减少动态效果"时，一键关闭所有动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 移动端优化 */
@media (max-width: 640px) {
  .particle {
    display: none;
  }

  .glass {
    border-radius: 16px;
  }

  .card-hover:hover {
    transform: translateY(-4px);
  }
}

/* 拖拽上传区域 */
.drop-zone {
  border: 2px dashed #D1D5DB;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .3s ease;
  background: rgba(255, 255, 255, 0.5);
}

.drop-zone:hover {
  border-color: var(--primary);
  background: rgba(255, 122, 89, 0.05);
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(255, 122, 89, 0.1);
  transform: scale(1.02);
}

.drop-zone .drop-hint {
  color: #9CA3AF;
}

.drop-zone .drop-hint .icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.drop-zone .drop-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.drop-zone input[type="file"] {
  display: none;
}

/* 深色模式适配 */
body.dark .drop-zone {
  background: rgba(30, 41, 59, 0.5);
  border-color: #475569;
}

body.dark .drop-zone:hover {
  background: rgba(255, 122, 89, 0.1);
}
