/*
 * 首屏：全屏短视频；往下滚时首屏缓缓后退、压暗，下面的内容像一张圆角面板盖上来（.sheet）。
 * 层次从后往前：画面（慢推）→ 压暗 → 标题与按钮 → 底部「一句话」玻璃条 → 盖上来的面板。
 * 离开首屏后顶部落下胶囊导航（学 Veo）。
 */

/* ── 悬浮导航 ── */
.fnav {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--c-hairline);
  border-radius: var(--r-pill);
  background: var(--c-glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 20px 60px -24px rgba(0, 0, 0, 0.8);
  font-size: var(--fs-small);
  color: var(--c-text-2);
  transform: translate(-50%, -160%);
  opacity: 0;
  transition: transform var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
}

.fnav.is-on { transform: translate(-50%, 0); opacity: 1; }
.fnav .brand { margin-right: 10px; font-size: 15px; }
.fnav .brand-mark img { width: 24px; height: 24px; }
.fnav a:not(.btn):not(.brand) { padding: 7px 14px; border-radius: var(--r-pill); white-space: nowrap; transition: color var(--t-fast), background var(--t-fast); }
.fnav a:not(.btn):not(.brand):hover { color: var(--c-text-strong); background: rgba(255, 255, 255, 0.06); }
.fnav .btn { margin-left: 6px; }

/* ── ① 首屏：粘在顶上，内容面板从下面盖上来 ── */
.hero {
  --card-lift: 150px;
  position: sticky;
  top: 0;
  z-index: 0;
  height: max(100svh, 620px);
  overflow: hidden;
  isolation: isolate;
  background: var(--c-bg-deepest);
}

/* 画面层：开场像睁开眼——从一道细缝睁开、由虚到实；之后随面板盖上来缓缓后退（--cover 由脚本写，0 → 1） */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  transform: scale(calc(1 - var(--cover, 0) * 0.08));
  animation: eye-open var(--t-open) var(--ease) both;
}

@keyframes eye-open {
  0% { clip-path: inset(49.5% 0 49.5% 0); filter: blur(16px) brightness(1.5); }
  55% { filter: blur(3px) brightness(1.1); }
  100% { clip-path: inset(0 0 0 0); filter: none; }
}

.stage-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--t-fade) var(--ease);
}

.stage-layer.is-active { opacity: 1; }

.stage-layer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: slow-push 18s var(--ease) infinite alternate;
}

@keyframes slow-push {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

/* 按了暂停：缓推也一起停住 */
.hero-media.is-paused .stage-layer video { animation-play-state: paused; }

/* 压暗：上沿托住顶栏，下沿压住标题与一句话条，四角暗角；面板盖上来时再整体压暗 */
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 9, 15, 0.55) 0%, transparent 24%, transparent 44%, rgba(8, 9, 15, 0.5) 66%, rgba(8, 9, 15, 0.94) 100%),
    radial-gradient(120% 90% at 50% 40%, transparent 50%, rgba(8, 9, 15, 0.65) 100%);
}

.hero-shade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c-bg-deepest);
  opacity: calc(var(--cover, 0) * 0.7);
}

/* 胶片颗粒：普通叠加，盖在播放中的视频上不做混合模式，省得每一帧都重算 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.hero-content {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  justify-items: center;
  gap: 20px;
  padding: 0 24px calc(var(--card-lift) + var(--r-stage) + clamp(24px, 5vh, 56px));
  text-align: center;
  opacity: calc(1 - var(--cover, 0) * 1.6);
  transform: translateY(calc(var(--cover, 0) * -48px));
}

.hero-title {
  font-size: clamp(52px, 7.6vw, 132px);
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--c-text-strong);
  /* 口号是展示字：标点占半格，「，」后不留一大块空 */
  font-feature-settings: "halt";
  text-shadow: 0 8px 60px rgba(8, 9, 15, 0.45);
  animation: rise 1200ms 1000ms var(--ease) both;
}

.hero-sub {
  font-size: clamp(16px, 1.4vw, 20px);
  letter-spacing: 0.18em;
  color: var(--c-text-2);
  animation: rise 1200ms 1150ms var(--ease) both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
  animation: rise 1200ms 1300ms var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/*
 * ── 一句话卡：骑在面板上沿、一半压在首屏画面上（学 Luma 的提示卡）──
 * 不是输入框（首屏不放输入框，plan/46 D10）：中间那块「一句话」写出当前画面的来历，点卡上任何一处都进创作。
 */
.prompt-card {
  position: relative;
  z-index: 3;
  width: min(860px, 100% - 32px);
  margin: calc(var(--card-lift) * -1) auto 0;
  padding: 22px 22px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-card);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)), rgba(13, 14, 20, 0.6);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow: var(--btn-edge), 0 40px 120px -30px rgba(0, 0, 0, 0.85), 0 30px 100px -50px var(--c-primary-glow);
  animation: rise 1200ms 1500ms var(--ease) both;
}

.prompt-card-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: var(--fs-small);
  letter-spacing: 0.08em;
  color: var(--c-text-3);
}

.prompt-key {
  flex: none;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--c-primary-subtle);
  color: var(--c-primary-soft);
  font-size: var(--fs-tiny);
  letter-spacing: 0.14em;
}

/* 中间一块浅色玻璃板，像 Luma 的输入区，但只是展示：写出这一段画面的一句话 */
.prompt-plate {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  width: 100%;
  min-height: 112px;
  margin-top: 16px;
  padding: 18px 14px 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-panel);
  background: rgba(8, 9, 15, 0.55);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.prompt-plate:hover { border-color: rgba(139, 124, 246, 0.36); background: rgba(8, 9, 15, 0.7); }

.prompt-text {
  flex: 1;
  align-self: flex-start;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.55;
  color: var(--c-text-strong);
}

/* 光标挂在文字末尾：一句话换行时也紧跟最后一个字 */
.prompt-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.16em;
  border-radius: 2px;
  background: var(--c-primary-soft);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* 发送键：与强调胶囊同一套颜色，圆形 */
.prompt-go {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--btn-emphasis-border);
  border-radius: 50%;
  background: var(--btn-emphasis-bg);
  color: var(--c-primary-soft);
  font-size: 18px;
  transition: background var(--t-fast), color var(--t-fast);
}

.prompt-plate:hover .prompt-go { background: var(--btn-emphasis-bg-hover); color: var(--c-text-strong); }

.prompt-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-top: 14px;
}

.prompt-starts { display: flex; flex-wrap: wrap; gap: 8px; }

/* 三个起点：幽灵胶囊的小号 */
.prompt-start {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--btn-ghost-border);
  border-radius: var(--r-pill);
  background: var(--btn-ghost-bg);
  color: var(--btn-ghost-fg);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.prompt-start:hover { background: var(--btn-ghost-bg-hover); border-color: var(--btn-ghost-border-hover); color: var(--c-text-strong); }

.prompt-src { max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text-4); letter-spacing: 0; }

.player-ctl {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
}

.player-ctl [data-hero-index] { min-width: 56px; text-align: center; }

/* 暂停 / 播放：图标用两道竖线和一个三角画出来，不依赖字体里有没有这两个符号 */
.hero-pause { position: relative; }
.hero-pause::before,
.hero-pause::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 3px;
  height: 10px;
  margin-top: -5px;
  border-radius: 1px;
  background: currentColor;
}
.hero-pause::before { left: calc(50% - 4px); }
.hero-pause::after { left: calc(50% + 1px); }
.hero-pause.is-paused::before {
  left: calc(50% - 3px);
  width: 0;
  height: 0;
  margin-top: -6px;
  border-radius: 0;
  background: none;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}
.hero-pause.is-paused::after { display: none; }
.prompt-card .btn-round { width: 32px; height: 32px; font-size: 15px; }

/* 卡片下沿一线进度：这一段放多久、下一段何时来 */
.hero-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-primary-deep), var(--c-primary-soft));
  transform-origin: left;
  transform: scaleX(0);
}

.hero-progress.is-running { animation: bar var(--slide-ms, 9000ms) linear forwards; }

@keyframes bar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ── 盖上来的面板：圆角上沿 + 向上的阴影，首屏之后的所有内容都在它上面 ── */
.sheet {
  --card-lift: 150px;
  /* 新的块级格式化上下文：一句话卡的负外边距不和面板的外边距合并，面板上沿留在原处 */
  display: flow-root;
  position: relative;
  z-index: 1;
  margin-top: calc(var(--r-stage) * -1);
  border-radius: var(--r-stage) var(--r-stage) 0 0;
  background: var(--c-bg);
  box-shadow: 0 -40px 90px -30px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── 窄屏 ── */
@media (max-width: 860px) {
  .fnav a:not(.btn):not(.brand):nth-of-type(n + 3) { display: none; }
  .fnav .brand span { display: none; }
  .hero, .sheet { --card-lift: 120px; }
  .hero { height: max(100svh, 580px); }
  .prompt-card { padding: 16px 14px 14px; }
  .prompt-plate { min-height: 96px; padding: 14px 10px 10px 14px; }
  .prompt-card-foot { flex-direction: column; align-items: stretch; }
  .player-ctl { justify-content: flex-end; }
  .prompt-src { margin-right: auto; }
}

/* 减少动态效果：由 config.js 在 <html> 上加 reduce-motion（系统设置决定，?motion 可强制打开） */
/* 首屏片段本身（缓推、淡入换片、进度条）照常，见 home.js 与 plan/46 D34；开场与文字的动效仍省掉 */
.reduce-motion .hero-media, .reduce-motion .hero-title, .reduce-motion .hero-sub, .reduce-motion .hero-actions, .reduce-motion .prompt-card, .reduce-motion .prompt-text::after { animation: none; }
