/* ==========================================================================
   home.css — 首页专属：机密档案 / 绝望影片 / 接管终幕
   ========================================================================== */

/* ---------- 机密档案 ---------- */
.archive {
  position: relative;
  border: 1px solid rgba(193, 18, 31, 0.32);
  background:
    linear-gradient(165deg, rgba(193, 18, 31, 0.11), transparent 55%),
    var(--ink-800);
}

.archive__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: clamp(1.1rem, 3vw, 1.5rem) clamp(1.15rem, 3vw, 1.75rem);
  border-bottom: 1px solid rgba(193, 18, 31, 0.28);
  background: rgba(0, 0, 0, 0.35);
}

.archive__title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-serif);
  font-size: var(--step-1);
  letter-spacing: 0.04em;
}

.archive__title::before {
  content: "";
  width: 3px;
  height: 1.1em;
  background: var(--blood);
}

.archive__body {
  padding: clamp(1.15rem, 3vw, 1.75rem);
}

.archive__lede {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  line-height: 1.75;
  color: var(--paper);
}

.archive__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

/* ---------- 影片播放器 ---------- */
.video-frame {
  position: relative;
  margin-top: 1.5rem;
  border: 1px solid var(--line-strong);
  background: #000;
}

.video-frame::before {
  content: "ARCHIVE / ZV-77";
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2;
  padding: 0.28rem 0.6rem;
  background: rgba(0, 0, 0, 0.72);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.2em;
  color: var(--paper-faint);
  pointer-events: none;
}

.video-frame video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  /* 无原生控件：禁用选中与拖拽，避免绕过控制 */
  pointer-events: none;
  user-select: none;
}

/* 播放状态条：替代被移除的原生控件 */
.video-status {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  background: rgba(0, 0, 0, 0.78);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.video-status__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.video-status[data-state="playing"] {
  color: #ff6b6b;
  background: rgba(120, 0, 8, 0.85);
}

.video-status[data-state="playing"] .video-status__dot {
  animation: status-pulse 1.1s ease-in-out infinite;
}

@keyframes status-pulse {
  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

/* ---------- 绝望警告 ---------- */
.despair-warning {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: clamp(1rem, 2.6vw, 1.4rem);
  border: 1px solid rgba(193, 18, 31, 0.45);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(193, 18, 31, 0.09) 0 10px,
      transparent 10px 20px
    ),
    rgba(193, 18, 31, 0.05);
}

.despair-warning__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--blood);
  color: var(--ember);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.despair-warning__title {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  color: #ff9a9a;
}

.despair-warning__list {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.6rem;
  font-size: var(--step--1);
  color: var(--paper-dim);
}

.despair-warning__list li {
  position: relative;
  padding-left: 1.1rem;
}

.despair-warning__list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--blood);
}

.archive__foot {
  margin-top: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.9;
  letter-spacing: 0.08em;
  color: var(--paper-faint);
}

/* 播放后的整页压暗 */
body.is-despair video {
  filter: contrast(1.1) saturate(1.25);
}

/* ---------- 抽选结果 ---------- */
.draw-result {
  margin-top: 1rem;
  padding: 0.95rem 1.1rem;
  border-left: 2px solid var(--blood);
  background: rgba(0, 0, 0, 0.32);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: var(--paper);
  animation: bubble-in 0.3s var(--ease);
}

.draw-result[data-tone="danger"] {
  border-left-color: var(--ember);
  color: #ffb4a8;
}

.draw-result[data-tone="glitch"] {
  color: #9be7ff;
  text-shadow: 1px 0 rgba(255, 0, 80, 0.6), -1px 0 rgba(0, 190, 255, 0.6);
}

.draw-result__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--paper-faint);
}

/* ==========================================================================
   接管终幕（故障动画之后）
   ========================================================================== */
.takeover {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: #000;
  overflow: hidden;
  animation: takeover-in 0.5s steps(2) both;
}

.takeover[hidden] {
  display: none;
}

@keyframes takeover-in {
  from {
    opacity: 0;
    background: #fff;
  }
}

/* 扫描线 */
.takeover__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.055) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.6;
  animation: scan-drift 5.5s linear infinite;
}

@keyframes scan-drift {
  to {
    background-position: 0 120px;
  }
}

/* 血色晕染 */
.takeover__blood {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, transparent 25%, rgba(120, 0, 8, 0.55) 78%, #1a0004 100%),
    radial-gradient(circle at 12% 18%, rgba(160, 0, 12, 0.4), transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(160, 0, 12, 0.34), transparent 30%);
  animation: blood-breathe 5s ease-in-out infinite alternate;
}

@keyframes blood-breathe {
  from {
    opacity: 0.75;
  }
  to {
    opacity: 1;
  }
}

/* 黑白熊的巨大剪影，缓慢浮现 */
.takeover__monokuma {
  position: absolute;
  right: -4%;
  bottom: -6%;
  width: min(46vw, 460px);
  opacity: 0;
  filter: brightness(0) drop-shadow(0 0 60px rgba(255, 0, 30, 0.55));
  animation: kuma-emerge 6s 0.4s ease-out forwards;
  pointer-events: none;
  user-select: none;
}

@keyframes kuma-emerge {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.94);
  }
  60% {
    opacity: 0.5;
  }
  100% {
    opacity: 0.82;
    transform: none;
  }
}

/* 随机闪烁的红色警示块 */
.takeover__alarm {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 0, 20, 0.55);
  opacity: 0;
  animation: alarm-flash 3.4s steps(1) infinite;
}

@keyframes alarm-flash {
  0%,
  88%,
  100% {
    opacity: 0;
  }
  89% {
    opacity: 0.9;
  }
  91% {
    opacity: 0;
  }
  93% {
    opacity: 0.6;
  }
  95% {
    opacity: 0;
  }
}

/* 随机横向撕裂条 */
.takeover__tear {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  mix-blend-mode: overlay;
  opacity: 0;
  animation: tear-sweep 2.6s linear infinite;
}

.takeover__tear--2 {
  animation-duration: 3.7s;
  animation-delay: 0.8s;
  height: 6px;
}

.takeover__tear--3 {
  animation-duration: 2.1s;
  animation-delay: 1.5s;
  height: 1.5px;
}

@keyframes tear-sweep {
  0% {
    top: -5%;
    opacity: 0;
  }
  4% {
    opacity: 0.85;
  }
  50% {
    opacity: 0.35;
  }
  60% {
    opacity: 0;
  }
  100% {
    top: 105%;
    opacity: 0;
  }
}

.takeover__inner {
  position: relative;
  z-index: 2;
  width: min(100%, 700px);
}

.takeover__status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--blood);
  animation: status-flicker 4.5s steps(1) infinite;
}

.takeover__status::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--blood), transparent);
}

@keyframes status-flicker {
  0%,
  92%,
  100% {
    opacity: 1;
  }
  93% {
    opacity: 0.15;
  }
  95% {
    opacity: 1;
  }
  97% {
    opacity: 0.3;
  }
}

.takeover__text {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 2.6vw, 1.6rem);
  line-height: 1.85;
  color: #ff2020;
  text-shadow:
    0 0 18px rgba(255, 0, 0, 0.55),
    0 0 46px rgba(160, 0, 0, 0.6);
  white-space: pre-wrap;
  min-height: 7em;
}

/* 文案的细微错位抖动，制造不稳定的信号感 */
.takeover__text.is-jittering {
  animation: text-jitter 0.28s steps(2) infinite;
}

@keyframes text-jitter {
  0% {
    transform: translate(0, 0);
    text-shadow: 2px 0 rgba(255, 0, 60, 0.6), -2px 0 rgba(0, 190, 255, 0.4), 0 0 18px rgba(255,0,0,0.55);
  }
  50% {
    transform: translate(-1px, 1px);
    text-shadow: -2px 0 rgba(255, 0, 60, 0.6), 2px 0 rgba(0, 190, 255, 0.4), 0 0 18px rgba(255,0,0,0.55);
  }
  100% {
    transform: translate(1px, -1px);
    text-shadow: 1px 0 rgba(255, 0, 60, 0.6), -1px 0 rgba(0, 190, 255, 0.4), 0 0 18px rgba(255,0,0,0.55);
  }
}

.takeover__caret {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 0.12em;
  background: #ff2020;
  vertical-align: -0.16em;
  animation: caret-blink 1s steps(1) infinite;
}

/* 终幕出现时整页抖一下 */
body.is-takeover {
  animation: body-shock 0.45s steps(2) 1;
}

@keyframes body-shock {
  0% {
    filter: invert(1) contrast(2);
  }
  20% {
    filter: invert(1);
  }
  40% {
    filter: contrast(1.8) hue-rotate(-18deg);
  }
  100% {
    filter: none;
  }
}


@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

/* 故障覆盖层 */
.glitch-overlay {
  position: fixed;
  inset: 0;
  /* 必须高于弹窗（120），才能在影片画面上直接撕裂 */
  z-index: 195;
  pointer-events: none;
  mix-blend-mode: screen;
  /* 撕裂时整层轻微横向抖动 */
  animation: overlay-shake 0.12s steps(2) infinite;
}

@keyframes overlay-shake {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-3px, 2px);
  }
  100% {
    transform: translate(2px, -2px);
  }
}

/* 故障期间：各区块独立做 3D 扭曲，不做整体黑场 */
.is-glitching .site-nav,
.is-glitching .site-header,
.is-glitching .marquee,
.is-glitching .section,
.is-glitching .site-footer {
  will-change: transform, filter;
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  filter: contrast(1.45) saturate(1.9) brightness(1.2);
}

/* Hero 主标题的故障错位（仅机密解锁后触发） */
.is-glitching .site-header__title,
.is-glitching .site-header__lead {
  animation: text-glitch 0.42s steps(2) infinite;
}

@keyframes text-glitch {
  0% {
    text-shadow: 2px 0 #ff003c, -2px 0 #00d9ff;
    transform: translate(0, 0);
  }
  50% {
    text-shadow: -3px 0 #ff003c, 3px 0 #00d9ff;
    transform: translate(1px, -1px);
  }
  100% {
    text-shadow: 1px 0 #ff003c, -1px 0 #00d9ff;
    transform: translate(-1px, 1px);
  }
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 640px) {
  .archive__head {
    align-items: flex-start;
  }

  .despair-warning {
    grid-template-columns: 1fr;
  }

  .despair-warning__mark {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
}
