/* =============================================================================
   CART — item cards + sticky totals panel.
   Source: two columns at 1440/1024, stacked at 390. Doc heights measured
   1440 2054px · 1024 2156px · 390 2458px.
   ============================================================================= */

.th-cart { padding: 32px 0 48px; }

.th-cart__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 40px;
  align-items: start;
}

.th-cart__heading {
  font-size: var(--th-fs-h2);
  line-height: var(--th-lh-h2);
  margin: 0 0 20px;
}

/* ---------- item cards ---------- */
.th-cart__list { display: flex; flex-direction: column; gap: 16px; }

.th-cart-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--th-border);
  background: #fff;
}

.th-cart-item__media img { width: 96px; height: auto; display: block; }

.th-cart-item__body { display: flex; flex-direction: column; gap: 12px; }

.th-cart-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.th-cart-item__name { font-size: var(--th-fs-sm); line-height: 1.4; }
.th-cart-item__name a { font-weight: var(--th-fw-bold); color: var(--th-heading); }

/* Selected options render as "label: value" lines, matching the source. */
.th-cart-item__name dl.variation { margin: 6px 0 0; font-size: var(--th-fs-xs); color: var(--th-muted); }
.th-cart-item__name dl.variation dt,
.th-cart-item__name dl.variation dd { display: inline; margin: 0; }
.th-cart-item__name dl.variation dd { margin-right: 8px; }
.th-cart-item__name dl.variation dd p { display: inline; margin: 0; }

/* ⚠ `.product-remove > a` — cart.js binds exactly this. Styled as the
   source's trash control, but it stays an <a> one level deep. */
.th-cart-item__remove a.remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
  color: var(--th-muted);
  text-decoration: none;
}
.th-cart-item__remove a.remove:hover { color: var(--th-error); }

.th-cart-item__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

/* ---------- boxed stepper ---------- */
.th-cart-item__qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--th-field-border);
}

.th-qty-btn {
  width: 34px;
  background: none;
  border: 0;
  font-size: 16px;
  line-height: 1;
  color: var(--th-text);
}
.th-qty-btn:hover { background: var(--th-badge-bg); }

/* Woo's own input — kept, never replaced. */
.th-cart-item__qty .quantity { display: flex; }
.th-cart-item__qty input.qty {
  width: 46px;
  height: 36px;
  padding: 0;
  border: 0;
  border-inline: 1px solid var(--th-field-border);
  text-align: center;
  font-family: var(--th-font);
  font-size: var(--th-fs-sm);
  -moz-appearance: textfield;
}
.th-cart-item__qty input.qty::-webkit-outer-spin-button,
.th-cart-item__qty input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.th-cart-item__price { font-size: var(--th-fs-sm); font-weight: var(--th-fw-bold); }
.th-cart-item__price del { color: var(--th-muted); font-weight: var(--th-fw-normal); margin-right: 6px; }

/* ---------- totals panel ---------- */
.th-cart__panel { position: sticky; top: calc(var(--th-header-h) + 16px); }

.th-totals {
  background: #f4f4f4;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ⚠ woocommerce.css's `.woocommerce table.shop_table` chrome is (0,2,1) with a
   border, a radius and border-collapse:separate, and it outranks a bare class.
   We render no table here, but reset defensively in case a Woo partial does. */
.woocommerce .th-totals table.shop_table {
  border: 0;
  border-radius: 0;
}

/* free-shipping progress */
.th-freeship__msg { margin: 0 0 8px; font-size: var(--th-fs-sm); }
.th-freeship__track {
  height: 8px;
  background: #e2e2e2;
  overflow: hidden;
}
.th-freeship__fill {
  display: block;
  height: 100%;
  background: var(--th-age-accent);   /* the source's orange fill */
  transition: width var(--th-speed-med);
}

/* coupon */
.th-coupon { display: flex; gap: 0; }
.th-coupon__input {
  flex: 1 1 auto;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--th-field-border);
  background: #fff;
  font-family: var(--th-font);
  font-size: var(--th-fs-sm);
}
.woocommerce .th-coupon .th-coupon__btn,
.th-coupon__btn {
  height: 44px;
  padding: 0 18px;
  background: var(--th-btn-bg);
  color: #fff;
  border: 1px solid var(--th-btn-bg);
  border-radius: 0;
  font-size: var(--th-fs-sm);
  font-weight: var(--th-fw-bold);
}

/* rows */
.th-totals__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--th-fs-sm);
}
.th-totals__row--total {
  padding-top: 12px;
  border-top: 1px solid #d8d8d8;
  font-size: var(--th-fs-base);
  font-weight: var(--th-fw-bold);
}
.th-totals__label { color: var(--th-text); }
.th-totals__value { font-weight: var(--th-fw-bold); text-align: right; }
.th-totals__muted { font-weight: var(--th-fw-normal); color: var(--th-muted); }
.th-totals__savings {
  display: block;
  font-size: var(--th-fs-xs);
  font-weight: var(--th-fw-normal);
  color: var(--th-muted);
}

/* CTA — price baked into the label, as the source does. */
.woocommerce .th-totals .th-checkout-btn,
.th-checkout-btn {
  width: 100%;
  height: 52px;
  font-size: var(--th-fs-card-cta);
  font-weight: var(--th-fw-bold);
  border-radius: 0;
  text-align: center;
}

.th-min-order td { font-size: var(--th-fs-xs); color: var(--th-error); }

@media (max-width: 991px) {
  .th-cart .th-cart__grid { grid-template-columns: 1fr; gap: 24px; }
  .th-cart .th-cart__panel { position: static; }
}
@media (max-width: 600px) {
  .th-cart .th-cart-item { grid-template-columns: 72px minmax(0, 1fr); }
  .th-cart .th-cart-item__media img { width: 72px; }
  .th-cart .th-cart-item__bottom { flex-wrap: wrap; }
}
