.demo-cart-badge {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  min-width: 1.8rem;
  height: 1.8rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgb(var(--color-button, 62, 37, 200));
  color: rgb(var(--color-button-text, 255, 255, 255));
  font-size: 1.1rem;
  line-height: 1.8rem;
  text-align: center;
  display: none;
}

.header__icon--cart {
  position: relative;
}

.demo-cart {
  padding: 3rem 0;
}

.demo-cart-items {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.demo-cart-item {
  display: grid;
  grid-template-columns: 6rem 1fr auto auto auto;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 0.1rem solid rgba(var(--color-foreground, 0, 0, 0), 0.1);
}

.demo-cart-item__image,
.demo-cart-item__image--none {
  width: 6rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 0.4rem;
  background: rgba(var(--color-foreground, 0, 0, 0), 0.05);
}

.demo-cart-item__details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.demo-cart-item__title {
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}

.demo-cart-item__price {
  font-size: 1.3rem;
  opacity: 0.7;
}

.demo-cart-item__qty {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.demo-cart-item__qty-btn {
  width: 2.8rem;
  height: 2.8rem;
  border: 0.1rem solid rgba(var(--color-foreground, 0, 0, 0), 0.2);
  border-radius: 0.4rem;
  background: transparent;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.demo-cart-item__line-total {
  font-weight: 600;
  white-space: nowrap;
}

.demo-cart-item__remove {
  border: none;
  background: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
}

.demo-cart-item__remove:hover {
  opacity: 1;
}

.demo-cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 1.8rem;
  padding-top: 1.5rem;
  border-top: 0.1rem solid rgba(var(--color-foreground, 0, 0, 0), 0.15);
  margin-bottom: 1rem;
}

.demo-cart-disclaimer {
  font-size: 1.2rem;
  opacity: 0.6;
  margin-bottom: 1.5rem;
}

.demo-cart-checkout {
  /* .button already centers its label via display:inline-flex +
     justify-content:center -- this used to override that with
     display:inline-block (no text-align set), which left "Check out"
     sitting flush left in a min-width button instead of centered. */
  display: inline-flex;
}

@media screen and (max-width: 749px) {
  .demo-cart-item {
    grid-template-columns: 5rem 1fr;
    grid-template-areas: 'image details' 'image qty' 'image total';
    row-gap: 0.6rem;
  }
  /* Named grid-template-areas only take effect on children that are
     explicitly assigned to them -- without this, all five items just
     auto-place into the 2-column track in DOM order (image, details,
     qty, total, remove), which puts qty controls in column 1 under the
     image and lets them visually overlap the price/total in column 2. */
  .demo-cart-item .demo-cart-item__image,
  .demo-cart-item .demo-cart-item__image--none {
    grid-area: image;
  }
  .demo-cart-item .demo-cart-item__details {
    grid-area: details;
  }
  .demo-cart-item .demo-cart-item__qty {
    grid-area: qty;
  }
  .demo-cart-item .demo-cart-item__line-total {
    grid-area: total;
  }
  .demo-cart-item__remove {
    grid-column: 2;
    justify-self: end;
  }
}

/* Narrow layout for cart items rendered inside the slide-out cart drawer,
   which is only ~40rem wide regardless of viewport -- reuses the same
   mobile stacked layout as .demo-cart-item unconditionally. */
.demo-cart-item--drawer {
  grid-template-columns: 5rem 1fr;
  grid-template-areas: 'image details' 'image qty' 'image total';
  row-gap: 0.6rem;
  padding-bottom: 1.5rem;
}

.demo-cart-item--drawer .demo-cart-item__image,
.demo-cart-item--drawer .demo-cart-item__image--none {
  grid-area: image;
}

.demo-cart-item--drawer .demo-cart-item__details {
  grid-area: details;
}

.demo-cart-item--drawer .demo-cart-item__qty {
  grid-area: qty;
}

.demo-cart-item--drawer .demo-cart-item__line-total {
  grid-area: total;
}

.demo-cart-item--drawer .demo-cart-item__remove {
  grid-column: 2;
  justify-self: end;
}

.demo-cart-drawer-items {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 0;
}
