/* ===== Work2 页：瞳孔星野（STILLS // 摄影 × AI 生图） ===== */
.work2-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

/* ===== 背景层：数字之眼（概念设计/4.png） ===== */
.work2-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.work2-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* 与 work2.js 中 pupilScreen() 的 cover 几何一致：居中裁切 */
  object-fit: cover;
  object-position: 50% 50%;
  filter: brightness(1.06) contrast(1.06) saturate(1.02);
}

/* 保留瞳孔亮度，四周压暗让飞出的图片突出 */
.work2-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 38%, transparent 0%, rgba(0, 0, 0, 0.16) 44%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.08) 50%, rgba(0, 0, 0, 0.45) 100%);
  z-index: 1;
}

/* 视图间过渡视频：覆盖在图片场之上、标题层之下 */
.work2-transition-video,
.work2-reverse-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.work2-transition-video.is-playing,
.work2-reverse-video.is-playing {
  opacity: 1;
}

/* 反向视频挂到 body 层，视图切换后保持末帧再渐隐（盖接缝） */
.work2-reverse-video.is-fading {
  opacity: 0;
}

/* 提前交还（视频未播完）时的慢渐隐：work 元素在其下入场 */
.work2-reverse-video.is-leaving {
  transition: opacity 1.8s ease;
  opacity: 0;
}

/* 扫描网格 */
.work2-grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(to right, rgba(138, 231, 68, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(138, 231, 68, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 40%, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 55%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 55%, rgba(0,0,0,0) 100%);
  animation: workGridShift 10s linear infinite;
  pointer-events: none;
}

/* ===== 顶部标签 ===== */
.work2-label {
  position: fixed;
  top: 1.55rem;
  left: 9.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  z-index: 210;
  opacity: 0;
  animation: workFadeIn 0.8s ease 0.2s forwards;
}

/* ===== 标题区 ===== */
.work2-content {
  position: fixed;
  top: 15vh;
  left: 5vw;
  z-index: 120;
  pointer-events: none;
}

.work2-title {
  font-size: clamp(3rem, 8.5vw, 7rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  pointer-events: auto;
  transform: scaleY(0.9);
  transform-origin: left bottom;
  opacity: 0;
  animation: workTitleReveal 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

.work2-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.7rem, 1.1vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.7;
  text-transform: uppercase;
}

/* ===== 透视飞行图片场 ===== */
.work2-field {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  /* 卡片绕 Y/X 轴的 3D 慢转依赖容器透视 */
  perspective: 1000px;
}

/* 位置 / 缩放 / 旋转 / 透明度 / 层级全部由 work2.js 每帧以 transform 驱动（GPU 合成） */
.w2-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 200px;
  margin: 0;
  transform-origin: 0 0;
  will-change: transform, opacity;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.w2-card img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(138, 231, 68, 0.3);
  background: var(--gray-900);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.w2-card:hover img {
  border-color: rgba(138, 231, 68, 0.65);
}

/* 拉到镜头前方（拖拽中） */
.w2-card.is-grabbed {
  cursor: grabbing;
}

.w2-card.is-grabbed img {
  border-color: var(--accent);
  box-shadow: 0 0 42px rgba(138, 231, 68, 0.35);
}

.w2-cap {
  margin-top: 0.3rem;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}

/* 靠近镜头或拖拽中显示编号 */
.w2-card.is-near .w2-cap,
.w2-card.is-grabbed .w2-cap {
  opacity: 0.9;
}

/* 松开后的故障消散：clip-path 撕裂由 JS 逐帧写入；::before/::after 为同一图像的
   两个色散分身（青/红通道反向偏移 + 屏幕混合），--gsx 偏移量由 JS 每帧抖动 */
.w2-card {
  --gsx: 6px;
}

.w2-card::before,
.w2-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--img);
  background-size: 100% auto;
  background-position: top left;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.w2-card.is-ejecting {
  animation: w2EjectFade 0.48s steps(3, end) forwards;
}

.w2-card.is-ejecting::before {
  opacity: 0.9;
  transform: translate(var(--gsx), 0);
  filter: hue-rotate(115deg) saturate(2.4) brightness(1.05);
}

.w2-card.is-ejecting::after {
  opacity: 0.9;
  transform: translate(calc(var(--gsx) * -1), 0);
  filter: hue-rotate(-55deg) saturate(2.4) brightness(1.05);
}

@keyframes w2EjectFade {
  0% { opacity: 1; }
  35% { opacity: 0.25; }
  60% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* ===== 侧边栏 ===== */
.work2-sidebar {
  position: fixed;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 210;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.5rem;
  text-align: right;
  pointer-events: none;
}

.work2-sidebar .sidebar-text {
  display: flex;
  gap: 1.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: rgba(230, 230, 230, 0.6);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  opacity: 1;
  animation: none;
}

.work2-sidebar-data {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: rgba(138, 231, 68, 0.55);
}

.work2-sidebar-data .data-line {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.work2-sidebar-data .data-line.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ===== 操作提示 ===== */
.work2-hint {
  position: fixed;
  left: 5vw;
  bottom: 2rem;
  z-index: 210;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.work2-hint.is-visible {
  opacity: 0.8;
  animation: workHintPulse 2.4s ease-in-out infinite;
}

/* ===== 右下角标签 ===== */
.work2-corner-tag {
  position: fixed;
  right: 2.5rem;
  bottom: 2rem;
  z-index: 210;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(230, 230, 230, 0.45);
  pointer-events: none;
}

.work2-corner-tag .corner-line {
  width: 40px;
  height: 1px;
  background: rgba(138, 231, 68, 0.4);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .work2-content {
    top: 12vh;
    left: 1.5rem;
  }

  .work2-sidebar {
    display: none;
  }

  .work2-label {
    left: 1.5rem;
    top: 4.2rem;
  }

  .work2-hint {
    left: 1.25rem;
    bottom: 1.25rem;
  }

  .work2-corner-tag {
    right: 1.25rem;
    bottom: 1.25rem;
  }
}
