/* ==========================================================================
   cart drawer — mobile: a bottom sheet styled like an open shopping
   bag (a "handle" bar + bag icon in the header). desktop: a right-side
   panel, same content, different geometry.
   ========================================================================== */

.cart {
  position: fixed;
  inset: 0;
  z-index: 50;
  visibility: hidden;
  pointer-events: none;
}

.cart.is-open {
  visibility: visible;
  pointer-events: auto;
}

.cart__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 15, 0.5);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.cart.is-open .cart__backdrop {
  opacity: 1;
}

/* -- mobile: bottom sheet -- */

.cart__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--hero-bg, #eef2e9);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.4);
  padding: 0.6rem 1.25rem clamp(1.5rem, 6vh, 2.25rem);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-cinematic, cubic-bezier(0.16, 1, 0.3, 1));
}

.cart.is-open .cart__panel {
  transform: translateY(0);
}

.cart__handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(40, 104, 71, 0.25);
  margin: 0.6rem auto 0.9rem;
}

/* two arched straps poking above the sheet's top edge, like the handles
   of an actual paper shopping bag — mobile bottom-sheet only, hidden on
   the desktop side panel below */
.cart__bag-handles {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 42px;
  pointer-events: none;
}

.cart__bag-handle {
  position: absolute;
  inset: 0;
  border: 8px solid var(--hero-bg, #eef2e9);
  border-bottom: none;
  border-radius: 999px 999px 0 0;
  filter: drop-shadow(0 -3px 4px rgba(0, 0, 0, 0.18));
}

.cart__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.cart__title {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--hero-font);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--hero-ink);
}

.cart__bag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--hero-green);
  color: #fff;
  font-size: 0.95rem;
}

.cart__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(40, 104, 71, 0.2);
  background: transparent;
  color: var(--hero-green);
  cursor: pointer;
  transition: background 0.2s ease;
}

.cart__close:hover {
  background: rgba(40, 104, 71, 0.08);
}

.cart__items {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow-y: auto;
  padding-bottom: 0.5rem;
}

.cart__item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: #fff;
  border-radius: 16px;
  padding: 0.75rem;
  box-shadow: 0 12px 26px -20px rgba(32, 45, 41, 0.4);
}

.cart__item-media {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, #dfe6db, var(--hero-bg, #eef2e9));
}

.cart__item-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart__item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.cart__item-body h3 {
  margin: 0;
  font-family: var(--hero-font);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--hero-ink);
}

.cart__item-flavor {
  display: block;
  font-size: 0.76rem;
  color: var(--hero-body);
  margin-top: 0.1rem;
}

.cart__item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.55rem;
}

.cart__item-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid rgba(40, 104, 71, 0.2);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.cart__item-stepper button {
  border: 0;
  background: transparent;
  color: var(--hero-green);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

.cart__item-stepper span {
  min-width: 1ch;
  text-align: center;
  font-size: 0.85rem;
  color: var(--hero-ink);
}

.cart__item-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--hero-ink);
}

.cart__item-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: rgba(52, 66, 62, 0.45);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem;
  transition: color 0.2s ease;
}

.cart__item-remove:hover {
  color: #c0392b;
}

.cart__empty {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 2rem 0;
}

.cart__empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(40, 104, 71, 0.1);
  color: var(--hero-green);
  font-size: 1.4rem;
}

.cart__empty p {
  margin: 0;
  color: var(--hero-body);
  font-size: 0.95rem;
}

.cart__empty-cta {
  color: var(--hero-green);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.cart__footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(40, 104, 71, 0.14);
}

.cart__subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--hero-ink);
  margin-bottom: 0.85rem;
}

.cart__subtotal span:last-child {
  font-weight: 700;
  font-size: 1.1rem;
}

.cart__checkout {
  width: 100%;
  border: 0;
  background: var(--hero-green);
  color: #fff;
  font-family: var(--hero-font);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.9em;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.cart__checkout:hover {
  background: var(--hero-green-accent);
}

@media (prefers-reduced-motion: reduce) {
  .cart__backdrop,
  .cart__panel {
    transition: none;
  }
}

/* -- desktop: right-side panel instead of a bottom sheet -- */

@media (min-width: 1024px) {
  .cart__panel {
    left: auto;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 92vw);
    max-height: none;
    border-radius: 0;
    box-shadow: -20px 0 50px -20px rgba(0, 0, 0, 0.4);
    padding: 1.5rem 1.75rem 2rem;
    transform: translateX(100%);
  }

  .cart.is-open .cart__panel {
    transform: translateX(0);
  }

  .cart__handle,
  .cart__bag-handles {
    display: none;
  }
}
