/*
 * Royal Vision Traders - Cart and Checkout skin.
 *
 * Styling only. The WooCommerce Cart and Checkout blocks keep their own markup
 * and their own column layout; this file re-skins them in the RVT palette and
 * fixes the sizing, overflow and tap-target problems the defaults ship with.
 *
 * Tokens come from rvt-design.css (:root), which loads site wide.
 *
 * Two rules to respect when editing this file:
 *
 * 1. Never set a height or padding on .wc-block-components-text-input inputs.
 *    WooCommerce floats the label from top:25px to top:6px, so changing the
 *    box height detaches the label from the field. Colors, border and radius
 *    are safe; geometry is not.
 *
 * 2. The quantity selector is a fixed-width flex box (107px by default) whose
 *    children must fit inside it. Growing the buttons without growing the box
 *    pushes the plus button outside the border.
 */

/* ===============================================================
   1. Shared shell
   =============================================================== */

body.woocommerce-cart,
body.woocommerce-checkout {
  background: var(--rvt-bg);
  color: var(--rvt-ink);
  font-family: var(--rvt-b);
}

body.woocommerce-cart .wp-block-woocommerce-cart,
body.woocommerce-checkout .wp-block-woocommerce-checkout {
  max-width: 1240px;
  margin-inline: auto;
  padding: 48px 24px 96px;
}

/* The blocks can force a horizontal scrollbar on narrow screens. */
body.woocommerce-cart .wc-block-cart,
body.woocommerce-cart .wc-block-cart__main,
body.woocommerce-cart .wc-block-cart__sidebar,
body.woocommerce-checkout .wc-block-checkout,
body.woocommerce-checkout .wc-block-checkout__main,
body.woocommerce-checkout .wc-block-checkout__sidebar {
  max-width: 100%;
  min-width: 0;
}

body.woocommerce-cart .wc-block-cart__main,
body.woocommerce-checkout .wc-block-checkout__main {
  padding-right: 32px;
}

body.woocommerce-cart h1,
body.woocommerce-cart h2,
body.woocommerce-cart h3,
body.woocommerce-checkout h1,
body.woocommerce-checkout h2,
body.woocommerce-checkout h3 {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ===============================================================
   2. Cart line items
   =============================================================== */

body.woocommerce-cart .wc-block-cart-items {
  width: 100%;
  border: 0;
}

body.woocommerce-cart .wc-block-cart-items__header {
  border-bottom: 1px solid var(--rvt-border);
  color: var(--rvt-muted);
  font-family: var(--rvt-b);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart-items__row {
  padding: 24px 0;
  border-bottom: 1px solid var(--rvt-border);
}

body.woocommerce-cart .wc-block-cart-items__row:last-child {
  border-bottom: 0;
}

body.woocommerce-cart .wc-block-cart-item__image img {
  width: 100%;
  max-width: 104px;
  aspect-ratio: 1 / 1;
  padding: 8px;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-bg);
  object-fit: contain;
}

body.woocommerce-cart .wc-block-components-product-name {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: color 0.2s ease;
}

body.woocommerce-cart .wc-block-components-product-name:hover,
body.woocommerce-cart .wc-block-components-product-name:focus-visible {
  color: var(--rvt-accent);
}

body.woocommerce-cart .wc-block-components-product-metadata,
body.woocommerce-cart .wc-block-components-product-metadata__description {
  color: var(--rvt-muted);
  font-size: 13px;
  line-height: 1.55;
}

body.woocommerce-cart .wc-block-components-product-price,
body.woocommerce-checkout .wc-block-components-product-price {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-weight: 700;
}

body.woocommerce-cart .wc-block-components-product-price__regular,
body.woocommerce-checkout .wc-block-components-product-price__regular {
  color: var(--rvt-muted);
  font-weight: 500;
  text-decoration: line-through;
}

body.woocommerce-cart .woocommerce-Price-currencySymbol,
body.woocommerce-checkout .woocommerce-Price-currencySymbol {
  color: var(--rvt-muted);
  font-size: 80%;
  letter-spacing: 0.02em;
}

body.woocommerce-cart .wc-block-components-sale-badge {
  border: 0;
  border-radius: var(--rvt-rs);
  background: var(--rvt-coral);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ===============================================================
   3. Quantity selector

   WooCommerce ships this as a 107px flex box with 30px buttons and a
   40px minimum input. Raising the buttons to a 44px tap target needs
   the box widened to match, or the plus button lands outside the
   border. Width below is 46 + 46 + input, inside a 148px box.
   =============================================================== */

body.woocommerce-cart .wc-block-components-quantity-selector,
body.woocommerce-checkout .wc-block-components-quantity-selector {
  display: flex;
  overflow: hidden;
  box-sizing: border-box;
  align-items: center;
  width: 148px;
  max-width: 100%;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rp);
  background: var(--rvt-surface);
}

body.woocommerce-cart .wc-block-components-quantity-selector::after,
body.woocommerce-checkout .wc-block-components-quantity-selector::after {
  border: 0;
  content: none;
}

body.woocommerce-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button,
body.woocommerce-checkout .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
  display: flex;
  width: 46px;
  min-width: 46px;
  height: 46px;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rvt-muted);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  opacity: 1;
  transition: color 0.2s ease, background-color 0.2s ease;
}

body.woocommerce-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:hover:not(:disabled),
body.woocommerce-checkout .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:hover:not(:disabled) {
  background: var(--rvt-bg);
  color: var(--rvt-accent);
}

body.woocommerce-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:disabled,
body.woocommerce-checkout .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

body.woocommerce-cart .wc-block-components-quantity-selector input.wc-block-components-quantity-selector__input,
body.woocommerce-checkout .wc-block-components-quantity-selector input.wc-block-components-quantity-selector__input {
  min-width: 0;
  flex: 1 1 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

/*
 * The remove control is an icon button. WooCommerce styles it through a long
 * descendant chain, so the override has to match that weight to win.
 */
body.woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__quantity .wc-block-cart-item__remove-link {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  border-radius: var(--rvt-rp);
  color: var(--rvt-muted);
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
  vertical-align: middle;
}

body.woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__quantity .wc-block-cart-item__remove-link:hover,
body.woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__quantity .wc-block-cart-item__remove-link:focus-visible {
  background: rgba(240, 128, 111, 0.12);
  color: var(--rvt-coral);
}

/* ===============================================================
   4. Summary sidebar (cart and checkout)
   =============================================================== */

/*
 * The summary card belongs on the inner block, not on the sidebar element.
 * WooCommerce puts .wc-block-components-sidebar and .wc-block-cart__sidebar
 * on the SAME element, so a descendant selector between those two class
 * names matches nothing and the card silently never renders.
 */
body.woocommerce-cart .wp-block-woocommerce-cart-order-summary-block,
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block {
  padding: 24px;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-surface);
  box-shadow: var(--rvt-sh);
}

body.woocommerce-cart .wp-block-woocommerce-cart-order-summary-heading-block,
body.woocommerce-checkout .wc-block-components-checkout-order-summary__title {
  margin: 0 0 4px;
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 18px;
  font-weight: 700;
}

body.woocommerce-cart .wc-block-components-totals-wrapper,
body.woocommerce-checkout .wc-block-components-totals-wrapper {
  padding: 14px 0;
  border-top: 1px solid var(--rvt-border);
}

body.woocommerce-cart .wc-block-components-totals-wrapper:first-of-type,
body.woocommerce-checkout .wc-block-components-totals-wrapper:first-of-type {
  border-top: 0;
}

/*
 * Fee, discount and tax wrappers are rendered even when they hold nothing,
 * so WooCommerce collapses them through :empty. The base rule above outranks
 * that collapse and turns each empty wrapper into a blank band with its own
 * divider line. Restated here at a weight that wins.
 */
body.woocommerce-cart .wc-block-components-totals-wrapper:empty,
body.woocommerce-cart .wc-block-components-totals-wrapper:has(> :only-child:empty),
body.woocommerce-checkout .wc-block-components-totals-wrapper:empty,
body.woocommerce-checkout .wc-block-components-totals-wrapper:has(> :only-child:empty) {
  padding: 0;
  border-width: 0;
}

body.woocommerce-cart .wc-block-components-totals-item__label,
body.woocommerce-checkout .wc-block-components-totals-item__label {
  color: var(--rvt-muted);
  font-size: 15px;
  font-weight: 500;
}

body.woocommerce-cart .wc-block-components-totals-item__value,
body.woocommerce-checkout .wc-block-components-totals-item__value {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-weight: 600;
}

body.woocommerce-cart .wc-block-components-totals-item__description,
body.woocommerce-checkout .wc-block-components-totals-item__description {
  color: var(--rvt-muted);
  font-size: 12px;
}

body.woocommerce-cart .wc-block-components-totals-footer-item,
body.woocommerce-checkout .wc-block-components-totals-footer-item {
  padding-top: 16px;
  border-top: 1px solid var(--rvt-border);
}

body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 19px;
  font-weight: 700;
}

body.woocommerce-cart .wc-block-components-totals-discount .wc-block-components-totals-item__value,
body.woocommerce-checkout .wc-block-components-totals-discount .wc-block-components-totals-item__value {
  color: var(--rvt-accent);
}

/* Order summary line items on checkout. */
body.woocommerce-checkout .wc-block-components-order-summary-item__image img {
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rs);
  background: var(--rvt-bg);
}

body.woocommerce-checkout .wc-block-components-order-summary-item__quantity {
  border: 1px solid var(--rvt-border);
  background: var(--rvt-bg);
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-weight: 600;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__description .wc-block-components-product-name {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 15px;
  font-weight: 600;
}

/* ===============================================================
   5. Checkout steps
   =============================================================== */

body.woocommerce-checkout .wc-block-components-checkout-step {
  padding: 24px;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-surface);
  box-shadow: var(--rvt-sh);
}

body.woocommerce-checkout .wc-block-components-checkout-step + .wc-block-components-checkout-step {
  margin-top: 20px;
}

body.woocommerce-checkout .wc-block-components-checkout-step__title {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

body.woocommerce-checkout .wc-block-components-checkout-step__description {
  color: var(--rvt-muted);
  font-size: 14px;
  line-height: 1.55;
}

body.woocommerce-checkout .wc-block-components-checkout-step--with-step-number .wc-block-components-checkout-step__title::before,
body.woocommerce-checkout .wc-block-components-checkout-step--with-step-number::before {
  color: var(--rvt-accent);
  font-family: var(--rvt-h);
  font-weight: 700;
}

/* ===============================================================
   6. Form controls

   Geometry is left to WooCommerce so the floating labels keep working.
   Only surface, border, radius, color and focus are changed here.
   =============================================================== */

body.woocommerce-cart .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-textarea,
body.woocommerce-checkout .wc-block-components-select__container,
body.woocommerce-checkout .wc-block-components-combobox-control input {
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rs);
  background: var(--rvt-surface);
  color: var(--rvt-ink);
  font-family: var(--rvt-b);
}

body.woocommerce-cart .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-block-components-textarea:focus,
body.woocommerce-checkout .wc-block-components-combobox-control input:focus {
  border-color: var(--rvt-accent);
  box-shadow: 0 0 0 3px rgba(47, 169, 160, 0.16);
  color: var(--rvt-ink);
  outline: none;
}

body.woocommerce-cart .wc-block-components-text-input label,
body.woocommerce-checkout .wc-block-components-text-input label {
  color: var(--rvt-muted);
}

body.woocommerce-checkout .wc-block-components-validation-error {
  color: var(--rvt-coral);
  font-size: 13px;
}

body.woocommerce-checkout .has-error input,
body.woocommerce-checkout .has-error .wc-block-components-select__container {
  border-color: var(--rvt-coral);
}

/* Checkboxes and radios pick up the brand accent. */
body.woocommerce-checkout .wc-block-components-checkbox__input:checked,
body.woocommerce-checkout .wc-block-components-radio-control__input:checked {
  border-color: var(--rvt-accent);
  background-color: var(--rvt-accent);
  accent-color: var(--rvt-accent);
}

body.woocommerce-checkout .wc-block-components-checkbox__mark {
  fill: #fff;
}

/* Shipping and payment option rows. */
body.woocommerce-checkout .wc-block-components-radio-control__option {
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-surface);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

body.woocommerce-checkout .wc-block-components-radio-control__option + .wc-block-components-radio-control__option {
  margin-top: 10px;
}

body.woocommerce-checkout .wc-block-components-radio-control__option:hover {
  border-color: var(--rvt-accent);
}

body.woocommerce-checkout .wc-block-components-radio-control__option-checked,
body.woocommerce-checkout .wc-block-checkout__shipping-method-option--selected {
  border-color: var(--rvt-accent);
  background: rgba(47, 169, 160, 0.06);
}

body.woocommerce-checkout .wc-block-components-radio-control__label {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: 15px;
  font-weight: 600;
}

body.woocommerce-checkout .wc-block-components-radio-control__description,
body.woocommerce-checkout .wc-block-components-radio-control__secondary-description {
  color: var(--rvt-muted);
  font-size: 13px;
}

body.woocommerce-checkout .wc-block-checkout__shipping-method-option {
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-surface);
}

body.woocommerce-checkout .wc-block-checkout__shipping-method-option-title {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-weight: 600;
}

body.woocommerce-checkout .wc-block-checkout__shipping-method-option-price {
  color: var(--rvt-accent);
  font-family: var(--rvt-h);
  font-weight: 700;
}

body.woocommerce-checkout .wc-block-components-address-card {
  padding: 16px;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-bg);
}

body.woocommerce-checkout .wc-block-components-address-card__edit {
  color: var(--rvt-accent);
  font-weight: 500;
}

body.woocommerce-checkout .wc-block-checkout__terms {
  color: var(--rvt-muted);
  font-size: 13px;
  line-height: 1.55;
}

body.woocommerce-checkout .wc-block-checkout__terms a {
  color: var(--rvt-accent);
}

/* ===============================================================
   7. Buttons
   =============================================================== */

body.woocommerce-cart .wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-components-button.contained,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout .wc-block-components-button.contained {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: 0;
  border-radius: var(--rvt-rp);
  background: var(--rvt-accent);
  box-shadow: none;
  color: #fff;
  font-family: var(--rvt-b);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-cart .wc-block-components-button.contained:hover,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover,
body.woocommerce-checkout .wc-block-components-button.contained:hover {
  background: var(--rvt-accent-h);
  color: #fff;
}

/* Secondary actions keep the outlined treatment from the design system. */
body.woocommerce-cart .wc-block-components-button.outlined,
body.woocommerce-checkout .wc-block-components-button.outlined {
  min-height: 52px;
  border: 1.5px solid var(--rvt-ink);
  border-radius: var(--rvt-rp);
  background: transparent;
  color: var(--rvt-ink);
}

body.woocommerce-cart .wc-block-components-button.outlined:hover,
body.woocommerce-checkout .wc-block-components-button.outlined:hover {
  background: var(--rvt-ink);
  color: var(--rvt-surface);
}

body.woocommerce-cart .wc-block-components-panel__button,
body.woocommerce-checkout .wc-block-components-panel__button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rvt-accent);
  font-family: var(--rvt-b);
  font-size: 14px;
  font-weight: 500;
}

body.woocommerce-cart .wc-block-components-panel__button:hover,
body.woocommerce-checkout .wc-block-components-panel__button:hover {
  background: transparent;
  color: var(--rvt-accent-h);
}

body.woocommerce-cart .wc-block-components-chip,
body.woocommerce-checkout .wc-block-components-chip {
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rp);
  background: var(--rvt-bg);
  color: var(--rvt-ink);
}

/* ===============================================================
   8. Notices
   =============================================================== */

body.woocommerce-cart .wc-block-components-notice-banner,
body.woocommerce-checkout .wc-block-components-notice-banner {
  border-radius: var(--rvt-rm);
  font-family: var(--rvt-b);
}

body.woocommerce-cart .wc-block-components-notice-banner.is-success,
body.woocommerce-checkout .wc-block-components-notice-banner.is-success {
  border-color: var(--rvt-mint);
  background: rgba(111, 207, 168, 0.12);
}

body.woocommerce-cart .wc-block-components-notice-banner.is-error,
body.woocommerce-checkout .wc-block-components-notice-banner.is-error {
  border-color: var(--rvt-coral);
  background: rgba(240, 128, 111, 0.12);
}

body.woocommerce-cart .wc-block-components-notice-banner.is-info,
body.woocommerce-checkout .wc-block-components-notice-banner.is-info {
  border-color: var(--rvt-border);
  background: var(--rvt-bg);
}

/* ===============================================================
   9. Empty states
   =============================================================== */

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block,
body.woocommerce-checkout .wc-block-checkout-empty {
  padding: 24px 0 48px;
  text-align: center;
}

body.woocommerce-cart .wc-block-cart__empty-cart__title,
body.woocommerce-checkout .wc-block-checkout-empty__title {
  color: var(--rvt-ink);
  font-family: var(--rvt-h);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 700;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-separator {
  max-width: 120px;
  margin: 24px auto;
  border-color: var(--rvt-border);
}

/* ===============================================================
   10. Cross sell products
   =============================================================== */

body.woocommerce-cart .wc-block-product-template {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.woocommerce-cart .wc-block-product-template__product {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 0 0 16px;
  border: 1px solid var(--rvt-border);
  border-radius: var(--rvt-rm);
  background: var(--rvt-surface);
  box-shadow: var(--rvt-sh);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.woocommerce-cart .wc-block-product-template__product:hover {
  box-shadow: var(--rvt-sh-lg);
  transform: translateY(-4px);
}

body.woocommerce-cart .wc-block-product-template__product .wp-block-woocommerce-product-image {
  margin: 0 0 12px;
  background: var(--rvt-bg);
}

body.woocommerce-cart .wc-block-product-template__product img {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 12%;
  object-fit: contain;
}

body.woocommerce-cart .wc-block-product-template__product .wp-block-post-title {
  margin: 0 16px 6px;
  font-family: var(--rvt-h);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

body.woocommerce-cart .wc-block-product-template__product .wp-block-post-title a {
  color: var(--rvt-ink);
  text-decoration: none;
}

body.woocommerce-cart .wc-block-product-template__product .wp-block-post-title a:hover {
  color: var(--rvt-accent);
}

body.woocommerce-cart .wc-block-product-template__product .wp-block-woocommerce-product-price {
  margin: 0 16px 12px;
  font-family: var(--rvt-h);
  font-weight: 700;
}

body.woocommerce-cart .wc-block-product-template__product .wp-block-woocommerce-product-button {
  margin: auto 16px 0;
}

/* ===============================================================
   11. Focus visibility
   =============================================================== */

body.woocommerce-cart a:focus-visible,
body.woocommerce-cart button:focus-visible,
body.woocommerce-checkout a:focus-visible,
body.woocommerce-checkout button:focus-visible {
  outline: 2px solid var(--rvt-accent);
  outline-offset: 3px;
}

/* ===============================================================
   12. Responsive
   =============================================================== */

@media (min-width: 1025px) {
  /* Summary follows the customer down a long page. */
  body.woocommerce-cart .wc-block-cart__sidebar,
  body.woocommerce-checkout .wc-block-checkout__sidebar {
    position: sticky;
    top: calc(var(--rvt-nav-h) + 16px);
    align-self: flex-start;
  }
}

@media (max-width: 1024px) {
  body.woocommerce-cart .wp-block-woocommerce-cart,
  body.woocommerce-checkout .wp-block-woocommerce-checkout {
    padding: 32px 20px 72px;
  }

  body.woocommerce-cart .wc-block-cart__main,
  body.woocommerce-checkout .wc-block-checkout__main {
    padding-right: 20px;
  }

  body.woocommerce-cart .wc-block-product-template {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 767px) {
  body.woocommerce-cart .wp-block-woocommerce-cart,
  body.woocommerce-checkout .wp-block-woocommerce-checkout {
    padding: 24px 16px 56px;
  }

  /* The blocks stack here. Drop the desktop gutter so the stacked
     columns are not pushed off centre. */
  body.woocommerce-cart .wc-block-cart__main,
  body.woocommerce-cart .wc-block-cart__sidebar,
  body.woocommerce-checkout .wc-block-checkout__main,
  body.woocommerce-checkout .wc-block-checkout__sidebar {
    width: 100%;
    padding-right: 0;
    padding-left: 0;
  }

  body.woocommerce-cart .wc-block-cart__sidebar,
  body.woocommerce-checkout .wc-block-checkout__sidebar {
    margin-top: 28px;
  }

  body.woocommerce-cart .wp-block-woocommerce-cart-order-summary-block,
  body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block,
  body.woocommerce-checkout .wc-block-components-checkout-step {
    padding: 20px 16px;
  }

  body.woocommerce-cart .wc-block-cart-items__row {
    padding: 18px 0;
  }

  body.woocommerce-cart .wc-block-cart-item__image img {
    max-width: 76px;
  }

  body.woocommerce-cart .wc-block-components-product-name {
    font-size: 15px;
  }

  /* Narrower but still a 40px tap target on each control. */
  body.woocommerce-cart .wc-block-components-quantity-selector,
  body.woocommerce-checkout .wc-block-components-quantity-selector {
    width: 132px;
  }

  body.woocommerce-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button,
  body.woocommerce-checkout .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  body.woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__quantity .wc-block-cart-item__remove-link {
    width: 40px;
    height: 40px;
    margin-left: 4px;
  }

  body.woocommerce-cart .wc-block-cart__submit-button,
  body.woocommerce-cart .wc-block-components-button.contained,
  body.woocommerce-cart .wc-block-components-button.outlined,
  body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
  body.woocommerce-checkout .wc-block-components-button.contained,
  body.woocommerce-checkout .wc-block-components-button.outlined {
    width: 100%;
  }

  body.woocommerce-checkout .wc-block-components-checkout-step + .wc-block-components-checkout-step {
    margin-top: 16px;
  }

  /* Two across keeps the cross sells readable on a phone. */
  body.woocommerce-cart .wc-block-product-template {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  body.woocommerce-cart .wc-block-product-template__product .wp-block-post-title {
    margin: 0 12px 6px;
    font-size: 14px;
  }

  body.woocommerce-cart .wc-block-product-template__product .wp-block-woocommerce-product-price,
  body.woocommerce-cart .wc-block-product-template__product .wp-block-woocommerce-product-button {
    margin-right: 12px;
    margin-left: 12px;
  }
}

@media (max-width: 400px) {
  body.woocommerce-cart .wp-block-woocommerce-cart,
  body.woocommerce-checkout .wp-block-woocommerce-checkout {
    padding: 20px 12px 48px;
  }

  body.woocommerce-cart .wc-block-cart-item__image img {
    max-width: 64px;
  }

  body.woocommerce-cart .wc-block-components-quantity-selector,
  body.woocommerce-checkout .wc-block-components-quantity-selector {
    width: 122px;
  }

  body.woocommerce-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button,
  body.woocommerce-checkout .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
  body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
  body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
  body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    font-size: 17px;
  }

  body.woocommerce-cart .wc-block-product-template {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.woocommerce-cart .wc-block-product-template__product,
  body.woocommerce-cart .wc-block-components-button,
  body.woocommerce-cart .wc-block-components-quantity-selector__button,
  body.woocommerce-checkout .wc-block-components-button,
  body.woocommerce-checkout .wc-block-components-radio-control__option {
    transition: none;
  }
}
