/* ============================================================================
 * Faint Studio · 首页开场（深色）
 * ----------------------------------------------------------------------------
 * 两拍：① 黑幕 DeepSeek 标识   ② 鲸鱼娘扫描睁眼   然后故障揭幕。
 * 第①拍的版式、字距、扫光取自 dsh-boot-suite 的第一幕（MIT，原作者沈宏宏 /
 * 维护 LeeRolling），只保留黑幕这一块，白底档案底板与授权序列整段没有引进来。
 * 第②拍是 7 秒视频，素材见 intro/NOTICE.md（BSD-3-Clause）。
 * ========================================================================== */

#dsh-startup-root,
#dsh-startup-root *,
#dsh-startup-root *::before,
#dsh-startup-root *::after { box-sizing: border-box; margin: 0; padding: 0; }

#dsh-startup-root {
  --dsu-din: "Bahnschrift", "DIN Alternate", "DIN Condensed", "Archivo", "Oswald",
    "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --dsu-mono: "Cascadia Mono", "SFMono-Regular", Consolas, Menlo, "DejaVu Sans Mono", monospace;
  --dsu-zh: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --dsu-blue: #4d6bfe;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: var(--dsu-din);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  contain: layout paint style;
}

/* 动画期间锁滚动（页面本来就不滚，这里兜一层） */
html.dsu-lock, html.dsu-lock body { overflow: hidden !important; }

/* 首帧兜底：脚本还没跑起来就先糊住整屏，绝不闪出首页 */
#dsh-startup-root.dsu-boot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 90;
}

/* ── 第一拍：黑幕 + 鲸鱼标识 + 深度求索 / DEEPSEEK ─────────────────────── */
.dsu-black {
  position: absolute;
  inset: 0;
  background: #000;
  display: grid;
  place-items: center;
  z-index: 40;
}
.dsu-black-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 560ms ease, transform 560ms ease;
}
.dsu-black-inner.dsu-in { opacity: 1; transform: none; }
.dsu-black-inner.dsu-out {
  opacity: 0;
  transform: scale(1.045);
  transition: opacity 620ms ease, transform 620ms ease;
}
.dsu-whale { display: block; fill: currentColor; }
.dsu-black .dsu-whale {
  width: 122px;
  height: 122px;
  color: #fff;
  margin-bottom: 18px;
}
.dsu-black-zh {
  font-family: var(--dsu-zh);
  font-size: 33px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: #fff;
}
.dsu-black-en {
  margin-top: 9px;
  font-family: var(--dsu-din);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: #fff;
  transition: letter-spacing 1300ms cubic-bezier(0.16, 0.84, 0.24, 1);
}
.dsu-black-en.dsu-tighten { letter-spacing: 0.2em; text-indent: 0.2em; }
.dsu-black-sub {
  margin-top: 12px;
  font-family: var(--dsu-mono);
  font-size: 10px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(255, 255, 255, 0.5);
}
/* 扫光：一条极淡的白色横条掠过标识 */
.dsu-sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  left: -50%;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.055) 42%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.055) 58%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
}
.dsu-sweep.dsu-go { animation: dsu-sweep 1150ms cubic-bezier(0.32, 0, 0.2, 1) forwards; }
@keyframes dsu-sweep {
  from { left: -50%; }
  to { left: 118%; }
}

/* 细颗粒噪点，压住纯黑的"塑料感" */
.dsu-grain {
  position: absolute;
  inset: -50%;
  z-index: 50;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.6'/></svg>");
}

/* ── 第二拍：鲸鱼娘扫描睁眼（视频）───────────────────────────────────── */
.dsu-video-wrap {
  position: absolute;
  inset: 0;
  z-index: 30;
  opacity: 0;
  background: #000;
  transition: opacity 340ms ease;
}
.dsu-video-wrap.dsu-in { opacity: 1; }
.dsu-video {
  width: 100%;
  height: 100%;
  /* 和首页底图（intro/home-bg.jpg）用同一取景：都是 cover + 62%。
     这样视频最后一帧和首页背景是同一张画面，揭幕时不会跳一下。 */
  object-fit: cover;
  object-position: 62% center;
  display: block;
  background: #000;
}
/* 素材署名（BSD-3-Clause 要求保留） */
.dsu-credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-family: var(--dsu-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(139, 232, 255, 0.5);
  pointer-events: none;
}

/* ── 第三拍：故障揭幕 ─────────────────────────────────────────────────── */
.dsu-exit {
  animation: dsu-jolt 300ms steps(1) 1;
}
@keyframes dsu-jolt {
  0%   { transform: translate3d(0, 0, 0); filter: none; }
  12%  { transform: translate3d(-7px, 2px, 0); filter: brightness(1.35) contrast(1.15); }
  24%  { transform: translate3d(6px, -3px, 0); filter: brightness(0.9) contrast(1.3); }
  36%  { transform: translate3d(-3px, 3px, 0); filter: brightness(1.5) saturate(1.4); }
  48%  { transform: translate3d(4px, -1px, 0); filter: none; }
  60%  { transform: translate3d(-2px, 1px, 0); filter: brightness(1.2); }
  100% { transform: translate3d(0, 0, 0); filter: none; }
}
/* 故障时叠一层横向扫描条，读起来像信号被切断 */
.dsu-scanlines {
  position: absolute;
  inset: 0;
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.09) 0px,
    rgba(255, 255, 255, 0.09) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px
  );
  mix-blend-mode: screen;
}
.dsu-scanlines.dsu-in { animation: dsu-glin 320ms steps(2) 1 forwards; }
@keyframes dsu-glin {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 0.8; transform: translateY(-6px); }
  40% { opacity: 0.15; }
  60% { opacity: 0.9; transform: translateY(5px); }
  80% { opacity: 0.2; }
  100% { opacity: 0; transform: translateY(0); }
}

#dsh-startup-root.dsu-gone {
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 跳过 ─────────────────────────────────────────────────────────────── */
.dsu-skip {
  position: absolute;
  top: 22px;
  right: 26px;
  z-index: 70;
  font-family: var(--dsu-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.45);
  padding: 8px 10px;
  cursor: pointer;
  transition: color 200ms ease;
  opacity: 0;
}
.dsu-skip.dsu-in { opacity: 1; }
.dsu-skip:hover { color: #fff; }

@media (max-width: 900px) {
  /* 窄屏用 cover 铺满，取景偏右，保住人脸那半边 */
  .dsu-video { object-position: 80% center; }
}

@media (max-width: 560px) {
  .dsu-black .dsu-whale { width: 92px; height: 92px; margin-bottom: 14px; }
  .dsu-black-zh { font-size: 24px; }
  .dsu-black-en { font-size: 19px; }
  .dsu-credit { font-size: 8px; letter-spacing: 0.1em; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .dsu-exit { animation: none; }
  .dsu-black-inner, .dsu-black-en, #dsh-startup-root.dsu-gone { transition-duration: 1ms; }
}
