/* ---------- Cart drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: var(--z-drawer); }
.drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 300ms var(--ease);
}
.drawer__panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(100vw, 440px);
  display: flex;
  flex-direction: column;
  background: var(--drawer-bg);
  color: var(--ink);
  transform: translateX(100%);
  transition: transform 300ms var(--ease);
}
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }

.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.drawer__title { font-size: var(--fs-xl); }
.drawer__title span { font-family: var(--font-body); font-size: var(--fs-sm); color: var(--ink-muted); }

.drawer__progress { padding: 0 var(--sp-5); }
.drawer__progress:not(:empty) { padding-block: var(--sp-4); border-bottom: 1px solid var(--line); }
.drawer__progress p { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.drawer__progress .icon { width: 18px; height: 18px; color: var(--accent); }
.bar { height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--lime); border-radius: inherit; transition: width 500ms var(--ease); }

.drawer__body { flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-5) var(--sp-5); overscroll-behavior: contain; }
.drawer__empty { display: grid; justify-items: center; gap: var(--sp-4); text-align: center; padding: var(--sp-8) 0 var(--sp-6); color: var(--ink-muted); }
.drawer__empty .icon { width: 40px; height: 40px; }

.cart-lines { display: grid; }
.cart-line {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: var(--sp-4);
  padding-block: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.cart-line__img { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--card-radius); background: var(--tile); }
.cart-line__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-line__name { font-weight: 700; font-size: var(--fs-sm); line-height: 1.3; display: block; }
.cart-line__meta { font-size: var(--fs-xs); color: var(--ink-muted); margin: 2px 0 var(--sp-2); text-transform: capitalize; }
.cart-line__end { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.cart-line__end .price { font-size: var(--fs-sm); }
.cart-line__remove { color: var(--ink-faint); padding: 6px; margin: -6px; }
.cart-line__remove:hover { color: var(--danger); }
.cart-line__remove .icon { width: 18px; height: 18px; }

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
}
.qty button { width: 34px; height: 34px; display: grid; place-items: center; }
.qty button[disabled] { opacity: 0.3; }
.qty .icon { width: 16px; height: 16px; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; font-size: var(--fs-sm); }

.upsell { margin-top: var(--sp-5); }
.upsell__title { font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: var(--sp-3); }
.upsell__list { display: grid; gap: var(--sp-3); }
.upsell__item { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--sp-3); align-items: center; }
.upsell__img { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--card-radius); background: var(--tile); }
.upsell__img img { width: 100%; height: 100%; object-fit: cover; }
.upsell__info { display: grid; font-size: var(--fs-sm); line-height: 1.3; }
.upsell__info a { font-weight: 600; }
.upsell__info .price { font-size: var(--fs-xs); color: var(--ink-muted); }

.drawer__foot {
  padding: var(--sp-4) var(--sp-5) calc(var(--sp-4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: grid;
  gap: var(--sp-2);
  background: var(--drawer-bg);
}
.drawer__foot:empty { display: none; }
.totals { margin: 0 0 var(--sp-2); display: grid; gap: 4px; font-size: var(--fs-sm); }
.totals div { display: flex; justify-content: space-between; }
.totals dt { color: var(--ink-muted); }
.totals dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals .free { color: var(--success); }
[data-theme="editorial"] .totals .free { color: var(--lime); }
.totals__grand { padding-top: var(--sp-2); border-top: 1px dashed var(--line); font-size: var(--fs-md); }
.totals__grand dt { color: var(--ink); font-weight: 700; }
.btn--checkout { --_bg: var(--lime); --_ink: var(--black); }
.drawer__trust { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--ink-muted); }
.drawer__trust .icon { width: 16px; height: 16px; }
