/* Global banner height contract.
 *
 * The homepage hero is the source of truth:
 * - desktop wide: 650px
 * - desktop/tablet landscape: follows the homepage responsive breakpoints
 *
 * This file is intentionally enqueued after page-specific hero styles.
 */

html body[class] {
  --tongyi-banner-shell: 1720px;
  --tongyi-banner-gutter: 72px;
  --tongyi-banner-top-gap: 58px;
  --tongyi-banner-gap: 48px;
  --tongyi-banner-media-width: 820px;
  --tongyi-banner-media-height: 433px;
  --tongyi-banner-bg: #f3f6f8;
  --tongyi-banner-title: #101828;
  --tongyi-banner-copy: #526071;
  --tongyi-banner-accent: var(--c-brand);
  --tongyi-banner-button-height: 52px;
  --tongyi-banner-radius: 8px;
}

/* Keep the homepage banner shell on the same horizontal grid as homepage sections. */
@media (min-width: 769px) {
  html body.home .home-page {
    --tongyi-banner-shell: var(--home-container);
    --tongyi-banner-gutter: var(--home-gutter);
  }
}

/*
 * Unified banner visual contract.
 *
 * The five public entry points intentionally keep their existing semantic
 * markup and CMS fields. These selectors map those implementations onto one
 * visual component: copy left, media right, one type scale and one CTA set.
 */
html body[class] :is(
  .home-hero,
  .product-center-hero,
  .solutions-live-hero,
  .industries-hero,
  .industry-hero
) {
  color: var(--tongyi-banner-title);
  background-color: var(--tongyi-banner-bg);
}

html body[class] :is(
  .home-hero h1,
  .product-center-hero h1,
  .solutions-live-hero h1,
  .industries-hero h1,
  .industry-hero h1
) {
  max-width: 840px;
  margin: 0;
  color: var(--tongyi-banner-title);
  font-family: inherit;
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-heading);
  line-height: var(--line-height-display);
  letter-spacing: -0.045em;
}

html body[class] :is(
  .home-eyebrow,
  .product-center-kicker,
  .solutions-live-hero .eyebrow,
  .industries-kicker,
  .industry-hero .industry-eyebrow
) {
  margin: 0 0 18px;
  color: var(--tongyi-banner-accent);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-heading);
  line-height: var(--line-height-heading);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

html body[class] :is(
  .home-hero__description,
  .product-center-hero-description,
  .solutions-live-hero .site-banner__description,
  .industries-hero__intro,
  .industry-hero .industry-lead
) {
  max-width: 700px;
  margin: 22px 0 0;
  color: var(--tongyi-banner-copy);
  font-size: var(--font-size-lead);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-relaxed);
}

html body[class] :is(
  .product-center-hero-description,
  .product-center-hero-description p
) {
  margin-bottom: 0;
}

html body[class] :is(
  .home-hero__actions,
  .product-center-hero-actions,
  .solutions-live-actions,
  .industries-hero__actions,
  .industry-actions
) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

html body[class] :is(
  .home-hero__actions > a,
  .product-center-hero-actions > a,
  .solutions-live-actions > a,
  .industries-hero__actions > a,
  .industry-actions > a
) {
  width: auto;
  min-width: 190px;
  height: var(--tongyi-banner-button-height);
  min-height: var(--tongyi-banner-button-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0 24px;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-display);
  letter-spacing: 0;
  text-decoration: none;
}

html body[class] :is(
  .home-button--primary,
  .product-center-hero-actions .button-primary,
  .solutions-live-actions .button-primary,
  .industries-button--primary,
  .industry-actions .button-primary
) {
  color: #fff;
  background: var(--tongyi-banner-accent);
  border: 1px solid var(--tongyi-banner-accent);
}

html body[class] :is(
  .home-button--outline,
  .product-center-secondary-button,
  .solutions-live-actions .button-outline,
  .industries-button--outline,
  .industry-actions .button-outline
) {
  color: var(--tongyi-banner-accent);
  background: #fff;
  border: 1px solid var(--tongyi-banner-accent);
}

html body[class] :is(
  .home-button--primary,
  .product-center-hero-actions .button-primary,
  .solutions-live-actions .button-primary,
  .industries-button--primary,
  .industry-actions .button-primary
):hover {
  color: #fff;
  background: var(--c-brand-dark);
  border-color: var(--c-brand-dark);
}

html body[class] :is(
  .home-button--outline,
  .product-center-secondary-button,
  .solutions-live-actions .button-outline,
  .industries-button--outline,
  .industry-actions .button-outline
):hover {
  color: #fff;
  background: var(--tongyi-banner-accent);
  border-color: var(--tongyi-banner-accent);
}

/* Homepage engineering benefits: compact four-point trust row matching the
   reference hero. It belongs to the copy column, not the statistics card. */
html body.home[class] .home-hero .home-hero__benefits {
  width: 100%;
  max-width: 700px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  align-items: center;
  justify-content: space-between;
  column-gap: 18px;
  row-gap: 12px;
  /* Align the trust row with the reference's lower hero baseline. */
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

html body.home[class] .home-hero .home-hero__benefits > li {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  color: #526071;
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.01em;
  white-space: nowrap;
  list-style: none;
}

html body.home[class] .home-hero .home-hero__benefits > li > svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--tongyi-banner-accent);
  stroke-width: 1.8;
}

html body.home[class] .home-hero .home-hero__benefits > li > span {
  min-width: 0;
}

/* Page styles use highly specific legacy selectors. Keep these final aliases
   explicit so all five banner variants resolve to the exact same tokens. */
html body.tax-application_industry[class] .industry-detail .industry-hero {
  background: var(--tongyi-banner-bg);
}

html body.tax-application_industry[class] .industry-detail .industry-hero h1 {
  max-width: 840px;
  color: var(--tongyi-banner-title);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-heading);
  line-height: var(--line-height-display);
  letter-spacing: -0.045em;
}

html body[class] :is(
  .products-page .product-center-hero-actions,
  .solutions-mobile-live .solutions-live-actions,
  .industry-detail .industry-actions,
  .industries-page .industries-hero__actions
) > a {
  width: auto;
  min-width: 190px;
  height: var(--tongyi-banner-button-height);
  min-height: var(--tongyi-banner-button-height);
  padding: 0 24px;
  border-radius: 4px;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-display);
}

html body[class] .products-page .product-center-hero .product-center-hero-actions > a.button,
html body[class] .industries-page .industries-hero .industries-hero__actions > a.industries-button,
html body.tax-application_industry[class] .industry-detail .industry-hero .industry-actions > a.button {
  width: auto;
  min-width: 190px;
  height: var(--tongyi-banner-button-height);
  min-height: var(--tongyi-banner-button-height);
  padding: 0 24px;
  border-radius: 4px;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-display);
}

html body:is(.post-type-archive-product, .page-template-page-products, .post-type-archive-solution) {
  --overview-hero-height: var(--ui-banner-overview-height);
  --overview-hero-max-width: var(--tongyi-banner-shell);
  --overview-hero-gap: var(--tongyi-banner-gap);
  --overview-hero-top-gap: var(--tongyi-banner-top-gap);
  --overview-hero-media-width: var(--tongyi-banner-media-width);
  --overview-hero-media-height: var(--tongyi-banner-media-height);
}

@media (min-width: 641px) and (max-width: 1180px) {
  html body.home[class] .home-hero .home-hero__benefits {
    max-width: 560px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    column-gap: 24px;
  }
}

@media (min-width: 769px) {
  html body[class] .home-hero,
  html body[class] .home-hero__inner,
  html body[class] .solutions-live-hero,
  html body[class] .solutions-live-hero-grid,
  html body[class] .product-center-hero,
  html body[class] .product-center-hero-inner,
  html body[class] .industries-hero,
  html body[class] .industries-hero__grid,
  html body:is(.post-type-archive-product, .page-template-page-products) .products-page .product-center-hero,
  html body:is(.post-type-archive-product, .page-template-page-products) .products-page .product-center-hero-inner,
  html body[class] .case-hub-hero,
  html body[class] .case-hub-hero-inner,
  html body[class] .cert-hero,
  html body[class] .cert-hero-grid {
    height: var(--ui-banner-overview-height);
    min-height: var(--ui-banner-overview-height);
    box-sizing: border-box;
  }

  html body[class] .solution-hero,
  html body[class] .solution-hero-grid,
  html body[class] .industry-hero,
  html body[class] .industry-hero-grid {
    height: var(--ui-banner-detail-height);
    min-height: var(--ui-banner-detail-height);
    box-sizing: border-box;
  }

  html body[class] .about-redesign-hero,
  html body[class] .case-study-hero,
  html body[class] .case-study-hero-grid,
  html body[class] .insights-hub-hero,
  html body[class] .kh-hero,
  html body[class] .services-hero,
  html body[class] .downloads-hero {
    min-height: var(--ui-banner-overview-height);
    box-sizing: border-box;
  }

  html body[class] :is(.archive-hero, .inner-hero):not(.compact),
  html body[class] .product-hero,
  html body[class] .selector-hero {
    min-height: var(--ui-banner-standard-height);
    box-sizing: border-box;
  }

  html body[class] :is(.archive-hero.compact, .inner-hero.compact) {
    min-height: var(--ui-banner-compact-height);
    box-sizing: border-box;
  }

  html body[class] .pd-hero {
    min-height: var(--ui-banner-product-height);
    box-sizing: border-box;
  }

  html body[class] .resource-detail-hero {
    min-height: var(--ui-banner-detail-height);
    box-sizing: border-box;
  }

  /* Top-level navigation pages share one banner grid and media size. */
  html body.home[class] .home-hero__inner,
  html body:is(.post-type-archive-product, .page-template-page-products) .products-page .product-center-hero-inner,
  html body.post-type-archive-solution .solutions-live-hero-grid,
  html body.page-template-page-industries .industries-hero__grid,
  html body.tax-application_industry .industry-hero-grid,
  html body.page-template-page-industries .site-breadcrumbs__inner.shell {
    width: min(calc(100% - (var(--tongyi-banner-gutter) * 2)), var(--tongyi-banner-shell));
    max-width: var(--tongyi-banner-shell);
    margin-inline: auto;
    box-sizing: border-box;
  }

  html body.home[class] .home-hero__inner {
    grid-template-columns: minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2)) minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2));
    gap: var(--tongyi-banner-gap);
    align-items: start;
    padding-top: var(--tongyi-banner-top-gap);
  }

  html body.home[class] .home-hero__copy {
    align-self: start;
    width: 100%;
    max-width: none;
    padding: 0;
  }

  html body.home[class] .home-hero__visual {
    top: var(--tongyi-banner-top-gap);
    right: max(var(--tongyi-banner-gutter), calc((100% - var(--tongyi-banner-shell)) / 2));
    bottom: auto;
    width: var(--tongyi-banner-media-width);
    height: var(--tongyi-banner-media-height);
    overflow: hidden;
    border-radius: 8px;
  }

  html body.home[class] .home-hero__visual::before {
    display: none;
  }

  html body.home[class] .home-hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  html body:is(.post-type-archive-product, .page-template-page-products) .products-page .product-center-hero-image,
  html body.post-type-archive-solution .solutions-live-hero-media,
  html body.page-template-page-industries .industries-hero__media {
    width: var(--tongyi-banner-media-width);
    max-width: var(--tongyi-banner-media-width);
    height: var(--tongyi-banner-media-height);
    min-height: 0;
    margin: 0;
    border-radius: 8px;
    box-sizing: border-box;
  }

  html body.page-template-page-industries .industries-hero__media {
    width: 100%;
    max-width: 100%;
  }

  html body:is(.post-type-archive-product, .page-template-page-products) .products-page .product-center-hero-image {
    top: var(--tongyi-banner-top-gap);
    right: max(var(--tongyi-banner-gutter), calc((100% - var(--tongyi-banner-shell)) / 2));
    bottom: auto;
    left: auto;
  }

  html body.post-type-archive-solution .solutions-live-hero-media,
  html body.page-template-page-industries .industries-hero__media {
    justify-self: end;
    align-self: start;
    margin-top: var(--tongyi-banner-top-gap);
    aspect-ratio: auto;
  }

  html body.post-type-archive-solution .solutions-live-hero-media img,
  html body.page-template-page-industries .industries-hero__media img,
  html body.page-template-page-industries .industries-hero__image {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }

  /*
   * Solutions archive has an older reference rule:
   *   html body[class] .solutions-mobile-live .shell { max-width: 1776px }
   * That selector is stronger than the generic banner contract above because
   * the hero grid also carries the shared `.shell` class. Lock this page to
   * the same 1720px / 58px / 820x433 desktop contract as Home, Products and
   * Industries, and avoid double-offsetting the image: grid padding provides
   * the top gap, so the media itself must not add another 58px margin.
   */
  html body.post-type-archive-solution[class] .solutions-mobile-live .solutions-live-hero .solutions-live-hero-grid.shell {
    width: min(calc(100% - (var(--tongyi-banner-gutter) * 2)), var(--tongyi-banner-shell));
    max-width: var(--tongyi-banner-shell);
    margin-inline: auto;
    padding-inline: 0;
    padding-top: var(--tongyi-banner-top-gap);
    grid-template-columns: minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2)) minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2));
    gap: var(--tongyi-banner-gap);
    align-items: start;
  }

  html body.post-type-archive-solution[class] .solutions-mobile-live .solutions-live-hero .solutions-live-hero-media {
    width: 100%;
    max-width: 100%;
    height: var(--tongyi-banner-media-height);
    margin: 0;
    justify-self: end;
    align-self: start;
    aspect-ratio: auto;
  }

  /* Industries previously centered its copy inside the full 650px grid. The
     shared grid already supplies the same top gap as Solutions, so centering
     here adds a second vertical offset and makes the content block appear at
     a different height. Keep both overview-page copy columns top-aligned. */
  html body.page-template-page-industries[class] .industries-hero .industries-hero__copy {
    align-self: start;
    padding-top: 0;
  }

  html body.page-template-page-industries .industries-hero__grid {
    height: var(--ui-banner-overview-height);
    min-height: var(--ui-banner-overview-height);
    padding: var(--tongyi-banner-top-gap) 0 0;
    grid-template-columns: minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2)) minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2));
    gap: var(--tongyi-banner-gap);
    align-items: start;
  }

  html body.tax-application_industry .industry-hero-grid {
    height: var(--ui-banner-detail-height);
    min-height: var(--ui-banner-detail-height);
    padding: var(--tongyi-banner-top-gap) 0 0;
    grid-template-columns: minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2)) minmax(0, calc((100% - var(--tongyi-banner-gap)) / 2));
    gap: var(--tongyi-banner-gap);
    align-items: start;
  }

  html body.tax-application_industry .industry-hero-media {
    width: var(--tongyi-banner-media-width);
    max-width: 100%;
    height: var(--tongyi-banner-media-height);
    min-height: 0;
    margin: 0;
    justify-self: end;
    align-self: start;
    overflow: hidden;
    border-radius: var(--tongyi-banner-radius);
    box-sizing: border-box;
  }

  html body.tax-application_industry .industry-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

@media (min-width: 1181px) and (max-width: 1600px) {
  /* The fixed 820px desktop artwork cannot coexist with a half-width copy
     column at 1366–1440px. Keep the two columns disjoint until the wide
     desktop shell has room for the reference media width. */
  html body.home[class] .home-hero__visual {
    width: calc((100% - var(--tongyi-banner-gap)) / 2);
    max-width: calc((100% - var(--tongyi-banner-gap)) / 2);
    right: max(var(--tongyi-banner-gutter), calc((100% - var(--tongyi-banner-shell)) / 2));
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  html body[class] :is(.home-hero, .product-center-hero, .solutions-live-hero, .industries-hero, .industry-hero) { height:auto; min-height:0; }
  html body[class] :is(.home-hero__inner, .product-center-hero-inner, .solutions-live-hero-grid, .industries-hero__grid, .industry-hero-grid) { height:auto; min-height:0; grid-template-columns:minmax(0,1fr); gap:30px; padding-block:42px 52px; align-items:start; }
  html body[class] :is(.home-hero__copy, .product-center-hero-copy, .solutions-live-hero-copy, .industries-hero__copy, .industry-hero-copy) { width:100%; max-width:820px; min-width:0; }
  html body[class] :is(.home-hero__visual, .solutions-live-hero-media, .industries-hero__media, .industry-hero-media) { position:static; width:min(100%,var(--tongyi-banner-media-width)); max-width:100%; height:auto; aspect-ratio:1.894 / 1; margin:0; justify-self:start; }
  html body[class] .product-center-hero .product-center-hero-image { position:static; width:min(100%,var(--tongyi-banner-media-width)); max-width:100%; height:auto; min-height:0; aspect-ratio:1.894 / 1; margin:0; object-fit:cover; }
}

@media (max-width: 768px) {
  html body[class] :is(.home-hero, .product-center-hero, .solutions-live-hero, .industries-hero, .industry-hero) { height:auto; min-height:0; }
  html body[class] :is(.home-hero__inner, .product-center-hero-inner, .solutions-live-hero-grid, .industries-hero__grid, .industry-hero-grid) { height:auto; min-height:0; grid-template-columns:minmax(0,1fr); gap:30px; padding-block:42px 52px; align-items:start; }
  html body[class] :is(.home-hero__copy, .product-center-hero-copy, .solutions-live-hero-copy, .industries-hero__copy, .industry-hero-copy) { width:100%; max-width:820px; min-width:0; }
  html body[class] :is(.home-hero__visual, .solutions-live-hero-media, .industries-hero__media, .industry-hero-media) { position:static; width:min(100%,var(--tongyi-banner-media-width)); max-width:100%; height:auto; aspect-ratio:1.894 / 1; margin:0; justify-self:start; }
  html body[class] .product-center-hero .product-center-hero-image { position:static; width:min(100%,var(--tongyi-banner-media-width)); max-width:100%; height:auto; min-height:0; aspect-ratio:1.894 / 1; margin:0; object-fit:cover; }
}

@media (max-width: 768px) {
  html body[class] {
    --tongyi-banner-gutter: 20px;
    --tongyi-banner-top-gap: 38px;
    --tongyi-banner-gap: 28px;
  }

  html body[class] :is(
    .home-hero,
    .product-center-hero,
    .solutions-live-hero,
    .industries-hero,
    .industry-hero
  ) {
    height: auto;
    min-height: 0;
  }

  html body.tax-application_industry[class] .industry-detail .industry-hero h1 {
    font-size: var(--font-size-h1);
    line-height: var(--line-height-display);
  }

  html body[class] .product-center-hero {
    display: flex;
    flex-direction: column;
  }

  html body[class] .product-center-hero .product-center-hero-image {
    position: static;
    order: 2;
    width: 100%;
    max-width: 100%;
    height: 220px;
    min-height: 0;
    object-fit: cover;
    margin: 26px 0 0;
  }

  html body[class] .product-center-hero .product-center-hero-inner {
    order: 1;
    width: calc(100% - 32px);
    height: auto;
    min-height: 0;
    margin-inline: auto;
  }


  html body[class] :is(.home-hero__inner, .solutions-live-hero-grid, .industries-hero__grid, .industry-hero-grid) {
    width: calc(100% - 32px);
    height: auto;
    min-height: 0;
    margin-inline: auto;
    padding: 38px 0 48px;
    box-sizing: border-box;
  }

  html body[class] :is(.home-hero__visual, .solutions-live-hero-media, .industries-hero__media, .industry-hero-media) {
    width: 100%;
    max-width: 100%;
    height: 220px;
    min-height: 0;
    margin: 28px 0 0;
    border-radius: var(--tongyi-banner-radius);
  }

  html body[class] :is(.home-hero__visual img, .solutions-live-hero-media img, .industries-hero__media img, .industry-hero-media img) {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  html body[class] :is(
    .home-hero h1,
    .product-center-hero h1,
    .solutions-live-hero h1,
    .industries-hero h1,
    .industry-hero h1
  ) {
    font-size: var(--font-size-h1);
    line-height: var(--line-height-display);
    letter-spacing: -0.04em;
  }

  html body[class] :is(
    .home-hero__description,
    .product-center-hero-description,
    .solutions-live-hero .site-banner__description,
    .industries-hero__intro,
    .industry-hero .industry-lead
  ) {
    margin-top: 18px;
    font-size: var(--font-size-body);
    line-height: var(--line-height-base);
  }

  html body[class] :is(
    .home-hero__actions,
    .product-center-hero-actions,
    .solutions-live-actions,
    .industries-hero__actions,
    .industry-actions
  ) {
    margin-top: 24px;
  }

  html body[class] :is(
    .home-hero__actions > a,
    .product-center-hero-actions > a,
    .solutions-live-actions > a,
    .industries-hero__actions > a,
    .industry-actions > a
  ) {
    min-width: min(190px, 100%);
    min-height: 50px;
    height: 50px;
    padding-inline: 20px;
  }

  html body[class] .home-hero .home-hero__actions > a,
  html body[class] .product-center-hero .product-center-hero-actions > a,
  html body[class] .solutions-live-hero .solutions-live-actions > a,
  html body[class] .industries-hero .industries-hero__actions > a,
  html body[class] .industry-hero .industry-actions > a {
    width: auto;
    min-width: 190px;
    height: 50px;
    min-height: 50px;
    font-size: var(--font-size-small);
  }

  html body.home[class] .home-hero .home-hero__benefits {
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    column-gap: 14px;
    row-gap: 12px;
    margin-top: 26px;
  }

  html body.home[class] .home-hero .home-hero__benefits > li {
    font-size: var(--font-size-caption);
    white-space: normal;
  }
}

@media (max-width: 768px) {
  html body.home .home-hero__inner {
    width: calc(100% - var(--home-gutter) * 2);
  }
}

@media (max-width: 420px) {
  html body.home[class] .home-hero .home-hero__benefits {
    grid-template-columns: 1fr;
  }
}

.ui-interactive {
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.ui-interactive:hover {
  transform: translateY(-1px);
}

.ui-interactive:focus-visible {
  outline: 3px solid var(--tongyi-banner-accent);
  outline-offset: 3px;
}

.ui-interactive:active {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .ui-interactive {
    transition: none;
  }

  .ui-interactive:hover,
  .ui-interactive:active {
    transform: none;
  }
}
