/* 桌面端gallery高度优化 */
@media (min-width: 769px) {
  .gallery {
    /* 移除固定高度限制，允许内容自然扩展 */
    min-height: calc(100vh - 250px); /* 保持最小高度 */
    /* 移除 overflow-y: auto; 让页面级滚动处理 */
    padding-right: 10px; /* 为滚动条留出空间 */
    padding-bottom: 50px; /* 进一步增加底部空间，从40px改为50px，解决剩余10px覆盖问题 */
  }
  
  /* 自定义gallery滚动条样式 */
  .gallery::-webkit-scrollbar {
    width: 6px;
  }
  
  .gallery::-webkit-scrollbar-thumb {
    background-color: rgba(39, 81, 160, 0.3);
    border-radius: 3px;
  }
  
  .gallery::-webkit-scrollbar-track {
    background: transparent;
  }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px; /* 减少gap，从20px改为15px */
  padding: 0;
  margin: 0;
  position: relative;
  transition: all 0.3s ease;
}

@media (min-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px; /* 减少gap，从25px改为20px */
  }
}

@media (min-width: 1600px) {
  .gallery {
    grid-template-columns: repeat(5, 1fr);
    gap: 25px; /* 减少gap，从30px改为25px */
  }
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 20px;
    max-width: 1800px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}

.gallery::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(2px);
  z-index: -1;
  border-radius: var(--radius);
}

.gallery img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow);
  background-color: #f0f0f0;
  opacity: 0;
  transform: translateY(20px) rotateX(10deg);
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px) rotateX(15deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

/* 交错动画延迟 */

  .gallery img:nth-child(1) { animation-delay: 0.05s; }
  .gallery img:nth-child(2) { animation-delay: 0.10s; }
  .gallery img:nth-child(3) { animation-delay: 0.15s; }
  .gallery img:nth-child(4) { animation-delay: 0.20s; }
  .gallery img:nth-child(5) { animation-delay: 0.25s; }
  .gallery img:nth-child(6) { animation-delay: 0.30s; }
  .gallery img:nth-child(7) { animation-delay: 0.35s; }
  .gallery img:nth-child(8) { animation-delay: 0.40s; }
  .gallery img:nth-child(9) { animation-delay: 0.45s; }
  .gallery img:nth-child(10) { animation-delay: 0.50s; }
  .gallery img:nth-child(11) { animation-delay: 0.55s; }
  .gallery img:nth-child(12) { animation-delay: 0.60s; }


.gallery {
  will-change: transform;
}

.gallery img:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.gallery::after {
  content: "";
  flex: auto;
}
