/* ============================================================
   雨夜· Persona — 开启动画 + 雨幕氛围层
   改造版：3 秒开场 / 打字机+故障特效 / 进度条 / 可跳过
   ============================================================ */

/* ---------- 1. 开屏遮罩 ---------- */
#rain-intro {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(1200px 800px at 50% 45%, #0d1b2f 0%, #050b14 70%, #02060c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  will-change: opacity, filter;
  transition: opacity .55s cubic-bezier(.4,0,.2,1),
              filter .55s cubic-bezier(.4,0,.2,1),
              visibility .55s;
}
#rain-intro.leaving {
  opacity: 0;
  filter: blur(14px) brightness(1.35);
  visibility: hidden;
  pointer-events: none;
}

/* 扫描线纹理：铺满遮罩，缓慢下移，制造 CRT/赛博质感 */
#rain-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.028) 0px,
    rgba(255,255,255,.028) 1px,
    transparent 1px,
    transparent 4px
  );
  animation: scanMove 3.2s linear infinite;
  opacity: .6;
}
@keyframes scanMove { from { background-position: 0 0; } to { background-position: 0 40px; } }

/* 中央品牌字 */
#rain-intro .intro-brand {
  position: relative;
  z-index: 3;
  text-align: center;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: .18em;
  color: #eaf6ff;
  text-shadow: 0 0 28px rgba(87,213,255,.55), 0 0 70px rgba(169,139,255,.35);
}
/* t1：打字机容器，每个字符由 JS 包成 <span> */
#rain-intro .intro-brand .t1 {
  display: block;
  font-size: clamp(38px, 9vw, 60px);
  font-weight: 800;
  line-height: 1.15;
  min-height: 1.15em;
}
#rain-intro .intro-brand .t1 .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px) scale(.9);
  animation: chIn .42s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes chIn { to { opacity: 1; transform: translateY(0) scale(1); } }
/* 故障闪现：短暂错位 + 青紫双影 */
#rain-intro.glitch .intro-brand .t1 {
  animation: glitchShake .28s steps(2) 2;
  text-shadow: -3px 0 rgba(87,213,255,.9), 3px 0 rgba(169,139,255,.9), 0 0 30px rgba(255,255,255,.5);
}
@keyframes glitchShake {
  0%   { transform: translate(0, 0) skewX(0); }
  25%  { transform: translate(-2px, 1px) skewX(-6deg); }
  50%  { transform: translate(2px, -1px) skewX(5deg); }
  75%  { transform: translate(-1px, 0) skewX(-2deg); }
  100% { transform: translate(0, 0) skewX(0); }
}
/* t2 副标题 */
#rain-intro .intro-brand .t2 {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .42em;
  color: rgba(155,176,200,.85);
  text-transform: uppercase;
  opacity: 0;
  animation: fadeUp .6s ease-out .7s forwards;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 卖点预告：三行短句依次闪现 */
#rain-intro .intro-teaser {
  position: relative;
  z-index: 3;
  margin-top: 26px;
  height: 20px;
  font-size: 12px;
  letter-spacing: .2em;
  color: rgba(87,213,255,.9);
  text-shadow: 0 0 16px rgba(87,213,255,.5);
}
#rain-intro .intro-teaser span {
  position: absolute;
  left: 0; right: 0;
  opacity: 0;
  animation: tease 0.75s ease-in-out forwards;
}
@keyframes tease {
  0%   { opacity: 0; transform: translateY(6px); filter: blur(4px); }
  25%  { opacity: 1; transform: translateY(0); filter: blur(0); }
  75%  { opacity: 1; transform: translateY(0); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-6px); filter: blur(4px); }
}

/* 进度条：底部一条，明确终点 */
#rain-intro .intro-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  z-index: 4;
  background: rgba(255,255,255,.06);
}
#rain-intro .intro-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #57d5ff, #a98bff);
  box-shadow: 0 0 12px rgba(87,213,255,.8);
  transition: width .08s linear;
}

/* 跳过提示 */
#rain-intro .intro-skip {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  font-size: 11px;
  letter-spacing: .1em;
  color: rgba(155,176,200,.7);
  padding: 6px 12px;
  border: 1px solid rgba(155,176,200,.3);
  border-radius: 999px;
  animation: skipPulse 1.6s ease-in-out infinite;
}
@keyframes skipPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* 光晕呼吸 */
#rain-intro .intro-glow {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(87,213,255,.16) 0%, rgba(169,139,255,.10) 40%, transparent 70%);
  filter: blur(30px);
  animation: glowPulse 2.6s ease-in-out infinite;
  z-index: 1;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(1);    opacity: .75; }
  50%      { transform: scale(1.14); opacity: 1; }
}

/* ---------- 2. 雨幕 ---------- */
#rain-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: .55;
  mix-blend-mode: screen;
}
#rain-layer .rain-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#rain-layer .rain-mist {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(60% 40% at 20% 15%, rgba(87,213,255,.10), transparent 60%),
    radial-gradient(55% 45% at 80% 30%, rgba(169,139,255,.09), transparent 62%),
    radial-gradient(70% 50% at 50% 100%, rgba(40,90,140,.16), transparent 70%);
  filter: blur(28px);
  animation: mistDrift 26s ease-in-out infinite alternate;
}
@keyframes mistDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
}

/* ---------- 3. 页面入场 ---------- */
body.rain-enter .nav,
body.rain-enter .hero,
body.rain-enter .section { animation: sectionRise .8s cubic-bezier(.16,1,.3,1) both; }
body.rain-enter .hero    { animation-delay: .05s; }
body.rain-enter .section { animation-delay: .12s; }
body.rain-enter .section:nth-of-type(2) { animation-delay: .18s; }
body.rain-enter .section:nth-of-type(3) { animation-delay: .24s; }
body.rain-enter .section:nth-of-type(4) { animation-delay: .30s; }
@keyframes sectionRise {
  from { opacity: 0; transform: translateY(22px); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

/* ---------- 4. 降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  #rain-intro { display: none !important; }
  #rain-layer { display: none !important; }
  body.rain-enter .nav,
  body.rain-enter .hero,
  body.rain-enter .section { animation: none !important; }
}

/* ---------- 5. 移动端 ---------- */
@media (max-width: 640px) {
  #rain-intro .intro-brand .t2 { font-size: 10px; letter-spacing: .3em; }
  #rain-intro .intro-teaser { font-size: 10px; }
  #rain-layer { opacity: .38; }
}
