/* Prime commerce pages. WooCommerce owns form state, totals, and order submission. */
body.prime-theme .prime-commerce {
  --prime-commerce-paper: #f3f3e9;
  --prime-commerce-input: #fffef6;
  --prime-commerce-ink: #173427;
  --prime-commerce-muted: #4b6054;
  --prime-commerce-line: #c3d0c4;
  --prime-commerce-action: #214e38;
  --prime-commerce-mint: #a8e9c6;
  padding-block: clamp(24px, 4vw, 54px) 64px;
}

.prime-commerce__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 16px 28px;
  margin-bottom: 20px;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid #4a6858;
  border-radius: 24px;
  background: linear-gradient(140deg, #294c3b, #152921 75%);
  color: #f1f8ef;
}

body.prime-theme .prime-commerce__header .prime-title {
  margin: 0;
  color: #f1f8ef;
  font-size: clamp(27px, 4vw, 46px);
  line-height: 1.4;
}

.prime-commerce__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prime-commerce__steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c7d9cc;
  font-size: 13px;
}

.prime-commerce__steps li::before {
  width: 7px;
  height: 7px;
  border: 1px solid #abc4b5;
  border-radius: 50%;
  content: "";
}

.prime-commerce__steps [aria-current="step"] {
  color: var(--prime-commerce-mint);
  font-weight: 800;
}

.prime-commerce__steps [aria-current="step"]::before {
  background: var(--prime-commerce-mint);
}

body.prime-theme .prime-commerce__steps a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.prime-commerce__content {
  min-width: 0;
}

body.prime-theme .prime-commerce--cart .prime-commerce__content > .woocommerce {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.prime-commerce--cart .prime-commerce__content > .woocommerce > :not(.woocommerce-cart-form, .cart-collaterals) {
  grid-column: 1 / -1;
}

.prime-commerce__content .woocommerce-notices-wrapper:empty {
  display: none;
}

body.prime-theme .prime-commerce__content :is(.woocommerce-cart-form, .cart_totals, #customer_details, #order_review, .woocommerce-order) {
  min-width: 0;
  margin: 0;
  padding: clamp(15px, 2.6vw, 28px);
  border: 1px solid var(--prime-commerce-line);
  border-radius: 20px;
  background: var(--prime-commerce-paper);
  color: var(--prime-commerce-ink);
}

body.prime-theme .prime-commerce__content .cart-collaterals .cart_totals {
  float: none;
  width: auto;
}

body.prime-theme .prime-commerce__content form.woocommerce-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr);
  grid-template-rows: auto min-content 1fr;
  align-items: start;
  column-gap: 16px;
}

.prime-commerce__content form.woocommerce-checkout > :not(#customer_details, #order_review, #order_review_heading) {
  grid-column: 1 / -1;
}

.prime-commerce__content form.woocommerce-checkout > .woocommerce-NoticeGroup {
  grid-column: 1 / -1;
  grid-row: 1;
}

.prime-commerce__content form.woocommerce-checkout > #customer_details {
  grid-column: 1;
  grid-row: 2 / span 2;
}

.prime-commerce__content form.woocommerce-checkout > :is(#order_review_heading, #order_review) {
  grid-column: 2;
}

body.prime-theme .prime-commerce__content form.woocommerce-checkout > #order_review_heading {
  grid-row: 2;
  float: none;
  width: auto;
  margin: 0;
  padding: 18px clamp(15px, 2.6vw, 28px) 0;
  border: 1px solid var(--prime-commerce-line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--prime-commerce-paper);
  color: var(--prime-commerce-ink);
}

body.prime-theme .prime-commerce__content form.woocommerce-checkout > #order_review {
  grid-row: 3;
  float: none;
  width: auto;
  padding-top: 12px;
  border-top: 0;
  border-radius: 0 0 20px 20px;
}

body.prime-theme .prime-commerce__content #customer_details > :is(.col-1, .col-2) {
  float: none;
  width: auto;
}

body.prime-theme .prime-commerce__content :is(.woocommerce-cart-form, .cart_totals, #customer_details, #order_review, .woocommerce-order) :is(h2, h3, label, th, td, .woocommerce-Price-amount) {
  color: var(--prime-commerce-ink);
}

body.prime-theme .prime-commerce__content :is(.woocommerce-cart-form, .cart_totals, #customer_details, #order_review, .woocommerce-order) a:not(.button, .remove) {
  color: var(--prime-commerce-action);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.prime-theme .prime-commerce__content table.shop_table {
  width: 100%;
  margin-bottom: 16px;
  border: 0;
  border-collapse: collapse;
  color: var(--prime-commerce-ink);
}

body.prime-theme .prime-commerce__content table.shop_table :is(th, td) {
  padding: 11px 8px;
  border-color: var(--prime-commerce-line);
  overflow-wrap: anywhere;
}

.prime-commerce__content .woocommerce-cart-form .product-thumbnail img {
  width: clamp(42px, 5vw, 70px);
  border-radius: 8px;
}

.prime-commerce__content :is(.woocommerce-cart-form, #order_review) dl.variation {
  margin: 5px 0 0;
  color: var(--prime-commerce-muted);
  font-size: 12px;
}

body.prime-theme .prime-commerce__content :is(.woocommerce-cart-form, #customer_details, .checkout_coupon) :is(input:not([type=checkbox]):not([type=radio]), select, textarea),
body.prime-theme .prime-commerce__content .select2-selection--single {
  min-height: 44px;
  border: 1px solid #a9bbad;
  border-radius: 9px;
  background: var(--prime-commerce-input);
  color: var(--prime-commerce-ink);
  font-size: 16px;
}

body.prime-theme .prime-commerce__content .select2-selection--single :is(.select2-selection__rendered, .select2-selection__arrow) {
  min-height: 42px;
  line-height: 42px;
}

body.prime-theme .prime-commerce__content .woocommerce-invalid :is(input, select, textarea) {
  border-color: #a92f32;
}

body.prime-theme .prime-commerce__content .woocommerce-cart-form .coupon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.prime-theme .prime-commerce__content .woocommerce-cart-form .coupon input {
  width: min(100%, 160px);
  margin: 0;
}

body.prime-theme .prime-commerce__content :is(.checkout-button, #place_order) {
  display: block;
  float: none;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--prime-commerce-action);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-align: center;
}

body.prime-theme .prime-commerce__content :is(.checkout-button, #place_order):hover {
  background: #163d2a;
  color: #fff;
}

.prime-commerce__content :is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid #30734e;
  outline-offset: 2px;
}

body.prime-theme .prime-commerce__content #payment {
  border: 1px solid var(--prime-commerce-line);
  border-radius: 12px;
  background: #e4ece0;
  color: var(--prime-commerce-ink);
}

body.prime-theme .prime-commerce__content #payment .payment_box {
  background: #d4e2d3;
  color: var(--prime-commerce-ink);
}

body.prime-theme .prime-commerce__content #payment .payment_box::before {
  border-bottom-color: #d4e2d3;
}

.prime-commerce__content .woocommerce-order {
  overflow-wrap: anywhere;
}

@media (max-width: 940px), (orientation: portrait) and (pointer: coarse) {
  body.prime-theme .prime-commerce__content form.woocommerce-checkout {
    display: block;
  }

  body.prime-theme .prime-commerce__content form.woocommerce-checkout > #order_review_heading {
    margin-top: 16px;
  }

  body.prime-theme .prime-commerce__content .woocommerce-cart-form .coupon {
    display: flex;
    float: none;
    margin-bottom: 8px;
  }
}

@media (max-width: 768px) {
  body.prime-theme .prime-commerce__header {
    align-items: start;
    flex-direction: column;
  }

}

/* A single reading order keeps the cart legible even in desktop mode on phones. */
body.prime-theme.woocommerce-cart main.prime-main {
  min-height: 0;
}

body.prime-theme .prime-commerce--cart {
  width: min(920px, calc(100% - 28px));
  padding-bottom: clamp(24px, 4vw, 48px);
}

body.prime-theme .prime-commerce--cart .cart-collaterals {
  width: 100%;
  margin: 0;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .shop_table {
  display: block;
  margin: 0;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .shop_table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .shop_table tbody {
  display: grid;
  gap: 12px;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item {
  display: grid;
  grid-template-columns: clamp(46px, 8vw, 70px) minmax(0, 1fr) auto;
  grid-template-areas:
    "photo name remove"
    "price price price"
    "quantity quantity quantity"
    "subtotal subtotal subtotal";
  align-items: center;
  column-gap: 10px;
  padding: clamp(10px, 2vw, 18px);
  border: 1px solid var(--prime-commerce-line);
  border-radius: 13px;
  background: var(--prime-commerce-input);
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > td {
  display: block;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  background: none;
  text-align: start !important;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > td::before {
  display: none;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-thumbnail { grid-area: photo; }
body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-name { grid-area: name; }
body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-remove { grid-area: remove; }
body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-price { grid-area: price; }
body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-quantity { grid-area: quantity; }
body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-subtotal { grid-area: subtotal; }

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > .product-name > a {
  font-weight: 800;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > :is(.product-price, .product-quantity, .product-subtotal) {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  border-top: 1px solid var(--prime-commerce-line);
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item > :is(.product-price, .product-quantity, .product-subtotal)::before {
  display: block;
  float: none;
  content: attr(data-title);
  font-weight: 700;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .cart_item .product-remove a.remove {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: #f3e7e2;
  color: #973334 !important;
  text-decoration: none;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .shop_table tbody > tr:not(.cart_item) {
  display: block;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .shop_table .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 0;
  border: 0;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .actions .coupon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(100%, 330px);
  margin: 0;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .actions .coupon input {
  width: 100%;
  min-width: 0;
}

body.prime-theme .prime-commerce--cart .woocommerce-cart-form .actions :is(input, button) {
  min-height: 44px;
}

body.prime-theme .prime-commerce--cart .cart_totals .checkout-button {
  min-height: 52px;
}

@media (max-width: 560px), (orientation: portrait) and (pointer: coarse) {
  body.prime-theme .prime-commerce--cart .prime-commerce__header {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  body.prime-theme .prime-commerce--cart .woocommerce-cart-form .actions :is(.coupon, button[name="update_cart"]) {
    width: 100%;
  }
}
