/* ============ Cart drawer ============ */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  backdrop-filter: blur(4px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.cart-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 384px;
  background: var(--color-surface);
  z-index: 70;
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  visibility: hidden; /* keeps the closed drawer's shadow and focusable content out of the page */
  transition: transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
  display: flex;
  flex-direction: column;
}
.cart-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform var(--dur-base) var(--ease-out), visibility 0s;
}
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-100);
}
.cart-drawer-title h3 {
  font-size: var(--text-base);
  font-weight: var(--fw-heading);
  color: var(--gray-900);
}
.cart-drawer-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-50);
  color: var(--color-brand-text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.juno-cart-item-count {
  font-size: var(--text-xs);
  color: var(--gray-400);
}
.cart-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
}
.cart-drawer-close:hover {
  background: var(--gray-100);
}
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}
.cart-drawer-footer {
  border-top: 1px solid var(--gray-100);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cart-drawer-row span:first-child {
  color: var(--color-text-muted);
  font-size: var(--text-md);
}
.cart-drawer-row-sm span:last-child {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.cart-drawer-subtotal {
  font-family: var(--font-display);
  font-weight: var(--fw-figure);
  font-size: var(--text-xl);
  color: var(--gray-900);
}


/* Cart line items + empty state (rendered by juno_render_cart_items()) */
.juno-cart-items {
  flex: 1;
  min-height: 0; /* lets .cart-drawer-body scroll while the footer stays pinned */
  display: flex;
  flex-direction: column;
}
.drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: var(--space-10) 0;
}
.drawer-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: var(--primary-50);
  color: var(--primary-200);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.drawer-empty-icon .icon { width: 40px; height: 40px; }
.drawer-empty h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-heading);
  font-size: var(--text-base);
  color: var(--gray-900);
  margin: 0 0 var(--space-1);
}
.drawer-empty p {
  color: var(--gray-400);
  font-size: var(--text-md);
  margin: 0 0 var(--space-5);
}
.cart-items { display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  display: flex;
  gap: var(--space-3);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: background var(--dur-fast) var(--ease-out);
}
.cart-item:hover { background: var(--gray-100); }
.cart-item-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
  flex-shrink: 0;
}
.cart-item-body { flex: 1; min-width: 0; }
.cart-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}
.cart-item-head h4 {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--gray-900);
  margin: 0;
  /* Two lines, not one: a variation's name ends in its attribute ("… - Medium"), which a single-line ellipsis cuts off. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.cart-item-remove { color: var(--gray-400); flex-shrink: 0; transition: color var(--dur-fast) var(--ease-out); }
.cart-item-remove:hover { color: var(--danger-600); }
.cart-item-price {
  color: var(--primary-600);
  font-weight: var(--fw-figure);
  font-size: var(--text-md);
  margin: var(--space-0-5) 0 0;
}
.cart-item-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.cart-item-qty { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--color-text-muted); }
.cart-item-total { margin-left: auto; font-size: var(--text-md); font-weight: var(--fw-figure); color: var(--gray-900); }

/* Stop the page scrolling behind the open drawer. */
html.has-drawer-open {
  overflow: hidden;
}
.cart-item-meta {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: var(--space-0-5);
}
.cart-item-meta dl,
.cart-item-meta dd,
.cart-item-meta p {
  display: inline;
  margin: 0;
}
.cart-item-meta dt {
  display: inline;
  font-weight: var(--fw-semibold);
}
