/* ============================================================================
   FUYAO Hero — 动态主视觉样式 v2（视频版）
   ----------------------------------------------------------------------------
   素材：demos/a/video/hero-bg.mp4（1280×720 / 10.01s / 3.07MB / 无水印）
   降级：视频失败或 reduced-motion → poster 静态图
   ========================================================================== */

.fy-hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #F5F2EC;
  --fy-ease: cubic-bezier(0.22, 1, 0.30, 1);
}

/* ============================================================================
   L0 主视觉视频 + poster
   ========================================================================== */
.fy-hero__video,
.fy-hero__poster {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 构图锚点：主瓶在画面中部偏左，右侧是河流与瓶群。
     58% 52% 让主瓶落在视觉中心偏左，河流与右侧瓶群完整可见。 */
  object-position: 58% 52%;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* poster 始终在视频下方兜底；视频就绪后视频盖住它 */
.fy-hero__poster { z-index: 0; }
.fy-hero__video {
  z-index: 1;
  opacity: 0;
  transition: opacity .8s var(--fy-ease);
}
.fy-hero[data-video-ready="true"] .fy-hero__video { opacity: 1; }

/* 视频失败：彻底隐藏 video 元素，poster 顶上 */
.fy-hero[data-video-failed="true"] .fy-hero__video { display: none; }

/* 自动播放被拒：保留 poster（video 停在第一帧，视觉一致） */
.fy-hero[data-video-blocked="true"] .fy-hero__video { opacity: 1; }

/* 色调层 */
.fy-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(64% 56% at 4% 22%,
      rgba(252, 249, 243, .38) 0%,
      rgba(252, 249, 243, .10) 44%,
      rgba(252, 249, 243, 0) 68%),
    linear-gradient(to top,
      rgba(74, 60, 44, .15) 0%,
      rgba(74, 60, 44, .04) 14%,
      rgba(74, 60, 44, 0) 28%);
}

/* ============================================================================
   L1 环境氛围
   ========================================================================== */
.fy-hero__atmos {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  will-change: transform;
  background:
    radial-gradient(44% 32% at 22% 28%, rgba(255, 249, 238, .18) 0%, transparent 68%),
    radial-gradient(36% 28% at 80% 20%, rgba(255, 242, 224, .13) 0%, transparent 70%),
    radial-gradient(50% 24% at 52% 76%, rgba(236, 216, 246, .09) 0%, transparent 72%);
  animation: fyAtmosBreath 19s ease-in-out infinite;
}
@keyframes fyAtmosBreath {
  0%, 100% { opacity: .84; }
  50%      { opacity: 1; }
}

/* ============================================================================
   L2 河流 SVG（几何由 JS 按 cover 设置，与视频严格对齐）
   ========================================================================== */
.fy-hero__river {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
  opacity: .52;
  transition: opacity .5s var(--fy-ease);
  mix-blend-mode: screen;
}
.fy-hero[data-river-near="true"] .fy-hero__river { opacity: .80; }

/* ============================================================================
   L3 粒子
   ========================================================================== */
.fy-hero__dust {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: .72;
  mix-blend-mode: screen;
}

/* ============================================================================
   L4a 鼠标聚光
   ========================================================================== */
.fy-hero__spot {
  position: absolute;
  left: 0; top: 0;
  z-index: 6;
  width: 500px;
  height: 500px;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 252, 244, .28) 0%,
    rgba(255, 245, 228, .16) 26%,
    rgba(255, 238, 214, .065) 48%,
    rgba(250, 228, 242, .022) 66%,
    rgba(250, 228, 242, 0) 78%);
  mix-blend-mode: soft-light;
  filter: blur(2px);
}

/* ============================================================================
   L4a1 右侧产品瓶群
   ----------------------------------------------------------------------------
   素材：甲方提供 7 张白底产品图，抠成透明 WebP（多尺寸）
   动效：各自独立的正弦悬浮（周期错开）+ 鼠标视差（靠前位移更多）
   ========================================================================== */
.fy-hero__products {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.fy-hero__product {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  will-change: transform;
  /* 轻投影让瓶子从背景里透出来，别太重 */
  filter: drop-shadow(0 8px 20px rgba(120, 92, 58, .13));
}

@media (prefers-reduced-motion: reduce) {
  .fy-hero__product { filter: none; }
}

/* ============================================================================
   L4a2 透明瓶身（方案 A —— 真正可独立运动的瓶子）
   ----------------------------------------------------------------------------
   素材来源：两段 Gemini 视频（含瓶 hero-bg.mp4 / 无瓶 hero-bg-clean.mp4）
             逐帧差分抠出的 RGBA 瓶身
   为什么可行：底层视频已换成「无瓶版本」，所以叠加的瓶子是唯一的一只，
             不会出现「原瓶还在视频里 + 叠加瓶又移动」的双重影像。
   位置：JS 按视频封面几何（cover）+ 归一化坐标换算，随窗口尺寸自适应
   ========================================================================== */
.fy-hero__bottle {
  position: absolute;
  left: 0; top: 0;
  z-index: 4;
  pointer-events: none;
  will-change: transform;
  transform-origin: 50% 94%;
  /* 极轻投影，让瓶子与背景有呼吸感；不能重，重了像剪纸 */
  filter: drop-shadow(0 12px 30px rgba(120, 92, 58, .15));
  transition: filter .45s var(--fy-ease);
}
.fy-hero__bottle[data-hover="true"] {
  filter:
    drop-shadow(0 20px 40px rgba(130, 98, 58, .24))
    drop-shadow(0 0 26px rgba(255, 236, 202, .28));
}

/* ============================================================================
   L4b 瓶身悬停光晕（跟随瓶身位置）
   ========================================================================== */
.fy-hero__bottle-glow {
  position: absolute;
  left: 0; top: 0;
  z-index: 6;
  width: 210px;
  height: 330px;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  background:
    radial-gradient(56% 44% at 50% 40%,
      rgba(255, 248, 232, .28) 0%,
      rgba(255, 240, 214, .12) 40%,
      rgba(255, 236, 206, .035) 62%,
      rgba(255, 236, 206, 0) 78%),
    linear-gradient(to right,
      rgba(255, 242, 218, .16) 0%,
      rgba(255, 242, 218, 0) 15%,
      rgba(255, 242, 218, 0) 85%,
      rgba(255, 242, 218, .16) 100%);
  mix-blend-mode: screen;
  filter: blur(6px);
  transition: opacity .42s var(--fy-ease);
}

/* ============================================================================
   L5 内容
   ========================================================================== */
.fy-hero__content {
  position: relative;
  z-index: 7;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* ============================================================================
   减少动效：视频暂停由 JS 处理，这里关掉所有附加效果
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .fy-hero__atmos { animation: none; opacity: 1; }
  .fy-hero__river { opacity: .40; transition: none; }
  .fy-hero__dust,
  .fy-hero__spot,
  .fy-hero__bottle-glow { display: none; }
  .fy-hero__video { transition: none; }
}

/* ============================================================================
   响应式：构图锚点随屏幕比例调整，保证主瓶不被裁掉
   ========================================================================== */
@media (max-width: 1240px) {
  .fy-hero__video,
  .fy-hero__poster { object-position: 59% 52%; }
}

@media (max-width: 900px) {
  .fy-hero__video,
  .fy-hero__poster { object-position: 55% 58%; }
  .fy-hero__scrim {
    background:
      linear-gradient(to bottom,
        rgba(252, 249, 243, .48) 0%,
        rgba(252, 249, 243, .14) 30%,
        rgba(252, 249, 243, 0) 50%),
      linear-gradient(to top,
        rgba(74, 60, 44, .20) 0%,
        rgba(74, 60, 44, 0) 22%);
  }
  .fy-hero__spot { width: 360px; height: 360px; }
  .fy-hero__bottle-glow { width: 170px; height: 270px; }
}

@media (max-width: 640px) {
  /* 手机端关键调整（实测）：
     · 视频 16:9 在 375×812 竖屏 cover 后 drawH=812=VH，**纵向无裁切空间**
     · 横向只能看到 26% 宽，主瓶宽 222px 占屏 59%
     · 主瓶原始纵向位置 y 27.8%~71.2%，与文字区必然重叠
     解法：object-position 取 30%（唯一能让主瓶完整可见的取值）
           + 纵向 100% 让瓶子沉到画面下部
           + 文字压缩到 y<290，落在主瓶上方的天空区 */
  .fy-hero__video,
  .fy-hero__poster { object-position: 30% 100%; }
  .fy-hero__dust { opacity: .55; }
}

/* 超窄/矮屏（iPhone SE 375×667）：极限情况，需专门取值
   实测该尺寸下：
     · 主瓶屏幕 y 185~475，文字到 y≈252 → 必然重叠 67px
     · pos-x 20% 时主瓶落在 x 191~374（完整且靠右），避开左侧文字
     · 20% 是唯一同时满足「完整可见 + 不压文字」的取值 */
@media (max-width: 640px) and (max-height: 700px) {
  .fy-hero__video,
  .fy-hero__poster { object-position: 20% 88%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .fy-hero__video,
  .fy-hero__poster { object-position: 58% 50%; }
}
