/**
 * sinopak/home-hero block styles
 *
 * Prototype: sinopak-homepage-premium-h5.html .hero / .hero-media /
 * .hero-overlay / .hero-copy / .hero-dots / .hero-rail (base rules merged
 * with the "impeccable polish pass" overrides — polish values win).
 * Breakpoints: 1180 / 760 (prototype @media breaks, no new ones).
 */
@layer spk-block {
  .spk-x-home-hero {
    position: relative;
    min-height: min(820px, 86svh);
    overflow: hidden;
    color: #fff;
    background: var(--wp--preset--color--deep, #06244a);
  }

  /* ── Rotating media ── */
  .spk-x-home-hero__media {
    position: absolute;
    inset: 0;
  }
  .spk-x-home-hero__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    opacity: 0;
    filter: saturate(0.94) contrast(1.06);
    transform: scale(1.03);
    transition: opacity 0.8s ease, transform 7s ease;
  }
  .spk-x-home-hero__slide.spk-x-active {
    opacity: 1;
    transform: scale(1);
  }
  .spk-x-home-hero__overlay {
    position: absolute;
    inset: 0;
    background:
      linear-gradient(90deg, rgba(2, 18, 38, 0.82) 0%, rgba(5, 45, 82, 0.62) 38%, rgba(5, 45, 82, 0.18) 100%),
      radial-gradient(circle at 78% 18%, rgba(23, 183, 216, 0.16), transparent 32%);
  }

  /* ── Inner shell ── */
  .spk-x-home-hero__inner {
    position: relative;
    z-index: 2;
    min-height: min(820px, 86svh);
    display: grid;
    align-content: center;
    padding: 100px 0 116px;
  }

  /* ── Copy cards (stacked, active one visible) ── */
  /* minmax(0,1fr):默认 1fr 的最小值是内容 min-content,CTA 按钮长文案会把轨道
     撑出视口(手机上整张卡片右侧被裁)。 */
  .spk-x-home-hero__copies {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .spk-x-home-hero__copy {
    grid-column: 1;
    grid-row: 1;
    width: min(610px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    padding: clamp(28px, 3.6vw, 48px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.055));
    backdrop-filter: blur(20px) saturate(1.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
  }
  .spk-x-home-hero__copy.spk-x-active {
    opacity: 1;
    visibility: visible;
  }

  .spk-x-home-hero__kicker {
    margin: 0 0 14px;
    color: #a8e7f4;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }
  .spk-x-home-hero__heading {
    max-width: 980px;
    margin: 0 0 22px;
    color: #fff;
    font-size: clamp(38px, 4vw, 60px);
    line-height: 0.98;
    letter-spacing: -0.035em;
    text-wrap: balance;
  }
  .spk-x-home-hero__subheading {
    max-width: 560px;
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(18px, 1.55vw, 25px);
    line-height: 1.16;
    letter-spacing: -0.025em;
  }
  .spk-x-home-hero__copy .spk-x-home-hero__text {
    max-width: 540px;
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.68;
  }
  .spk-x-home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
  }

  /* ── CTAs (prototype .cta / .ghost-cta) ── */
  .spk-x-home-hero__cta {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 10px;
    padding: 15px 23px;
    background: var(--wp--preset--color--orange, #f28a2e);
    color: #fff;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
  }
  .spk-x-home-hero__cta:hover,
  .spk-x-home-hero__cta:focus-visible {
    transform: translateY(-1px);
    background: #ff8d2c;
  }
  .spk-x-home-hero__cta::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
    transform: translateX(-120%);
    transition: transform 0.5s ease;
  }
  .spk-x-home-hero__cta:hover::after,
  .spk-x-home-hero__cta:focus-visible::after {
    transform: translateX(120%);
  }
  .spk-x-home-hero__cta--ghost {
    border: 1px solid rgba(255, 255, 255, 0.46);
    padding: 14px 22px;
    background: transparent;
  }
  .spk-x-home-hero__cta--ghost:hover,
  .spk-x-home-hero__cta--ghost:focus-visible {
    background: rgba(255, 255, 255, 0.12);
  }
  .spk-x-home-hero__cta--ghost::after {
    display: none;
  }

  /* ── Slide dots ── */
  .spk-x-home-hero__dots {
    position: absolute;
    bottom: 112px;
    left: 0;
    display: flex;
    gap: 10px;
  }
  .spk-x-home-hero__dots button {
    position: relative;
    width: 42px;
    height: 3px;
    border: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.32);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    transform-origin: left center;
  }
  /* Keep the prototype's thin visual bar while giving it a usable hit area. */
  .spk-x-home-hero__dots button::after {
    position: absolute;
    inset: -9px -5px;
    width: auto;
    height: auto;
    background: transparent;
    content: "";
    transform: none;
  }
  .spk-x-home-hero__dots button.spk-x-active {
    background: var(--wp--preset--color--orange, #f28a2e);
    transform: scaleX(1.65);
  }

  /* ── Bottom capability rail (prototype widths/type) ── */
  .spk-x-home-hero__rail {
    position: absolute;
    right: max(22px, calc((100vw - 1250px) / 2));
    bottom: 30px;
    left: max(22px, calc((100vw - 1250px) / 2));
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(2, 23, 51, 0.42);
    backdrop-filter: blur(12px);
  }
  .spk-x-home-hero__rail-item {
    position: relative;
    overflow: hidden;
    padding: 14px 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.88);
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    font-family: inherit;
    font-size: 9.5px;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
  }

  .spk-x-home-hero__rail-copy {
    display: block;
  }
  .spk-x-home-hero__rail-item strong {
    display: block;
    margin-bottom: 3px;
    color: #fff;
    font-size: 15px;
    letter-spacing: -0.01em;
  }

  .spk-x-home-hero__rail-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    height: 2px;
    background: linear-gradient(90deg, rgba(242, 138, 46, 0.36), rgba(242, 138, 46, 0.86));
    opacity: 0;
    pointer-events: none;
    transform: scaleX(0);
    transform-origin: left center;
  }

  .spk-x-home-hero__rail-item.spk-x-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.055);
  }
  .spk-x-home-hero__rail-item:hover,
  .spk-x-home-hero__rail-item:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
  }
  .spk-x-home-hero__rail-item:focus-visible {
    outline: 2px solid rgba(242, 138, 46, 0.78);
    outline-offset: -2px;
  }
  .spk-x-home-hero__rail-item.spk-x-active .spk-x-home-hero__rail-progress {
    animation-name: spk-x-hero-rail-progress;
    animation-duration: var(--spk-x-hero-interval, 5200ms);
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    opacity: 0.55;
  }

  @keyframes spk-x-hero-rail-progress {
    from {
      transform: scaleX(0);
      opacity: 0.18;
    }
    to {
      transform: scaleX(1);
      opacity: 0.68;
    }
  }

}

@layer spk-responsive {
  @media (max-width: 1180px) {
    .spk-x-home-hero,
    .spk-x-home-hero__inner {
      min-height: 82svh;
    }
    .spk-x-home-hero__media {
      opacity: 0.55;
    }
    .spk-x-home-hero__overlay {
      background: linear-gradient(90deg, rgba(4, 34, 69, 0.9), rgba(4, 34, 69, 0.68));
    }
    .spk-x-home-hero__copy {
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07));
    }
    .spk-x-home-hero__rail {
      right: 20px;
      left: 20px;
      grid-auto-flow: row;
      grid-auto-columns: auto;
      grid-template-columns: repeat(3, 1fr);
    }
  }

  @media (max-width: 760px) {
    .spk-x-home-hero,
    .spk-x-home-hero__inner {
      min-height: 88svh;
    }
    .spk-x-home-hero__inner {
      align-content: end;
      padding: 110px 0 232px;
    }
    .spk-x-home-hero__heading {
      font-size: clamp(40px, 13vw, 58px);
    }
    .spk-x-home-hero__copy {
      min-width: 0;
      padding: 22px 20px;
    }
    .spk-x-home-hero__heading {
      overflow-wrap: break-word;
    }
    .spk-x-home-hero__actions {
      flex-direction: column;
      align-items: stretch;
    }
    .spk-x-home-hero__cta {
      min-width: 0;
      white-space: normal;
      text-align: center;
    }
    /* 8 张幻灯片 × 42px 定宽圆点 = 406px,窄屏溢出;改为在 wrap 内等分收缩。 */
    .spk-x-home-hero__dots {
      left: 0;
      right: 0;
      bottom: 182px;
      gap: 8px;
    }
    .spk-x-home-hero__dots button {
      flex: 0 1 42px;
      min-width: 0;
    }
    .spk-x-home-hero__rail {
      bottom: 0;
      right: 0;
      left: 0;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .spk-x-home-hero__rail-item {
      min-width: 0;
      padding: 13px 10px;
      letter-spacing: 0.06em;
      overflow-wrap: break-word;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .spk-x-home-hero__rail-item.spk-x-active .spk-x-home-hero__rail-progress {
      animation: none;
      opacity: 0.32;
      transform: scaleX(1);
    }
  }
}
