/* ========================================================
   Rewmington の 宝藏之地 - 毛玻璃风格静态博客
   ======================================================== */

/* ===== 1. CSS 变量与基础 ===== */
:root {
  --color-indigo: #6366f1;
  --color-indigo-light: #818cf8;
  --color-indigo-dark: #4f46e5;
  --color-purple: #a855f7;
  --color-pink: #ec4899;
  --gradient-colors: #a18cd1, #fbc2eb, #a1c4fd, #c2e9fb;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --radius-card: 1.5rem;
  --build-date: 2026-07-13;
}

.dark {
  --glass-bg: rgba(30, 41, 59, 0.5);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ===== 2. Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-serif);
  line-height: 1.6;
  color: #0f172a;
  background: #f8fafc;
  transition: color 1s, background-color 1s;
  min-height: 100vh;
  overflow-x: hidden;
}

.dark body {
  color: #f1f5f9;
  background: #020617;
}

h1, h2, h3, h4 {
  font-weight: 900;
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== 3. 毛玻璃卡片 ===== */
.glass-card {
  border-radius: var(--radius-card);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all 0.7s ease;
}

.glass-card:hover {
  box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* ===== 4. 渐变流动动画 ===== */
.gradient-flow {
  background: linear-gradient(-45deg, var(--gradient-colors));
  background-size: 400% 400%;
  animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== 5. 主题切换渐变 ===== */
.bg-gradient-sun {
  background: linear-gradient(to top right, #7dd3fc, #fde68a);
}

.bg-gradient-moon {
  background: linear-gradient(to top right, #312e81, #1e293b);
}

/* ===== 6. 导航栏 ===== */
.nav-link {
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.3s;
  color: #334155;
  font-size: 0.875rem;
  font-weight: 700;
}

.dark .nav-link {
  color: #e2e8f0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-indigo);
}

.dark .nav-link:hover,
.dark .nav-link.active {
  color: var(--color-indigo-light);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -0.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--color-indigo);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.5; transform: translateX(-50%) scale(1.5); }
}

/* ===== 7. 社交按钮 ===== */
.social-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  transition: all 0.3s;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .social-btn {
    width: 2.5rem;
    height: 2.5rem;
  }
}

.dark .social-btn {
  background: rgba(51, 65, 85, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.social-btn:hover {
  background: var(--color-indigo);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ===== 8. 搜索栏 ===== */
.search-bar {
  position: relative;
  width: 100%;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: 1.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all 0.3s;
}

.search-input-wrapper:focus-within {
  border-color: var(--color-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-serif);
  font-size: 0.875rem;
  color: #0f172a;
}

.dark .search-input {
  color: #f1f5f9;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-kbd {
  display: none;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: #64748b;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .search-kbd {
    display: block;
  }
}

.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  border-radius: 1.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-height: 20rem;
  overflow-y: auto;
  z-index: 40;
  padding: 0.5rem;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

.search-result-item h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.dark .search-result-item h4 {
  color: #f1f5f9;
}

.search-result-item p {
  font-size: 0.75rem;
  color: #64748b;
  line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 9. 说说条目 ===== */
.moment-item {
  padding: 0.75rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s;
}

.dark .moment-item {
  background: rgba(30, 41, 59, 0.3);
  border-color: rgba(255, 255, 255, 0.05);
}

.moment-item:hover {
  transform: translateX(4px);
  background: rgba(99, 102, 241, 0.08);
}

/* ===== 10. 项目卡片 ===== */
.project-card {
  border-radius: var(--radius-card);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 1.5rem;
  transition: all 0.5s;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15);
}

.project-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.project-card h3 {
  font-size: 1.125rem;
  font-weight: 800;
  color: #0f172a;
  transition: color 0.3s;
}

.dark .project-card h3 {
  color: #f1f5f9;
}

.project-card h3:hover {
  color: var(--color-indigo);
}

.project-card p {
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.6;
  flex: 1;
}

.dark .project-card p {
  color: #94a3b8;
}

.project-card-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.project-tag {
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-indigo);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.dark .project-tag {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
}

.project-card-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.project-card-stats svg {
  width: 0.875rem;
  height: 0.875rem;
  margin-right: 0.25rem;
}

/* ===== 11. 开屏动画 ===== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #020617;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.8s ease, filter 0.8s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  filter: blur(10px);
  pointer-events: none;
}

.splash-avatar-ring {
  position: relative;
  width: 100px;
  height: 100px;
}

.splash-avatar-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #6366f1, #a855f7, #ec4899, #6366f1);
  animation: spin 2s linear infinite;
  filter: blur(8px);
  opacity: 0.6;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.splash-avatar-border {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #6366f1, #a855f7, #ec4899, #6366f1);
  animation: spin 2s linear infinite;
}

.splash-avatar-inner {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.splash-progress {
  width: 200px;
  height: 3px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.splash-progress-bar {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  animation: progress 2s ease-in-out forwards;
}

@keyframes progress {
  from { width: 0%; }
  to { width: 100%; }
}

.splash-text {
  color: #94a3b8;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}

/* ===== 12. Toast 通知 ===== */
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 1rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  animation: toastIn 0.3s ease;
  max-width: 20rem;
}

.dark .toast {
  color: #f1f5f9;
}

.toast.success {
  border-left: 3px solid #22c55e;
}

.toast.info {
  border-left: 3px solid var(--color-indigo);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.fade-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ===== 13. 弹幕 ===== */
.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.4);
  pointer-events: none;
  animation: danmakuScroll linear forwards;
  will-change: transform;
}

.dark .danmaku-item {
  color: rgba(148, 163, 184, 0.25);
}

@keyframes danmakuScroll {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

/* ===== 14. 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.8);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

/* ===== 15. 工具类 ===== */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 16. 响应式调整 ===== */
@media (max-width: 640px) {
  .splash-avatar-ring {
    width: 80px;
    height: 80px;
  }

  .splash-avatar-inner {
    font-size: 2rem;
  }
}

/* ===== 17. 背景图片淡入淡出 ===== */
.bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 2s ease-in-out;
  will-change: opacity;
}

/* ===== 18. 樱花粒子 ===== */
.sakura-petal {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  font-size: 1rem;
  opacity: 0;
  animation: sakuraFall linear forwards;
}

@keyframes sakuraFall {
  0% {
    opacity: 0;
    transform: translateY(-10vh) rotate(0deg) translateX(0);
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translateY(110vh) rotate(720deg) translateX(100px);
  }
}

/* ===== 19. 萤火虫粒子 (暗色模式) ===== */
.firefly {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #818cf8;
  box-shadow: 0 0 6px 2px rgba(129, 140, 248, 0.6);
  opacity: 0;
  animation: fireflyFloat linear infinite;
}

@keyframes fireflyFloat {
  0% {
    opacity: 0;
    transform: translate(0, 0);
  }
  20% {
    opacity: 0.8;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
    transform: translate(var(--fx), var(--fy));
  }
}

/* ===== 20. 移动端菜单动画 ===== */
.mobile-menu-enter {
  animation: menuEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes menuEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(-90deg);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

.mobile-menu-exit {
  animation: menuExit 0.3s ease forwards;
}

@keyframes menuExit {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(90deg);
  }
}

.mobile-nav-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.5rem;
  height: 3.5rem;
  margin-left: -1.75rem;
  margin-top: -1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-item a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-size: 0.6875rem;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: all 0.3s;
}

.dark .mobile-nav-item a {
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.1);
}

.mobile-nav-item a:hover,
.mobile-nav-item a.active {
  background: var(--color-indigo);
  color: white;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
  transform: scale(1.1);
}

/* ===== 21. 轮播指示点 ===== */
.carousel-dot {
  height: 6px;
  border-radius: 9999px;
  transition: all 0.5s;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  padding: 0;
}

.carousel-dot.active {
  width: 1.5rem;
  background: var(--color-indigo-light);
}

.carousel-dot:not(.active) {
  width: 0.5rem;
}

.carousel-dot:not(.active):hover {
  background: rgba(255, 255, 255, 0.8);
}

/* ===== 22. 页面入场动画 ===== */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 23. 数字跳动动画 ===== */
.count-up {
  display: inline-block;
  transition: transform 0.3s;
}

.count-up:hover {
  transform: scale(1.1);
}

/* ===== 24. 关于页面 - 技能标签 ===== */
.skill-group {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.dark .skill-group {
  background: rgba(30, 41, 59, 0.2);
  border-color: rgba(255, 255, 255, 0.05);
}

.skill-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.3s;
}

.dark .skill-tag {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.skill-tag:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}

/* ===== 25. 关于页面 - 联系方式卡片 ===== */
.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  transition: all 0.3s;
}

.contact-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.contact-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== 26. 友链页面 - 友链卡片 ===== */
.friend-card {
  text-decoration: none;
  display: block;
}

/* ===== 27. 时间线样式 ===== */
.timeline-dot {
  position: absolute;
  left: -2.15rem;
  top: 1.25rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #6366f1;
  border: 2px solid #c7d2fe;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
  z-index: 1;
}

.dark .timeline-dot {
  border-color: #4338ca;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.timeline-item {
  transition: transform 0.3s;
}

.timeline-item:hover {
  transform: translateX(4px);
}

/* ===== 28. 内容排版 ===== */
.prose-content p {
  margin-bottom: 1rem;
}

.prose-content strong {
  font-weight: 800;
}

.prose-content a {
  color: #6366f1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dark .prose-content a {
  color: #818cf8;
}

.prose-content a:hover {
  color: #4f46e5;
}
