/* ==============================
   Custom Styles
   ============================== */

/* 噪点纹理覆盖层 */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* 渐变文字 */
.text-gradient {
  background: linear-gradient(135deg, #ffffff 0%, #3b82f6 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 导航栏滚动效果 */
.nav-pill {
  transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.nav-pill.scrolled {
  background: rgba(10, 10, 10, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.nav-link.active {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
}

/* 搜索框聚焦效果 */
.search-box::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 1rem;
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.search-box:focus-within::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
  opacity: 1;
}

/* 项目卡片 - Double-Bezel 双层结构 */
.project-card {
  position: relative;
  border-radius: 1.25rem;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.5rem;
  transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  cursor: pointer;
  text-decoration: none;
  display: block;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  opacity: 0;
  transition: opacity 0.5s;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  background: #111111;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 8px 40px rgba(0, 0, 0, 0.3),
    0 0 60px var(--card-glow, rgba(59, 130, 246, 0.05));
}

.project-card:hover::before {
  opacity: 1;
}

/* 卡片图标 */
.card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1rem;
  transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.project-card:hover .card-icon {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* 卡片按钮 - Button-in-Button */
.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.card-btn-icon {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.project-card:hover .card-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.project-card:hover .card-btn-icon {
  transform: translate(1px, -1px);
  background: rgba(255, 255, 255, 0.1);
}

/* 分类按钮 */
.category-btn {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.category-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
}

.category-btn.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: rgba(59, 130, 246, 0.9);
}

/* 技能标签悬停 */
.skill-tag {
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.skill-tag:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}

/* 社交链接按钮 */
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  text-decoration: none;
}

.social-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.social-btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.social-btn:hover svg {
  opacity: 1;
}

/* 滚动指示器动画 */
.scroll-indicator {
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* 卡片入场动画基础状态 */
.project-card {
  opacity: 0;
  transform: translateY(16px);
}

.project-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Featured 卡片特殊样式 */
.project-card.featured {
  grid-column: span 1;
}

@media (min-width: 640px) {
  .project-card.featured {
    grid-column: span 2;
  }
}

.project-card.featured .card-icon {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.5rem;
}

/* 响应式调整 */
@media (max-width: 640px) {
  .nav-pill {
    display: none;
  }

  .project-card {
    padding: 1.25rem;
  }
}

/* 移动端导航菜单 */
.mobile-nav {
  display: none;
}

@media (max-width: 640px) {
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    padding: 0.5rem;
    border-radius: 9999px;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    gap: 0.25rem;
  }

  .mobile-nav a {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: all 0.3s;
  }

  .mobile-nav a.active {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.06);
  }
}

/* ==============================
   QR Code Modal
   ============================== */

.qrcode-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.qrcode-modal.open {
  opacity: 1;
  visibility: visible;
}

.qrcode-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.qrcode-modal-content {
  position: relative;
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.qrcode-modal.open .qrcode-modal-content {
  transform: scale(1) translateY(0);
}

.qrcode-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s;
}

.qrcode-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.qrcode-modal-img {
  width: 200px;
  height: 200px;
  border-radius: 0.75rem;
  object-fit: contain;
  background: #ffffff;
  padding: 0.5rem;
}

.qrcode-modal-text {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
}
