/* =============================================
   腾讯云风格 Hero Banner 样式
   严格对齐 cloud.tencent.com portal-hero 组件
   ============================================= */

/* ========== 1. Hero 容器 ========== */
.tx-portal-hero {
  background: #e0efff;
  height: 436px;
  position: relative;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.tx-portal-hero__inner {
  height: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.tx-portal-hero__content {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 背景层 - 带渐变遮罩 */
.tx-portal-hero__bgs {
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  max-width: 2048px;
}

.tx-portal-hero__bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-size: auto 100%;
  background-position: 50%;
  background-repeat: no-repeat;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
  /* video 元素作为背景：禁止所有交互，防止浏览器弹屏 */
  pointer-events: none;
  -webkit-pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  /* 防止被选中或拖拽 */
  -webkit-user-drag: none;
  /* 关键：让 video 表现得像图片，不显示控件 */
  -webkit-media-controls: none !important;
  -webkit-media-controls-playback-rate-button: none !important;
  -webkit-media-controls-volume-slider: none !important;
  -webkit-media-controls-fullscreen-button: none !important;
  -webkit-media-controls-overlay-play-button: none !important;
}

/* 兼容 Firefox / IE / Edge 的 video 控件隐藏 */
.tx-portal-hero__bg::-webkit-media-controls {
  display: none !important;
}

.tx-portal-hero__bg::-webkit-media-controls-enclosure {
  display: none !important;
}

/* 当 video 加载失败或无 src 时，显示同样的背景色，避免色差 */
.tx-portal-hero__bg:not([src]):not([data-src]),
.tx-portal-hero__bg[style*="display: none"] {
  display: none;
}

.tx-portal-hero__bg.active {
  opacity: 1;
}

/* 当 video 没有 src 时不显示（保持背景为纯色 #e0efff） */
.tx-portal-hero__bg:not([src]):not([data-src]) {
  display: none;
}

/* ========== 2. 左侧导航控制器 ========== */
.tx-portal-hero__ctrls-wrap {
  flex-shrink: 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  position: absolute;
  z-index: 2;
  left: 48px;
  top: 0;
  padding-top: 56px;
  align-items: center;
}

.tx-portal-hero__ctrls {
  width: 100%;
  position: relative;
  border-right: 2px solid rgba(255, 255, 255, 0.6);
}

.tx-portal-hero__ctrl {
  position: relative;
  cursor: pointer;
  width: 100%;
  /* 移除 padding-right，让 mask 的 border-right 与父级 .ctrls 的 border-right 完美重合 */
  padding: 14px 0;
  text-align: right;
}

.tx-portal-hero__ctrl + .tx-portal-hero__ctrl {
  margin-top: 12px;
}

.tx-portal-hero__ctrl-inner {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  /* 把 12px 移到这里，文字内容左移，但 mask 的右边线仍贴齐父级 */
  margin-right: 12px;
}

.tx-portal-hero__ctrl-text {
  flex-grow: 1;
  width: fit-content;
  color: #181818;
  font-size: 14px;
  line-height: 22px;
  white-space: nowrap;
  word-break: keep-all;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.3s ease-in-out;
}

.tx-portal-hero__ctrl.active .tx-portal-hero__ctrl-text {
  color: #0f62ea;
}

@media screen and (min-width: 769px) {
  .tx-portal-hero__ctrl:hover .tx-portal-hero__ctrl-text {
    color: #0f62ea;
  }
}

.tx-portal-hero__ctrl-icon {
  flex-shrink: 0;
  margin-right: 8px;
  height: 20px;
}

.tx-portal-hero__ctrl-tag {
  flex-shrink: 0;
  margin-right: 8px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 18px;
  color: #fff;
  border-radius: 2px;
  background: linear-gradient(90deg, #08f -4.72%, #409cff 48.25%, #217dfd 103.3%);
}

/* 激活遮罩条 - 白线（带半透明渐变遮罩） */
.tx-portal-hero__ctrl-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, hsla(0, 0%, 100%, 0), hsla(0, 0%, 100%, 0.4));
  border-right: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.3s ease-in-out;
}

.tx-portal-hero__ctrl.active .tx-portal-hero__ctrl-mask,
.tx-portal-hero__ctrl:hover .tx-portal-hero__ctrl-mask {
  border-right-color: #0f62ea;
}

/* ========== 3. 幻灯片项 ========== */
.tx-portal-hero__swiper {
  position: relative;
  width: 100%;
  height: 100%;
}

.tx-portal-hero__item {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  padding: 96px 48px 40px;
  transition: opacity 0.5s ease-in-out;
}

.tx-portal-hero__item.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.tx-portal-hero__item-content {
  position: relative;
  height: 100%;
  /* ★ 可微调项：padding-left 控制大字标题与左侧导航【AI智能生态】的水平对齐 */
  padding-left: 296px;
  padding-top: 70px;
  padding-bottom: 24px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* 标题 */
.tx-portal-hero__item-title {
  color: #181818;
  font-weight: 500;
  font-size: 36px;
  line-height: 48px;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  margin: 0;
}

.tx-portal-hero__item-title .linear {
  background: linear-gradient(90deg, #0052d9, #606eff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* 描述 */
.tx-portal-hero__item-desc {
  margin-top: 12px;
  color: #253554;
  font-size: 14px;
  line-height: 22px;
}

@media screen and (min-width: 769px) {
  .tx-portal-hero__item-desc {
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }
}

/* 按钮 — 右边缘对齐左侧导航最后一个【查看全部活动】 */
.tx-portal-hero__item-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* ★ 可微调项：按钮距上方描述文字的间距，改大=按钮下移 */
  margin-top: 80px;
  /* ★ 可微调项：width 控制按钮宽度，margin-left 控制按钮与左侧导航右边缘对齐 */
  width: 220px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #0059eb, #2677ff);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

@media screen and (min-width: 769px) {
  .tx-portal-hero__item-btn {
    --hero-btn-mx: 50%;
    --hero-btn-my: 50%;
  }

  .tx-portal-hero__item-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease;
    background: radial-gradient(
      200px circle at var(--hero-btn-mx) var(--hero-btn-my),
      hsla(0, 0%, 100%, 0.28),
      hsla(0, 0%, 100%, 0) 65%
    );
  }

  .tx-portal-hero__item-btn:hover::before {
    opacity: 1;
  }

  .tx-portal-hero__item-btn .tx-portal-hero__item-btn-icon,
  .tx-portal-hero__item-btn .tx-portal-hero__item-btn-text {
    position: relative;
    z-index: 2;
  }

  .tx-portal-hero__item-btn:hover .tx-portal-hero__item-btn-icon {
    transform: translateX(4px);
  }
}

.tx-portal-hero__item-btn-text {
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
}

.tx-portal-hero__item-btn-icon {
  display: flex;
  align-items: center;
  width: 14px;
  height: 5px;
  color: #fff;
  transition: transform 0.3s ease-in-out;
}

.tx-portal-hero__item-btn,
.tx-portal-hero__item-desc,
.tx-portal-hero__item-title {
  max-width: 500px;
  position: relative;
  z-index: 1;
}

/* 右侧主题图/视频区 */
.tx-portal-hero__theme {
  max-width: 650px;
  width: calc(100% - 788px);
  height: 280px;
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  transform-origin: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tx-portal-hero__theme-video {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  object-fit: contain;
  object-position: center;
}

/* ========== 4. 底部入口卡片 (Hero Segments) ==========
   1:1 复刻 cloud.tencent.com 样式：
   - 白色底纹 + 细线隔离（无圆角、无独立背景色）
   - hover 时整块轻微弹起 + 箭头交互
   - 移动端 2-1-1 布局（首行 2 个、第 2 行 1 个、第 3 行 1 个）
   ========== */
.tx-portal-hero__segments {
  background: #fff;
  padding: 0;
  margin: 0;
  border-top: 1px solid #ebeef5;
  border-bottom: 1px solid #ebeef5;
}

.tx-portal-hero__segments-inner {
  max-width: 1680px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

/* 单个卡片 */
.tx-portal-hero__segment {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 22px 28px;
  min-height: 96px;
  background: #fff;
  text-decoration: none;
  cursor: pointer;
  border-right: 1px solid #ebeef5;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  z-index: 1;
  /* 防止内容撑爆 grid 列 */
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.tx-portal-hero__segment:last-child {
  border-right: none;
}

/* Hover：整块轻微弹起 + 蓝色阴影 */
.tx-portal-hero__segment:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 82, 217, 0.08);
  z-index: 2;
}

/* 隐藏图标（参考腾讯云官网样式无图标） */
.tx-portal-hero__segment-icon {
  display: none;
}

.tx-portal-hero__segment-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.tx-portal-hero__segment-tag {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: #8a8a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-portal-hero__segment-title {
  font-size: 16px;
  line-height: 24px;
  color: #181818;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-portal-hero__segment-desc {
  font-size: 13px;
  line-height: 20px;
  color: #666;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右侧 › 箭头（SVG） */
.tx-portal-hero__segment-arrow {
  flex-shrink: 0;
  align-self: center;
  width: 14px;
  height: 14px;
  color: #909399;
  transition: color 0.2s ease, transform 0.2s ease;
}

.tx-portal-hero__segment:hover .tx-portal-hero__segment-arrow {
  color: #0052d9;
  transform: translateX(3px);
}

.tx-portal-hero__segment-subtitle {
  color: #f56c00;
  font-weight: 400;
}

/* ========== 5. 移动端分页器 ========== */
.tx-portal-hero__pagination {
  display: none;
}

/* ========== 6. 响应式 - 大屏 (>=1400px) ========== */
@media screen and (min-width: 1400px) {
  .tx-portal-hero {
    height: 461px;
  }
  .tx-portal-hero__ctrls-wrap {
    left: 64px;
  }
  .tx-portal-hero__item {
    padding: 104px 64px 48px;
  }
  /* ★ 可微调项：max-width 控制标题/描述/按钮的最大宽度 */
  .tx-portal-hero__item-btn,
  .tx-portal-hero__item-desc,
  .tx-portal-hero__item-title {
    max-width: 520px;
  }
  .tx-portal-hero__item-title {
    font-size: 40px;
    line-height: 52px;
  }
  .tx-portal-hero__theme {
    width: calc(100% - 788px);
  }
  .tx-portal-hero__segments-inner {
    padding: 20px 64px;
  }
}

/* ========== 7. 响应式 - 超大屏 (>=1600px) ========== */
@media screen and (min-width: 1600px) {
  .tx-portal-hero {
    height: 500px;
  }
  .tx-portal-hero__ctrls-wrap {
    width: 240px;
    left: 64px;
  }
  .tx-portal-hero__ctrl {
    padding: 18px 0;
  }
  .tx-portal-hero__ctrl-inner {
    margin-right: 20px;
  }
  .tx-portal-hero__ctrl-text {
    font-size: 14px;
    line-height: 22px;
  }
  .tx-portal-hero__item-content {
    /* ★ 可微调项：大屏标题左对齐导航文字 */
    padding-left: 328px;
  }
  .tx-portal-hero__item-title {
    font-size: 42px;
    line-height: 56px;
  }
  .tx-portal-hero__item-btn,
  .tx-portal-hero__item-desc,
  .tx-portal-hero__item-title {
    max-width: 600px;
  }
  /* ★ 可微调项：大屏按钮宽度 */
  .tx-portal-hero__item-btn {
    width: 240px;
  }
}

/* ========== 8. 响应式 - 超大屏 (>=1920px) ========== */
@media screen and (min-width: 1920px) {
  .tx-portal-hero__item {
    padding: 104px 120px 48px;
  }
  .tx-portal-hero__item-title {
    font-size: 48px;
    line-height: 56px;
  }
  .tx-portal-hero__item-btn,
  .tx-portal-hero__item-desc,
  .tx-portal-hero__item-title {
    max-width: 720px;
  }
  .tx-portal-hero__item-btn {
    width: 340px;
    padding: 12px 16px;
    /* ★ 可微调项：≥1920px 大屏按钮下移 */
    margin-top: 100px;
  }
  .tx-portal-hero__ctrls-wrap {
    left: calc(50vw - 840px);
  }
  .tx-portal-hero__segments-inner {
    padding: 0 120px;
  }
}

/* ========== 9. 响应式 - 平板 (769px - 1200px) ========== */
@media screen and (max-width: 1200px) {
  .tx-portal-hero__ctrls-wrap {
    width: 180px;
    left: 24px;
  }
  .tx-portal-hero__item-content {
    /* ★ 可微调项：平板标题左对齐 */
    padding-left: 252px;
  }
  .tx-portal-hero__item-title {
    font-size: 28px;
    line-height: 38px;
  }
  .tx-portal-hero__item-btn,
  .tx-portal-hero__item-desc,
  .tx-portal-hero__item-title {
    max-width: 380px;
  }
  .tx-portal-hero__item-btn {
    width: 220px;
  }
  .tx-portal-hero__theme {
    width: calc(100% - 680px);
    max-width: 400px;
    height: 220px;
  }
  .tx-portal-hero__item {
    padding: 90px 24px 40px;
  }
  .tx-portal-hero__segments-inner {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px 24px;
  }
}

/* ========== 10. 响应式 - 平板竖屏 (768px) ========== */
@media screen and (max-width: 768px) {
  /* Hero 改高度，隐藏桌面导航 */
  .tx-portal-hero {
    height: 250px;
  }

  .tx-portal-hero__ctrls-wrap {
    display: none;
  }

  .tx-portal-hero__swiper {
    height: 100%;
  }

  /* 幻灯片移动端样式 */
  .tx-portal-hero__item {
    opacity: 1;
    padding: 32px 24px 44px;
    background-size: 768px 250px;
    background-position: 50%;
    background-repeat: no-repeat;
  }

  .tx-portal-hero__item:not(.active) {
    opacity: 0;
    pointer-events: none;
  }

  .tx-portal-hero__item-content {
    padding-left: 0;
    padding-top: 0;
    padding-bottom: 0;
    max-width: 100%;
  }

  .tx-portal-hero__item-title {
    color: #181818;
    font-size: 32px;
    line-height: 48px;
  }

  .tx-portal-hero__item-desc {
    white-space: nowrap;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tx-portal-hero__item-btn {
    width: auto;
    max-width: 300px;
    /* ★ 可微调项：平板端按钮下移 */
    margin-top: 24px;
  }

  .tx-portal-hero__item-btn,
  .tx-portal-hero__item-desc,
  .tx-portal-hero__item-title {
    max-width: 500px;
  }

  /* 右侧主题区隐藏 */
  .tx-portal-hero__theme {
    display: none;
  }

  /* 背景层改为适配移动端 */
  .tx-portal-hero__bgs {
    -webkit-mask: linear-gradient(90deg, transparent, #000 0%, #000 100%, transparent);
    mask: linear-gradient(90deg, transparent, #000 0%, #000 100%, transparent);
  }

  /* 分页器显示 */
  .tx-portal-hero__pagination {
    z-index: 1;
    position: absolute;
    left: 24px;
    bottom: 18px;
    width: calc(100% - 48px);
    display: flex;
    align-items: center;
  }

  .tx-portal-hero__pagination-num {
    flex-shrink: 0;
    color: rgba(0, 0, 0, 0.35);
    font-size: 12px;
    line-height: 20px;
    font-weight: 500;
  }

  .tx-portal-hero__pagination-current {
    color: #000;
  }

  .tx-portal-hero__pagination-bullets {
    width: 0;
    flex-grow: 1;
    height: 12px;
    margin-left: 16px;
    display: flex;
    gap: 0;
  }

  .tx-portal-hero__pagination-bullet {
    width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .tx-portal-hero__pagination-bullet::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
  }

  .tx-portal-hero__pagination-bullet.is-active::after {
    background: #000;
  }

  /* 入口卡片 — 2-1-1 布局（首行 2 个，第 2 行 1 个，第 3 行 1 个） */
  .tx-portal-hero__segments-inner {
    /* minmax(0, 1fr) 才能真正 50:50 平分，防止内容过长撑爆列 */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 24px;
  }

  /* 第 3、4 个卡片跨两列（独占整行） */
  .tx-portal-hero__segment:nth-child(3),
  .tx-portal-hero__segment:nth-child(4) {
    grid-column: 1 / -1;
  }

  /* 移动端边框：去除右边框 + 加底边框，最后一个去除底边框 */
  .tx-portal-hero__segment {
    border-right: none;
    border-bottom: 1px solid #ebeef5;
    padding: 16px;
    min-height: 72px;
    /* 关键：保证 grid 列真的 50:50，不会被内容撑爆 */
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
  }
  .tx-portal-hero__segment:last-child {
    border-bottom: none;
  }
  /* 首个卡片保留右边框（隔开第 2 个） */
  .tx-portal-hero__segment:nth-child(1) {
    border-right: 1px solid #ebeef5;
  }

  .tx-portal-hero__segment-title {
    font-size: 14px;
    line-height: 20px;
  }

  .tx-portal-hero__segment-desc {
    font-size: 12px;
    line-height: 18px;
  }

  .tx-portal-hero__segment-tag {
    font-size: 11px;
    line-height: 14px;
  }

  .tx-portal-hero__segment-arrow {
    font-size: 18px;
  }
}

/* ========== 11. 响应式 - 手机 (<=600px) ========== */
@media screen and (max-width: 600px) {
  .tx-portal-hero {
    height: 250px;
  }

  .tx-portal-hero__item {
    padding: 32px 16px 44px;
  }

  .tx-portal-hero__item-title {
    color: #181818;
    font-size: 28px;
    line-height: 36px;
  }

  .tx-portal-hero__pagination {
    left: 16px;
    bottom: 16px;
    width: calc(100% - 32px);
  }

  .tx-portal-hero__segments-inner {
    padding: 0 16px;
  }

  .tx-portal-hero__segment {
    padding: 14px 12px;
    min-height: 64px;
  }

  .tx-portal-hero__segment-title {
    font-size: 13px;
    line-height: 18px;
  }

  .tx-portal-hero__segment-desc {
    font-size: 11px;
    line-height: 16px;
  }

  .tx-portal-hero__segment-tag {
    font-size: 10px;
    line-height: 14px;
  }

  .tx-portal-hero__segment-arrow {
    width: 14px;
    height: 14px;
  }
}

/* ========== 12. 响应式 - 超小屏 (<=480px) ========== */
@media screen and (max-width: 480px) {
  .tx-portal-hero__item-title {
    font-size: 24px;
    line-height: 32px;
  }

  .tx-portal-hero__item-desc {
    font-size: 13px;
    line-height: 20px;
  }

  .tx-portal-hero__item-btn {
    /* ★ 可微调项：手机端按钮改为自适应宽度，类似常规手机按钮 */
    width: auto;
    min-width: 140px;
    max-width: 220px;
    margin-top: 20px;
    padding: 10px 16px;
    font-size: 14px;
  }

  .tx-portal-hero__segments-inner {
    /* 保持 2 列 + 后两个跨两列的 2-1-1 布局 */
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ========== 13. 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) {
  .tx-portal-hero__ctrl-mask {
    display: none;
  }
}
