/* ==========================================
   办公环境MagicBento特效样式
   ========================================== */

:root {
  --office-hue: 27;
  --office-sat: 69%;
  --office-white: hsl(0, 0%, 100%);
  --office-purple-primary: rgba(132, 0, 255, 1);
  --office-purple-glow: rgba(132, 0, 255, 0.2);
  --office-purple-border: rgba(132, 0, 255, 0.8);
  --office-border-color: #392e4e;
  --office-background-dark: #060010;
  --office-glow-color: 132, 0, 255;
}

/* 办公环境版块样式 */
.office-gallery {
  position: relative;
  background: var(--dark-bg);
  padding: 80px 0;
  overflow: visible; /* 改为visible以显示特效 */
  user-select: none;
}

.office-gallery .section-title {
  text-align: center;
  margin-bottom: 1rem;
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #a855f7 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
}

.office-gallery .section-subtitle {
  text-align: center;
  margin-bottom: 3rem;
  color: #cbd5e1;
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* 魔法网格容器 */
.gallery-grid {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
  position: relative;
}

/* 魔法卡片样式 */
.gallery-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  aspect-ratio: 4/3;
  min-height: 250px;
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--office-border-color);
  background: var(--office-background-dark);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  
  /* 魔法特效变量 */
  --glow-x: 50%;
  --glow-y: 50%;
  --glow-intensity: 0;
  --glow-radius: 300px;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.2),
    0 5px 15px rgba(132, 0, 255, 0.1);
}

/* 图片样式 */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* 覆盖层样式 */
.gallery-overlay {
  position: relative;
  z-index: 2;
  padding: 1.5rem;
  background: linear-gradient(
    to top,
    rgba(6, 0, 16, 0.95) 0%,
    rgba(6, 0, 16, 0.8) 50%,
    transparent 100%
  );
  color: var(--office-white);
  transition: all 0.3s ease;
}

.gallery-overlay h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #ffffff;
}

.gallery-overlay p {
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0.9;
  margin: 0;
  color: #cbd5e1;
}

/* 边框发光效果 */
.gallery-item.magic-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  padding: 3px;
  background: radial-gradient(
    var(--glow-radius) circle at var(--glow-x) var(--glow-y),
    rgba(var(--office-glow-color), calc(var(--glow-intensity) * 0.8)) 0%,
    rgba(var(--office-glow-color), calc(var(--glow-intensity) * 0.4)) 30%,
    transparent 60%
  );
  border-radius: inherit;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: subtract;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 3;
  opacity: 0;
}

.gallery-item.magic-glow:hover::after {
  opacity: 1;
}

.gallery-item.magic-glow:hover {
  box-shadow:
    0 8px 30px rgba(46, 24, 78, 0.4),
    0 0 40px var(--office-purple-glow);
}

/* 粒子容器 */
.gallery-item.particle-container {
  position: relative;
  overflow: hidden;
}

.office-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(var(--office-glow-color), 1);
  box-shadow: 0 0 8px rgba(var(--office-glow-color), 0.6);
  pointer-events: none;
  z-index: 100;
}

.office-particle::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: rgba(var(--office-glow-color), 0.3);
  border-radius: 50%;
  z-index: -1;
}

/* 全局聚光灯 */
.office-spotlight {
  position: fixed;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle,
    rgba(var(--office-glow-color), 0.15) 0%,
    rgba(var(--office-glow-color), 0.08) 15%,
    rgba(var(--office-glow-color), 0.04) 25%,
    rgba(var(--office-glow-color), 0.02) 40%,
    rgba(var(--office-glow-color), 0.01) 65%,
    transparent 70%
  );
  z-index: 200;
  opacity: 0;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

/* 点击涟漪效果 */
.office-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, 
    rgba(var(--office-glow-color), 0.4) 0%, 
    rgba(var(--office-glow-color), 0.2) 30%, 
    transparent 70%
  );
  pointer-events: none;
  z-index: 1000;
}

/* 响应式网格布局 */
@media (max-width: 599px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0.5rem;
  }

  .gallery-item {
    min-height: 200px;
  }
  
  .gallery-overlay {
    padding: 1rem;
  }
  
  .gallery-overlay h3 {
    font-size: 1rem;
  }
  
  .gallery-overlay p {
    font-size: 0.8rem;
  }
}

@media (min-width: 600px) and (max-width: 1023px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
  }

  /* 大卡片布局 */
  .gallery-item.large {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 350px;
  }
  
  /* 特殊布局调整 */
  .gallery-item:nth-child(1) {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
  }
  
  .gallery-item:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
  }
  
  .gallery-item:nth-child(3) {
    grid-column: 4;
    grid-row: 1;
  }
  
  .gallery-item:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
  }
  
  .gallery-item:nth-child(5) {
    grid-column: 4;
    grid-row: 2;
  }
}

/* 3D倾斜效果 */
.gallery-item.tilt-enabled {
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* 磁性效果 */
.gallery-item.magnetism-enabled {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 文本自动隐藏效果 */
.gallery-item.text-autohide .gallery-overlay {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.gallery-item.text-autohide:hover .gallery-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* 性能优化 */
.gallery-item {
  will-change: transform;
}

.gallery-item img {
  will-change: transform;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .gallery-item {
    border: 3px solid #fff;
  }
  
  .gallery-overlay {
    background: rgba(0, 0, 0, 0.9);
  }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item img,
  .gallery-overlay {
    transition: none;
  }
  
  .gallery-item:hover {
    transform: none;
  }
  
  .gallery-item:hover img {
    transform: none;
  }
}
