/* 浅色首页 Banner 末位覆盖（链在 hybrid.css 之后）
 * 卡片：文案居中 + 入口四卡叠入 Banner；加高
 * 中性主/次按钮：深/浅共用（白实心 + 白描边 pill）
 */

/* ---------- Banner CTA：深浅同款（压过 .df-btn 浅色边框/悬停） ---------- */
html body .hero-actions:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
html body .hero-actions__btn.df-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  /* 与创作面导航同档：高 36 · 圆角 8，不用 pill */
  min-height: var(--df-hybrid-creative-nav-h, 36px);
  height: var(--df-hybrid-creative-nav-h, 36px);
  padding: 0 20px;
  text-decoration: none;
  line-height: 20px;
  pointer-events: auto;
  border-radius: var(--df-hybrid-creative-nav-radius, 8px);
  font-size: var(--df-font-size-sm, 14px);
  font-weight: var(--df-font-weight-medium, 500);
}
html body .hero-actions__btn--primary.df-btn {
  border: 1px solid #ffffff;
  background: #fffffff2;
  color: #1a1b20;
}
html body .hero-actions__btn--primary.df-btn:hover {
  border-color: #ffffff;
  background: #ffffff;
  color: #111214;
}
html body .hero-actions__btn--secondary.df-btn {
  border: 1px solid #ffffffa6;
  background: #ffffff1a;
  color: #fffffff2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
/* 明亮视频帧上维持白字对比，同时保留玻璃底。 */
html body .hero-actions__btn--secondary.df-btn:is(:hover, :focus-visible),
html[data-theme="light"] body .hero-actions__btn--secondary.df-btn:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--df-palette-black) 28%, transparent);
  border-color: #ffffffd9;
  color: #ffffff;
  box-shadow: inset 0 1px 0 #ffffff3d, 0 0 0 1px #ffffff1f;
}
html body .hero-actions__btn--secondary.df-btn:active,
html[data-theme="light"] body .hero-actions__btn--secondary.df-btn:active {
  background: color-mix(in srgb, var(--df-palette-black) 38%, transparent);
  border-color: #ffffffb3;
  color: #fffffff2;
  box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
  html body .hero-actions__btn--secondary.df-btn { transition: none; }
}
html[data-theme] body .hero-actions__btn.df-btn:focus-visible {
  outline: 2px solid var(--df-color-on-media);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--df-palette-neutral-950);
}

.home-page {
  --df-home-page-gutter: 40px;
  --df-home-banner-inset: var(--df-hybrid-creative-card-radius, 16px);
  /* 1280px 起平滑加高，1440px 增 40px，1920px 封顶 56px。 */
  --df-home-banner-wide-extra: clamp(0px, min(25vw - 320px, (100vw - 240px) / 30), 56px);
  padding-inline: var(--df-home-page-gutter);
}

body:has(.home-page) .hero-section {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  align-items: center;
  grid-template-rows: minmax(calc(clamp(168px, min(16vw, 22vh), 224px) + var(--df-home-banner-wide-extra) + var(--df-home-banner-light-extra, 0px)), auto) auto auto;
  gap: 16px;
  padding: 16px 0 24px;
}

.home-page .hero-section > .home-hero-dots,
.home-page .hero-section > .entry-section {
  margin: 0;
}

.home-page .hero-section > .home-bg-wrapper {
  z-index: -1;
}

/* 仅压暗文案所在的区域，保留主体和边缘的光色。 */
.hero-section .home-bg-mask::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 36% 36% at 52% 25%, color-mix(in srgb, var(--df-palette-black) 38%, transparent) 30%, transparent 100%);
}

.home-page .hero-title {
  font-size: clamp(34px, 3.1vw, var(--df-font-size-home-title));
  line-height: 1.16;
}

.home-page .hero-section > .entry-section {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-page .hero-section .entry-card {
  min-width: 0;
}

/* 深色画面从标题区延伸过入口卡，底部渐隐。 */
body[data-home-hero-surface="bleed"] .hero-section > .home-bg-wrapper {
  inset: -48px calc(-1 * (27px + var(--df-home-page-gutter))) -24px calc(-1 * (var(--sidebar-width) + var(--df-home-page-gutter)));
  min-width: 0;
  max-width: none;
}

body[data-home-hero-surface="bleed"] .hero-section > .home-bg-wrapper .home-bg-video-wrap {
  margin-top: 0;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}

body[data-home-hero-surface="bleed"] .hero-section > .home-bg-wrapper :is(.home-bg-video, .home-bg-still) {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

/* 深色入口卡：压暗左侧文案区，右侧保留背景的光带和彩色反射。 */
body[data-home-hero-surface="bleed"] .hero-section .entry-card-bg {
  --df-entry-glass-ink: var(--df-palette-black);
  --df-entry-glass-light: var(--df-palette-white);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--df-entry-glass-light) 10%, transparent), transparent 28%),
    linear-gradient(100deg,
      color-mix(in srgb, var(--df-entry-glass-ink) 56%, transparent),
      color-mix(in srgb, var(--df-entry-glass-ink) 34%, transparent) 54%,
      color-mix(in srgb, var(--df-entry-glass-ink) 15%, transparent));
  border-color: color-mix(in srgb, var(--df-entry-glass-light) 25%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--df-entry-glass-light) 28%, transparent),
    inset 0 0 10px color-mix(in srgb, var(--df-entry-glass-light) 8%, transparent),
    0 6px 18px color-mix(in srgb, var(--df-entry-glass-ink) 25%, transparent);
  -webkit-backdrop-filter: blur(3px) saturate(1.12);
  backdrop-filter: blur(3px) saturate(1.12);
}

body[data-home-hero-surface="bleed"] .hero-section .entry-card-bg::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: radial-gradient(circle, color-mix(in srgb, var(--df-entry-glass-light) 16%, transparent) .5px, transparent 1px) 0 0 / 4px 4px;
  mask-image: linear-gradient(transparent, var(--df-palette-black) 10%, transparent 38%);
  pointer-events: none;
}

body[data-home-hero-surface="bleed"] .hero-section .entry-card:is(:hover, :focus-visible) .entry-card-bg {
  border-color: color-mix(in srgb, var(--df-entry-glass-light) 44%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--df-entry-glass-light) 40%, transparent),
    inset 0 0 12px color-mix(in srgb, var(--df-entry-glass-light) 12%, transparent),
    0 10px 24px color-mix(in srgb, var(--df-entry-glass-ink) 34%, transparent);
}

/* ---------- 卡片 Banner ---------- */
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"] {
  /* 同心圆：左右贴齐下方模块；仅顶部留白避开导航（勿用四边 shorthand） */
  inset: var(--df-home-banner-inset) 0 0;
  min-width: 0;
  height: auto;
  background: transparent;
  -webkit-mask-image: none;
  mask-image: none;
  overflow: visible;
}
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"] .home-bg-video-wrap {
  margin-top: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: var(--df-hybrid-creative-card-radius, 16px);
  overflow: hidden;
  background: #11151d;
  box-shadow: var(--df-shadow-card-hover, 0 8px 28px #18202e14);
  filter: none;
}
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"] :is(.home-bg-still, .home-bg-video) {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  opacity: 1;
  filter: none;
  transform: none;
  -webkit-mask-image: none;
  mask-image: none;
  object-fit: cover;
}
/* 居中文案：轻顶暗 + 底暗托入口卡；无强左暗 */
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"] .home-bg-mask {
  background:
    linear-gradient(180deg, #00000040 0%, transparent 32%, transparent 52%, #0000004d 100%),
    radial-gradient(ellipse 72% 48% at 50% 22%, #0000002e 0%, transparent 72%);
  -webkit-mask-image: none;
  mask-image: none;
}
/* 浅色卡片：主体略偏中右，对齐前四张留白节奏 */
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"][data-home-hero-id="portal"] :is(.home-bg-still, .home-bg-video) {
  object-position: 58% 46%;
}
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"][data-home-hero-id="ribbons"] :is(.home-bg-still, .home-bg-video) {
  object-position: 55% 40%;
}
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"][data-home-hero-id="splash"] :is(.home-bg-still, .home-bg-video) {
  object-position: 52% 48%;
}
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"][data-home-hero-id="legacy-video"] :is(.home-bg-still, .home-bg-video) {
  object-position: 54% 42%;
}
html[data-theme="light"] .hero-section .home-bg-wrapper[data-home-hero-id="legacy-video"] .home-bg-mask::before {
  background: linear-gradient(180deg, color-mix(in srgb, var(--df-palette-black) 52%, transparent) 0% 52%, transparent 82%);
}
html[data-theme="light"] .home-bg-wrapper[data-home-hero-surface="card"][data-home-hero-id="kling-ambient"] :is(.home-bg-still, .home-bg-video) {
  object-position: 50% 45%;
}

html[data-theme="light"] body[data-home-hero-surface="card"] .hero-section {
  /* 从 1440px 的 0px 平滑增加到 1920px 的 40px。 */
  --df-home-banner-light-extra: clamp(0px, (100vw - 1440px) / 12, 40px);
  margin-bottom: 36px;
  /* 顶 = 上方间隙 + 卡内边；左右/底 = 入口卡间距（同心内环） */
  padding: calc(2 * var(--df-home-banner-inset)) var(--df-home-banner-inset) var(--df-home-banner-inset);
}
html[data-theme="light"] body[data-home-hero-surface="card"] .hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: min(720px, 86%);
  flex-shrink: 0;
}
html[data-theme="light"] body[data-home-hero-surface="card"] .hero-title {
  color: #fffffff2;
  text-shadow: 0 1px 18px #00000059;
}
html[data-theme="light"] body[data-home-hero-surface="card"] .hero-desc {
  color: #ffffffd6;
  text-shadow: 0 1px 12px #00000040;
}
html[data-theme="light"] body[data-home-hero-surface="card"] .hero-actions {
  margin-top: 18px;
}

/* 入口四卡叠在 Banner 内；卡间距 = 左右/底 inset */
html[data-theme="light"] body[data-home-hero-surface="card"] .hero-section > .entry-section {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  flex-shrink: 0;
  gap: var(--df-home-banner-inset);
}
html[data-theme="light"] body[data-home-hero-surface="card"] .entry-card .entry-card-bg {
  background: #fffffff0;
  border: 1px solid #ffffff;
  box-shadow: 0 10px 28px #00000033, inset 0 1px 0 #ffffff;
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
  opacity: 1;
}
html[data-theme="light"] body[data-home-hero-surface="card"] .entry-card:is(:hover, :focus-visible) .entry-card-bg {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 14px 32px #00000040, inset 0 1px 0 #ffffff;
}

/* 低于四张入口并排的舒适宽度时，改成两行，媒体仍铺满其容器。 */
@media (max-width: 1249px) {
  .home-page .hero-section > .entry-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-page .hero-section .entry-card {
    height: 124px;
    padding-inline: 20px;
  }

  .home-page .entry-card__image--cover {
    display: block;
    width: 54px;
    height: 72px;
    right: 20px;
  }

  .home-page .entry-card:has(.entry-card__image--cover) .entry-card__info {
    min-width: 0;
    padding-right: 66px;
  }

}

@media (max-width: 900px) {
  .home-page .entry-card__image--cover {
    display: none;
  }

  .home-page .entry-card:has(.entry-card__image--cover) .entry-card__info {
    padding-right: 0;
  }
}

:is(html[data-theme], html:not([data-theme])) .home-bg-wrapper[data-home-hero-id="kling-ambient"] :is(.home-bg-video, .home-bg-still) {
  z-index: 0;
}

:is(html[data-theme], html:not([data-theme])) .home-bg-wrapper[data-home-hero-id="kling-ambient"] .home-bg-video {
  filter: saturate(1.18) brightness(1.1);
}

:is(html[data-theme], html:not([data-theme])) .home-bg-wrapper[data-home-hero-id="kling-ambient"] .home-bg-video-wrap::before {
  content: "";
  position: absolute;
  inset: -20% -10% 12%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 26% 52% at 42% 15%, color-mix(in srgb, var(--df-color-home-ambient-blue) 70%, transparent), transparent 72%),
    radial-gradient(ellipse 21% 48% at 56% 8%, color-mix(in srgb, var(--df-color-home-ambient-violet) 66%, transparent), transparent 72%),
    radial-gradient(ellipse 23% 52% at 70% 18%, color-mix(in srgb, var(--df-color-home-ambient-coral) 55%, transparent), transparent 74%),
    radial-gradient(ellipse 18% 64% at 96% 22%, color-mix(in srgb, var(--df-color-home-ambient-teal) 64%, transparent), transparent 76%);
  filter: blur(18px) saturate(1.15);
  mix-blend-mode: screen;
  opacity: .72;
  transform-origin: 55% 15%;
  animation: df-home-ambient-flow 12s ease-in-out infinite alternate;
}

.hero-section .home-bg-wrapper[data-home-hero-id="kling-ambient"] .home-bg-mask::before {
  background: linear-gradient(180deg, color-mix(in srgb, var(--df-palette-black) 38%, transparent) 36%, transparent 84%);
}

html[data-theme="dark"] body:is([data-home-hero-id="legacy-video"], [data-home-hero-id="splash"]).home-header-transparent .topbar {
  background: color-mix(in srgb, var(--df-color-bg-console) 72%, transparent);
}

html[data-theme="light"] .hero-section .home-bg-wrapper[data-home-hero-id="kling-ambient"] .home-bg-mask::before {
  /* One full-width gradient keeps the copy area legible as the video changes. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--df-palette-black) 32%, transparent) 0% 46%, transparent 82%);
}

html[data-theme="light"] body[data-home-hero-id="kling-ambient"] :is(.hero-title, .hero-desc) {
  text-shadow: none;
}

@media (max-width: 1199px) {
  html[data-theme="dark"] .hero-section .home-bg-wrapper[data-home-hero-id="kling-ambient"] .home-bg-mask::before {
    background: linear-gradient(180deg, color-mix(in srgb, var(--df-palette-black) 56%, transparent) 42%, transparent 84%);
  }
}
@keyframes df-home-ambient-flow {
  from {
    opacity: .72;
    transform: translate3d(-3%, 1%, 0) scale(1.04);
  }
  to {
    opacity: 1;
    transform: translate3d(3%, -3%, 0) scale(1.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-bg-wrapper[data-home-hero-id="kling-ambient"] .home-bg-video-wrap::before {
    animation: none;
    opacity: .86;
  }
}
