/* ===== Contact 页基础 ===== */
.contact-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 7rem 0 5rem;
}

/* ===== 背景层（概念设计 0_6.png 对应动态视频：数字故障大脑） ===== */
.contact-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.contact-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 50%;
  transform: scale(1.06);
  filter: brightness(1.05) contrast(1.05) saturate(1.05);
  animation: contactDrift 26s ease-in-out infinite alternate;
}

/* 常驻极缓的呼吸推移，让静态图保持"活着的信号"感 */
@keyframes contactDrift {
  from { transform: scale(1.06) translate(0, 0); }
  to { transform: scale(1.13) translate(-1.5%, 1%); }
}

/* 背景偶发信号抖动：JS 每隔数秒挂一次 .is-shifting */
.contact-bg.is-shifting .contact-bg-video {
  animation: contactShift 0.28s steps(2, end) 1;
}

@keyframes contactShift {
  0% {
    transform: scale(1.08) translate(4px, -2px);
    filter: brightness(1.1) contrast(1.2) saturate(1.3) hue-rotate(10deg);
  }
  50% {
    transform: scale(1.08) translate(-3px, 2px);
    filter: brightness(0.9) contrast(1.15) saturate(0.85) hue-rotate(-8deg);
  }
  100% {
    transform: scale(1.06) translate(0, 0);
    filter: brightness(1.05) contrast(1.05) saturate(1.05);
  }
}

/* 左侧适度压暗保证文字可读，右侧让大脑图形透出 */
.contact-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0.1) 70%, rgba(0, 0, 0, 0.35) 100%),
    radial-gradient(circle at 62% 42%, transparent 0%, rgba(0, 0, 0, 0.3) 95%);
  z-index: 1;
}

/* 网格覆层：与 about 同款，向右侧渐隐 */
.contact-grid-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(to right, rgba(138, 231, 68, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(138, 231, 68, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0) 100%);
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0) 100%);
  animation: gridShift 8s linear infinite;
  pointer-events: none;
}

/* 周期性纵向扫描光束 */
.contact-scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: -2%;
  height: 1px;
  z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(138, 231, 68, 0.45), rgba(79, 253, 196, 0.35), transparent);
  opacity: 0;
  animation: beamSweep 7s linear infinite;
  pointer-events: none;
}

@keyframes beamSweep {
  0% { top: -2%; opacity: 0; }
  4% { opacity: 1; }
  42% { top: 102%; opacity: 1; }
  46%, 100% { top: 102%; opacity: 0; }
}

/* 周期性横向扫描竖线（与纵向光束错开周期） */
.contact-scan-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -2%;
  width: 1px;
  z-index: 3;
  background: linear-gradient(to bottom, transparent, rgba(138, 231, 68, 0.45), rgba(79, 253, 196, 0.35), transparent);
  opacity: 0;
  animation: lineSweep 9s linear infinite;
  pointer-events: none;
}

@keyframes lineSweep {
  0% { left: -2%; opacity: 0; }
  4% { opacity: 1; }
  42% { left: 102%; opacity: 1; }
  46%, 100% { left: 102%; opacity: 0; }
}

/* ===== 视图间过渡视频（work2 ⇄ contact） ===== */
.contact-transition-video,
.contact-reverse-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* 正向过渡视频与 contact 循环背景保持同一几何与影调，接缝处画面连续 */
.contact-transition-video {
  object-position: 60% 50%;
  transform: scale(1.06);
  filter: brightness(1.05) contrast(1.05) saturate(1.05);
}

/* 反向过渡视频与 work2 瞳孔背景保持同一几何 */
.contact-reverse-video {
  object-position: 50% 50%;
}

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

/* 末尾提前缓慢淡出：过渡视频仍在播放时，contact 元素在淡出的盖层下开始入场 */
.contact-transition-video.is-leaving {
  transition: opacity 1.8s ease;
  opacity: 0;
}

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

/* ===== 顶部标签 ===== */
.contact-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: 100;
}

/* ===== 主内容区 ===== */
.contact-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1400px;
  padding: 0 5vw;
}

.contact-title {
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  transform: scaleY(0.9);
  transform-origin: left bottom;
  opacity: 0;
  animation: titleReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

.contact-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.75rem, 1.2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 3rem;
  text-transform: uppercase;
}

/* ===== 联系通道列表 ===== */
.contact-channels {
  display: flex;
  flex-direction: column;
  max-width: 640px;
}

.contact-channel {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  padding: 0.95rem 0.65rem;
  border-top: 1px solid rgba(138, 231, 68, 0.18);
  cursor: pointer;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-30px);
  clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    clip-path 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.3s ease;
}

.contact-channel.is-visible {
  opacity: 1;
  transform: translateX(0);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.contact-channel:hover {
  background: rgba(138, 231, 68, 0.05);
}

.channel-index {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(138, 231, 68, 0.55);
  flex-shrink: 0;
}

.channel-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.channel-name {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}

.channel-value {
  font-size: clamp(0.85rem, 1.4vw, 1.1rem);
  color: var(--text-primary);
  letter-spacing: 0.04em;
  word-break: break-all;
}

.channel-action {
  margin-left: auto;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: rgba(230, 230, 230, 0.45);
  flex-shrink: 0;
  transition: color 0.3s ease;
}

.contact-channel:hover .channel-action {
  color: var(--accent);
}

.contact-channel.copied .channel-action {
  color: var(--glitch-cyan);
}

/* hover 时横向扫过的高亮条 */
.channel-scanline {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -90px;
  width: 80px;
  background: linear-gradient(90deg, transparent, rgba(79, 253, 196, 0.1), rgba(138, 231, 68, 0.22), transparent);
  pointer-events: none;
}

.contact-channel:hover .channel-scanline {
  animation: rowSweep 0.9s ease;
}

@keyframes rowSweep {
  to { left: 110%; }
}

/* ===== 邮件 CTA ===== */
.contact-cta {
  display: inline-block;
  margin-top: 2.5rem;
  padding: 0.95rem 1.7rem;
  border: 1px solid rgba(138, 231, 68, 0.4);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.contact-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.contact-cta:hover {
  background: rgba(138, 231, 68, 0.1);
  box-shadow: 0 0 18px rgba(138, 231, 68, 0.25);
}

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

.contact-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;
}

.contact-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);
}

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

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

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

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

/* ===== 扰码中的临时字符 ===== */
.scramble-char {
  color: rgba(138, 231, 68, 0.6);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .contact-page {
    align-items: flex-start;
    padding-top: 6.5rem;
  }

  .contact-content {
    padding: 0 1.5rem;
  }

  .contact-subtitle {
    margin-bottom: 2rem;
  }

  .contact-channel {
    gap: 1rem;
    padding: 1.1rem 0.5rem;
  }

  .channel-action {
    display: none;
  }

  .contact-sidebar {
    display: none;
  }

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

  .contact-label {
    left: 5.5rem;
  }
}
