/* Keep closing copy together, with a separate step down to its action. */
main :is(.commerce-close, .about-page__close, .case-detail__closing) {
  --closing-copy-gap: clamp(10px, 1.15vw, 16px);
  --closing-action-gap: clamp(20px, 2.5vw, 36px);
  padding-block: clamp(44px, 6vw, 88px);
}

main .city-page .commerce-close {
  min-height: 0;
}

main :is(.commerce-close, .about-page__close, .case-detail__closing) > :is(h2, p) {
  margin-block: 0;
}

main :is(.commerce-close, .about-page__close, .case-detail__closing) > :is(h2, p) + p {
  margin-block-start: var(--closing-copy-gap);
}

main :is(.commerce-close, .about-page__close, .case-detail__closing) > :is(h2, p) + :is(.commerce-close__cta, a) {
  margin-block-start: var(--closing-action-gap);
  margin-block-end: 0;
}

/* Keep introductions and their supporting text together inside the same panel. */
main .seo-results__panel > h2:has(+ p),
main .content-callout__text > h2:has(+ p) {
  margin-block-end: clamp(18px, 2vw, 26px);
}

main .seo-results__panel > p:has(+ .seo-results__cards),
main .content-callout__text > p:has(+ .commerce-button) {
  margin-block-end: clamp(24px, 3vw, 40px);
}

main .content-plans > p:has(+ p) {
  margin-block-end: clamp(10px, 1.15vw, 16px);
}

main .business-chinese-page .commerce-section-intro > h2:has(+ p) {
  margin-block-end: clamp(22px, 2.1vw, 30px);
}

@media (max-width: 767px) {
  main .platform-page .commerce-section-intro > h2:has(+ p),
  html[lang^="zh"] main .fidelity-service-section .commerce-section-intro > h2:has(+ p),
  html[lang^="zh"] main .marketing-page--email .fidelity-service-section .commerce-section-intro > h2:has(+ p) {
    margin-block-end: 22px;
  }
}

@media (max-width: 1024px) {
  main .about__grid:has(> .about__title + .about__copy) {
    row-gap: 24px;
  }
}
