/* Cart card action bar: keep edit and delete in normal flow at every width. */
body.cart-page .cart-card:not(.empty) {
  grid-template-areas:
    "select thumb copy"
    "actions actions actions" !important;
  grid-template-rows: auto auto !important;
  row-gap: 14px !important;
  padding-bottom: 16px !important;
}

body.cart-page .cart-card:not(.empty) > .cart-item-actions {
  grid-area: actions !important;
  position: static !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  min-width: 0 !important;
  gap: 12px !important;
  margin: 0 !important;
}

body.cart-page .cart-card .cart-item-actions > .text-button,
body.cart-page .cart-card .cart-item-actions > .cart-delete {
  position: relative !important;
  inset: auto !important;
  display: inline-flex !important;
  flex: 0 1 auto !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 72px !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 0 18px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.cart-page .cart-card .cart-item-actions > .text-button {
  border: 1px solid rgba(204, 176, 125, 0.52) !important;
  border-radius: 999px !important;
  background: rgba(255, 253, 251, 0.95) !important;
}

body.cart-page .cart-card .cart-item-actions > .cart-delete {
  border-color: rgba(154, 57, 60, 0.24) !important;
  background: #fffdf9 !important;
  color: #91383c !important;
  box-shadow: none !important;
}

@media (max-width: 430px) {
  body.cart-page .cart-card:not(.empty) {
    row-gap: 12px !important;
  }

  body.cart-page .cart-card .cart-item-actions > .text-button,
  body.cart-page .cart-card .cart-item-actions > .cart-delete {
    min-width: 68px !important;
    min-height: 42px !important;
    padding-inline: 15px !important;
  }
}

/* Cart selection: a clear 44px touch target with a branded checked state. */
body.cart-page .cart-card:not(.empty) {
  grid-template-columns: 44px minmax(82px, 150px) minmax(0, 1fr) !important;
  transition: border-color 160ms ease-out, background-color 160ms ease-out !important;
}

body.cart-page .cart-card.is-selected:not(.empty) {
  border-color: rgba(118, 84, 99, 0.48) !important;
  background: rgba(249, 244, 246, 0.7) !important;
}

body.cart-page .cart-select {
  display: grid !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  margin: 0 !important;
  place-items: center !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent;
}

body.cart-page .cart-select span {
  position: relative !important;
  display: grid !important;
  width: 24px !important;
  height: 24px !important;
  place-items: center !important;
  border: 2px solid rgba(118, 84, 99, 0.5) !important;
  border-radius: 999px !important;
  background: #fffdfb !important;
  box-shadow: none !important;
  transition: border-color 140ms ease-out, background-color 140ms ease-out !important;
}

body.cart-page .cart-select input:checked + span {
  border-color: #765463 !important;
  background: #fffdfb !important;
}

body.cart-page .cart-select input:checked + span::after {
  content: "" !important;
  display: block !important;
  width: 8px !important;
  height: 5px !important;
  margin: -2px 0 0 !important;
  border: 0 !important;
  border-left: 2px solid #765463 !important;
  border-bottom: 2px solid #765463 !important;
  transform: rotate(-45deg) !important;
}

body.cart-page .cart-select:focus-within {
  outline: none !important;
}

body.cart-page .cart-select input:focus-visible + span {
  border-color: #513844 !important;
  border-width: 3px !important;
}

@media (hover: hover) {
  body.cart-page .cart-select:hover span {
    border-color: #765463 !important;
  }
}

body.cart-page #checkoutButton:disabled {
  cursor: not-allowed !important;
  opacity: 0.48 !important;
  box-shadow: none !important;
}

@media (max-width: 680px) {
  body.cart-page .cart-card:not(.empty) {
    grid-template-columns: 44px 92px minmax(0, 1fr) !important;
    column-gap: 8px !important;
  }
}

@media (max-width: 430px) {
  body.cart-page .cart-card:not(.empty) {
    grid-template-columns: 44px 82px minmax(0, 1fr) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.cart-page .cart-card:not(.empty),
  body.cart-page .cart-select span {
    transition: none !important;
  }
}

/*
 * Bracelet preview geometry
 * Keep the generated square preview square. Earlier mobile grid overrides made
 * the column narrower than the image height, which squeezed the bracelet into
 * a portrait-shaped frame.
 */
body.cart-page .cart-card:not(.empty) {
  grid-template-columns: 44px 128px minmax(0, 1fr) !important;
}

body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
  box-sizing: border-box !important;
  width: 128px !important;
  min-width: 128px !important;
  max-width: none !important;
  height: 128px !important;
  min-height: 128px !important;
  max-height: 128px !important;
  aspect-ratio: 1 / 1 !important;
  align-self: center !important;
  justify-self: center !important;
  object-fit: contain !important;
  object-position: center !important;
}

body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb {
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb .cart-bracelet-canvas,
body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb .cart-bracelet-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

@media (max-width: 680px) {
  body.cart-page .cart-card:not(.empty) {
    grid-template-columns: 44px minmax(0, 1fr) 44px !important;
    grid-template-areas:
      "select thumb spacer"
      "copy copy copy"
      "actions actions actions" !important;
    column-gap: 8px !important;
    row-gap: 14px !important;
  }

  body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
  body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
  body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
    grid-area: thumb !important;
    width: 210px !important;
    min-width: 210px !important;
    height: 210px !important;
    min-height: 210px !important;
    max-height: 210px !important;
    align-self: center !important;
    justify-self: center !important;
  }

  body.cart-page .cart-card:not(.empty) > .cart-item-content {
    grid-area: copy !important;
    width: 100% !important;
  }
}

@media (max-width: 430px) {
  body.cart-page .cart-card:not(.empty) {
    grid-template-columns: 42px minmax(0, 1fr) 42px !important;
    column-gap: 8px !important;
  }

  body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
  body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
  body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
    width: 200px !important;
    min-width: 200px !important;
    height: 200px !important;
    min-height: 200px !important;
    max-height: 200px !important;
  }
}

@media (max-width: 360px) {
  body.cart-page .cart-card:not(.empty) {
    grid-template-columns: 40px minmax(0, 1fr) 40px !important;
  }

  body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
  body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
  body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
    width: 184px !important;
    min-width: 184px !important;
    height: 184px !important;
    min-height: 184px !important;
    max-height: 184px !important;
  }
}

/* Cart product card: preview on the left, materials and actions on the right. */
body.cart-page .cart-card:not(.empty) {
  position: relative !important;
  grid-template-columns: minmax(140px, 0.85fr) minmax(0, 1.15fr) !important;
  grid-template-areas:
    "thumb copy"
    "thumb actions" !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  align-items: start !important;
  column-gap: clamp(14px, 3vw, 24px) !important;
  row-gap: 12px !important;
}

body.cart-page .cart-card:not(.empty) > .cart-select {
  position: absolute !important;
  top: 14px !important;
  left: 14px !important;
  z-index: 2 !important;
}

body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
  grid-area: thumb !important;
  box-sizing: border-box !important;
  width: min(100%, 220px) !important;
  min-width: 0 !important;
  max-width: 220px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  align-self: center !important;
  justify-self: center !important;
}

body.cart-page .cart-card:not(.empty) > .cart-item-content {
  grid-area: copy !important;
  width: 100% !important;
  min-width: 0 !important;
  align-self: start !important;
}

body.cart-page .cart-card:not(.empty) > .cart-item-actions {
  grid-area: actions !important;
  align-self: end !important;
}

@media (max-width: 390px) {
  body.cart-page .cart-card:not(.empty) {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "thumb"
      "copy"
      "actions" !important;
    grid-template-rows: auto auto auto !important;
    row-gap: 12px !important;
  }

  body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
  body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
  body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
    width: min(100%, 184px) !important;
    max-width: 184px !important;
  }
}

@media (max-width: 330px) {
  body.cart-page .cart-card:not(.empty) > .cart-bracelet-thumb,
  body.cart-page .cart-card:not(.empty) > .cart-bracelet-image,
  body.cart-page .cart-card:not(.empty) > img.cart-bracelet-image {
    max-width: 164px !important;
  }
}

/* Order summary primary action. */
body.cart-page .checkout-card > .actions {
  display: flex !important;
  width: 100% !important;
  justify-content: center !important;
  padding-top: 8px !important;
}

body.cart-page #checkoutButton {
  display: inline-flex !important;
  width: min(100%, 240px) !important;
  min-width: 220px !important;
  min-height: 52px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  margin-inline: auto !important;
  padding: 0 24px !important;
  border-radius: 999px !important;
  background: #765463 !important;
  color: #fffdfb !important;
  font-size: 0.95rem !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  box-shadow: 0 10px 22px rgba(95, 64, 80, 0.2) !important;
  transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease !important;
}

body.cart-page #checkoutButton .checkout-button__icon {
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

@media (hover: hover) and (pointer: fine) {
  body.cart-page #checkoutButton:not(:disabled):hover {
    background: #5f4050 !important;
    box-shadow: 0 12px 26px rgba(95, 64, 80, 0.26) !important;
    transform: translateY(-1px) !important;
  }
}

body.cart-page #checkoutButton:not(:disabled):active {
  background: #5f4050 !important;
  box-shadow: 0 6px 14px rgba(95, 64, 80, 0.18) !important;
  transform: scale(0.98) !important;
}

body.cart-page #checkoutButton:focus-visible {
  outline: 3px solid rgba(118, 84, 99, 0.3) !important;
  outline-offset: 3px !important;
}

@media (max-width: 390px) {
  body.cart-page #checkoutButton {
    width: 100% !important;
    min-width: 0 !important;
  }
}
