/* Customized Designs Payments: the card box on the classic checkout and the Pay for order page.
   Works down to 360 px wide. The hosted fields draw their own input inside each frame; the wrapper
   draws the border. */
/* Mockup A (0.9.3, Brian's pick on 2026-11-19). Fonts and the heading come from the theme; the
   accent (focus edge) is the theme's primary color where it publishes one, so the box fits either
   store. Neutral grays otherwise. */
.cdp-card {
  --cdp-accent: var(--primary-color, var(--wp--preset--color--primary, #2271b1));
  --cdp-edge: #c3c8cf;
  --cdp-muted: #4b5563;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  max-width: 100%;
}
/* The "Payment" heading takes the theme's own h3 look. It replaces WooCommerce's lone "Credit card"
   label when this is the only method (the label stays for screen readers); with other methods listed
   the label stays and the heading goes. */
.cdp-heading {
  margin: 0 0 0.75em;
}
/* Themes style the method label with an id selector (Storefront: #payment ... > label), so the
   screen-reader-only rule needs !important, as WordPress's own screen-reader-text does. */
.wc_payment_methods > li.payment_method_cd_payments:only-child > label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.wc_payment_methods > li.payment_method_cd_payments:not(:only-child) .cdp-heading {
  display: none;
}
.cdp-card .cdp-field {
  margin: 0 0 0.875em;
  min-width: 0;
}
.cdp-card .cdp-field-row .cdp-field {
  margin-bottom: 0;
}
.cdp-card .cdp-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 6px;
}
/* The hosted fields draw their own input inside each frame (16 px text, so iPhones don't zoom); the
   wrapper draws the border, and the edge turns the accent with a soft ring while the field has focus. */
.cdp-card .cdp-hosted {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--cdp-edge);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cdp-card .cdp-hosted iframe {
  display: block;
  width: 100% !important;
  height: 46px !important;
  border: 0;
}
.cdp-card .cdp-hosted.cdp-focus,
.cdp-card .cdp-hosted:focus-within {
  border-color: var(--cdp-accent);
  box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cdp-accent) 22%, transparent);
}
.cdp-card .cdp-hosted-wrap {
  position: relative;
}
.cdp-card .cdp-cvv-hint {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 30px;
  height: 20px;
  margin-top: -10px;
  color: #6b7280;
  pointer-events: none;
}
.cdp-card .cdp-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.cdp-card .cdp-secure {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--cdp-muted);
}
.cdp-card .cdp-secure .cdp-lock {
  flex: none;
}
.cdp-card .cdp-loading {
  font-size: 0.9em;
  margin: 0.75em 0 0;
}
.cdp-card.cdp-ready .cdp-loading,
.cdp-card.cdp-failed .cdp-loading {
  display: none;
}
.cdp-card .cdp-message {
  color: #b32d2e;
  font-weight: 600;
  margin: 0.75em 0 0;
}
.cdp-card .cdp-message[hidden] {
  display: none;
}
.cdp-card.cdp-busy .cdp-hosted {
  opacity: 0.6;
}
.cdp-thankyou {
  font-weight: 600;
}
/* The tight gap above Place order: the box ends on its lock line, and WooCommerce's terms wrapper
   above the button keeps no bottom margin while it is empty (themes give it one even with no terms). */
#payment:has(.cdp-card) .woocommerce-terms-and-conditions-wrapper:not(:has(*)) {
  margin-bottom: 0;
}
@media (max-width: 380px) {
  .cdp-card .cdp-field-row {
    gap: 8px;
  }
}
/* The bank-check window: centred over the page, inside the viewport at 360 px, with the bank's own
   frame below the plain heading and a Cancel button. It sits above theme sticky headers and the admin
   bar (a very high layer), and the page under it doesn't scroll. */
body.cdp-modal-open {
  overflow: hidden;
}
.cdp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.55);
}
/* Never a sideways scrollbar: the bank's frame is sized in pixels by its script, so it is held to the
   window's width; themes that give buttons a side margin or headings wide letters are reset here. The
   window scrolls up and down when the bank's page is tall, so Cancel is always reachable. */
.cdp-modal {
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px;
  border-radius: 6px;
  background: #fff;
  color: #1f2328;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.cdp-modal > * {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 400px) {
  .cdp-modal-backdrop {
    padding: 8px;
  }
  .cdp-modal {
    max-height: calc(100vh - 16px);
    padding: 12px;
  }
}
.cdp-modal .cdp-modal-title {
  margin: 0 0 0.4em;
  font-size: 1.25em;
  line-height: 1.3;
}
.cdp-modal .cdp-modal-note {
  margin: 0 0 1em;
  font-size: 0.95em;
}
.cdp-modal .cdp-verify-frame {
  min-height: 60px;
  margin: 0 0 1em;
  overflow: hidden;
}
.cdp-modal .cdp-verify-frame iframe {
  display: block;
  max-width: 100% !important;
  margin: 0 auto;
  border: 0;
}
.cdp-modal .cdp-modal-cancel {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
}
.cdp-modal .cdp-modal-cancel[hidden] {
  display: none;
}
.cdp-modal:focus {
  outline: none;
}
/* The Place order window (0.9.0): the invoice payment site's numbered steps, done, current (turning)
   and to do. The bank's frame box takes no room until the bank's page is up; while it is, the steps
   fold away and the window fits round the bank's box as below. */
.cdp-modal .cdp-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}
.cdp-modal .cdp-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #1f2328;
}
.cdp-modal .cdp-step::before {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid #9aa0a6;
}
.cdp-modal .cdp-step--done::before {
  border: 0;
  background: #0a6496;
}
.cdp-modal .cdp-step--current {
  font-weight: 600;
}
.cdp-modal .cdp-step--current::before {
  border: 3px solid #cfe6f3;
  border-top-color: #0a6496;
  /* A working indicator keeps turning, also under "reduce motion" and against a theme's catch-all
     reduced-motion rule: Brian's rule is that anything working must visibly move. It is a small status
     spinner, not decoration. */
  animation: cdp-spin 0.9s linear infinite !important;
}
.cdp-modal .cdp-step--todo {
  color: #5a6068;
}
.cdp-modal.cdp-modal-steps .cdp-verify-frame {
  min-height: 0;
  margin: 0;
}
.cdp-modal.cdp-modal-steps.cdp-modal-challenge .cdp-steps {
  display: none;
}
@keyframes cdp-spin {
  to {
    transform: rotate(360deg);
  }
}
/* While the bank's page is shown: the window fits round the bank's box. The box is the fixed size the
   bank's script reports (390 by 400 px on the gateway's test account, with the bank's own page scrolling
   inside it), drawn at that size and never stretched. The window is a compact heading, the box, and a
   smaller outlined "Cancel payment" right under it, centred, as tall as that and no taller. On a screen
   too small for the box, the script's frame is shrunk evenly (to 70% at most) and the box takes the
   shrunk size, so no empty band is left; below 70% the window scrolls up and down and Cancel stays
   reachable; a box too wide even at 70% is cut to the screen, centred. The sizes come from the page
   script (--cdp-box-w/h, --cdp-frame-w/h/x, --cdp-bank-scale);
   until the bank's script reports one, the plain window above stays as it is. */
.cdp-modal-backdrop.cdp-modal-backdrop-challenge {
  padding: 16px;
}
@media (max-width: 480px) {
  .cdp-modal-backdrop.cdp-modal-backdrop-challenge {
    padding: 8px;
  }
}
.cdp-modal.cdp-modal-challenge.cdp-modal-fit {
  width: var(--cdp-box-w);
  min-width: 0;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.cdp-modal.cdp-modal-fit .cdp-modal-title {
  margin: 0;
  padding: 10px 12px 0;
  font-size: 1.05em;
  line-height: 1.3;
}
.cdp-modal.cdp-modal-fit .cdp-modal-note {
  margin: 0;
  padding: 2px 12px 8px;
  font-size: 0.85em;
  line-height: 1.4;
}
.cdp-modal.cdp-modal-fit .cdp-verify-frame {
  position: relative;
  width: var(--cdp-box-w);
  height: var(--cdp-box-h);
  min-height: 0;
  margin: 0;
  overflow: hidden;
}
.cdp-modal.cdp-modal-fit .cdp-verify-frame iframe {
  position: absolute;
  top: 0;
  left: var(--cdp-frame-x, 0px);
  width: var(--cdp-frame-w) !important;
  height: var(--cdp-frame-h) !important;
  max-width: none !important;
  margin: 0;
  border: 0;
  transform: scale(var(--cdp-bank-scale, 1));
  transform-origin: 0 0;
}
.cdp-modal.cdp-modal-challenge .cdp-modal-cancel {
  display: block;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  margin: 8px auto 10px;
  padding: 0 16px;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #1f2328;
  font-size: 14px;
  font-weight: 400;
  line-height: 42px;
  letter-spacing: normal;
  text-transform: none;
}
.cdp-modal.cdp-modal-challenge .cdp-modal-cancel:hover {
  background: #f0f0f1;
  color: #1f2328;
}
.cdp-modal.cdp-modal-challenge .cdp-modal-cancel:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
}
/* Apple Pay and Google Pay (0.9.3): an "Express checkout" row above the card fields, the two buttons
   side by side at the same height and corners, each box shown only once the wallet's own script has
   drawn it. One wallet takes the whole row. Each column is at least 140 px (Apple's published minimum
   button width; Google's is 90), so on a narrow phone where both don't fit they stack. */
.cdp-card .cdp-wallets {
  margin: 0 0 4px;
}
.cdp-card .cdp-wallets[hidden],
.cdp-card .cdp-wallet[hidden] {
  display: none;
}
.cdp-card .cdp-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--cdp-muted);
  text-align: center;
}
.cdp-card .cdp-rule::before,
.cdp-card .cdp-rule::after {
  content: "";
  flex: 1 1 0;
  min-width: 16px;
  height: 1px;
  background: #dfe3e8;
}
.cdp-card .cdp-wallet-express {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cdp-card .cdp-wallet-or {
  margin: 18px 0 14px;
}
.cdp-card .cdp-wallet-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: start;
}
.cdp-card .cdp-wallet {
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  overflow: hidden;
}
.cdp-card .cdp-wallet > * {
  max-width: 100%;
}
.cdp-card .cdp-wallet apple-pay-button {
  display: block;
  width: 100%;
  --apple-pay-button-width: 100%;
  --apple-pay-button-height: 40px;
  --apple-pay-button-border-radius: 4px;
}
/* Google's button draws about 40 px tall in its fixed 45 px frame (no size option); Apple's is set to
   40 px to match, and both sit at the top of the row. */
.cdp-card .cdp-wallet iframe {
  display: block;
  width: 100%;
  border: 0;
}
.cdp-card.cdp-busy .cdp-wallets {
  pointer-events: none;
  opacity: 0.6;
}
