/* =========================================================
   宁中风云榜 · 开屏
   纸面 + 毛笔书写：光晕铺开 → 双环描出 → 校名从左推扫写出
   → 细线展开 → 进度走满 → 淡出进入首页
   所有规则都限定在 #nz-boot 内，不影响站点其余样式
   ========================================================= */

html.nz-lock,
html.nz-lock body { overflow: hidden !important; }

#nz-boot {
  --paper: #FBFAF6;
  --ink: #14181F;
  --blue: #1B4C9B;
  --green: #2E9E6B;
  --gray: #8A8375;
  --ease: cubic-bezier(.2, .9, .25, 1);

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, #FFFDFA 0%, #FAF7EF 55%, #F0EBDE 100%);
  opacity: 1;
  transition: opacity .58s ease;
  -webkit-tap-highlight-color: transparent;
}

#nz-boot.is-out { opacity: 0; }

/* 中心微光 */
#nz-boot .nb-bloom {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(150vmax, 1500px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.82);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255, 255, 255, .78) 42%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  animation: nbBloom .95s ease-out .05s forwards;
}

@keyframes nbBloom {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 底部山水 */
#nz-boot .nb-mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* 光晕圆环 */
#nz-boot .nb-ring {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(52vmin, 540px);
  aspect-ratio: 1;
  pointer-events: none;
}

#nz-boot .nb-ring circle {
  fill: none;
  stroke-width: 1;
  stroke-dasharray: 1634;
  stroke-dashoffset: 1634;
}

#nz-boot .nb-ring .c1 { stroke: var(--blue); stroke-opacity: .16; animation: nbDraw 1.1s cubic-bezier(.6, 0, .4, 1) .28s forwards; }
#nz-boot .nb-ring .c2 { stroke: var(--green); stroke-opacity: .13; animation: nbDraw 1.4s cubic-bezier(.6, 0, .4, 1) .5s forwards; }

@keyframes nbDraw { to { stroke-dashoffset: 0; } }

/* 中央内容 */
#nz-boot .nb-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-inline: clamp(16px, 5vw, 48px);
  transform: translateY(-2vh);
  /* transform/animation 会形成层叠上下文，导致 img 的 multiply 只与透明背景混合，
     出现白色方块。把混合提到这一层，就能与纸面正确相乘 */
  mix-blend-mode: multiply;
  animation: nbBreathe 7s ease-in-out 3.4s infinite alternate;
}

@keyframes nbBreathe {
  from { transform: translateY(-2vh) scale(1); }
  to   { transform: translateY(-2vh) scale(1.006); }
}

#nz-boot .nb-lockup {
  position: relative;
  /* 取「设计宽度」和「容器可用宽度」的较小值，窄屏永不溢出 */
  width: min(clamp(240px, 42vw, 640px), 100%);
  max-width: 100%;
  line-height: 0;
}

#nz-boot .nb-lockup img {
  width: 100%;
  height: auto;
  display: block;
  mix-blend-mode: multiply;              /* 白底融入纸面 */
  clip-path: inset(0 100% 0 0);
  animation: nbWrite 1.75s var(--ease) .38s forwards;
  will-change: clip-path;
}

@keyframes nbWrite { to { clip-path: inset(0 0 0 0); } }

/* 笔锋光边，跟随推扫 */
#nz-boot .nb-edge {
  position: absolute;
  top: 8%;
  height: 84%;
  width: 2px;
  left: 0;
  background: linear-gradient(180deg,
      transparent,
      rgba(27, 76, 155, .42) 35%,
      rgba(46, 158, 107, .42) 70%,
      transparent);
  filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  animation: nbEdgeMove 1.75s var(--ease) .38s forwards;
}

@keyframes nbEdgeMove {
  0%   { left: 0; opacity: 0; }
  12%  { opacity: .9; }
  88%  { opacity: .6; }
  100% { left: 100%; opacity: 0; }
}

/* 细线 */
#nz-boot .nb-rule {
  width: 0;
  height: 1px;
  margin-top: clamp(26px, 4.6vh, 48px);
  background: linear-gradient(90deg,
      rgba(27, 76, 155, 0),
      rgba(27, 76, 155, .85) 30%,
      rgba(46, 158, 107, .85) 70%,
      rgba(46, 158, 107, 0));
  animation: nbRuleGrow .85s var(--ease) 2s forwards;
}

@keyframes nbRuleGrow { to { width: clamp(64px, 9vw, 96px); } }

#nz-boot .nb-hint {
  margin-top: 22px;
  font-size: 12px;
  letter-spacing: .34em;
  text-indent: .34em;
  color: var(--gray);
  opacity: 0;
  transform: translateY(6px);
  animation: nbFadeUp .7s ease-out 1.95s forwards;
}

@keyframes nbFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* 底部载入 */
#nz-boot .nb-loader {
  position: absolute;
  left: 50%;
  bottom: clamp(40px, 7vh, 74px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: nbFadeIn .8s ease-out 2.15s forwards, nbLoaderOut .55s ease 3.4s forwards;
}

#nz-boot .nb-loader .txt {
  font-size: 10px;
  letter-spacing: .22em;
  text-indent: .22em;
  color: #ADA592;
}

#nz-boot .nb-track {
  width: 160px;
  height: 2px;
  border-radius: 1px;
  background: #E4DFD2;
  overflow: hidden;
}

#nz-boot .nb-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  animation: nbFill 1.15s cubic-bezier(.55, .1, .35, 1) 2.25s forwards;
}

@keyframes nbFill { to { width: 100%; } }
@keyframes nbFadeIn { to { opacity: 1; } }
@keyframes nbLoaderOut { to { opacity: 0; } }

/* 角标 */
#nz-boot .nb-mark {
  position: absolute;
  font-size: 9px;
  letter-spacing: .2em;
  color: #B5AD9B;
}

#nz-boot .nb-mark.l { left: clamp(16px, 3.4vw, 48px); bottom: clamp(14px, 2.6vh, 26px); }
#nz-boot .nb-mark.r { right: clamp(16px, 3.4vw, 48px); bottom: clamp(14px, 2.6vh, 26px); }

/* 窄屏 */
@media (max-width: 560px) {
  #nz-boot .nb-hint { font-size: 11px; }
  #nz-boot .nb-mark { font-size: 8px; letter-spacing: .14em; }
  #nz-boot .nb-mark.r { display: none; }
}

/* 尊重系统的减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  #nz-boot .nb-bloom,
  #nz-boot .nb-ring .c1,
  #nz-boot .nb-ring .c2,
  #nz-boot .nb-lockup img,
  #nz-boot .nb-rule,
  #nz-boot .nb-hint,
  #nz-boot .nb-loader,
  #nz-boot .nb-track i {
    animation-duration: .45s !important;
    animation-delay: .02s !important;
  }
  #nz-boot .nb-edge { display: none; }
  #nz-boot .nb-center { animation: none; }
}
