/* Cart is a system page. Keep its layout isolated from editable storefront grids. */
body[data-store-kind="cart"] .sp-page {
  width: min(1180px, calc(100% - 32px));
  max-width: none;
  margin-inline: auto;
  padding: clamp(42px, 6vw, 78px) 0 clamp(64px, 8vw, 104px);
}

body[data-store-kind="cart"] .sp-page-head {
  margin: 0 0 clamp(22px, 3vw, 34px);
}

body[data-store-kind="cart"] .sp-page-head h1 {
  margin-block: 10px 12px;
  font-size: clamp(46px, 6vw, 78px);
}

body[data-store-kind="cart"] .sp-cart-page {
  overflow: hidden;
  padding: clamp(10px, 1.5vw, 18px);
  border: 1px solid var(--line);
  border-radius: clamp(20px, 2vw, 28px);
  background: var(--soft);
}

body[data-store-kind="cart"] .sp-cart-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) max-content minmax(112px, max-content);
  grid-template-areas: "media copy quantity price";
  align-items: center;
  gap: clamp(14px, 2.2vw, 28px);
  min-width: 0;
  padding: clamp(16px, 2vw, 22px);
  border: 0;
  border-bottom: 1px solid var(--line);
}

body[data-store-kind="cart"] .sp-cart-row:last-of-type {
  border-bottom: 0;
}

body[data-store-kind="cart"] .sp-cart-media {
  grid-area: media;
  width: 84px;
  height: 84px;
  border-radius: 17px;
  object-fit: cover;
  background: var(--paper);
}

body[data-store-kind="cart"] .sp-cart-copy {
  grid-area: copy;
  min-width: 0;
}

body[data-store-kind="cart"] .sp-cart-copy > b {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.35;
}

body[data-store-kind="cart"] .sp-cart-copy small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

body[data-store-kind="cart"] .sp-qty {
  grid-area: quantity;
  display: grid;
  grid-template-columns: 44px minmax(30px, auto) 44px;
  align-items: center;
  gap: 7px;
  width: max-content;
  min-width: 0;
  flex-wrap: nowrap;
}

body[data-store-kind="cart"] .sp-qty button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

body[data-store-kind="cart"] .sp-qty button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
}

body[data-store-kind="cart"] .sp-qty button:active {
  transform: scale(.96);
}

body[data-store-kind="cart"] .sp-qty button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 36%, transparent);
  outline-offset: 2px;
}

body[data-store-kind="cart"] .sp-qty > b {
  min-width: 30px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

body[data-store-kind="cart"] .sp-cart-line-total {
  grid-area: price;
  justify-self: end;
  white-space: nowrap;
  font-size: clamp(14px, 1.5vw, 17px);
  font-variant-numeric: tabular-nums;
}

body[data-store-kind="cart"] .sp-cart-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin: 0;
  padding: clamp(20px, 2.5vw, 30px) clamp(16px, 2vw, 22px) clamp(14px, 2vw, 20px);
  color: inherit;
  font-size: clamp(18px, 2.2vw, 24px);
}

body[data-store-kind="cart"] .sp-cart-total b {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

body[data-store-kind="cart"] .sp-cart-hold {
  margin: 0 clamp(16px, 2vw, 22px) clamp(10px, 2vw, 18px);
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: 13px;
  color: inherit;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 12px;
  line-height: 1.5;
}

body[data-store-kind="cart"] .sp-cart-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

body[data-store-kind="cart"] .sp-cart-actions .sp-btn {
  min-width: 188px;
  min-height: 48px;
}

body.alki-master-surface[data-store-kind="cart"] .sp-cart-page {
  color: #f7f7fb;
  border-color: var(--alki-master-line);
  background: linear-gradient(155deg, rgba(20, 23, 33, .96), rgba(10, 12, 19, .96));
  box-shadow: 0 24px 72px rgba(0, 0, 0, .24);
}

body.alki-master-surface[data-store-kind="cart"] .sp-cart-row {
  border-color: var(--alki-master-line-soft);
}

body.alki-master-surface[data-store-kind="cart"] .sp-cart-media {
  background: rgba(255, 255, 255, .06);
}

body.alki-master-surface[data-store-kind="cart"] .sp-cart-copy small {
  color: #aeb4c2;
}

body.alki-master-surface[data-store-kind="cart"] .sp-qty button {
  color: #f7f7fb;
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .055);
}

body.alki-master-surface[data-store-kind="cart"] .sp-qty button:hover {
  border-color: color-mix(in srgb, var(--accent) 72%, #fff);
  background: color-mix(in srgb, var(--accent) 20%, rgba(255, 255, 255, .06));
}

@media (max-width: 680px) {
  body[data-store-kind="cart"] .sp-page {
    width: calc(100% - 16px);
    padding-block: 28px 72px;
  }

  body[data-store-kind="cart"] .sp-page-head {
    padding-inline: 8px;
    margin-bottom: 18px;
  }

  body[data-store-kind="cart"] .sp-page-head h1 {
    font-size: clamp(42px, 14vw, 58px);
  }

  body[data-store-kind="cart"] .sp-cart-page {
    padding: 7px;
    border-radius: 20px;
  }

  body[data-store-kind="cart"] .sp-cart-row {
    grid-template-columns: 72px minmax(0, 1fr) max-content;
    grid-template-areas:
      "media copy copy"
      "quantity quantity price";
    gap: 13px 12px;
    padding: 14px 12px;
  }

  body[data-store-kind="cart"] .sp-cart-media {
    width: 72px;
    height: 72px;
    border-radius: 14px;
  }

  body[data-store-kind="cart"] .sp-cart-copy > b {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow-wrap: anywhere;
  }

  body[data-store-kind="cart"] .sp-cart-line-total {
    align-self: center;
    font-size: 14px;
  }

  body[data-store-kind="cart"] .sp-cart-total {
    padding: 18px 12px 12px;
  }

  body[data-store-kind="cart"] .sp-cart-hold {
    margin-inline: 12px;
  }

  body[data-store-kind="cart"] .sp-cart-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  body[data-store-kind="cart"] .sp-cart-actions .sp-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-store-kind="cart"] .sp-qty button {
    transition: none;
  }
}
