/* ==========================================================================
   6ixmerchandise — cart drawer (§2.4).
   Right-side dialog: 95vw / max 500px / 100dvh, 0.2s open,
   shadow 0 4px 20px rgb(0 0 0 / .15). Full-screen at <=749px.
   ========================================================================== */

.s6m-cart {
  border: 0;
  padding: 0;
  margin: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: visible;
  inset: 0;
  color: var(--6m-ink);
}

.s6m-cart::backdrop {
  background: rgb(0 0 0 / 0.5);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.s6m-cart[open]::backdrop { opacity: 1; }

.s6m-cart__panel {
  position: absolute;
  inset-block: 0;
  right: 0;
  width: 95vw;
  max-width: 500px;
  height: 100dvh;
  background: #fff;
  box-shadow: 0 4px 20px rgb(0 0 0 / 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease-in-out;
}

.s6m-cart[open] .s6m-cart__panel { transform: translateX(0); }

/* The slide-out. `open` stays on the element until the dialog actually leaves
   the top layer (see close() in cart-drawer.js), so the exit transform has to
   come from this class rather than from the absence of [open]. */
.s6m-cart[open].is-closing .s6m-cart__panel { transform: translateX(100%); }
.s6m-cart[open].is-closing::backdrop { opacity: 0; }

/* Full-screen on phones. */
@media (max-width: 749px) {
  .s6m-cart__panel {
    inline-size: 100vw;
    max-width: none;
    block-size: 100dvh;
    border: 0;
    border-radius: 0;
  }
}

/* Head ---------------------------------------------------------------------- */

.s6m-cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 25px;
  border-bottom: 1px solid var(--6m-line);
  flex: 0 0 auto;
}

.s6m-cart__title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--6m-sans);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.s6m-cart__count {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--6m-ink);
  color: #fff;
  font-family: var(--6m-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* Body ---------------------------------------------------------------------- */

.s6m-cart__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.s6m-cart__items {
  list-style: none;
  margin: 0;
  padding: 10px 25px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.s6m-cart__item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--6m-line-2);
}

.s6m-cart__media img {
  display: block;
  width: 80px;
  height: 100px;
  object-fit: cover;
  background: var(--6m-bg-2);
}

.s6m-cart__name {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.s6m-cart__name a { text-decoration: none; }

.s6m-cart__variant {
  font-family: var(--6m-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--6m-muted);
  margin-bottom: 10px;
}

.s6m-cart__variant p { margin: 0; }

.s6m-cart__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--6m-line);
}

.s6m-cart__step {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--6m-ink);
  padding: 0;
}

.s6m-cart__qty-input {
  width: 40px;
  height: 32px;
  border: 0;
  text-align: center;
  font-family: var(--6m-mono);
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  color: var(--6m-ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

.s6m-cart__qty-input::-webkit-outer-spin-button,
.s6m-cart__qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.s6m-cart__remove {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--6m-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--6m-muted);
  text-decoration: none;
}

.s6m-cart__remove:hover { color: var(--6m-signal); }

.s6m-cart__price {
  font-family: var(--6m-mono);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

/* Summary ------------------------------------------------------------------- */

.s6m-cart__summary {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--6m-line);
  padding: 18px 25px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.s6m-cart__ship {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  background: var(--6m-bg-2);
  font-size: 12px;
  line-height: 1.4;
}

.s6m-cart__ship svg { flex: 0 0 auto; }

/*
 * Subtotal + every discount, above the estimated total (REVIEW_2 H-2). The
 * block only renders when there is at least one discount, so a plain cart
 * still shows a single figure and nothing else.
 */
.s6m-cart__lines {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--6m-line);
}

.s6m-cart__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--6m-muted);
}

.s6m-cart__line-value { font-family: var(--6m-mono); }

.s6m-cart__line--discount { color: var(--6m-signal); }

.s6m-cart__totals {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.s6m-cart__total-value { font-family: var(--6m-mono); font-weight: 700; font-size: 16px; }

.s6m-cart__tax {
  margin: 0;
  font-size: 11px;
  color: var(--6m-muted);
}

.s6m-cart__checkout { justify-content: space-between; }
.s6m-cart__checkout-total { font-family: var(--6m-mono); }

/* Empty state ---------------------------------------------------------------- */

.s6m-cart__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 25px;
  text-align: center;
}

.s6m-cart__empty-title {
  margin: 0;
  font-family: var(--6m-display);
  font-size: 28px;
  text-transform: uppercase;
}

.s6m-cart__empty .s6m-btn { max-width: 280px; }

.s6m-cart__empty-note { margin: 0; font-size: 12px; color: var(--6m-muted); }

/* Busy state while a fragment refresh is in flight. */
.s6m-cart.is-busy .s6m-cart__body { opacity: 0.55; pointer-events: none; }

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