/* ============================================================================
   T261013-05 2026-10-13 首屏（Hero）氛围与动效层  v43.9
   ----------------------------------------------------------------------------
   与 style.css 的分工：style.css 保留首屏既有版式与霓虹动画；本文件只负责
   「背景分层 + 逐字点亮 + 质感 + 滚动编排」，且**所有选择器限定在 .hero-container 作用域内**。
   本层为纯装饰：全部 pointer-events:none；关掉 JS 也照常呈现（逐字拆分在 PHP 侧完成）。
   落点：仅 YOGA axiom.yoga（Mango / AXIOM / 166 零改动，铁律十二）。
   回滚：整文件不引用即可（header.php / footer.php 各去掉一行引用）。
   ============================================================================ */

/* ==========================================================================
   ① 背景分层：远景雾 / 中景光尘 / 近景散景 + 街景剪影 + 噪点 + 暗角
   --------------------------------------------------------------------------
   现状是"一层粒子 + 文字"，暗部近黑 #0A0B0D 占比过高 ⇒ 观感发空。
   这里把背景拆成多个**位移系数各不相同**的视差层，建立纵深。
   注意：中景沿用既有 #hero-particle-canvas（js/app.js 的商道路径粒子，**未改动**），
        故不在此给它加 transform，避免与 app.js 的尺寸计算相互干扰。
   ========================================================================== */
.hero-container .static-particles { display: none; }   /* 旧的兜底两团模糊斑，已被下列分层取代 */

.hero-container .fx-layer {
    position: absolute;
    pointer-events: none;
    will-change: transform;
}

/* —— 远景：暖色雾霭（大面积低透明径向渐变 + 重模糊，位移最小、同向） —— */
.hero-container .fx-far {
    inset: -6%;
    z-index: 0;
    background:
        radial-gradient(46% 40% at 22% 26%, rgba(245, 179, 66, 0.13) 0%, rgba(245, 179, 66, 0) 68%),
        radial-gradient(52% 46% at 80% 74%, rgba(108, 52, 131, 0.17) 0%, rgba(108, 52, 131, 0) 70%),
        radial-gradient(60% 50% at 50% 108%, rgba(0, 120, 190, 0.10) 0%, rgba(0, 120, 190, 0) 72%);
    filter: blur(14px);
    transform: translate3d(calc(var(--px, 0) * 10px), calc(var(--py, 0) * -8px), 0);
    animation: fxFarDrift 26s ease-in-out infinite alternate;
}
@keyframes fxFarDrift {
    0%   { filter: blur(14px) saturate(1);   opacity: .85; }
    100% { filter: blur(20px) saturate(1.2); opacity: 1; }
}

/* —— 光尘画布：由 js/hero-fx.js 绘制（WebGL 优先，不可用时回落 2D Canvas） —— */
.hero-container .fx-dust {
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    transform: translate3d(calc(var(--px, 0) * -16px), calc(var(--py, 0) * 12px), 0);
}
/* WebGL 走 screen 叠加发光；2D 回落路径由 JS 加 .is-canvas2d 换成普通叠加 */
.hero-container .fx-dust.is-webgl  { mix-blend-mode: screen; }
.hero-container .fx-dust.is-canvas2d { mix-blend-mode: normal; }

/* —— 街景剪影：中景城市轮廓（内联 SVG 在 index.php，零外部资源） ——
   现状首屏下半屏近 40% 是纯黑空洞；补这层中景，"三层视差"的纵深才真正成立。 */
.hero-container .fx-skyline {
    inset: auto 0 0 0;
    height: 36%;
    z-index: 1;
    opacity: .88;
    transform: translate3d(calc(var(--px, 0) * -22px), calc(var(--py, 0) * 8px), 0);
    /* 顶部渐隐：让屋脊"化"进雾里，避免硬边横切上方内容 */
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 58%, rgba(0,0,0,0) 100%);
            mask-image: linear-gradient(to top, rgba(0,0,0,1) 58%, rgba(0,0,0,0) 100%);
}
.hero-container .fx-skyline svg { display: block; width: 100%; height: 100%; }
.hero-container .fx-skyline .sky-far    { fill: #0d0b12; }
.hero-container .fx-skyline .sky-near   { fill: #08070b; }
.hero-container .fx-skyline .sky-win    { fill: rgba(255, 196, 110, .5); }
.hero-container .fx-skyline .sky-sign-r { fill: rgba(232, 58, 46, .5); }
.hero-container .fx-skyline .sky-sign-c { fill: rgba(0, 229, 255, .38); }

/* —— 近景：大颗散景光斑（少而大、强模糊，位移最大且与鼠标反向） —— */
.hero-container .fx-near {
    inset: -6%;
    z-index: 1;
    transform: translate3d(calc(var(--px, 0) * -34px), calc(var(--py, 0) * 26px), 0);
}
.hero-container .fx-bokeh {
    position: absolute;
    border-radius: 50%;
    filter: blur(16px);
    opacity: .34;
    animation: fxBokehFloat 12s ease-in-out infinite alternate;
}
/* 三段径向渐变让边缘自己化开，避免"灰饼"感 */
.hero-container .fx-bokeh.b1 { left: 12%; top: 30%; width: 78px;  height: 78px;  background: radial-gradient(circle, rgba(255,214,140,.60) 0%, rgba(255,190,100,.22) 38%, rgba(255,180,80,0) 100%);  animation-duration: 13s; }
.hero-container .fx-bokeh.b2 { right: 16%; top: 22%; width: 56px; height: 56px;  background: radial-gradient(circle, rgba(255,140,200,.48) 0%, rgba(255,90,170,.16) 38%, rgba(255,60,150,0) 100%);   animation-duration: 17s; }
.hero-container .fx-bokeh.b3 { left: 24%; bottom: 20%; width: 104px; height: 104px; background: radial-gradient(circle, rgba(140,220,255,.40) 0%, rgba(60,170,255,.13) 38%, rgba(0,140,255,0) 100%);  animation-duration: 21s; }
.hero-container .fx-bokeh.b4 { right: 26%; bottom: 28%; width: 48px; height: 48px; background: radial-gradient(circle, rgba(255,238,200,.55) 0%, rgba(255,210,140,.18) 38%, rgba(255,200,120,0) 100%); animation-duration: 15s; }
@keyframes fxBokehFloat {
    0%   { transform: translate3d(0, 0, 0) scale(1);           opacity: .24; }
    100% { transform: translate3d(10px, -18px, 0) scale(1.12); opacity: .42; }
}
/* v43.9 街景上来后，在线状态那行需要托底阴影才保得住可读性 */
.hero-container .server-status-3d .status-text,
.hero-container .server-status-3d .online-dot {
    text-shadow: 0 1px 6px rgba(0, 0, 0, .85), 0 0 14px rgba(0, 0, 0, .6);
}

/* —— 质感 1：胶片噪点（SVG feTurbulence data-URI，5.5% 叠加，消掉"纯黑塑料感"） —— */
.hero-container .fx-grain {
    inset: 0;
    z-index: 1;
    opacity: .055;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: fxGrainShift 1.2s steps(3) infinite;
}
@keyframes fxGrainShift {
    0%   { transform: translate3d(0, 0, 0); }
    33%  { transform: translate3d(-6px, 4px, 0); }
    66%  { transform: translate3d(4px, -6px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

/* —— 质感 2：暗角（把视觉重心压回标题；文字层 z-index 更高，不受影响） —— */
.hero-container .fx-vignette {
    inset: 0;
    z-index: 1;
    background: radial-gradient(ellipse 78% 70% at 50% 44%, rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, .62) 100%);
}

/* ==========================================================================
   ② 逐字点亮：霓虹灯管逐根"合闸"
   --------------------------------------------------------------------------
   字符级 span（.nch）由 **PHP 在 index.php 内**渲染，不依赖 JS ⇒ 关掉 JS 也照常点亮。
   做法：把行级那套 7s opacity 交替**关掉**，把点亮/熄灭整体下沉到字符级；
        `animation-fill-mode: backwards` 保证"轮到它之前"是灭的 ⇒ 首屏即一次真实的合闸，
        随后进入"青灯逐字亮 → 逐字灭 → 粉灯逐字亮"的循环。
   无障碍：粉灯行是唯一可读文本，拆字后父元素加 aria-label、字符 span 全部 aria-hidden
          （已在 index.php 落地），朗读不受影响。
   ========================================================================== */
.hero-container .hero-title .neon-sign                  { animation: none; }
.hero-container .hero-title .neon-sign .neon-line-latin { animation: none; }
.hero-container .hero-title .neon-sign .neon-line-kana  { animation: none; }

.hero-container .nch {
    display: inline-block;
    animation: neonChar 7s linear infinite;
    animation-fill-mode: backwards;
    will-change: opacity, filter;
}
.hero-container .neon-line-latin .nch { --lo: 0s; }      /* 青灯：周期起点 */
.hero-container .neon-line-kana  .nch { --lo: 3.22s; }   /* 粉灯：46% × 7s */
.hero-container .nch { animation-delay: calc(var(--lo, 0s) + var(--i, 0) * 90ms + var(--j, 0ms)); }

@keyframes neonChar {
    0%    { opacity: 0;   filter: brightness(2.4); }                   /* 合闸瞬间过冲 */
    1.1%  { opacity: .42; filter: brightness(1.9) saturate(.55); }     /* 白热（低饱和≈发白，不是发灰） */
    1.8%  { opacity: 1;   filter: brightness(2.0); }
    2.4%  { opacity: .58; filter: brightness(1.7); }                   /* 启动闪烁 */
    3.2%  { opacity: 1;   filter: brightness(1.5); }
    6%    { opacity: 1;   filter: brightness(1); }                     /* 稳定点亮 */
    40%   { opacity: 1;   filter: brightness(1); }
    43%   { opacity: .35; filter: brightness(1.3); }
    46%   { opacity: 0;   filter: brightness(2); }                     /* 熄灭 */
    100%  { opacity: 0;   filter: brightness(2); }
}

/* ==========================================================================
   ③ 滚动编排（原生 scroll-driven animation，零 JS）
   --------------------------------------------------------------------------
   滚出首屏时：内容块轻微缩小 + 模糊淡出、近景层反向走得更快 ⇒ 产生"推进镜头"的感觉。
   兼容性：`animation-timeline: scroll()` 目前 Chrome / Edge 115+ 支持，
          **Safari / Firefox 不支持** —— 因此整段包在 @supports 里，不支持时**完全等同现状**（优雅降级）。
   ========================================================================== */
@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .hero-container .hero-content-wrapper {
            animation: fxHeroScrollOut linear both;
            animation-timeline: scroll(root block);
            animation-range: 0 78vh;
        }
        .hero-container .fx-near {
            animation: fxNearScrollOut linear both;
            animation-timeline: scroll(root block);
            animation-range: 0 100vh;
        }
        @keyframes fxHeroScrollOut {
            from { transform: scale(1)     translateY(0);     opacity: 1; filter: blur(0); }
            to   { transform: scale(0.945) translateY(-26px); opacity: 0; filter: blur(7px); }
        }
        @keyframes fxNearScrollOut {
            from { margin-top: 0; }
            to   { margin-top: 22vh; }
        }
    }
}

/* —— 滚动提示（首屏底部小箭头，滚过 40px 由 JS 淡出；无 JS 时静止常显） —— */
.hero-container .fx-scrollcue {
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: rgba(232, 230, 240, .5);
    font-family: 'DM Sans', 'Noto Sans SC', sans-serif;
    font-size: 0.66rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    pointer-events: none;
    animation: fxCueFloat 2.6s ease-in-out infinite;
}
.hero-container .fx-scrollcue .fx-cue-line {
    width: 1px;
    height: 34px;
    background: linear-gradient(to bottom, rgba(245, 179, 66, .75), rgba(245, 179, 66, 0));
}
@keyframes fxCueFloat {
    0%, 100% { transform: translate(-50%, 0);   opacity: .55; }
    50%      { transform: translate(-50%, 7px); opacity: .95; }
}
/* 矮屏（横屏手机）不占这块位置 */
@media (max-height: 620px) { .hero-container .fx-scrollcue { display: none; } }

/* ==========================================================================
   ④ 移动端收敛：小屏减少装饰层、缩短合闸节奏，控制开销
   ========================================================================== */
@media (max-width: 768px) {
    .hero-container .fx-bokeh.b3 { width: 72px; height: 72px; }
    .hero-container .fx-bokeh.b4 { display: none; }
    .hero-container .fx-skyline  { height: 30%; }
    .hero-container .nch { animation-delay: calc(var(--lo, 0s) + var(--i, 0) * 70ms + var(--j, 0ms)); }
}

/* ==========================================================================
   ⑤ 无障碍：用户开了"减少动态效果"⇒ 装饰层静止、字符常亮（信息不丢）
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .hero-container .fx-far,
    .hero-container .fx-near,
    .hero-container .fx-bokeh,
    .hero-container .fx-grain,
    .hero-container .fx-scrollcue,
    .hero-container .fx-dust { animation: none; }
    .hero-container .fx-far,
    .hero-container .fx-near,
    .hero-container .fx-dust,
    .hero-container .fx-skyline { transform: none; }
    .hero-container .nch { animation: none; opacity: 1; filter: none; }
}
