/* ===========================================================================
   CART + CHECKOUT — skin over WooCommerce's cart/checkout blocks.

   Layout ported from app/checkout/checkout-v2-client.tsx:
     header  grid  lg:[minmax(0,56fr) minmax(0,44fr)], 64px bar
     main    grid  lg:[minmax(0,56fr) minmax(0,44fr)]
     form    max-w-[42rem], ml-auto, py-8 → lg:py-10, pl-8 pr-12 xl:pr-16
     summary rail bg, border-left, sticky top-0, max-w-[33rem], px-8 py-10
   The FORM ITSELF is Woo's block checkout — its validation/shipping/payment
   machinery is deliberately untouched.

   ⚠️ CONTROL METRICS ARE LITERAL HERE, NOT TOKENS. The theme's radius scale
   (--radius-lg = 6px) and --border-strong (24% ink) are tuned for marketing
   surfaces; on a commerce form they read as stock WordPress. Shopify-grade
   controls need 10–12px radii and a QUIETER ~15% hairline, so this file pins
   its own `--cko-*` scale rather than bending the global tokens.

   ⚠️ THE SCALE IS DECLARED ON BOTH PAGES ON PURPOSE. Cart and checkout are one
   funnel and a buyer sees them back to back; when only one of them carried the
   scale, the two surfaces drifted (4.8px cart controls against 10px checkout
   ones). Add a control to either page and it inherits the same language.
   =========================================================================== */

body.ms-checkout-page,
body.ms-cart-page {
  --cko-radius: 0.625rem;        /* inputs, thumbnails, quantity stepper */
  --cko-radius-lg: 0.75rem;      /* option groups, buttons, cards */
  --cko-white: oklch(1 0 0);
  --cko-field-border: color-mix(in oklab, var(--foreground) 15%, transparent);
  --cko-field-border-hover: color-mix(in oklab, var(--foreground) 30%, transparent);
  --cko-rail-bg: color-mix(in oklab, var(--foreground) 2.5%, var(--background));
  --cko-brand-tint: color-mix(in oklab, var(--brand) 5%, var(--cko-white));
  --cko-focus-ring: 0 0 0 3px color-mix(in oklab, var(--brand) 18%, transparent);
}

/* ---- checkout chrome ------------------------------------------------------ */
.cko-header { border-bottom: 1px solid var(--border); background: var(--background); }
.cko-header__grid, .cko-footer__grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 1024px) {
  .cko-header__grid, .cko-footer__grid { grid-template-columns: minmax(0, 56fr) minmax(0, 44fr); }
}
.cko-header__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--p-space-4);
  height: 4rem; width: 100%; max-width: 42rem; margin-inline: auto;
  padding-inline: var(--p-space-5);
}
@media (min-width: 640px) { .cko-header__bar { padding-inline: var(--p-space-8); } }
@media (min-width: 1024px) {
  .cko-header__bar { margin-right: 0; margin-left: auto; padding-left: var(--p-space-8); padding-right: var(--p-space-12); }
}
@media (min-width: 1280px) { .cko-header__bar { padding-right: var(--p-space-16); } }
.cko-header__secure {
  display: inline-flex; align-items: center; gap: 0.4375rem; margin: 0;
  font-size: var(--p-text-13); color: var(--ink-3);
}
.cko-header__secure svg { color: var(--stock-in); }

.cko-footer { border-top: 1px solid var(--border); margin-top: auto; }
.cko-footer__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--p-space-3); width: 100%; max-width: 42rem; margin-inline: auto;
  padding: var(--p-space-6) var(--p-space-5) var(--p-space-10);
}
@media (min-width: 640px) { .cko-footer__bar { padding-inline: var(--p-space-8); } }
@media (min-width: 1024px) {
  .cko-footer__bar { margin-right: 0; margin-left: auto; padding-left: var(--p-space-8); padding-right: var(--p-space-12); }
}
.cko-footer__legal { margin: 0; font-size: var(--p-text-12); color: var(--ink-4); }
.cko-footer__links { display: flex; flex-wrap: wrap; gap: var(--p-space-4); }
.cko-footer__links a {
  font-size: var(--p-text-12); color: var(--ink-3); text-decoration: none;
  transition: color 150ms var(--ease-out-quart);
}
.cko-footer__links a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }

/* ---- the 56/44 split ------------------------------------------------------ */
/* Gutenberg block-gap AND WC's own 24px block padding put cream between the
   header rule and the split — the rail must MEET the header, like Shopify's */
body.ms-checkout-page .wp-block-woocommerce-checkout { margin-block: 0; padding: 0; }
body.ms-checkout-page .wc-block-components-sidebar-layout {
  display: grid; grid-template-columns: 1fr; gap: 0; align-items: start;
  margin: 0;
}
@media (min-width: 1024px) {
  body.ms-checkout-page .wc-block-components-sidebar-layout {
    grid-template-columns: minmax(0, 56fr) minmax(0, 44fr);
  }
}
/* Woo's own float/width rules fight the grid — neutralise them */
body.ms-checkout-page .wc-block-components-main,
body.ms-checkout-page .wc-block-components-sidebar {
  width: auto; max-width: none; float: none; padding: 0; margin: 0;
}

body.ms-checkout-page .wc-block-components-main {
  width: 100%; max-width: 42rem; margin-inline: auto;
  padding: var(--p-space-8) var(--p-space-5);
}
@media (min-width: 640px) { body.ms-checkout-page .wc-block-components-main { padding-inline: var(--p-space-8); } }
@media (min-width: 1024px) {
  body.ms-checkout-page .wc-block-components-main {
    margin-right: 0; margin-left: auto;
    padding: var(--p-space-10) var(--p-space-12) var(--p-space-10) var(--p-space-8);
  }
}
@media (min-width: 1280px) { body.ms-checkout-page .wc-block-components-main { padding-right: var(--p-space-16); } }

body.ms-checkout-page .wc-block-components-sidebar {
  background: var(--cko-rail-bg);
  border-top: 1px solid var(--border);
}
@media (min-width: 1024px) {
  body.ms-checkout-page .wc-block-components-sidebar {
    position: sticky; top: 0; align-self: start;
    border-top: none; border-left: 1px solid var(--border);
    min-height: 100vh;
  }
}

/* ⚠️ The rail's inner width/padding lives on the ORDER-SUMMARY BLOCK, never on
   a blanket `sidebar > *`. Woo mounts two NOTICE containers before the summary
   — both usually empty — and a blanket child padding turns each into an 80px
   blank band above the card. */
body.ms-checkout-page .wc-block-components-sidebar > * { padding: 0; }

body.ms-checkout-page .wp-block-woocommerce-checkout-order-summary-block {
  width: 100%; max-width: 33rem; margin-right: auto;
  /* 1.5rem, not the form's 2.5rem — the two title BASELINES align across the
     split (the headings differ in size), measured live at 1440 */
  padding: var(--p-space-6) var(--p-space-8) var(--p-space-12);
  /* WC 11 draws its own bordered, rounded card here — a box inside the rail's
     box. The rail IS the surface; the card dies. */
  border: none; border-radius: 0; background: transparent;
}
@media (min-width: 1280px) {
  body.ms-checkout-page .wp-block-woocommerce-checkout-order-summary-block { padding-inline: var(--p-space-11); }
}
/* a REAL notice (payment error etc.) still gets room when one exists */
body.ms-checkout-page .wc-block-components-sidebar .wc-block-components-notices:has(*) {
  padding: var(--p-space-6) var(--p-space-8) 0; max-width: 33rem;
}

/* ---- checkout steps ------------------------------------------------------- */
body.ms-checkout-page .wc-block-components-checkout-step {
  border: none; padding: 0; margin-bottom: var(--p-space-10);
}
body.ms-checkout-page .wc-block-components-checkout-step__title {
  font-family: inherit; font-size: var(--p-text-18); line-height: 1.35;
  font-weight: 600; letter-spacing: var(--p-tracking-n10); color: var(--foreground);
}
body.ms-checkout-page .wc-block-components-checkout-step__heading { margin: 0 0 var(--p-space-3-5); }
body.ms-checkout-page .wc-block-components-checkout-step__description {
  color: var(--ink-3); font-size: var(--p-text-13); line-height: 1.5; margin: var(--p-space-1-5) 0 var(--p-space-3);
}
body.ms-checkout-page .wc-block-components-checkout-step__heading-content { color: var(--ink-3); font-size: var(--p-text-13); }
/* an empty express-payment mount must not leave a gap */
body.ms-checkout-page .wp-block-woocommerce-checkout-express-payment-block:empty { display: none; }

/* ---- fields --------------------------------------------------------------- */
/* ⚠️ THE `input[type=…]` VARIANTS ARE LOAD-BEARING, NOT VERBOSITY. WC core
   styles text inputs as `.wc-block-components-text-input input[type="text"]`
   (etc.) — an attribute selector that outguns a bare `… input` on specificity.
   The SELECTS have no such variant, which is exactly why they took the restyle
   while text inputs silently kept WC's dark 4px look. Every state below must
   carry the typed variants or inputs and selects drift apart again. */
body.ms-checkout-page .wc-block-components-text-input input,
body.ms-checkout-page .wc-block-components-text-input input[type="text"],
body.ms-checkout-page .wc-block-components-text-input input[type="email"],
body.ms-checkout-page .wc-block-components-text-input input[type="tel"],
body.ms-checkout-page .wc-block-components-text-input input[type="number"],
body.ms-checkout-page .wc-block-components-text-input input[type="url"],
body.ms-checkout-page .wc-block-components-text-input input[type="password"],
body.ms-checkout-page .wc-block-components-textarea,
body.ms-checkout-page .wc-blocks-components-select__select,
body.ms-cart-page .wc-block-components-text-input input,
body.ms-cart-page .wc-block-components-text-input input[type="text"] {
  height: 3.25rem; border-radius: var(--cko-radius);
  border: 1px solid var(--cko-field-border);
  background: var(--cko-white);
  color: var(--foreground); font-family: inherit; font-size: var(--p-text-15);
  box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 3%, transparent);
  transition: border-color 150ms var(--ease-out-quart), box-shadow 150ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-text-input input:hover,
body.ms-checkout-page .wc-block-components-text-input input[type="text"]:hover,
body.ms-checkout-page .wc-block-components-text-input input[type="email"]:hover,
body.ms-checkout-page .wc-block-components-text-input input[type="tel"]:hover,
body.ms-checkout-page .wc-block-components-text-input input[type="number"]:hover,
body.ms-checkout-page .wc-block-components-text-input input[type="url"]:hover,
body.ms-checkout-page .wc-block-components-text-input input[type="password"]:hover,
body.ms-checkout-page .wc-blocks-components-select__select:hover,
body.ms-checkout-page .wc-block-components-textarea:hover,
body.ms-cart-page .wc-block-components-text-input input:hover {
  border-color: var(--cko-field-border-hover);
}
body.ms-checkout-page .wc-block-components-text-input input:focus,
body.ms-checkout-page .wc-block-components-text-input input[type="text"]:focus,
body.ms-checkout-page .wc-block-components-text-input input[type="email"]:focus,
body.ms-checkout-page .wc-block-components-text-input input[type="tel"]:focus,
body.ms-checkout-page .wc-block-components-text-input input[type="number"]:focus,
body.ms-checkout-page .wc-block-components-text-input input[type="url"]:focus,
body.ms-checkout-page .wc-block-components-text-input input[type="password"]:focus,
body.ms-checkout-page .wc-block-components-textarea:focus,
body.ms-checkout-page .wc-blocks-components-select__select:focus,
body.ms-cart-page .wc-block-components-text-input input:focus {
  border-color: var(--brand);
  box-shadow: var(--cko-focus-ring);
  outline: none;
}
body.ms-checkout-page .wc-block-components-text-input label,
body.ms-checkout-page .wc-blocks-components-select__label {
  color: var(--ink-3); font-family: inherit; font-size: var(--p-text-15);
}
body.ms-checkout-page .wc-block-components-text-input.is-active label,
body.ms-checkout-page .wc-blocks-components-select.is-active .wc-blocks-components-select__label {
  color: var(--ink-3); font-size: var(--p-text-12);
}
/* tight Shopify field rhythm — Woo's default gaps read airy and unrelated */
body.ms-checkout-page .wc-block-components-text-input,
body.ms-checkout-page .wc-blocks-components-select,
body.ms-checkout-page .wc-block-components-country-input,
body.ms-checkout-page .wc-block-components-state-input {
  margin-top: var(--p-space-3);
}
/* ⚠️ The select's CONTAINER paints its own WHITE box at WC's 4px radius,
   BEHIND the 10px-rounded select — square white corners bleed out past every
   rounded corner. Transparent, not re-rounded: the select itself is the only
   layer that may paint, and nothing here may clip (overflow would amputate the
   focus ring). */
body.ms-checkout-page .wc-blocks-components-select__container {
  background: transparent; border: none; border-radius: var(--cko-radius);
}
body.ms-checkout-page .wc-blocks-components-select__expander { color: var(--ink-3); }

/* ---- address form — an OWNED grid, not stacked margins ---------------------
   Woo lays address fields out with per-field margins that resolve differently
   for text-input and select wrappers, so paired rows (City/State) drift out of
   alignment. A real grid makes every row share one top edge and one gap. */
body.ms-checkout-page .wc-block-components-address-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--p-space-3-5); align-items: start;
}
body.ms-checkout-page .wc-block-components-address-form > * {
  grid-column: 1 / -1; margin: 0; min-width: 0;
}
/* the select COMPONENT nests one level below the grid child, so the global
   field-rhythm margin survives the `> *` reset and makes select rows 12px
   taller than input rows — inside the grid, the gap is the only spacing */
body.ms-checkout-page .wc-block-components-address-form .wc-blocks-components-select,
body.ms-checkout-page .wc-block-components-address-form .wc-block-components-text-input,
body.ms-checkout-page .wc-block-components-address-form .wc-block-components-country-input,
body.ms-checkout-page .wc-block-components-address-form .wc-block-components-state-input {
  margin: 0;
}
body.ms-checkout-page .wc-block-components-address-form__first_name,
body.ms-checkout-page .wc-block-components-address-form__last_name,
body.ms-checkout-page .wc-block-components-address-form__city,
body.ms-checkout-page .wc-block-components-address-form__state,
body.ms-checkout-page .wc-block-components-address-form__postcode,
body.ms-checkout-page .wc-block-components-address-form__phone {
  grid-column: span 1;
}
body.ms-checkout-page .wc-block-components-address-form__address_2-toggle {
  font-size: var(--p-text-13); color: var(--ink-3); text-decoration: none;
  transition: color 150ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-address-form__address_2-toggle:hover {
  color: var(--brand); text-decoration: underline; text-underline-offset: 3px;
}
/* validation — quiet, adjacent, red only where it is wrong */
body.ms-checkout-page .wc-block-components-text-input.has-error input,
body.ms-checkout-page .wc-block-components-text-input.has-error input[type="text"],
body.ms-checkout-page .wc-block-components-text-input.has-error input[type="email"],
body.ms-checkout-page .wc-block-components-text-input.has-error input[type="tel"],
body.ms-checkout-page .wc-block-components-text-input.has-error input[type="number"],
body.ms-checkout-page .wc-blocks-components-select.has-error .wc-blocks-components-select__select {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--destructive) 14%, transparent);
}
body.ms-checkout-page .wc-block-components-text-input.has-error label { color: var(--destructive); }
body.ms-checkout-page .wc-block-components-validation-error p {
  font-size: var(--p-text-13); color: var(--destructive); margin: var(--p-space-1-5) 0 0;
}
body.ms-checkout-page .wc-block-components-notice-banner,
body.ms-cart-page .wc-block-components-notice-banner {
  border-radius: var(--cko-radius-lg); font-size: var(--p-text-14);
}

/* ---- checkboxes & radios -------------------------------------------------- */
body.ms-checkout-page .wc-block-components-checkbox__input[type="checkbox"] {
  width: 1.25rem; height: 1.25rem; border-radius: var(--p-radius-6);
  border: 1.5px solid color-mix(in oklab, var(--foreground) 35%, transparent);
  background: var(--cko-white);
  transition: border-color 150ms var(--ease-out-quart), background-color 150ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-checkbox__input[type="checkbox"]:hover { border-color: var(--brand); }
body.ms-checkout-page .wc-block-components-checkbox__input[type="checkbox"]:checked {
  background: var(--brand); border-color: var(--brand);
}
body.ms-checkout-page .wc-block-components-checkbox__mark { color: var(--brand-foreground); fill: currentColor; }
body.ms-checkout-page .wc-block-components-checkbox__label { font-size: var(--p-text-14); color: var(--ink-2); }

body.ms-checkout-page .wc-block-components-radio-control__input {
  width: 1.25rem; height: 1.25rem;
  border: 1.5px solid color-mix(in oklab, var(--foreground) 35%, transparent);
  background: var(--cko-white);
  transition: border-color 150ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-radio-control__input:hover { border-color: var(--brand); }
body.ms-checkout-page .wc-block-components-radio-control__input:checked { border-color: var(--brand); }
body.ms-checkout-page .wc-block-components-radio-control__input:checked::before,
body.ms-checkout-page .wc-block-components-radio-control__input:checked::after {
  background: var(--brand);
}

/* ---- payment & shipping options — one border, one ring per surface --------- */
/* THE FOUR-RING DEFECT (the "double border, cut off at the corners"). Woo, the
   Whop bridge plugin, and this theme were each drawing a ring on the option
   group at a different radius, so every corner diverged and the sides doubled.
   The rings, measured live on WC 11:
     - the group ::after — Woo's 1px SECOND group border at radius 4px, sides
       only, sitting inside our 12px one (this is the visible doubled edge)
     - __option--checked-option-highlighted — Woo's inset near-black ring on the
       checked header
     - accordion-option and __option ::after — Woo hairlines on the wrapper AND
       the label, landing on the same pixel row and reading twice as dark
     - the Whop bridge plugin ships border-radius and box-shadow with !important
       on the rows and loads AFTER the theme
   ONE ring per surface from here: the GROUP owns the only border, the only
   radius, and CLIPS (overflow hidden), so nothing inside can round differently
   or spill past it; a ROW is a flush rectangle — selection is the brand tint,
   the accent radio and weight, never a border; exactly one full-bleed hairline
   between rows, ours. Woo keeps RENAMING these state classes between versions —
   which is why every hand-tuned fix regressed and this one was lost in the
   rebrand — so the kills use substring selectors that survive the renames and
   sit above the non-important rings Woo and the Whop bridge draw on the rows.
   DO NOT re-introduce a per-row border, ring, radius or box-shadow here. */

/* the group: the single bordered, rounded, clipping surface */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control,
body.ms-checkout-page .wc-block-components-radio-control--highlight-checked {
  border: 1px solid var(--cko-field-border); border-radius: var(--cko-radius-lg);
  background: var(--cko-white); overflow: hidden;
}
/* Woo's SECOND group border and every hairline it paints as a pseudo on a row —
   removed outright. The substring match covers the highlight-checked,
   --first-selected, --last-selected, accordion-option and __option variants. */
body.ms-checkout-page .wc-block-components-radio-control[class*="highlight-checked"]::before,
body.ms-checkout-page .wc-block-components-radio-control[class*="highlight-checked"]::after,
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control [class*="__option"]::before,
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control [class*="__option"]::after,
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control [class*="accordion-option"]::before,
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control [class*="accordion-option"]::after,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control [class*="__option"]::before,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control [class*="__option"]::after,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control [class*="accordion-option"]::before,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control [class*="accordion-option"]::after {
  content: none;
}
/* rows carry no ring of their own — this sits above Woo's non-important ring by
   specificity, and the Whop bridge plugin's only !important on the visible row
   sets box-shadow and outline to none, which agrees with us (its !important
   radius lands on the wrapper, which has no fill, so it never shows). */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control [class*="__option"],
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control [class*="accordion-option"],
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control [class*="__option"],
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control [class*="accordion-option"] {
  box-shadow: none; outline: none; border: 0; border-radius: 0;
}
/* the clickable row */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control__option,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control__option {
  padding: 1.0625rem var(--p-space-4) 1.0625rem var(--p-space-12); margin: 0;
  font-size: var(--p-text-15); font-weight: 500; color: var(--foreground);
  background: transparent;
  transition: background-color 150ms var(--ease-out-quart);
}
/* one full-bleed hairline between adjacent methods (accordion wrappers, then
   the classic / non-accordion fallback, so both DOM shapes separate cleanly) */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option + .wc-block-components-radio-control-accordion-option,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control-accordion-option + .wc-block-components-radio-control-accordion-option,
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control__option + .wc-block-components-radio-control__option,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control__option + .wc-block-components-radio-control__option {
  border-top: 1px solid var(--border);
}
/* hover on the rows that are not already the answer */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control__option:not(.wc-block-components-radio-control__option-checked):hover,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control__option:not(.wc-block-components-radio-control__option-checked):hover {
  background: color-mix(in oklab, var(--foreground) 2.5%, var(--cko-white));
}
/* the checked row: brand tint + weight, no ring. The group's clip hands it the
   container's own corners, so there is nothing left to disagree about. */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control__option-checked,
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control__option-checked,
body.ms-checkout-page .wc-block-components-radio-control--highlight-checked .wc-block-components-radio-control__option-checked {
  background: var(--cko-brand-tint); font-weight: 600;
}
/* the open pane belongs to the group's surface — white, not a third tone under
   the tinted row and the processor's own white card */
body.ms-checkout-page .wc-block-components-radio-control-accordion-content {
  padding: var(--p-space-3-5) var(--p-space-4) var(--p-space-4); border-top: 1px solid var(--border);
  background: var(--cko-white);
  font-size: var(--p-text-14); color: var(--ink-3);
}
/* focus halo on the whole row — AFTER the checked rule on purpose, so keyboard
   focus shows through a selected row */
body.ms-checkout-page .wc-block-checkout__payment-method .wc-block-components-radio-control__option:has(.wc-block-components-radio-control__input:focus-visible),
body.ms-checkout-page .wc-block-checkout__shipping-option .wc-block-components-radio-control__option:has(.wc-block-components-radio-control__input:focus-visible) {
  background: color-mix(in oklab, var(--brand) 8%, var(--cko-white));
}

/* ---- order summary — content ON the rail, no card ------------------------- */
body.ms-checkout-page .wc-block-components-order-summary { padding: 0; }
body.ms-checkout-page .wc-block-components-checkout-order-summary__title {
  font-size: var(--p-text-17); font-weight: 600; letter-spacing: var(--p-tracking-n10);
  color: var(--foreground); padding: 0 0 var(--p-space-2);
}
body.ms-checkout-page .wc-block-components-order-summary-item {
  padding: var(--p-space-3-5) 0; font-size: var(--p-text-14);
}
body.ms-checkout-page .wc-block-components-order-summary-item__image {
  width: 4rem; min-width: 4rem;
}
body.ms-checkout-page .wc-block-components-order-summary-item__image img,
body.ms-cart-page .wc-block-cart-item__image img {
  width: 4rem; height: 4rem; object-fit: cover;
  border-radius: var(--cko-radius); background: var(--surface);
  border: 1px solid var(--border);
}
/* the qty badge that rides the thumbnail — a reference detail */
body.ms-checkout-page .wc-block-components-order-summary-item__quantity {
  background: var(--ink-3); color: var(--brand-foreground);
  border: 2px solid var(--cko-rail-bg); border-radius: var(--p-radius-pill);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: var(--p-text-11); font-weight: 600; font-variant-numeric: tabular-nums;
  min-width: 1.375rem; height: 1.375rem;
  box-shadow: none; opacity: 1;
}
body.ms-checkout-page .wc-block-components-product-name,
body.ms-cart-page .wc-block-components-product-name {
  color: var(--foreground); font-weight: 600; font-size: var(--p-text-14); line-height: 1.4;
  text-decoration: none;
}
/* Shopify shows the variant, not a paragraph — the catalogue blurb gets two
   lines, then it yields */
body.ms-checkout-page .wc-block-components-product-metadata,
body.ms-cart-page .wc-block-components-product-metadata { margin-top: var(--p-space-1); }
body.ms-checkout-page .wc-block-components-product-metadata__description,
body.ms-checkout-page .wc-block-components-product-metadata__description p,
body.ms-cart-page .wc-block-components-product-metadata__description,
body.ms-cart-page .wc-block-components-product-metadata__description p {
  color: var(--ink-4); font-size: 0.78125rem; line-height: 1.45; margin: 0;
}
body.ms-checkout-page .wc-block-components-product-metadata__description,
body.ms-cart-page .wc-block-components-product-metadata__description {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* the per-unit price echo under the name duplicates the line total — drop it */
body.ms-checkout-page .wc-block-components-order-summary-item__individual-prices { display: none; }
body.ms-checkout-page .wc-block-components-order-summary-item__total-price {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-variant-numeric: tabular-nums; font-weight: 500; font-size: var(--p-text-14);
  color: var(--foreground);
}

/* ---- shared: money, badges, totals ---------------------------------------- */
/* mono = data, on BOTH surfaces. The cart's per-unit prices were the one money
   figure still set in DM Sans, which showed as soon as a sale struck through
   the old price next to a mono line total. */
body.ms-cart-page .wc-block-cart-item__prices,
body.ms-cart-page .wc-block-cart-item__prices .wc-block-components-product-price,
body.ms-cart-page .wc-block-cart-item__total-price-and-sale-badge-wrapper .wc-block-components-product-price {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-variant-numeric: tabular-nums; color: var(--foreground);
}
body.ms-cart-page .wc-block-cart-item__prices { font-size: var(--p-text-13); color: var(--ink-3); }
body.ms-cart-page .wc-block-cart-item__prices del,
body.ms-cart-page .wc-block-components-product-price__regular { color: var(--ink-4); }
body.ms-cart-page .wc-block-cart-item__total-price-and-sale-badge-wrapper .wc-block-components-product-price {
  font-weight: 600;
}
body.ms-checkout-page .wc-block-components-sale-badge,
body.ms-cart-page .wc-block-components-sale-badge {
  border: none; border-radius: var(--p-radius-6);
  background: color-mix(in oklab, var(--foreground) 6%, transparent);
  color: var(--ink-2);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: var(--p-text-11); font-weight: 500; font-variant-numeric: tabular-nums;
  padding: 0.1875rem 0.4375rem;
}

/* zone separators — hairlines between items / coupon / totals / footer */
body.ms-checkout-page .wc-block-components-totals-wrapper,
body.ms-cart-page .wc-block-components-totals-wrapper {
  padding: var(--p-space-4) 0; border-top: 1px solid var(--border);
}
/* Woo mounts DISCOUNT and FEE wrappers even when the order has neither —
   childless, but the rule above would still give each a padded hairline band
   between Subtotal and Total */
body.ms-checkout-page .wc-block-components-totals-wrapper:not(:has(*)),
body.ms-cart-page .wc-block-components-totals-wrapper:not(:has(*)) { display: none; }
/* the TOTAL wrapper draws the rule itself (on the footer item) — the generic
   wrapper hairline above it would stack a second, fainter line */
body.ms-checkout-page .wc-block-components-totals-wrapper:has(.wc-block-components-totals-footer-item),
body.ms-cart-page .wc-block-components-totals-wrapper:has(.wc-block-components-totals-footer-item) {
  border-top: none; padding: 0;
}
/* ⚠️ ONE DIVIDER WEIGHT PER SUMMARY, AND IT IS `--border`. Left alone, the
   summary draws three DIFFERENT rules: WC's own 0.2 hairline on the totals
   block lands 1px above our 0.08 one on the subtotal block — two lines a pixel
   apart that read as a drop shadow, not a divider — and the footer item drew a
   heavier 0.24. All normalised to the hairline the coupon row uses, so the
   separators are indistinguishable. The cart repeats the defect with its own
   0.2 rule under the summary block, so both are named here. */
body.ms-checkout-page .wp-block-woocommerce-checkout-order-summary-totals-block,
body.ms-cart-page .wp-block-woocommerce-cart-order-summary-totals-block {
  border-top: none;
}
body.ms-cart-page .wp-block-woocommerce-cart-order-summary-block {
  border-bottom: none;
}
body.ms-checkout-page .wc-block-components-totals-item,
body.ms-cart-page .wc-block-components-totals-item {
  font-size: var(--p-text-14); color: var(--ink-2);
}
body.ms-checkout-page .wc-block-components-totals-item__value,
body.ms-cart-page .wc-block-components-totals-item__value {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-variant-numeric: tabular-nums; color: var(--foreground);
}
body.ms-checkout-page .wc-block-components-totals-item__description,
body.ms-cart-page .wc-block-components-totals-item__description { font-size: 0.78125rem; color: var(--ink-4); }
/* `--border`, matching the coupon and subtotal rules above. The Total earns its
   emphasis from type weight and size, not from a heavier rule. */
body.ms-checkout-page .wc-block-components-totals-footer-item,
body.ms-cart-page .wc-block-components-totals-footer-item {
  border-top: 1px solid var(--border); padding: var(--p-space-4-5) 0 0; margin-top: var(--p-space-1);
}
body.ms-checkout-page .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.ms-cart-page .wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
  font-weight: 600; color: var(--foreground); font-size: var(--p-text-16);
}
body.ms-checkout-page .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
body.ms-cart-page .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
  font-size: var(--p-text-22); font-weight: 600; letter-spacing: var(--p-tracking-n10);
}

/* ---- shared: the coupon panel --------------------------------------------- */
body.ms-checkout-page .wc-block-components-totals-coupon,
body.ms-cart-page .wc-block-components-totals-coupon { padding: 0; }
body.ms-checkout-page .wc-block-components-panel__button,
body.ms-cart-page .wc-block-components-panel__button {
  font-family: inherit; font-size: var(--p-text-14); font-weight: 600; color: var(--foreground);
  transition: color 150ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-panel__button:hover,
body.ms-cart-page .wc-block-components-panel__button:hover { color: var(--brand); }
body.ms-checkout-page .wc-block-components-panel__content,
body.ms-cart-page .wc-block-components-panel__content { padding-top: var(--p-space-3); }
body.ms-checkout-page .wc-block-components-totals-coupon__form,
body.ms-cart-page .wc-block-components-totals-coupon__form { gap: var(--p-space-2); }
body.ms-checkout-page .wc-block-components-totals-coupon__input input,
body.ms-cart-page .wc-block-components-totals-coupon__input input { height: 3rem; }
body.ms-checkout-page .wc-block-components-totals-coupon__button,
body.ms-cart-page .wc-block-components-totals-coupon__button {
  height: 3rem; border-radius: var(--cko-radius);
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  color: var(--foreground); border: none;
  font-family: inherit; font-size: var(--p-text-14); font-weight: 600;
  transition: background-color 150ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-totals-coupon__button:hover,
body.ms-cart-page .wc-block-components-totals-coupon__button:hover {
  background: color-mix(in oklab, var(--foreground) 12%, transparent);
}

/* ---- terms + primary action ----------------------------------------------- */
body.ms-checkout-page .wc-block-checkout__terms {
  font-size: var(--p-text-13); color: var(--ink-3); line-height: 1.55;
  border-top: 1px solid var(--border); padding-top: var(--p-space-5); margin-top: var(--p-space-2);
}
body.ms-checkout-page .wc-block-checkout__terms a { color: var(--foreground); text-underline-offset: 3px; }
body.ms-checkout-page .wc-block-checkout__terms a:hover { color: var(--brand); }

body.ms-checkout-page .wc-block-checkout__actions_row { margin-top: var(--p-space-5); }
body.ms-checkout-page .wc-block-components-checkout-place-order-button,
body.ms-cart-page .wc-block-cart__submit-button {
  width: 100%; height: 3.5rem; border-radius: var(--cko-radius-lg);
  background: var(--brand); color: var(--brand-foreground);
  font-family: inherit; font-size: var(--p-text-17); font-weight: 600; letter-spacing: 0.01em;
  box-shadow: var(--elevation-key);
  transition: background-color 150ms var(--ease-out-quart), box-shadow 200ms var(--ease-out-quart), transform 160ms var(--ease-out-quart);
}
body.ms-checkout-page .wc-block-components-checkout-place-order-button:hover,
body.ms-cart-page .wc-block-cart__submit-button:hover {
  background: var(--brand-hover); box-shadow: var(--shadow-brand);
}
body.ms-checkout-page .wc-block-components-checkout-place-order-button:active,
body.ms-cart-page .wc-block-cart__submit-button:active { transform: scale(0.99); }
body.ms-checkout-page .wc-block-components-checkout-place-order-button:focus-visible,
body.ms-cart-page .wc-block-cart__submit-button:focus-visible {
  outline: none; box-shadow: var(--cko-focus-ring), var(--elevation-key);
}
body.ms-checkout-page .wc-block-components-checkout-return-to-cart-button {
  color: var(--ink-3); font-size: var(--p-text-14); text-decoration: none;
}
body.ms-checkout-page .wc-block-components-checkout-return-to-cart-button:hover { color: var(--brand); }

/* ---- mobile order summary panel ------------------------------------------- */
@media (max-width: 1023.98px) {
  /* summary FIRST on mobile, exactly like Shopify's collapsed bar */
  body.ms-checkout-page .wc-block-components-sidebar { order: -1; border-top: none; border-bottom: 1px solid var(--border); }
  body.ms-checkout-page .wp-block-woocommerce-checkout-order-summary-block {
    max-width: none; margin: 0; padding: 0; border: none; border-radius: 0;
  }
  /* the collapse bar IS the band — no padding above or below it */
  body.ms-checkout-page .wc-block-components-checkout-order-summary__title {
    display: flex; align-items: center; justify-content: space-between; gap: var(--p-space-3);
    width: 100%; max-width: 42rem;
    margin: 0 auto; /* WC gives the bar its own 16px margin-top — must sit flush */
    padding: var(--p-space-4) var(--p-space-5); font-size: var(--p-text-15);
    -webkit-tap-highlight-color: transparent;
  }
  body.ms-checkout-page .wc-block-components-checkout-order-summary__content {
    width: 100%; max-width: 42rem; margin-inline: auto;
    padding: 0 var(--p-space-5) var(--p-space-5);
  }
  /* ⚠️ Woo ALSO mounts a SECOND full summary inside MAIN on mobile (the
     `-fill` block above the place-order button) — with the top bar expandable
     that duplicate is pure scroll weight, and it resurrects WC's bordered
     card. Shopify's grammar: ONE collapsible bar at the top. */
  body.ms-checkout-page .wc-block-components-main .wp-block-woocommerce-checkout-order-summary-block {
    display: none;
  }
  body.ms-checkout-page .wc-block-components-sidebar .wc-block-components-notices:has(*) {
    max-width: 42rem; margin-inline: auto; padding: var(--p-space-4) var(--p-space-5) 0;
  }
}
body.ms-checkout-page .wc-block-components-checkout-order-summary__title-price {
  font-family: var(--font-mono), ui-monospace, monospace; font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ===========================================================================
   CART PAGE
   =========================================================================== */
.cart-head { padding-top: var(--p-space-6); }
@media (min-width: 640px) { .cart-head { padding-top: var(--p-space-8); } }
.cart-head__row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--p-space-3); margin-top: var(--p-space-4); }
.cart-head__count {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: var(--p-text-13); font-variant-numeric: tabular-nums; color: var(--ink-3);
}
.cart-head__back { margin-top: var(--p-space-3); }

body.ms-cart-page .wc-block-cart {
  width: 100%; max-width: calc(80rem + 3rem); margin-inline: auto;
  padding: var(--p-space-6) var(--p-space-4) var(--p-space-16);
}
@media (min-width: 640px) { body.ms-cart-page .wc-block-cart { padding-inline: var(--p-space-6); } }
body.ms-cart-page .wc-block-cart__main,
body.ms-cart-page .wc-block-cart__sidebar { padding: 0; }
@media (min-width: 1024px) {
  body.ms-cart-page .wc-block-components-sidebar-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--p-space-12); align-items: start; }
  body.ms-cart-page .wc-block-cart__main, body.ms-cart-page .wc-block-cart__sidebar { width: auto; max-width: none; float: none; }
  body.ms-cart-page .wc-block-cart__sidebar { position: sticky; top: calc(var(--site-header-h) + 1.5rem); }
}

/* the summary panel reads as a card, matching the drawer's foot */
body.ms-cart-page .wc-block-cart__sidebar {
  border: 1px solid var(--border); border-radius: var(--cko-radius-lg);
  background: var(--surface); padding: var(--p-space-5);
}
@media (min-width: 1024px) { body.ms-cart-page .wc-block-cart__sidebar { padding: var(--p-space-6); } }
/* ⚠️ Only the OUTER card is rounded. A blanket `sidebar > div` radius (what
   this used to do) also rounds the totals rows inside it, which do not paint a
   background — invisible on its own, but it rounds the CORNERS OF THEIR
   HAIRLINES, so the dividers arrive with clipped ends. */
body.ms-cart-page .wc-block-cart__sidebar > div { border-radius: 0; }
body.ms-cart-page .wp-block-woocommerce-cart-order-summary-heading-block {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: var(--p-text-11); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; margin: 0 0 var(--p-space-1); padding: 0;
}

/* line items in the same register as the drawer */
body.ms-cart-page .wc-block-cart-items__header {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: var(--p-text-11); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--border);
}
body.ms-cart-page .wc-block-cart-items__row { border-bottom: 1px solid var(--border); }
body.ms-cart-page .wc-block-cart-item__wrap { padding: var(--p-space-5) 0; }

/* the quantity stepper — the cart's one interactive control, so it carries the
   same 10px/white/hairline language as every checkout field rather than WC's
   32px cream pill */
body.ms-cart-page .wc-block-components-quantity-selector {
  border: 1px solid var(--cko-field-border); border-radius: var(--cko-radius);
  background: var(--cko-white); height: 2.5rem; min-width: 7rem;
  box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 3%, transparent);
  transition: border-color 150ms var(--ease-out-quart), box-shadow 150ms var(--ease-out-quart);
}
body.ms-cart-page .wc-block-components-quantity-selector:hover { border-color: var(--cko-field-border-hover); }
body.ms-cart-page .wc-block-components-quantity-selector:focus-within {
  border-color: var(--brand); box-shadow: var(--cko-focus-ring);
}
body.ms-cart-page .wc-block-components-quantity-selector__input {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-variant-numeric: tabular-nums; color: var(--foreground);
  font-size: var(--p-text-14); font-weight: 500; background: transparent;
}
body.ms-cart-page .wc-block-components-quantity-selector__button {
  color: var(--ink-3); font-size: var(--p-text-16); background: transparent; border: none;
  transition: color 150ms var(--ease-out-quart), background-color 150ms var(--ease-out-quart);
}
body.ms-cart-page .wc-block-components-quantity-selector__button:hover:not(:disabled) {
  color: var(--foreground); background: color-mix(in oklab, var(--foreground) 5%, transparent);
}
body.ms-cart-page .wc-block-components-quantity-selector__button:disabled { opacity: 0.4; }
/* WC rounds the stepper's end buttons on its own 4px scale, so their corners
   cut inside the 10px shell — inherit the shell's radius instead */
body.ms-cart-page .wc-block-components-quantity-selector__button--minus {
  border-radius: calc(var(--cko-radius) - 1px) 0 0 calc(var(--cko-radius) - 1px);
}
body.ms-cart-page .wc-block-components-quantity-selector__button--plus {
  border-radius: 0 calc(var(--cko-radius) - 1px) calc(var(--cko-radius) - 1px) 0;
}

/* remove control — WC 11 renders `__remove-link` as an ICON BUTTON (verified in
   the live DOM: a <button aria-label="Remove … from cart">, not the text link
   the old rule assumed), so it needs a hit area and a hover state, not
   link-coloured text */
body.ms-cart-page .wc-block-cart-item__remove-link {
  color: var(--ink-4); text-decoration: none;
  border-radius: var(--p-radius-6);
  transition: color 150ms var(--ease-out-quart), background-color 150ms var(--ease-out-quart);
}
body.ms-cart-page .wc-block-cart-item__remove-link:hover {
  color: var(--destructive); background: color-mix(in oklab, var(--destructive) 8%, transparent);
}
body.ms-cart-page .wc-block-cart-item__remove-link:focus-visible {
  outline: none; box-shadow: var(--cko-focus-ring);
}

/* WooCommerce's cross-sell block grid ships negative inline margins that
   overflow the cart page by 8px on every viewport (measured 2026-08-19). */
.wc-block-grid__products { margin-inline: 0; }
.woocommerce-cart .wc-block-grid { overflow-x: clip; }
