/* 首屏动效(移动端)。
 * 结构:.hero-track 高 140vh 提供滚动距离,里面的 .hero 吸顶占满一屏。
 * 层级(从下到上):截图 z 1 → 变化模糊层 z 2 → 文字 z 3。
 * 截图在模糊层下面,文字压在糊过的截图上,读得清。
 * 滚动进度 --p(0→1)由 hero.js 写入。文字和模糊层一起向上离场、淡出,
 * 露出下面的截图;截图同时从 0.84 放大到 1。
 * 只在 ≤880px、有 JS、且没有「减少动效」偏好时启用。
 * 其余情况沿用 site.css 里的 .hero 布局,不加载这些效果。 */

/* 模糊层默认不显示(桌面和非动效状态) */
.hero-glass { display: none; }

/* ── 动效状态 ── */
.hero-track.is-live {
  height: 140vh;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
.hero-track.is-live .hero {
  position: sticky;
  top: 0;
  display: block;
  height: 100vh;
  height: 100svh;
  padding: 0;
  overflow: hidden;
}

/* 文字:顶部起排,随 --p 上移、淡出。淡出放在 p 的后 60%,前段保持清晰。 */
.hero-track.is-live .hero-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  padding: 104px 22px 0;
  transform: translate3d(0, calc(var(--p, 0) * -64vh), 0);
  opacity: clamp(0, calc(1 - (var(--p, 0) - 0.4) / 0.6), 1);
  will-change: transform, opacity;
}
.hero-track.is-live .hero__icon { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 16px; }
.hero-track.is-live .hero__meta,
.hero-track.is-live .hero__note { display: none; }

/* ── 变化模糊 ──
 * 每层都是一块同样位置、同样大小的 backdrop-filter,只是半径和遮罩不同。
 * 叠起来后,顶部四层都糊(等效约 34px),往下层数递减,底部只剩 3px。
 * 每层的遮罩只盖自己那一段,交界处靠遮罩渐隐,所以看不出台阶。
 * 层与层之间不能放 opacity/filter 的父容器,否则子层的 backdrop 会被截断,
 * 所以 transform 和 opacity 写在每一层自己身上。 */
.hero-track.is-live .hero-glass {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 74%;
  z-index: 2;
  pointer-events: none;
  transform: translate3d(0, calc(var(--p, 0) * -64vh), 0);
  opacity: max(0, calc(1 - var(--p, 0) * 1.2));
  will-change: transform, opacity;
}
.hero-track.is-live .hero-glass--1 {
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 25%, transparent 50%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 25%, transparent 50%);
}
.hero-track.is-live .hero-glass--2 {
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 65%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 65%);
}
.hero-track.is-live .hero-glass--3 {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 80%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 80%);
}
.hero-track.is-live .hero-glass--4 {
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
}
/* 底色:不含 backdrop,只是一层从上到下渐隐的主题玻璃色,保证文字可读 */
.hero-track.is-live .hero-glass--tint {
  background: linear-gradient(to bottom, var(--glass-sheet) 0%, var(--glass-sheet) 35%, transparent 100%);
}

/* 截图:底部对齐。从视口下方 8vh 处、缩到 0.84 开始,随 --p 升到底部、放到 1。
 * z-index 1 在模糊层之下:模糊层盖住截图,文字在最上面。 */
.hero-track.is-live .phone-wrap {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  width: min(88vw, 360px);
  justify-self: auto;
  transform-origin: 50% 100%;
  transform: translate3d(-50%, calc((1 - var(--p, 0)) * 8vh), 0) scale(calc(0.84 + var(--p, 0) * 0.16));
  will-change: transform;
}
.hero-track.is-live .float { display: none; }
