/* Match the main PPF landing page styles on the site's labelled actions. */
:root {
  --md-cta-bronze: #c7a17e;
  --md-cta-ink: #161813;
  --md-cta-green: #12a552;
  --md-cta-green-hover: #0f9e4b;
}

/* The landing pages already use this layer for high-priority WhatsApp rules. */
@layer modcare-whatsapp {
  html body :is(a, button)[data-md-cta] {
    box-sizing: border-box;
    min-block-size: var(--md-cta-min-height, 54px) !important;
    max-inline-size: 100%;
    padding: var(--md-cta-padding, 13px 24px) !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid var(--md-cta-border, currentColor) !important;
    border-radius: var(--md-cta-radius, 0) !important;
    background: var(--md-cta-fill, transparent) !important;
    color: var(--md-cta-text, inherit) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    text-indent: 0;
    font-family: Montserrat, sans-serif !important;
    font-size: var(--md-cta-font-size, 14px) !important;
    font-weight: var(--md-cta-font-weight, 600) !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
    text-align: center;
    white-space: normal !important;
  }

  /* Use the existing display property for hidden, sticky and floating controls. */
  html body :is(a, button)[data-md-cta]:not([hidden], .ts-whatsapp-float, .mc11-whatsapp--round) {
    display: inline-flex;
  }

  html body :is(a, button)[data-md-cta="primary"] {
    --md-cta-fill: var(--md-cta-bronze);
    --md-cta-border: var(--md-cta-bronze);
    --md-cta-text: var(--md-cta-ink);
    min-inline-size: min(220px, 100%) !important;
  }

  html body :is(a, button)[data-md-cta="primary"]:is(:hover, :focus-visible),
  html body :is(a, button)[data-md-cta="secondary"]:is(:hover, :focus-visible) {
    --md-cta-fill: #d7ae8a;
    --md-cta-border: #d7ae8a;
    --md-cta-text: var(--md-cta-ink);
  }

  html body :is(a, button)[data-md-cta="secondary"] {
    --md-cta-text: var(--md-cta-secondary-text, inherit);
  }

  html body :is(a, button)[data-md-cta-secondary-tone="light"] {
    --md-cta-secondary-text: #fff;
  }

  html body :is(a, button)[data-md-cta-secondary-tone="dark"] {
    --md-cta-secondary-text: var(--md-cta-ink);
  }

  html body :is(a, button)[data-md-cta^="whatsapp"] {
    --md-cta-fill: var(--md-cta-green);
    --md-cta-border: var(--md-cta-green);
    --md-cta-text: #111;
    --md-cta-radius: 999px;
    --md-cta-font-size: 14px;
  }

  html body :is(a, button)[data-md-cta^="whatsapp"]:is(:hover, :focus-visible) {
    --md-cta-fill: var(--md-cta-green-hover);
    --md-cta-border: var(--md-cta-green-hover);
  }

  html body :is(a, button)[data-md-cta="whatsapp-submit"] {
    --md-cta-min-height: 58px;
  }

  html body :is(a, button)[data-md-cta="whatsapp-icon"] {
    --md-cta-min-height: 48px;
    --md-cta-padding: 0;
    inline-size: 48px !important;
    min-inline-size: 48px !important;
    block-size: 48px !important;
    flex: 0 0 48px;
    place-items: center;
  }

  html body .mc2-main a.cb18-whatsapp-round[data-md-cta="whatsapp-icon"] {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
  }

  html body :is(a, button)[data-md-cta="whatsapp-float"] {
    --md-cta-min-height: 58px;
    --md-cta-padding: 0;
  }

  html body :is(a, button)[data-md-cta^="whatsapp"] :is(img[src$="/whatsapp.svg"], svg.ts-parity-icon--whatsapp) {
    inline-size: 22px !important;
    block-size: 22px !important;
    flex: 0 0 22px;
    color: #fff !important;
    filter: brightness(0) invert(1) !important;
    text-shadow: none !important;
  }

  html body :is(a, button):is([data-md-cta="whatsapp"], [data-md-cta="whatsapp-submit"]):not([data-md-cta-size="footer"])
    :is(img[src$="/whatsapp.svg"], svg.ts-parity-icon--whatsapp) {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    margin: 0 !important;
    order: -1;
  }

  html body .ts-legacy-home-hero .ts-button-row > a.ts-button--whatsapp[data-md-cta="whatsapp"] {
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
  }

  html body .ts-legacy-home-hero .ts-button-row > a.ts-button--whatsapp[data-md-cta="whatsapp"] > img.ts-button-brand-icon {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    margin: 0 !important;
  }

  html body .ts-legacy-home-hero .ts-button-row > a.ts-button--whatsapp[data-md-cta="whatsapp"] > span {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
  }

  html body .mc2-support-contact-quick > [data-md-cta] {
    --md-cta-padding: 9px 10px;
    --md-cta-font-size: 13px;
    gap: 6px;
  }

  html body .mc2-support-contact-quick > [data-md-cta="whatsapp"] > svg:not(.ts-parity-icon--whatsapp) {
    display: none;
  }

  html body :is(a, button)[data-md-cta="whatsapp-icon"] :is(img[src$="/whatsapp.svg"], svg.ts-parity-icon--whatsapp) {
    inline-size: 28px !important;
    block-size: 28px !important;
    flex-basis: 28px;
    margin: 0;
  }

  html body :is(a, button)[data-md-cta="whatsapp-float"] img[src$="/whatsapp.svg"] {
    inline-size: 32px !important;
    block-size: 32px !important;
  }

  /* Use the same white mark on text-only WhatsApp controls, including submit states. */
  html body :is(a, button)[data-md-cta-icon="add"]::before {
    content: "";
    order: -1;
    inline-size: 22px;
    block-size: 22px;
    flex: 0 0 22px;
    background: #fff;
    -webkit-mask: url("/assets/ts-modcare/whatsapp.svg") center/contain no-repeat;
    mask: url("/assets/ts-modcare/whatsapp.svg") center/contain no-repeat;
  }

  html body :is(a, button)[data-md-cta-size="compact"] {
    --md-cta-min-height: 44px;
    --md-cta-padding: 9px 14px;
  }

  html body :is(a, button)[data-md-cta-size="footer"] {
    --md-cta-min-height: 42px;
    --md-cta-padding: 0;
    --md-cta-font-size: 12px;
  }

  html body .ts-footer-actions > a[data-md-cta="secondary"] {
    --md-cta-border: #92582e;
    --md-cta-text: #d8a475;
    --md-cta-font-weight: 650;
  }

  html body .ts-footer-actions > a[data-md-cta="whatsapp"] {
    --md-cta-padding: 0 42px;
  }

  html body :is(a, button)[data-md-cta]:focus-visible {
    outline: 2px solid #9a5d38 !important;
    outline-offset: 3px;
  }

  html body :is(a, button)[data-md-cta]:disabled {
    opacity: .7;
    cursor: wait;
  }

  @media (max-width: 760px) {
    html body .ts-legacy-home-hero .ts-button-row > [data-md-cta] {
      --md-cta-padding: 11px 12px;
    }

    html body :is(a, button)[data-md-cta="whatsapp-submit"] {
      --md-cta-min-height: 54px;
    }
    html body .mc4-mobile-actions > :is(a, button)[data-md-cta="primary"] {
      --md-cta-min-height: 58px;
      --md-cta-padding: 11px 16px;
      --md-cta-font-size: clamp(14px, 4vw, 16px);
      min-inline-size: 0 !important;
    }
    html body :is(a, button)[data-md-cta="whatsapp-float"] {
      --md-cta-min-height: 54px;
    }
  }
}
