/* ==========================================================================
   Cart Items Block
   Tokens (--shop-*) are shared with checkout and live in assets/css/theme.css.
   The table keeps WooCommerce's markup order; columns are placed with grid
   areas: thumbnail | product | price | quantity | subtotal | remove.
   ========================================================================== */

/* Free shipping goal bar ---------------------------------------------------------- */
.starterkit-cart-shipping-bar {
  margin: 0 0 var(--shop-space-lg);
  padding: var(--shop-space-sm) var(--shop-space-md);
  border-radius: var(--shop-radius);
  background: var(--shop-surface-soft);
}

.starterkit-cart-shipping-bar.is-unlocked {
  background: var(--shop-success-soft);
}

.starterkit-cart-shipping-bar__header {
  display: flex;
  align-items: center;
  gap: var(--shop-space-xs);
  margin-bottom: var(--shop-space-xs);
}

.starterkit-cart-shipping-bar__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--shop-ink);
}

.starterkit-cart-shipping-bar__text {
  margin: 0;
  color: var(--shop-text);
  font-size: var(--shop-font-md);
  line-height: 1.4;
}

.starterkit-cart-shipping-bar__text strong {
  color: var(--shop-ink);
  font-weight: 600;
}

.starterkit-cart-shipping-bar.is-unlocked :is(.starterkit-cart-shipping-bar__icon, .starterkit-cart-shipping-bar__text strong) {
  color: var(--shop-success);
}

.starterkit-cart-shipping-bar__track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--shop-border);
}

.starterkit-cart-shipping-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--shop-cta);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.starterkit-cart-shipping-bar.is-unlocked .starterkit-cart-shipping-bar__fill {
  background: var(--shop-success);
}

/* Table reset --------------------------------------------------------------------- */
.starterkit-cart-items {
  margin: 0;
}

/* :where() keeps this at one-class specificity so the row grids below win;
   other rows (actions, hook output) stay plain blocks. */
.starterkit-cart-items :where(table, thead, tbody, tbody > tr) {
  display: block;
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.starterkit-cart-items th,
.starterkit-cart-items td {
  padding: 0 !important;
  border: 0 !important;
  background: none;
  text-align: left;
  vertical-align: middle !important;
}

/* Header + item rows share one column template ----------------------------------- */
.starterkit-cart-items__header,
.starterkit-cart-items__row {
  display: grid;
  grid-template-columns: var(--shop-thumb-size) minmax(0, 1fr) 96px 120px 96px 32px;
  grid-template-areas: "thumb product price qty total remove";
  column-gap: var(--shop-space-md);
  align-items: center;
}

.starterkit-cart-items .product-thumbnail { grid-area: thumb; }
.starterkit-cart-items .product-name { grid-area: product; }
.starterkit-cart-items .product-price { grid-area: price; text-align: right; }
.starterkit-cart-items .product-quantity { grid-area: qty; text-align: center; }
.starterkit-cart-items .product-subtotal { grid-area: total; text-align: right; }
.starterkit-cart-items .product-remove { grid-area: remove; text-align: right; }

.starterkit-cart-items__header {
  padding-bottom: var(--shop-space-sm);
  border-bottom: 1px solid var(--shop-border);
  color: var(--shop-muted);
  font-size: var(--shop-font-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* "Product" heads the thumbnail + name columns. */
.starterkit-cart-items__header .product-name {
  grid-column: thumb-start / product-end;
}

.starterkit-cart-items__header .product-thumbnail {
  display: none;
}

.starterkit-cart-items__row {
  padding: var(--shop-space-md) 0;
  border-bottom: 1px solid var(--shop-border);
  transition: opacity 0.2s ease;
}

/* Thumbnail ----------------------------------------------------------------------- */
.starterkit-cart-items__image a {
  display: block;
  border-radius: var(--shop-radius-control);
}

.starterkit-cart-items__image img,
.starterkit-cart-items__img-placeholder {
  display: block;
  width: var(--shop-thumb-size);
  height: var(--shop-thumb-size);
  border: 1px solid var(--shop-border);
  border-radius: var(--shop-radius-control);
  background: var(--shop-surface-soft);
  object-fit: cover;
}

.starterkit-cart-items__img-placeholder {
  display: grid;
  place-items: center;
  color: var(--shop-muted);
}

.starterkit-cart-items__image a:hover img {
  opacity: 0.85;
}

/* Product name & variation -------------------------------------------------------- */
.starterkit-cart-items__product-copy {
  min-width: 0;
  line-height: 1.4;
}

.starterkit-cart-items__name,
.starterkit-cart-items__product-title {
  display: inline;
  margin: 0;
  color: var(--shop-ink);
  font-size: var(--shop-font-lg);
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
}

.starterkit-cart-items__name a {
  color: inherit;
  text-decoration: none;
}

.starterkit-cart-items__name a:hover,
.starterkit-cart-items__product-title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.starterkit-cart-items__meta,
.starterkit-cart-items .variation,
.starterkit-cart-items dl.variation {
  margin: 4px 0 0;
  padding: 0;
  color: var(--shop-muted);
  font-size: var(--shop-font-sm);
  line-height: 1.5;
}

.starterkit-cart-items__meta dl,
.starterkit-cart-items dl.variation {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 6px;
  margin: 0;
  padding: 0;
}

.starterkit-cart-items__meta dl dt,
.starterkit-cart-items dl.variation dt {
  float: none !important;
  clear: none !important;
  margin: 0 !important;
  padding: 0 !important;
  font-weight: 500 !important;
  color: var(--shop-text) !important;
}

.starterkit-cart-items__meta dl dd,
.starterkit-cart-items dl.variation dd {
  float: none !important;
  clear: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.starterkit-cart-items__meta dl dd p,
.starterkit-cart-items dl.variation dd p {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}

.starterkit-cart-items .backorder_notification {
  margin: 4px 0 0;
  color: var(--shop-muted);
  font-size: var(--shop-font-xs);
}

/* Price & subtotal ---------------------------------------------------------------- */
.starterkit-cart-items__price,
.starterkit-cart-items__total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.starterkit-cart-items__price {
  color: var(--shop-text);
  font-size: var(--shop-font-md);
}

.starterkit-cart-items__total {
  color: var(--shop-ink);
  font-size: var(--shop-font-lg);
  font-weight: 600;
}

/* Remove -------------------------------------------------------------------------- */
.starterkit-cart-items__remove,
.starterkit-cart-items__remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--shop-radius-control);
  color: var(--shop-muted);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.starterkit-cart-items__remove:hover,
.starterkit-cart-items__remove-btn:hover {
  background: var(--shop-surface-soft);
  color: var(--shop-danger);
}

/* Quantity stepper ---------------------------------------------------------------- */
.starterkit-cart-items__qty {
  display: flex;
  justify-content: center;
}

.starterkit-cart-items .starterkit-qty-control {
  display: inline-flex;
  align-items: center;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--shop-border-strong);
  border-radius: var(--shop-radius-control);
  background: var(--shop-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.starterkit-cart-items .starterkit-qty-control:focus-within {
  border-color: var(--shop-focus);
  box-shadow: var(--shop-focus-ring);
}

.starterkit-cart-items .starterkit-qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--shop-ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.starterkit-cart-items .starterkit-qty-btn:hover {
  background: var(--shop-surface-soft);
}

.starterkit-cart-items .starterkit-qty-btn:focus {
  outline: none;
}

.starterkit-cart-items .starterkit-qty-input {
  width: 40px !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--shop-ink) !important;
  font-family: inherit !important;
  font-size: var(--shop-font-md) !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums;
  text-align: center !important;
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

.starterkit-cart-items .starterkit-qty-input:focus {
  outline: none;
}

.starterkit-qty-input::-webkit-outer-spin-button,
.starterkit-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

/* Actions: coupon form ------------------------------------------------------------ */
.starterkit-cart-items__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--shop-space-xs);
  padding-top: var(--shop-space-md) !important;
}

.starterkit-cart-items__coupon {
  display: flex;
  flex: 1 1 320px;
  gap: var(--shop-space-xs);
  min-width: 0;
  max-width: 440px;
}

.starterkit-cart-items__coupon .input-text {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: var(--shop-control-height);
  margin: 0;
  padding: 0 var(--shop-space-sm);
  border: 1px solid var(--shop-border-strong);
  border-radius: var(--shop-radius-control);
  background: var(--shop-surface);
  color: var(--shop-ink);
  font-family: inherit;
  font-size: var(--shop-font-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.starterkit-cart-items__coupon .input-text:hover {
  border-color: var(--shop-muted);
}

.starterkit-cart-items__coupon .input-text:focus {
  border-color: var(--shop-focus);
  outline: none;
  box-shadow: var(--shop-focus-ring);
}

.starterkit-cart-items__coupon .input-text::placeholder {
  color: var(--shop-muted);
}

.starterkit-cart-items__actions .button {
  min-height: var(--shop-control-height);
  height: var(--shop-control-height);
  padding: 0 var(--shop-space-md);
  border: 1px solid var(--shop-border-strong);
  border-radius: var(--shop-radius-control);
  background: var(--shop-surface);
  box-shadow: none;
  color: var(--shop-ink);
  font-size: var(--shop-font-md);
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.starterkit-cart-items__actions .button:hover {
  border-color: var(--shop-ink);
  background: var(--shop-surface);
  transform: none;
}

/* Quantity changes update the cart automatically; the fallback button stays in the form. */
.starterkit-cart-items__actions .button[name="update_cart"] {
  display: none;
}

/* Keyboard focus ------------------------------------------------------------------ */
.starterkit-cart-items :is(a, button, .button):focus-visible {
  outline: 2px solid var(--shop-focus);
  outline-offset: 2px;
}

.starterkit-cart-items .starterkit-qty-btn:focus-visible {
  outline: 2px solid var(--shop-focus);
  outline-offset: -2px;
}

/* Extension blocks under the table ------------------------------------------------ */
.starterkit-cart-items__extensions {
  display: grid;
  gap: var(--shop-space-sm);
  margin-top: var(--shop-space-lg);
}

/* Empty cart ---------------------------------------------------------------------- */
.starterkit-cart-empty {
  display: grid;
  justify-items: center;
  gap: var(--shop-space-md);
  padding: 64px var(--shop-space-md);
  text-align: center;
}

.starterkit-cart-empty__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--shop-surface-soft);
  color: var(--shop-muted);
}

.starterkit-cart-empty__icon svg {
  width: 36px;
  height: 36px;
}

.starterkit-cart-empty__title {
  margin: 0;
  color: var(--shop-ink);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.starterkit-cart-empty__text {
  max-width: 420px;
  margin: -8px 0 0;
  color: var(--shop-muted);
  font-size: var(--shop-font-lg);
  line-height: 1.6;
}

/* The empty state reuses the summary CTA class; size it to its label here. */
.starterkit-cart-empty .button.starterkit-cart-summary__checkout {
  display: inline-flex;
  width: auto;
  margin-top: var(--shop-space-xs);
  padding: 0 var(--shop-space-lg);
}

/* Mobile: compact item cards ------------------------------------------------------
   thumb | name ........ remove
   thumb | unit price
   thumb | quantity .... subtotal */
@media (max-width: 767px) {
  .starterkit-cart-items__header {
    display: none;
  }

  .starterkit-cart-items__row {
    grid-template-columns: var(--shop-thumb-size) minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb product remove"
      "thumb price price"
      "thumb qty total";
    column-gap: var(--shop-space-sm);
    row-gap: var(--shop-space-xs);
    align-items: start;
  }

  .starterkit-cart-items__row .product-remove {
    margin: -6px -6px 0 0;
  }

  .starterkit-cart-items__name,
  .starterkit-cart-items__product-title {
    font-size: var(--shop-font-md);
  }

  .starterkit-cart-items__row .product-price {
    text-align: left;
    font-size: var(--shop-font-sm);
    color: var(--shop-muted);
  }

  .starterkit-cart-items__row .product-quantity {
    justify-content: flex-start;
    align-self: center;
  }

  .starterkit-cart-items__row .product-subtotal {
    align-self: center;
    font-size: var(--shop-font-md);
  }

  .starterkit-cart-items__coupon {
    flex-basis: 100%;
    max-width: none;
  }

  .starterkit-cart-empty {
    padding: 48px var(--shop-space-md);
  }

  .starterkit-cart-empty__title {
    font-size: 22px;
  }
}
