/*
 * MinBørneBog checkout/cart theme — CSS ONLY. Never touch payment markup, field names, or
 * WooCommerce/Woo Blocks logic here — this file is purely presentational.
 *
 * Served from `minboernebog.dk/marketing/checkout-theme.css`: the Cloudflare routing for
 * that domain sends `/marketing/*` to this Next.js app (see CURRENT-STATE.md, the
 * "Homepage-only Worker cutover" entries) — this literal file, deployed with the rest of
 * `apps/web`, IS what the WordPress bridge plugin loads on cart/checkout/my-account.
 * Editing and deploying this file is the whole change; no WordPress plugin re-upload is
 * needed for a styling-only pass.
 *
 * Extended 2026-09-06 (launch-readiness pass): the original version set page background,
 * heading font and button color but left the actual checkout FORM — input fields, the
 * order-summary table, the payment-method box — visually unchanged from the Astra theme
 * default. A real production purchase test found the result still read as "the old
 * website" next to the new MinBørneBog application. This pass brings the same warm
 * Scandinavian-cream / rounded-card / dark-green-CTA language from `design-system.css`
 * to the surfaces a customer actually fills in and reads, without changing what any of
 * them do.
 */
:root {
  --mb-background: oklch(0.982 0.008 84);
  --mb-cream: oklch(0.968 0.013 85);
  --mb-card: oklch(0.995 0.005 90);
  --mb-ink: oklch(0.26 0.02 96);
  --mb-ink-soft: oklch(0.48 0.018 96);
  --mb-primary: oklch(0.46 0.052 152);
  --mb-primary-foreground: oklch(0.985 0.008 90);
  --mb-primary-hover: color-mix(in oklab, var(--mb-primary) 90%, black);
  --mb-border: oklch(0.9 0.016 84);
  --mb-destructive: oklch(0.55 0.17 27);
  --mb-radius-pill: 999px;
  --mb-radius-lg: 1rem;
  --mb-radius-md: 0.7rem;
  --mb-shadow-soft:
    0 1px 2px oklch(0.35 0.03 90 / 0.04), 0 12px 32px -18px oklch(0.35 0.03 90 / 0.28);
}

body.woocommerce-cart,
body.woocommerce-checkout,
body.woocommerce-account {
  background: var(--mb-background);
  color: var(--mb-ink);
  font-family: 'DM Sans', system-ui, sans-serif;
}

body.woocommerce-cart h1,
body.woocommerce-cart h2,
body.woocommerce-checkout h1,
body.woocommerce-checkout h2,
body.woocommerce-checkout h3,
body.woocommerce-account h1 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  color: var(--mb-ink);
}

/* --- the two card surfaces: customer details, and the order review/payment box --- */

body.woocommerce-checkout #customer_details,
body.woocommerce-checkout #order_review,
body.woocommerce-checkout .woocommerce-checkout-review-order,
body.woocommerce-cart .cart-collaterals .cart_totals {
  background: var(--mb-card);
  border: 1px solid var(--mb-border);
  border-radius: var(--mb-radius-lg);
  box-shadow: var(--mb-shadow-soft);
  padding: 1.5rem;
}

body.woocommerce-checkout #order_review table.shop_table,
body.woocommerce-cart table.shop_table {
  border: none;
  border-collapse: collapse;
}

body.woocommerce-checkout #order_review table.shop_table th,
body.woocommerce-checkout #order_review table.shop_table td,
body.woocommerce-cart table.shop_table th,
body.woocommerce-cart table.shop_table td {
  border-color: var(--mb-border);
}

body.woocommerce-checkout #order_review table.shop_table .order-total .amount,
body.woocommerce-cart table.shop_table .order-total .amount {
  color: var(--mb-ink);
  font-weight: 600;
}

/* --- form fields: rounded, warm-bordered, matching the app's input treatment --- */

body.woocommerce-checkout input.input-text,
body.woocommerce-checkout select,
body.woocommerce-checkout textarea,
body.woocommerce-account input.input-text,
body.woocommerce-account select,
body.woocommerce-account textarea,
body.woocommerce-checkout .select2-selection {
  border: 1px solid var(--mb-border) !important;
  border-radius: var(--mb-radius-md) !important;
  background: var(--mb-background) !important;
  color: var(--mb-ink) !important;
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 2.75rem;
}

body.woocommerce-checkout input.input-text:focus,
body.woocommerce-checkout select:focus,
body.woocommerce-checkout textarea:focus {
  border-color: var(--mb-primary) !important;
  outline: 2px solid color-mix(in oklab, var(--mb-primary) 35%, transparent);
  outline-offset: 1px;
}

body.woocommerce-checkout label {
  color: var(--mb-ink);
  font-weight: 500;
}

/* Radio/checkbox accent — the browser-native accent-color keeps full accessibility
   (focus rings, contrast, screen-reader behavior) untouched; only the tint changes. */
body.woocommerce-checkout input[type='checkbox'],
body.woocommerce-checkout input[type='radio'] {
  accent-color: var(--mb-primary);
}

/* --- payment method list: give each gateway row (Stripe, MobilePay) a defined card --- */

body.woocommerce-checkout ul.wc_payment_methods li.wc_payment_method {
  border: 1px solid var(--mb-border);
  border-radius: var(--mb-radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  background: var(--mb-background);
}

body.woocommerce-checkout ul.wc_payment_methods li.wc_payment_method.payment_method_stripe,
body.woocommerce-checkout ul.wc_payment_methods li.wc_payment_method[class*='vipps'] {
  border-color: var(--mb-border);
}

/* --- primary action: the one button this whole page exists for --- */

.woocommerce button.button,
.woocommerce #place_order,
.woocommerce a.button.alt,
.woocommerce input.button.alt {
  background: var(--mb-primary) !important;
  color: var(--mb-primary-foreground) !important;
  border: 0 !important;
  border-radius: var(--mb-radius-pill) !important;
  min-height: 3rem;
  font-weight: 500;
  transition: background 150ms ease;
}

.woocommerce button.button:hover,
.woocommerce #place_order:hover,
.woocommerce a.button.alt:hover {
  background: var(--mb-primary-hover) !important;
}

/* Secondary/plain buttons (coupon apply, "update cart") stay outlined rather than filled,
   so the ONE primary action ("Bestil"/place order) keeps its visual weight. */
.woocommerce form.checkout_coupon button.button,
.woocommerce .cart_totals .button:not(.checkout-button) {
  background: transparent !important;
  color: var(--mb-primary) !important;
  border: 1px solid var(--mb-primary) !important;
}

/* --- notices, links, and the coupon toggle --- */

.woocommerce-info,
.woocommerce-message {
  background: var(--mb-cream);
  border-color: var(--mb-primary);
  color: var(--mb-ink);
  border-radius: var(--mb-radius-md);
}

.woocommerce-error {
  border-color: var(--mb-destructive);
  border-radius: var(--mb-radius-md);
}

body.woocommerce-checkout a,
body.woocommerce-cart a,
body.woocommerce-account a {
  color: var(--mb-primary);
}

.woocommerce table.shop_table {
  border-color: var(--mb-border);
}

/* Classic checkout responsive repair (2026-09-07). The child theme loads AFTER this
   sheet, so specificity/!important below deliberately beat its presentation rules.
   Keep all field names, native controls, gateway visibility and submit logic in Woo. */
body.woocommerce-checkout form.checkout {
  --mb-touch: max(44px, 2.75rem);
  --mb-btn-height: max(48px, 3rem);
  min-width: 0;
}

/* The marketing create-book banner overlays the payment CTA on small screens.
   Suppress it only while the actual checkout form is present. */
body.woocommerce-checkout:has(form.checkout) #mbbSticky {
  display: none !important;
}

/* The child theme fakes a second label with ::before. Woo/gateways own the real
   text node, including any dynamically supplied label; never replace it in CSS. */
body.woocommerce-checkout form.checkout #payment #place_order::before {
  content: none;
}

body.woocommerce-checkout form.checkout #payment #place_order {
  box-sizing: border-box;
  float: none;
  width: 100%;
  max-width: 100%;
  height: auto !important;
  min-height: var(--mb-btn-height);
  margin: 1rem 0 0;
  padding: 0.875rem 1.5rem;
  background: var(--mb-primary) !important;
  color: var(--mb-primary-foreground) !important;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
  text-indent: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

body.woocommerce-checkout form.checkout #payment #place_order:hover {
  background: var(--mb-primary-hover) !important;
}

body.woocommerce-checkout form.checkout #payment #place_order:disabled,
body.woocommerce-checkout form.checkout #payment #place_order.disabled,
body.woocommerce-checkout form.checkout #payment #place_order[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Woo still controls its blocking overlay and any gateway-specific replacement. */
body.woocommerce-checkout form.checkout.processing #payment #place_order {
  opacity: 0.5;
  cursor: progress;
}

body.woocommerce-checkout form.checkout #place_order:focus-visible,
body.woocommerce-checkout form.checkout input[type='radio']:focus-visible,
body.woocommerce-checkout form.checkout input[type='checkbox']:focus-visible,
body.woocommerce-checkout form.checkout .woocommerce-terms-and-conditions-wrapper a:focus-visible {
  outline: 2px solid var(--mb-primary);
  outline-offset: 3px;
}

body.woocommerce-checkout form.checkout #order_review #shipping_method li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  column-gap: 0.75rem;
  margin: 0 0 0.5rem;
  padding: 0;
  text-indent: 0;
  text-align: left;
}

body.woocommerce-checkout form.checkout #shipping_method input[type='radio'] {
  width: 20px;
  height: 20px !important;
  margin: 12px 0 0;
}

body.woocommerce-checkout form.checkout #shipping_method label {
  display: block;
  min-width: 0;
  min-height: var(--mb-touch);
  padding: 0.625rem 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-indent: 0;
  cursor: pointer;
}

/* A sole rate uses a hidden input: no empty radio column or invented control. */
body.woocommerce-checkout form.checkout #shipping_method input[type='hidden'] + label {
  grid-column: 1 / -1;
  cursor: default;
}

body.woocommerce-checkout form.checkout #order_review .amount {
  display: inline-block;
  white-space: nowrap;
}

body.woocommerce-checkout
  form.checkout
  #payment
  ul.wc_payment_methods
  > li:not(.wc-stripe-optimized-checkout) {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  column-gap: 0.75rem;
}

/* Astra's clearfix pseudo-elements otherwise become extra grid cells. */
body.woocommerce-checkout form.checkout #payment ul.wc_payment_methods > li::before,
body.woocommerce-checkout form.checkout #payment ul.wc_payment_methods > li::after {
  content: none;
}

body.woocommerce-checkout
  form.checkout
  #payment
  ul.wc_payment_methods
  > li:not(.wc-stripe-optimized-checkout)
  > input[type='radio'] {
  grid-column: 1;
  grid-row: 1;
  width: 20px;
  height: 20px !important;
  margin: 12px 0 0;
}

body.woocommerce-checkout
  form.checkout
  #payment
  ul.wc_payment_methods
  > li:not(.wc-stripe-optimized-checkout)
  > label {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  min-height: var(--mb-touch);
  margin: 0;
  line-height: 1.5;
  cursor: pointer;
}

body.woocommerce-checkout form.checkout #payment ul.wc_payment_methods > li > label img {
  float: none;
  flex: 0 0 auto;
  max-width: 3rem;
  max-height: 2rem;
  width: auto;
  height: auto;
  margin: 0;
  object-fit: contain;
}

/* Only the panel's outer layout changes. Never style Stripe iframe internals. */
body.woocommerce-checkout form.checkout #payment .payment_box {
  grid-column: 1 / -1;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

body.woocommerce-checkout form.checkout .woocommerce-terms-and-conditions-wrapper {
  margin-top: 1.25rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

body.woocommerce-checkout form.checkout .woocommerce-privacy-policy-text p {
  margin: 0 0 1rem;
}

body.woocommerce-checkout
  form.checkout
  #payment
  .woocommerce-terms-and-conditions-wrapper
  .form-row {
  margin: 0;
  padding: 0;
}

body.woocommerce-checkout form.checkout .woocommerce-terms-and-conditions-wrapper label,
body.woocommerce-checkout form.checkout #ship-to-different-address label {
  position: relative;
  display: block;
  min-height: var(--mb-touch);
  padding-left: 32px;
  line-height: 1.7;
  cursor: pointer;
}

body.woocommerce-checkout form.checkout #terms,
body.woocommerce-checkout form.checkout #ship-to-different-address-checkbox {
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 20px;
  height: 20px;
  margin: 0;
}

body.woocommerce-checkout form.checkout .woocommerce-terms-and-conditions-wrapper a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

body.woocommerce-checkout form.checkout .woocommerce-error,
body.woocommerce-checkout form.checkout .woocommerce-info,
body.woocommerce-checkout form.checkout .woocommerce-message {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

@media (max-width: 1023px) {
  /* Elementor page 887 otherwise makes checkout a half-width column at 768px. */
  body.woocommerce-checkout .elementor-887 .elementor-element-c6d5eeb > .e-con-inner {
    flex-direction: column;
  }

  body.woocommerce-checkout .elementor-887 .elementor-element-c6d5eeb > .e-con-inner > .e-con {
    --width: 100%;
    width: 100%;
  }

  body.woocommerce-checkout form.checkout #customer_details {
    box-sizing: border-box;
    padding: 1.25rem;
    margin-bottom: 1.25rem !important;
  }

  body.woocommerce-checkout form.checkout .woocommerce-billing-fields,
  body.woocommerce-checkout form.checkout .woocommerce-shipping-fields .shipping_address {
    padding: 0 !important;
    background: transparent;
    box-shadow: none;
  }

  body.woocommerce-checkout form.checkout #payment {
    padding: 1.25rem !important;
  }

  body.woocommerce-checkout form.checkout .form-row {
    float: none;
    width: 100%;
    min-width: 0;
    margin-bottom: 1rem;
  }

  body.woocommerce-checkout form.checkout input.input-text,
  body.woocommerce-checkout form.checkout select,
  body.woocommerce-checkout form.checkout textarea,
  body.woocommerce-checkout form.checkout .select2-container {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: max(16px, 1rem);
  }

  body.woocommerce-checkout form.checkout #order_review table.shop_table {
    width: 100%;
    table-layout: fixed;
  }

  body.woocommerce-checkout form.checkout #order_review table.shop_table th,
  body.woocommerce-checkout form.checkout #order_review table.shop_table td {
    padding: 0.875rem 0.625rem;
    overflow-wrap: anywhere;
  }

  body.woocommerce-checkout form.checkout #order_review .product-total {
    width: 36%;
  }
}
