/* ═══════════════════════════════════════════════════════════════════
   Cart, checkout and order-received.

   Loaded only on those three screens. The goal here is not decoration:
   it is that a buyer on a phone can go from cart to placed order without
   pinch-zooming, hunting for the button, or meeting a surprise.
   ═══════════════════════════════════════════════════════════════════ */

/* On these pages the brand accent is the store's own, not a product's. */
.woocommerce-cart, .woocommerce-checkout, .woocommerce-order-received {
  --accent: var(--brand);
  --accent-deep: var(--brand-deep);
}

.woocommerce-cart .bm-main,
.woocommerce-checkout .bm-main,
.woocommerce-order-received .bm-main { padding-block: clamp(20px, 3vw, 38px) clamp(48px, 7vw, 80px); }

/* Cart and checkout are WordPress pages, so they arrive through singular.php wrapped
   in the article/prose shell — and .bm-prose caps content at 68ch, which is why the
   cart was rendering as a narrow strip down the middle of a wide screen. Reading
   measure is right for a blog post and wrong for a two-column transactional layout. */
.woocommerce-cart .bm-prose,
.woocommerce-checkout .bm-prose,
.woocommerce-order-received .bm-prose { max-width: none; }
.woocommerce-cart .bm-prose > * + *,
.woocommerce-checkout .bm-prose > * + * { margin-top: 0; }

.woocommerce-cart .bm-article__head,
.woocommerce-checkout .bm-article__head,
.woocommerce-order-received .bm-article__head { margin-bottom: clamp(18px, 2.5vw, 28px); }

/* A transactional page title should announce the step, not dominate it. */
.woocommerce-cart .bm-article__title,
.woocommerce-checkout .bm-article__title,
.woocommerce-order-received .bm-article__title,
.bm-co-title { font-size: clamp(1.55rem, 1.3rem + 1.2vw, 2.2rem); }

/* ── shared controls ─────────────────────────────────────────────── */

.woocommerce form .form-row { display: flex; flex-direction: column; gap: 7px; margin: 0 0 14px; }
.woocommerce form .form-row label {
  font-size: .82rem; font-weight: 600; color: var(--ink-soft); letter-spacing: .005em;
}
.woocommerce form .form-row .required { color: #B3261E; text-decoration: none; }
.woocommerce form .form-row .optional { color: var(--ink-mute); font-weight: 500; }

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce .select2-container .select2-selection--single,
.woocommerce input[type="tel"],
.woocommerce input[type="email"],
.woocommerce input[type="text"] {
  font: inherit; font-size: 1rem;          /* 16px: anything smaller makes iOS zoom */
  width: 100%; height: auto; padding: 14px 15px;
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none; appearance: none;
}
.woocommerce form .form-row input.input-text::placeholder,
.woocommerce form .form-row textarea::placeholder { color: var(--ink-mute); }

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.woocommerce form .form-row.woocommerce-invalid input.input-text { border-color: #B3261E; }
.woocommerce form .form-row.woocommerce-validated input.input-text { border-color: color-mix(in srgb, var(--ok) 55%, var(--hair)); }

/* Select gets a caret of its own, since appearance:none removed the native one. */
.woocommerce form .form-row select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237A98A8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; background-size: 12px;
  padding-right: 40px;
}

/* Two fields on one line, collapsing to one on a phone. */
.woocommerce form .form-row-first, .woocommerce form .form-row-last { width: 100%; float: none; }
@media (min-width: 560px) {
  .woocommerce .bm-co__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .woocommerce .bm-co__fields .form-row-wide,
  .woocommerce .bm-co__fields > p:not(.form-row-first):not(.form-row-last) { grid-column: 1 / -1; }
}

.bm-hidden { display: none !important; }
.woocommerce .woocommerce-billing-fields h3,
.woocommerce .woocommerce-shipping-fields h3 { display: none; }

/* ── checkout layout ─────────────────────────────────────────────── */

.bm-co__grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: clamp(24px, 4vw, 56px); align-items: start;
}
.bm-co__main { min-width: 0; }

.bm-co__block { margin-top: 30px; }
.bm-co__h {
  font-size: 1.15rem; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}

.bm-co__side { min-width: 0; }
.bm-co__sticky {
  position: sticky; top: 96px;
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: var(--r-lg); padding: 24px;
}

/* The collapsed mobile summary. Hidden on desktop, where the aside does the job. */
.bm-co__peek { display: none; }

@media (max-width: 900px) {
  .bm-co__grid { grid-template-columns: 1fr; }
  .bm-co__side { display: none; }

  .bm-co__peek {
    display: block; margin-bottom: 22px;
    background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  }
  .bm-co__peek > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 15px 18px;
  }
  .bm-co__peek > summary::-webkit-details-marker { display: none; }
  .bm-co__peek-label { display: flex; align-items: center; gap: 9px; font-size: .938rem; font-weight: 600; color: var(--accent-deep); }
  .bm-co__peek-label .bm-ico { color: var(--accent); }
  .bm-co__peek-caret {
    width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px); transition: transform .25s ease;
  }
  .bm-co__peek[open] .bm-co__peek-caret { transform: rotate(-135deg) translate(-2px, -2px); }
  .bm-co__peek-total { font-family: var(--disp); font-variation-settings: var(--soft); font-weight: 600; font-size: 1.1rem; }
  .bm-co__peek-total .amount { font-family: inherit; }
  .bm-co__peek-body { padding: 0 18px 18px; border-top: 1px solid var(--hair-soft); }
  .bm-co__peek-body .bm-sum { padding-top: 16px; }
}

/* ── order summary panel ─────────────────────────────────────────── */

.bm-sum__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.bm-sum__item { display: grid; grid-template-columns: 52px 1fr auto; gap: 13px; align-items: center; }

.bm-sum__thumb { position: relative; display: block; }
.bm-sum__thumb img {
  width: 52px; height: 52px; object-fit: contain;
  background: var(--surface-2); border: 1px solid var(--hair-soft); border-radius: var(--r-sm);
}
/* Quantity as a badge on the thumbnail, not a column. It is the Shopify pattern
   because it reads instantly and costs no horizontal space on a phone. */
.bm-sum__qty {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px;
  display: grid; place-items: center; padding: 0 5px;
  background: var(--ink); color: #fff; border-radius: 99px;
  font-size: .688rem; font-weight: 700; line-height: 1;
}
.bm-sum__name { font-size: .9rem; font-weight: 600; line-height: 1.32; min-width: 0; }
.bm-sum__meta { display: block; margin-top: 3px; font-size: .75rem; font-weight: 400; color: var(--ink-mute); }
.bm-sum__meta p { margin: 0; }
.bm-sum__line { font-size: .9rem; font-weight: 600; white-space: nowrap; }

.bm-sum__totals { margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--hair-soft); display: grid; gap: 11px; }
.bm-sum__row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.bm-sum__row dt { font-size: .875rem; color: var(--ink-soft); }
.bm-sum__row dd { margin: 0; font-size: .938rem; font-weight: 600; }
.bm-sum__row--total {
  margin-top: 5px; padding-top: 14px; border-top: 1px solid var(--hair-soft); align-items: center;
}
.bm-sum__row--total dt { font-size: 1rem; font-weight: 700; color: var(--ink); }
.bm-sum__row--total dd { font-size: 1.45rem; font-family: var(--disp); font-variation-settings: var(--soft); letter-spacing: -.03em; }
.bm-sum__row--total dd .amount { font-family: inherit; }

.bm-sum__note, .bm-sum__eta {
  display: flex; gap: 10px; margin-top: 16px;
  font-size: .813rem; line-height: 1.5; color: var(--ink-soft);
}
.bm-sum__note { padding: 12px 14px; background: var(--ok-tint); border-radius: var(--r-sm); color: #0B5F56; }
.bm-sum__note .bm-ico { color: var(--ok); flex: none; margin-top: 1px; }
.bm-sum__eta .bm-ico { color: var(--accent); flex: none; margin-top: 1px; }

/* ── payment ─────────────────────────────────────────────────────── */

.woocommerce-checkout-payment { background: none; border-radius: 0; }
.woocommerce-checkout-payment ul.payment_methods { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.bm-pm input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.bm-pm__label {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 17px 18px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--hair); border-radius: var(--r);
  transition: border-color .18s ease, background .18s ease;
}
.bm-pm input:checked + .bm-pm__label { border-color: var(--accent); background: var(--accent-tint); }
.bm-pm input:focus-visible + .bm-pm__label { box-shadow: 0 0 0 3px var(--accent-tint); }
.bm-pm__ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); color: var(--accent-deep); }
.bm-pm input:checked + .bm-pm__label .bm-pm__ico { background: var(--surface); }
.bm-pm__text strong { display: block; font-size: .95rem; }
.bm-pm__text small { display: block; margin-top: 3px; font-size: .813rem; line-height: 1.45; color: var(--ink-soft); }
.bm-pm__tick { opacity: 0; color: var(--accent); transition: opacity .18s ease; }
.bm-pm input:checked + .bm-pm__label .bm-pm__tick { opacity: 1; }
.bm-pm .payment_box {
  margin: 0; padding: 13px 16px; background: var(--surface-2);
  border-radius: 0 0 var(--r) var(--r); font-size: .875rem; color: var(--ink-soft);
}
.bm-pm .payment_box p:last-child { margin-bottom: 0; }

/* The button. One per page, full width, and it says what happens when you press it. */
.woocommerce #place_order,
.woocommerce .wc-proceed-to-checkout .button {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; margin-top: 20px; padding: 17px 24px;
  background: var(--accent); color: #fff; border: 0; border-radius: 100px;
  font: inherit; font-size: 1.02rem; font-weight: 700; letter-spacing: .005em;
  text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .25s ease, opacity .2s ease;
}
.woocommerce #place_order:hover,
.woocommerce .wc-proceed-to-checkout .button:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.woocommerce #place_order:disabled { opacity: .6; transform: none; cursor: progress; }

.bm-pay__terms { margin-top: 12px; font-size: .75rem; color: var(--ink-mute); text-align: center; }

/* Woo's blocking overlay during the AJAX submit. The default is an unstyled spinner
   on a white sheet, which reads as a crash on a slow connection. */
.woocommerce .blockUI.blockOverlay { background: rgba(247,250,252,.72) !important; backdrop-filter: blur(2px); }
.woocommerce .blockUI.blockOverlay::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 2.5px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%;
  animation: bm-spin .7s linear infinite;
}
@keyframes bm-spin { to { transform: rotate(360deg); } }

/* ── notices ─────────────────────────────────────────────────────── */

.woocommerce-message, .woocommerce-info, .woocommerce-error, .woocommerce-NoticeGroup {
  list-style: none; margin: 0 0 20px; padding: 14px 18px;
  border-radius: var(--r); border-left: 3px solid var(--accent);
  background: var(--accent-tint); font-size: .938rem; line-height: 1.5;
}
.woocommerce-error { border-left-color: #B3261E; background: #FCECEA; color: #7A1A14; }
.woocommerce-error li { margin: 0; }
.woocommerce-message { border-left-color: var(--ok); background: var(--ok-tint); }
.woocommerce-message .button, .woocommerce-info .button { float: right; text-decoration: underline; }

/* ── cart ────────────────────────────────────────────────────────── */

.bm-cart-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); gap: clamp(22px, 3.5vw, 44px); align-items: start; }
@media (max-width: 900px) { .bm-cart-grid { grid-template-columns: 1fr; } }

.woocommerce table.shop_table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: var(--r-lg); overflow: hidden;
}
.woocommerce table.shop_table th {
  text-align: left; font-size: .688rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 700; padding: 14px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--hair);
}
.woocommerce table.shop_table td { padding: 16px; border-bottom: 1px solid var(--hair-soft); vertical-align: middle; }
.woocommerce table.shop_table tr:last-child td { border-bottom: 0; }
.woocommerce table.shop_table img {
  width: 62px; height: 62px; object-fit: contain;
  border-radius: var(--r-sm); background: var(--surface-2);
}
.woocommerce table.shop_table .product-name a { font-weight: 600; text-decoration: none; }
.woocommerce table.shop_table .product-name a:hover { color: var(--accent); }
.bm-cart__unit { display: block; margin-top: 4px; font-size: .813rem; color: var(--ink-mute); }

.woocommerce a.remove {
  display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface-2); color: var(--ink-mute);
  font-size: 1rem; line-height: 1; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.woocommerce a.remove:hover { background: #FCECEA; color: #B3261E; }

.woocommerce .quantity input.qty {
  font: inherit; width: 74px; padding: 10px 6px; text-align: center;
  border: 1px solid var(--hair); border-radius: var(--r-sm); background: var(--surface);
  -moz-appearance: textfield;
}
.woocommerce .quantity input.qty::-webkit-outer-spin-button,
.woocommerce .quantity input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Coupons are off, so this row is only ever the update button. */
.woocommerce .cart .actions { padding: 14px 16px; background: var(--surface-2); }
.woocommerce .cart .actions .coupon { display: none; }
.woocommerce .cart .actions .button[name="update_cart"] {
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
  padding: 10px 18px; border-radius: 100px;
  background: var(--surface); color: var(--ink-soft); border: 1px solid var(--hair);
}
.woocommerce .cart .actions .button[name="update_cart"]:disabled { opacity: .45; cursor: default; }

.woocommerce .cart-collaterals { margin: 0; max-width: none; width: 100%; }
.woocommerce .cart_totals {
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: var(--r-lg); padding: 24px;
  position: sticky; top: 96px;
}
.woocommerce .cart_totals h2 { font-size: 1.15rem; margin-bottom: 16px; }
.woocommerce .cart_totals table { width: 100%; border-collapse: collapse; }
.woocommerce .cart_totals th { text-align: left; font-weight: 500; font-size: .875rem; color: var(--ink-soft); padding: 9px 0; }
.woocommerce .cart_totals td { text-align: right; font-weight: 600; font-size: .938rem; padding: 9px 0; }
.woocommerce .cart_totals .order-total th { font-weight: 700; color: var(--ink); font-size: 1rem; }
.woocommerce .cart_totals .order-total td {
  font-family: var(--disp); font-variation-settings: var(--soft);
  font-size: 1.4rem; letter-spacing: -.03em;
}
.woocommerce .cart_totals .order-total td .amount { font-family: inherit; }
.woocommerce .cart_totals ul#shipping_method { list-style: none; margin: 0; padding: 0; font-size: .875rem; }
.woocommerce .cart_totals .woocommerce-shipping-destination { font-size: .75rem; color: var(--ink-mute); margin-top: 6px; }

.bm-nudge {
  background: var(--accent-tint); border: 1px dashed var(--accent-line);
  border-radius: var(--r); padding: 13px 18px; margin-bottom: 20px; font-size: .938rem;
}

.cart-empty, .woocommerce .return-to-shop { text-align: center; }
.woocommerce .return-to-shop { margin-top: 22px; }

/* A five-column table cannot fit a phone. Below this width each line item becomes a
   card: thumbnail left, name and unit price beside it, quantity and line total on a
   row underneath. The markup is unchanged — only the display roles are. */
@media (max-width: 680px) {
  .woocommerce table.shop_table.cart,
  .woocommerce table.shop_table.cart tbody,
  .woocommerce table.shop_table.cart tr,
  .woocommerce table.shop_table.cart td { display: block; width: auto; }

  .woocommerce table.shop_table.cart { border: 0; background: none; border-radius: 0; }
  .woocommerce table.shop_table.cart thead { display: none; }

  .woocommerce table.shop_table.cart tr.woocommerce-cart-form__cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    grid-template-areas: "thumb name" "thumb qty";
    gap: 4px 14px; align-items: start;
    background: var(--surface); border: 1px solid var(--hair);
    border-radius: var(--r); padding: 15px 44px 15px 15px; margin-bottom: 12px;
  }
  .woocommerce table.shop_table.cart tr.woocommerce-cart-form__cart-item td { border: 0; padding: 0; }

  .woocommerce table.shop_table.cart .product-thumbnail { grid-area: thumb; }
  /* The packshots are tall portraits. Without a height the card grows to ~250px per
     line item and two products fill the screen. */
  .woocommerce table.shop_table.cart .product-thumbnail img {
    width: 74px; height: 74px; object-fit: contain;
  }
  .woocommerce table.shop_table.cart .product-name { grid-area: name; font-size: .95rem; }

  /* Quantity and line total share the second row of the card. */
  .woocommerce table.shop_table.cart .product-quantity {
    grid-area: qty; align-self: end; margin-top: 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
  }
  .woocommerce table.shop_table.cart .product-subtotal {
    position: absolute; right: 15px; bottom: 15px;
    font-weight: 700; font-size: .95rem;
  }
  .woocommerce table.shop_table.cart .product-subtotal::before { content: none; }

  /* Remove sits in the corner rather than taking a column of its own. */
  .woocommerce table.shop_table.cart .product-remove { position: absolute; top: 12px; right: 12px; }

  .woocommerce table.shop_table.cart .quantity input.qty { width: 84px; padding: 9px 6px; }

  .woocommerce table.shop_table.cart tr:has(.actions),
  .woocommerce .cart .actions { display: block; background: none; padding: 0; margin-bottom: 18px; }
  .woocommerce .cart .actions .button[name="update_cart"] { width: 100%; }
}

/* ── order received ──────────────────────────────────────────────── */

.woocommerce-order { max-width: 780px; margin-inline: auto; }
.woocommerce-order-overview {
  list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 24px 0; padding: 0;
}
.woocommerce-order-overview li {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 14px 16px; font-size: .688rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute);
}
.woocommerce-order-overview li strong {
  display: block; margin-top: 6px; font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--ink);
  font-family: var(--disp); font-variation-settings: var(--soft);
}
.woocommerce-order .woocommerce-column__title, .woocommerce-order h2 { font-size: 1.15rem; margin: 28px 0 14px; }
