/* Compact paired actions on public pages. Single CTAs, forms and navigation
   keep their own layout; no customer or admin dashboard selectors are used. */
@media (max-width: 767px) {
  #root:has(.legacy-header) main#main-content :is(
    .aws-service-actions, .azure-home-actions,
    .service-product-actions,
    .home-feedback-actions,
    .enterprise-centered-actions,
    .enterprise-contact-actions,
    .reinvent-connect-actions,
    .octa-industry-approach__actions,
    .ocean-actions
  ):has(> :is(a, button) ~ :is(a, button)),
  #root .cr-page main#main-content :is(.cr-actions, .cr-contact-actions),
  #root .ad-page .ad-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    min-width: 0;
  }

  #root:has(.legacy-header) main#main-content :is(
    .aws-service-actions, .azure-home-actions,
    .service-product-actions,
    .home-feedback-actions,
    .enterprise-centered-actions,
    .enterprise-contact-actions,
    .reinvent-connect-actions,
    .octa-industry-approach__actions,
    .ocean-actions
  ):has(> :is(a, button) ~ :is(a, button)) > :is(a, button),
  #root .cr-page main#main-content :is(.cr-actions, .cr-contact-actions) > a,
  #root .ad-page .ad-actions > :is(a, button) {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: stretch;
    gap: 6px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    height: auto;
    margin: 0 !important;
    padding: 8px 10px !important;
    font-size: .8125rem !important;
    line-height: 1.3 !important;
    text-align: center;
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }

  #root:has(.legacy-header) main#main-content :is(
    .aws-service-actions, .azure-home-actions, .service-product-actions, .home-feedback-actions,
    .enterprise-centered-actions, .enterprise-contact-actions,
    .reinvent-connect-actions, .octa-industry-approach__actions, .ocean-actions
  ) > :is(a, button) > svg,
  #root .cr-page main#main-content :is(.cr-actions, .cr-contact-actions) > a > svg,
  #root .ad-page .ad-actions > :is(a, button) > svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
  }

  #root .cr-page main#main-content .cr-contact-actions > span {
    grid-column: 1 / -1;
  }

  /* Keep all three advertising actions in a single compact row. */
  #root .ad-page .ad-actions:has(> .ad-button:nth-child(3)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #root .ad-page .ad-actions > .ad-button:first-child {
    grid-column: auto !important;
  }

  #root .ad-page .ad-contact-strip > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  #root .ad-page .ad-contact-strip > div > :is(a, button) {
    min-width: 0;
    min-height: 44px;
    padding: 8px 6px;
    font-size: .75rem;
    line-height: 1.3;
    white-space: normal;
  }

  /* The existing CityRoot welcome is portalled outside #root. */
  body:has(#root .legacy-header) .cityroot-dialog .cityroot-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body:has(#root .legacy-header) .cityroot-dialog .cityroot-actions > a {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    font-size: .8125rem;
    line-height: 1.3;
    white-space: normal;
    text-align: center;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 479px) {
  /* The labels carry the meaning; omit decorative icons when three actions
     share a narrow row so words such as WhatsApp do not need to split. */
  #root .ad-page .ad-actions:has(> .ad-button:nth-child(3)) > .ad-button > svg {
    display: none;
  }
}
