/* Shopping cart and cart checkout pages (docs/cart.md). */

.lc-cart {
  display: grid;
  gap: var(--lc-space-8);
  align-items: start;
}

@media (min-width: 960px) {
  .lc-cart { grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem); }
  .lc-cart__summary { position: sticky; top: calc(var(--lc-header-h) + var(--lc-space-4)); }
}

.lc-cart__main { min-width: 0; }
.lc-cart__main section { display: grid; gap: var(--lc-space-4); }

.lc-cart-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--lc-border);
}

.lc-cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "info remove"
    "qty total";
  gap: var(--lc-space-3) var(--lc-space-4);
  align-items: center;
  padding-block: var(--lc-space-5);
  border-bottom: 1px solid var(--lc-border);
}

.lc-cart-line--quote { grid-template-areas: "info remove" "status status"; }

.lc-cart-line__info { grid-area: info; display: grid; gap: var(--lc-space-1); min-width: 0; }
.lc-cart-line__brand {
  font-family: var(--lc-font-mono);
  font-size: var(--lc-text-2xs);
  letter-spacing: 0.04em;
  color: var(--lc-text-subtle);
}
.lc-cart-line__name { margin: 0; font-size: var(--lc-text-md); font-weight: var(--lc-weight-semibold); overflow-wrap: anywhere; }
.lc-cart-line__name a { color: var(--lc-text); text-decoration: none; }
.lc-cart-line__name a:hover { text-decoration: underline; }
.lc-cart-line__unit { font-size: var(--lc-text-sm); color: var(--lc-text-muted); }
.lc-cart-line__qty { grid-area: qty; display: flex; align-items: center; gap: var(--lc-space-2); }
.lc-cart-line__total { grid-area: total; justify-self: end; font-size: var(--lc-text-md); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc-cart-line__remove { grid-area: remove; justify-self: end; }
.lc-cart-line__status { grid-area: status; justify-self: start; }

@media (min-width: 720px) {
  .lc-cart-line {
    grid-template-columns: minmax(0, 1fr) auto minmax(7.5rem, auto) auto;
    grid-template-areas: "info qty total remove";
  }
  .lc-cart-line--quote {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "info status remove";
  }
}

.lc-cart__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lc-space-3);
}

.lc-cart__summary { display: grid; gap: var(--lc-space-4); }

.lc-cart-totals { margin: 0; display: grid; gap: var(--lc-space-2); }
.lc-cart-totals > div { display: flex; justify-content: space-between; gap: var(--lc-space-4); font-size: var(--lc-text-sm); color: var(--lc-text-muted); }
.lc-cart-totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.lc-cart-totals__total {
  padding-top: var(--lc-space-3);
  border-top: 1px solid var(--lc-border);
  align-items: baseline;
}
.lc-cart-totals > .lc-cart-totals__total { color: var(--lc-text); font-weight: var(--lc-weight-semibold); }
.lc-cart-totals__total dd { font-size: var(--lc-text-xl); white-space: nowrap; }

.lc-cart__assurances {
  display: grid;
  gap: var(--lc-space-3);
  margin: 0;
  padding: var(--lc-space-4) 0 0;
  border-top: 1px solid var(--lc-border);
  list-style: none;
  font-size: var(--lc-text-sm);
  color: var(--lc-text-muted);
}
.lc-cart__assurances li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--lc-space-3); align-items: start; }
.lc-cart__assurances .lc-icon { color: var(--lc-text-subtle); }

/* ---------- Checkout form ---------- */
.lc-checkout-form { display: grid; gap: var(--lc-space-8); }
.lc-checkout-form__group { display: grid; gap: var(--lc-space-4); }
.lc-checkout-form__group legend { font-size: var(--lc-text-lg); }
.lc-checkout-form__row { display: grid; gap: var(--lc-space-4); }
.lc-checkout-form__billing { display: grid; gap: var(--lc-space-4); }
.lc-checkout-form__billing[hidden] { display: none; }
.lc-checkout-form__address { min-height: 5.5rem; padding-block: var(--lc-space-3); resize: vertical; }

@media (min-width: 640px) {
  .lc-checkout-form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lc-checkout-form__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.lc-field-error { margin: 0; font-size: var(--lc-text-xs); color: var(--lc-danger-text); }

.lc-checkout-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--lc-space-3); font-size: var(--lc-text-sm); }
.lc-checkout-lines li { display: flex; justify-content: space-between; gap: var(--lc-space-4); }
.lc-checkout-lines__name { min-width: 0; overflow-wrap: anywhere; }
.lc-checkout-lines__price { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* =========================================================== STORE THEME (commerce-first UI) */
/* Product, quantity, price on one calm row; a summary card with the total and the one next step. */
.lc-cart-line__thumb {
  grid-area: thumb;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--lc-radius-md);
  background: var(--lc-store-media, var(--lc-surface-sunken));
  color: var(--lc-text-muted);
}

.lc-cart-line__thumb .lc-icon { width: 1.5rem; height: 1.5rem; stroke-width: 1.3; }

.lc-cart-line {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb info remove"
    "thumb qty total";
}

.lc-cart-line--quote { grid-template-areas: "thumb info remove" "thumb status status"; }

@media (min-width: 720px) {
  .lc-cart-line {
    grid-template-columns: auto minmax(0, 1fr) auto minmax(7.5rem, auto) auto;
    grid-template-areas: "thumb info qty total remove";
  }
  .lc-cart-line--quote {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "thumb info status remove";
  }
}

.lc-theme-store .lc-cart-lines { border-top-color: var(--lc-store-line); }
.lc-theme-store .lc-cart-line { border-bottom-color: var(--lc-store-line); }
.lc-theme-store .lc-cart-line--quote .lc-cart-line__thumb { background: transparent; border: 1px dashed var(--lc-border-strong); }
.lc-theme-store .lc-cart-line__brand { font-family: var(--lc-font-sans); font-size: var(--lc-text-xs); font-weight: var(--lc-weight-semibold); color: var(--lc-text-muted); }
.lc-theme-store .lc-cart-line__total { font-size: var(--lc-text-lg); font-weight: var(--lc-weight-bold); }
.lc-theme-store .lc-cart__main h2 { font-size: var(--lc-text-lg); }

.lc-theme-store .lc-cart__summary {
  gap: var(--lc-space-4);
  padding: var(--lc-space-6);
  border-color: var(--lc-store-line);
  border-radius: var(--lc-radius-xl);
  box-shadow: var(--lc-shadow-card);
}

.lc-theme-store .lc-cart-totals__total dd { font-size: var(--lc-text-2xl); font-weight: var(--lc-weight-bold); letter-spacing: -0.02em; }
.lc-theme-store .lc-cart__assurances { border-top-color: var(--lc-store-line); font-size: var(--lc-text-xs); }
.lc-theme-store .lc-cart__assurances strong { font-size: var(--lc-text-sm); }

.lc-theme-store .lc-checkout-form__group {
  padding: var(--lc-space-6);
  border: 1px solid var(--lc-store-line);
  border-radius: var(--lc-radius-xl);
  background: var(--lc-surface);
}

.lc-theme-store .lc-checkout-form__group legend { float: left; width: 100%; margin-bottom: var(--lc-space-2); font-weight: var(--lc-weight-semibold); }
.lc-theme-store .lc-checkout-form__group legend + * { clear: both; }
.lc-theme-store .lc-checkout-lines li { padding-bottom: var(--lc-space-3); border-bottom: 1px solid var(--lc-store-line); }
.lc-theme-store .lc-checkout-lines__price { font-weight: var(--lc-weight-semibold); }
.lc-theme-store .lc-page-intro .lc-steps-bar { margin-top: var(--lc-space-2); }

/* Phones and tablets: on the order details page the summary (what is bought, the total) comes before the form,
   so the buyer sees the amount before the button that creates the order. */
@media (max-width: 959px) {
  .lc-cart:has(.lc-checkout-form) .lc-cart__summary { order: -1; }
}
