/* ==========================================================================
   pay-step.css : our own payment step on /order/ (design leg L2D, 2026-11-24).
   Copy this block over site/src/css/pay-step.css. Every id and class that js/pay-step-fb.js and payStepPanel() already use is kept;
   the new hooks are listed in .claude/design/pay-panel/SPEC.md section 4.
   System: site.css :root tokens only. Deep green is the only fill, mint-light (--tint) the only tint, pink is not used.
   4px controls (--radius); 999px only on the spinner, the loading bar and the error dot. Text is 16px or larger; controls are 48px tall (the text link 44px).
   Placement: order-flow.js regroup() moves this panel into the Payment stage card (#stage-payment .stage-body), so it never draws a box of its own.
   ========================================================================== */

/* 0. Pay mode. While the step is open the stage card shows ONLY the step: one job on screen. "Change my order" closes it and the review comes back.
      CSS only. A browser without :has() keeps the review above the step and nothing breaks. Delete these three rules to go back to that. */
#stage-payment:has(#pay-step:not([hidden])) :is(#stage-payment-title, .stage-intro, #stage-review, .cash-panel, .stage-actions) { display: none; }
/* Two-screen checkout (plan 2026-11-27-hh2-checkout-two-screens, C5): the allergy answers share this screen, so they leave with the review; js/pay-step-fb.js payMode() also makes them inert. */
#stage-payment:has(#pay-step:not([hidden])) :is(#stage-allergens, #stage-declarations, #stage-declarations-more, #saved-notes-row, #consent-block, #office-allergy-note, #allergy-help, #allergies, label[for="allergies"], #notes, label[for="notes"]) { display: none; }
#stage-payment:has(#pay-step:not([hidden])) #pay-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#stage-payment:has(#pay-step:not([hidden])) .pay-step { margin-top: 0; padding-top: 0; border-top: 0; scroll-margin-top: 38px; }

.pay-step { --pay-danger: #b3261e; margin: 20px 0 6px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; font-size: 16px; line-height: 1.5; color: var(--ink); }
.pay-step[hidden], .pay-step [hidden] { display: none !important; }

/* 1. Head: what is being paid, and the reference to quote */
.pay-step-head { margin: 0; }
.pay-step-title { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; font-variation-settings: "opsz" 72, "SOFT" 30; color: var(--green-deep); }
.pay-step-title:focus { outline: none; }
.pay-step-title:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
#pay-step-amount { font-variant-numeric: tabular-nums; }
.pay-step-ref { margin: 6px 0 0; font-size: 16px; line-height: 1.4; color: var(--muted); }
#pay-step-ref { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* 2. Recap: how the total is made up. One mint tile, one strong rule above the total.
      Phone and tablet only: from 901px the sticky "Your summary" card sits beside the step and is the recap, so the figures appear once. */
.pay-recap { margin: 16px 0 0; padding: 6px 14px; border-radius: var(--radius); background: var(--tint); font-size: 16px; }
.pay-recap > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 7px 0; }
.pay-recap dt { color: var(--muted); }
.pay-recap dd { margin: 0; flex: none; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-recap-offer dt { flex: 1 1 auto; }
.pay-recap-offer dd { color: var(--green-text); }
.pay-recap-total { margin-top: 4px; border-top: 1px solid var(--line-strong); }
.pay-recap > .pay-recap-total { padding: 10px 0 8px; }
.pay-recap-total dt { color: var(--ink); font-weight: 700; }
.pay-recap-total dd { font-size: 18px; font-weight: 700; }
@media (min-width: 901px) { .pay-recap { display: none; } }

/* 3. Express row: Stripe draws Apple Pay / Google Pay inside #pay-express-element (buttonHeight 48). Hidden until a wallet is available. */
.pay-step-express { margin: 20px 0 0; }
#pay-express-element { min-height: 48px; }
.pay-step-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 0; font-size: 16px; font-weight: 600; line-height: 1.2; color: var(--muted); }
.pay-step-or::before, .pay-step-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* 4. Card fields: Stripe mounts one iframe in each .pay-field-box. Same box as the site's inputs. */
.pay-step-fields { display: grid; gap: 14px; margin: 18px 0 0; container-type: inline-size; }
.pay-field { display: block; min-width: 0; }
.pay-field-label { display: block; margin: 0 0 6px; font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.pay-field-box { min-height: 48px; padding: 13px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--ground); transition: border-color 140ms ease-out, box-shadow 140ms ease-out; }
.pay-field-box.StripeElement--focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.pay-field-box.StripeElement--invalid { border-color: var(--pay-danger); box-shadow: inset 0 0 0 1px var(--pay-danger); }
/* Billing postcode as the site's own input instead of a Stripe field (SPEC delta L2, option b): the same box and the same states. */
input.pay-field-box { display: block; box-sizing: border-box; width: 100%; height: 48px; padding: 0 14px; font: 500 16px/1.25 var(--body); color: var(--ink); }
input.pay-field-box:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input.pay-field-box[aria-invalid="true"] { border-color: var(--pay-danger); box-shadow: inset 0 0 0 1px var(--pay-danger); }
.pay-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.pay-field-postcode { grid-column: 1 / -1; }
@container (min-width: 480px) { .pay-field-row:has(.pay-field-postcode) { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pay-field-postcode { grid-column: auto; } }
@media (max-width: 339px) { .pay-field-row { grid-template-columns: minmax(0, 1fr); } }
/* Opening: until Stripe mounts its iframe the box is empty, so it holds its full size and shows a quiet bar. No script, no layout jump. */
.pay-field-box:empty::before { content: ''; display: block; width: 46%; height: 12px; margin-top: 4px; border-radius: 999px; background: var(--tint-deep); }
@media (prefers-reduced-motion: no-preference) { .pay-field-box:empty::before { animation: pay-pulse 1.1s ease-in-out infinite alternate; } }
@keyframes pay-pulse { from { opacity: 0.45; } to { opacity: 1; } }

/* 5. Error: one plain sentence, directly above the button it explains. The "!" dot is the cue that does not rely on colour. */
.pay-step-error { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 0; padding: 12px 14px; border: 1px solid var(--pay-danger); border-radius: var(--radius); background: var(--ground); color: var(--pay-danger); font-size: 16px; font-weight: 600; line-height: 1.45; }
.pay-step-error::before { content: '!'; flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 999px; background: var(--pay-danger); color: var(--white); font-size: 15px; font-weight: 800; line-height: 22px; text-align: center; }

/* 6. Pay button: the one filled action in the step. Mint while the card is incomplete (site .button:disabled); deep green and working while paying. */
.pay-step-submit { width: 100%; min-height: 48px; margin: 18px 0 0; justify-content: center; gap: 10px; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-step-error:not([hidden]) ~ :is(.pay-step-submit, .pay-step-reload) { margin-top: 12px; }
.pay-step[aria-busy="true"] .pay-step-submit, .pay-step[aria-busy="true"] .pay-step-submit:disabled { background: var(--green-deep); border-color: var(--green-deep); color: var(--white); cursor: progress; transform: none; }
.pay-step[aria-busy="true"] .pay-step-submit::before, .pay-step-klarna[aria-busy="true"]::before { content: ''; flex: none; width: 18px; height: 18px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: var(--white); }
.pay-step-klarna[aria-busy="true"]::before { border-color: var(--tint-deep); border-top-color: var(--green-deep); }
@media (prefers-reduced-motion: no-preference) { .pay-step[aria-busy="true"] .pay-step-submit::before, .pay-step-klarna[aria-busy="true"]::before { animation: pay-spin 0.8s linear infinite; } }
@keyframes pay-spin { to { transform: rotate(360deg); } }
/* Paying: everything except the working button steps back and cannot be pressed. */
.pay-step[aria-busy="true"] :is(.pay-step-express, .pay-step-fields, #pay-paypal, .pay-step-klarna:not([aria-busy="true"]), .pay-step-terms, .pay-step-klarna + .field-help, .pay-step-back) { opacity: 0.5; pointer-events: none; }
.pay-step[aria-busy="true"]:not(:has(.pay-step-klarna[aria-busy="true"])) .pay-step-alt > .pay-step-or { opacity: 0.5; }
.pay-step-wait { display: none; margin: 10px 0 0; font-size: 16px; line-height: 1.45; color: var(--muted); text-align: center; }
.pay-step[aria-busy="true"] .pay-step-wait { display: block; }
/* Klarna is the one working: the card button waits in its mint state, the Klarna button carries the spinner. */
.pay-step[aria-busy="true"]:has(.pay-step-klarna[aria-busy="true"]) .pay-step-submit { background: var(--tint-deep); border-color: var(--line); color: var(--muted); cursor: default; }
.pay-step[aria-busy="true"]:has(.pay-step-klarna[aria-busy="true"]) .pay-step-submit::before { content: none; }
.pay-step[aria-busy="true"]:has(.pay-step-klarna[aria-busy="true"]) .pay-step-wait { display: none; }

/* 7. The secure fields did not load (data-load="failed" on the panel): the message, one Try again button, and the way back. Nothing half-working stays on screen. */
.pay-step-reload { width: 100%; min-height: 48px; margin: 18px 0 0; justify-content: center; font-size: 17px; font-weight: 700; }
.pay-step[data-load="failed"] :is(.pay-step-express, .pay-step-fields, .pay-step-submit, .pay-step-alt, .pay-step-note) { display: none; }

/* 8. Other ways to pay: PayPal (Stripe draws it in #pay-paypal-element) and Klarna (our own button). Both outlined, so the card button stays the one filled action. */
.pay-step-alt { margin: 20px 0 0; }
#pay-alt:not(:has(.pay-step-alt-item:not([hidden]))) { display: none; }
.pay-step-alt-list { display: grid; gap: 10px; margin: 16px 0 0; }
.pay-step-or + .pay-step-klarna { margin-top: 16px; }   /* the markup before SPEC delta M5: the button sits straight under its divider */
.pay-step-alt-item { min-width: 0; }
#pay-paypal-element { min-height: 48px; }
.pay-step-klarna { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 16px; font-size: 16px; font-weight: 700; }
.pay-step-klarna img { flex: none; width: auto; height: 20px; }
.pay-step-klarna[aria-busy="true"] { cursor: progress; }
.pay-step-terms, .pay-step-klarna + .field-help { margin: 8px 0 0; font-size: 16px; line-height: 1.45; color: var(--muted); }

/* 9. Reassurance and the way back */
.pay-step-note { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.5; color: var(--muted); }
.pay-step-note::before { content: ''; flex: none; width: 16px; height: 20px; margin-top: 2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'%3E%3Cpath fill='none' stroke='%232e6114' stroke-width='1.8' d='M4.2 9V6a3.8 3.8 0 0 1 7.6 0v3'/%3E%3Crect x='1.5' y='9' width='13' height='9.5' rx='1.5' fill='%232e6114'/%3E%3C/svg%3E") center / contain no-repeat; }
.pay-step .pay-step-back { display: inline-flex; align-items: center; width: auto; min-height: 44px; margin: 6px 0 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--ink); font-size: 16px; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.pay-step .pay-step-back:hover { background: none; color: var(--accent); }
.pay-step .pay-step-back:disabled { color: var(--muted); text-decoration: none; cursor: not-allowed; }
