/* ===== Hero ===== */
.hero {
  position: relative;
  height: 406px;
  padding-top: 160px;
  overflow-x: clip;
  background: var(--bg);
}

.hero__rain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  overflow: hidden;
  font-family: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
  line-height: 14px;
  letter-spacing: 0.2em;
  color: var(--bg);
  white-space: pre;
  text-align: center;
  word-break: break-all;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 8%, #000 42%, transparent 82%);
  mask-image: radial-gradient(120% 90% at 50% 8%, #000 42%, transparent 82%);
}

.hero__light {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1440px;
  max-width: none;
  height: 540px;
  pointer-events: none;
  z-index: 1;
  -webkit-mask-image: radial-gradient(ellipse 55% 55% at 50% 45%, #000 30%, transparent 70%);
  mask-image: radial-gradient(ellipse 55% 55% at 50% 45%, #000 30%, transparent 70%);
}

.hero__fade {
  position: absolute;
  top: 320px;
  left: 0;
  right: 0;
  height: 400px;
  background: linear-gradient(180deg, rgba(235, 239, 245, 0) 0%, rgba(235, 239, 245, 1) 70%);
  z-index: 1;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
  max-width: 576px;
  margin: 0 auto;
}

.hero__title {
  margin: 0;
  /* 与三个产品页 hero 标题统一的流式字号（覆盖 .heading-xl 的固定档位 64→48→36）：
     桌面封顶 64px、随视口平滑收缩，保证任意宽度下与子页面 hero 字号一致。 */
  font-size: clamp(28px, 8.4vw, 64px);
  line-height: 1.25;
}

/* 英文态：.hero__content 的 max-width:576px 是按中文 7 字掐的，英文标题约 590px 会被挤折行；
   标题保持单行居中溢出容器（不改容器宽度），流式字号保证 320px 视口下也不超屏 */
html[lang="en"] .hero__title {
  white-space: nowrap;
}

.hero__subtitle {
  margin: 0;
  color: var(--text-primary);
  opacity: 0.9;
}

/* ===== Products ===== */
.products {
  position: relative;
  padding: 0;
  z-index: 5;
}

/* Full-bleed stage clips horizontal overflow and fades both edges */
.products__stage {
  overflow: hidden;
  padding: 48px 0;
  margin: -48px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 120px, #000 calc(100% - 120px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 120px, #000 calc(100% - 120px), transparent 100%);
}

/* Content box aligned with the nav bar (max-width 1024, centered) */
.products__content {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
}

/* Let the track bleed past the centered content box */
.products__stage > .products__content {
  overflow: visible;
}

.products__grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: max-content;
  height: 536px;
  transform: translateX(0);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card {
  position: relative;
  flex: 0 0 auto;
  width: 320px;
  height: 536px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-card);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  cursor: pointer;
}

.product-card--active {
  width: 696px;
}

/* Frosted glass tint over the background image (matches design) */
.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.product-card__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.product-card__header {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  padding: 48px 48px 0 48px;
}

.product-card__title {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 500;
  line-height: normal;
  white-space: nowrap;
  color: var(--text-primary);
}

.product-card__desc {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: #000000;
  white-space: nowrap;
}

/* Screenshot shown on every card; clipped by the narrow width when collapsed.
   切图（中/英文版均为 1376×788 @2x）已自带 8px 白描边、投影及左 40px/上 20px 边距，
   故 CSS 不再画描边/投影，定位按「设计位 56/170 − 切图内边距 40/20」偏移，
   宽度取 @2x 切图的一半（1:2 原比例） */
.product-card__shot {
  position: absolute;
  left: 16px;
  top: 150px;
  width: 688px; /* 1376 ÷ 2 */
  max-width: none;
  height: auto;
  z-index: 2;
}

.product-card__btn {
  position: absolute;
  top: 48px;
  right: 48px;
  z-index: 4;
  gap: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.4s ease, width 0.35s ease, padding 0.35s ease,
    border-radius 0.35s ease;
}

.product-card__btn-label {
  display: inline-block;
  max-width: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.35s ease, opacity 0.25s ease;
}

.product-card--active .product-card__btn {
  opacity: 1;
  pointer-events: auto;
}

/* Hover expands the icon button into a pill with the label (Figma 展开 state) */
.product-card__btn:hover {
  width: 136px;
  padding: 0 18px 0 24px;
  border-radius: var(--radius-pill);
  gap: 4px;
}

.product-card__btn:hover .product-card__btn-label {
  max-width: 90px;
  opacity: 1;
}

/* 英文态：展开宽度是按中文「了解更多」（64px）掐的，"Learn more" 约 82px 会被截断；
   按「左边距 24 + 文案 82 + 间距 4 + 箭头 20 + 右边距 18」另给一档 */
html[lang="en"] .product-card__btn:hover {
  width: 154px;
}

html[lang="en"] .product-card__btn:hover .product-card__btn-label {
  max-width: 100px;
}

@media (max-width: 1024px) {
  .products__stage {
    overflow: visible;
    padding: 0;
    margin: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
  /* Tablet and below: the JS transform carousel is replaced by a native
     horizontal swipe strip (CSS scroll-snap). The old 2+1 wrap grid left
     the third card alone on a second row at ~900px widths. */
  .products__content {
    padding: 0;
  }
  .products__grid {
    flex-wrap: nowrap;
    width: auto;
    height: auto;
    transform: none;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 40px;
    padding: 8px 40px 32px; /* room for card shadows + the visible scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(114, 92, 255, 0.35) rgba(9, 12, 12, 0.05);
    -webkit-overflow-scrolling: touch;
  }
  /* A slim accent scrollbar doubles as a "there's more to swipe" affordance
     (the strip used to hide it entirely, which made the overflow invisible). */
  .products__grid::-webkit-scrollbar {
    height: 6px;
  }
  .products__grid::-webkit-scrollbar-track {
    background: rgba(9, 12, 12, 0.05);
    border-radius: 9999px;
  }
  .products__grid::-webkit-scrollbar-thumb {
    background: rgba(114, 92, 255, 0.35);
    border-radius: 9999px;
  }
  .products__grid::-webkit-scrollbar-thumb:hover {
    background: rgba(114, 92, 255, 0.6);
  }
  .product-card,
  .product-card--active {
    width: min(56vw, 440px);
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 24px;
    scroll-snap-align: center;
  }
  /* Card interior switches to the vertical flow (title → desc → shot) */
  .product-card__header {
    position: static;
    padding: 32px 24px 0;
  }
  .product-card__title,
  .product-card__desc {
    white-space: normal;
  }
  .product-card__title {
    padding-right: 56px; /* clear the top-right circular button */
  }
  .product-card__btn {
    opacity: 1;
    pointer-events: auto;
    top: 24px;
    right: 24px;
  }
  .product-card__shot {
    position: static;
    left: auto;
    top: auto;
    width: 100%; /* 切图自带边距与描边，占满卡宽即可 */
    max-width: none;
    margin: 12px 0 0;
    align-self: center;
  }
  /* Higher specificity than the later base `.carousel-arrows` rule, which
     would otherwise win the cascade and keep the arrows visible. */
  .products .carousel-arrows {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Phone sizing for the shared swipe strip: narrower cards and 20px
     gutters aligned with the nav's mobile padding. */
  .products__grid {
    scroll-padding: 0 20px;
    padding: 8px 20px 32px;
  }
  .product-card,
  .product-card--active {
    width: min(80vw, 336px);
  }
}

/* ===== Capability ===== */
.capability {
  position: relative;
  z-index: 1;
  padding: 128px 0 0;
}

/* 左右边距与导航栏 .nav 保持一致：1024 居中，≤768 两侧 20px */
.capability .container {
  max-width: 1024px;
  padding: 0;
}

@media (max-width: 768px) {
  .capability .container {
    padding: 0 20px;
  }
}

.capability__header {
  position: relative; /* containing block for the glow video */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  /* 960px 而非 900px：英文标题第二句单行需 924px，900px 会把它挤成两行（共 3 行） */
  max-width: 960px;
  margin: 0 auto 80px;
}

.capability__title-wrap {
  /* Intentionally not positioned: the glow video must use .capability__header
     (full header width) as its containing block, not the narrower title box. */
}

/* Glow spans exactly the header width and is centered on it, so it can
   never bleed past the viewport at any screen size (the old fixed 1280px
   box anchored left:-144px produced a page-wide horizontal scrollbar).
   The radial mask already fades to transparent at 72% of the radius, so
   the light never touches the header edges. */
.capability__glow {
  position: absolute;
  top: -72px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 480px;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 35%, transparent 72%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 35%, transparent 72%);
}

.capability__header .body-lg,
.capability__title-wrap h2 {
  position: relative;
  z-index: 1;
  margin: 0;
}

.capability__header .body-lg {
  font-size: 16px;
  /* 描述文字仍沿用 900px 行宽，不随标题容器一起变宽 */
  max-width: 900px;
  margin: 0;
}

.capability__grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capability-card {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-card);
  container-type: inline-size;
}

.capability-card__info {
  /* shrink 取近零：与 __visual 的大 shrink 权重配合，保证短缺空间几乎全由配图消化，
     否则按比例分摊的几十像素会让英文标题差几像素不够而折行；
     配图冻结在 min-width 后本区仍可继续收缩，窄视口不会溢出 */
  flex: 1 0.001 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 48px 48px 48px 56px;
}

.capability-card__logo {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.capability-card__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.capability-card__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.capability-card__dot {
  flex: 0 0 auto;
  margin-top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 4px solid transparent;
  background: var(--rainbow) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.capability-card__title {
  margin: 0;
  font-size: clamp(22px, 6vw, 48px);
  font-weight: 500;
  background: linear-gradient(153deg, #725CFF 0%, #090C0C 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.capability-card__metric {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: 42px;
}

.capability-card__metric-label,
.capability-card__first {
  white-space: nowrap;
}

.capability-card__metric-label {
  font-size: clamp(16px, 4.5vw, 30px);
  font-weight: 500;
  color: var(--text-primary);
}

.capability-card__first {
  font-size: clamp(16px, 4.5vw, 30px);
  font-weight: 500;
  background: var(--rainbow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.capability-card__detail {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: var(--text-primary);
}

.capability-card__visual {
  position: relative;
  /* shrink 权重给大：空间不够时优先压缩配图而非文字区，
     避免英文标题（如 "Hears Accurately" 48px 约 388px）被挤折行；
     配图压到 min-width 300px 后文字区才开始收缩 */
  flex: 0 999 416px;
  min-width: 300px;
  min-height: 280px;
  overflow: hidden;
}

.capability-card__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capability-card__visual::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 120px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
}

/* ===== Carousel arrows ===== */
.carousel-arrows {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.carousel-arrow {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--glass-white-30);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.carousel-arrow svg {
  width: 24px;
  height: 24px;
}

.carousel-arrow--disabled {
  opacity: 0.2;
  cursor: default;
}

@media (max-width: 1024px) {
  .capability-card {
    flex-direction: column;
  }
  .capability-card__visual {
    flex: 0 0 auto;
    width: 100%;
    /* Without a definite height here, the img's height:100% falls back to
       the image's intrinsic ratio and the illustration stretches the card
       hundreds of px tall; a fixed ratio keeps the height tied to width. */
    min-height: 0;
    aspect-ratio: 16 / 7;
  }
  .capability-card__visual::after {
    width: 100%;
    height: 80px;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
  }
}

@media (max-width: 768px) {
  /* Smaller glow box on phones: less video overdraw behind the header. */
  .capability__glow {
    height: 360px;
  }
  /* Compact card: tighter padding, smaller gaps, and a short fixed-ratio
     visual strip instead of the 220px-min-height illustration block. */
  .capability-card__info {
    padding: 24px 20px;
    gap: 16px;
  }
  .capability-card__text {
    gap: 8px;
  }
  .capability-card__metric {
    min-height: 0;
  }
  .capability-card__detail {
    font-size: 14px;
    line-height: 22px;
  }
}

/* Component-level adaptation: when the card itself is narrow (phones),
   shrink the logo and tighten the gap while keeping logo + text in one
   row — stacking the logo above the text made the card too tall. */
@container (max-width: 520px) {
  .capability-card__info {
    gap: 16px;
  }
  .capability-card__logo {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
  }
}

/* ===== Bottom Content ===== */
.bottom_content {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 640px;
  margin: -40px auto 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* 幻彩光晕：默认用 CSS 径向渐变作为降级底图（无 WebGL2 时可见）；
   JS 挂载 WebGL2 Aurora 呼吸光晕动效后，追加 --live 状态移除静态渐变，改由 <canvas> 渲染。
   底色 #EBEFF5（--bg，与 body/上方区块一致）由 .bottom_content 自身背景提供，这里只叠加边角彩色光晕并渐隐为透明，与底色融合，因此无硬边界、可随页面自然缩放 */
.bottom_content__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(48% 62% at 5% 100%, rgba(51, 173, 255, 0.45) 0%, rgba(51, 173, 255, 0) 62%),
    radial-gradient(52% 58% at 50% 114%, rgba(138, 160, 245, 0.40) 0%, rgba(138, 160, 245, 0) 60%),
    radial-gradient(50% 66% at 96% 100%, rgba(230, 110, 255, 0.50) 0%, rgba(230, 110, 255, 0) 62%);
}

.bottom_content__glow--live {
  background: none;
}

.bottom_content__glow canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.bottom_content__brand {
  position: relative;
  z-index: 2; /* 高于同层注入的 footer，保证语言切换面板不被遮挡 */
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px; /* Figma 879:11769：品牌组与切换器间距 */
  padding: 0 40px;
}

/* 品牌组：Qwen Audio Studio 字标（真实文本，替代原 footer-wordmark/footer-wave 位图） */
.bottom_brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* 字标组：Qwen（径向渐变）+ Audio Studio（实色），48px/68px Medium（Figma 879:11772） */
.bottom_brand__wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(30px, 4.4vw, 48px);
  font-weight: 500;
  line-height: 68px;
}

.bottom_brand__qwen {
  background: radial-gradient(circle at 100% 0%,
    #33ADFF 0%, #0A8DFF 15%, #3D4AFF 40%,
    #281BE0 60%, #6531F5 85%, #9D5CFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bottom_brand__studio {
  color: #090C0C;
}

/* 语言切换器：56px 胶囊（Figma 879:11776），面板向上展开避开下方页脚 */
.lang-switch {
  position: relative;
}

.lang-switch__toggle {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 56px;
  padding: 12px 24px;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font: inherit;
}

.lang-switch__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-switch__icon,
.lang-switch__chevron {
  display: block;
  width: 24px;
  height: 24px;
}

.lang-switch__chevron {
  transition: transform 0.25s ease;
}

.lang-switch--open .lang-switch__chevron {
  transform: rotate(180deg);
}

.lang-switch__label {
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: #090C0C;
}

.lang-switch__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(9, 12, 12, 0.12);
}

/* display:flex 会覆盖 hidden 属性的 UA 样式，需显式恢复收起态 */
.lang-switch__menu[hidden] {
  display: none;
}

.lang-switch__option {
  border: none;
  background: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 24px;
  color: #090C0C;
  text-align: left;
  cursor: pointer;
}

.lang-switch__option:hover {
  background: rgba(9, 12, 12, 0.05);
}

/* 页脚宽度与导航栏一致（max-width 1024 居中），左右内边距对齐导航栏内容
   （nav padding 4px + brand padding 24px = 28px，使页脚文字与 logo/菜单对齐） */
.bottom_content .footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 32px 28px;
}

@media (max-width: 768px) {
  .bottom_content {
    height: auto;
    padding-bottom: 8px;
  }
  .bottom_content__brand {
    padding: 64px 20px 24px;
    gap: 28px;
  }
  .bottom_brand__wordmark {
    line-height: 1.3;
  }
  .bottom_content .footer {
    max-width: calc(100% - 40px);
    padding: 32px 0;
  }
}
