/* 
 * 图库页面样式
 * 参考图片样式设计
 */

/* 图库内容容器 */
.gallery-container {
  padding-top: 120px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 3rem;
}

/* 图库分类标签 */
.gallery-categories {
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-md);
  padding: 1rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: center;
}

.category-tabs {
  display: flex;
  gap: 2rem;
}

.category-tab {
  color: var(--text-dark);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
  transition: color var(--transition-fast);
}

.category-tab span {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

.category-tab.active {
  color: var(--primary-color);
}

.category-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
}

.category-tab:hover {
  color: var(--primary-color);
}

/* 图库网格布局 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(250px, auto);
  gap: 1.5rem;
}

/* 图片项目样式 */
.gallery-item {
  position: relative;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* 大尺寸图片项目 */
.gallery-item.large {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-image {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
  cursor: pointer;
}

.gallery-item:hover .gallery-image img {
  transform: scale(1.05);
}

/* 图片覆盖层 */
.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 1rem;
}

.view-count {
  background-color: rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: var(--border-radius-full);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
}

/* 图片标题 */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
  color: white;
}

.gallery-caption h3 {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.gallery-caption p {
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 图片放大查看器 */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--border-radius-md);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.lightbox-close:hover {
  transform: rotate(90deg);
}

.lightbox-caption {
  position: absolute;
  bottom: -40px;
  left: 0;
  width: 100%;
  color: white;
  text-align: center;
  font-size: 1.2rem;
  padding: 0.5rem 0;
}

/* 深色模式适配 */
body.dark-mode .gallery-categories {
  background-color: var(--bg-primary);
}

body.dark-mode .category-tab {
  color: var(--text-light);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-item.large {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 768px) {
  .gallery-container {
    padding: 80px 1rem 0;
  }

  .category-tabs {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .lightbox img {
    max-height: 80vh;
  }
}

@media (max-width: 576px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(200px, auto);
  }

  .lightbox-caption {
    font-size: 1rem;
  }
}