/* ================================================================
   CART — fixed nav icon (every page), slide-in drawer, buy-button group
   on ProductCard. Loaded alongside style.css; reuses its tokens
   (--brand-red / --paper / --cream / --ink) rather than redefining them.
   ================================================================ */

/* ---------- fixed cart icon, promoted from the old scroll-away hero one ---------- */
/* Any element with [data-cart-toggle] becomes the fixed, persistent cart
   trigger — cart.js finds every one of these on the page (a page can only
   sensibly have one, but this supports the icon existing inside different
   nav markup per page/breakpoint). */
/* Unscoped (not ".sm-hero"-only) so this box has a real size on every
   page, not just the homepage hero — a page without ".sm-hero" as an
   ancestor previously had no width/height/aspect-ratio for this at all,
   which is why the hanger rendered at 0x0 (invisible) on Shop Now. */
[data-cart-toggle] {
  position: fixed;
  top: 20px;
  right: 20px;
  /* Above .draggable-ephemera.is-dragging's z-index:50 (style.css) — a
     dragged charm can be moved anywhere on the page, but should never be
     able to visually cover the hanger/cart icon itself. */
  z-index: 55;
  width: 52px;
  aspect-ratio: 1;
  cursor: pointer;
}
.hero-nav-cart img.cart-ring { position: absolute; width: 164%; height: auto; left: -32%; top: -26%; max-width: none; }
.hero-nav-cart img.hanger { position: absolute; left: 15%; top: 6px; width: 73%; }
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.cart-badge.is-visible { display: flex; }

/* ---------- backdrop + drawer ---------- */
.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(26, 26, 26, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.cart-backdrop.is-open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 61;
  width: min(420px, 92vw);
  height: 100%;
  background: var(--paper);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
}
.cart-drawer.is-open { transform: translateX(0); }

.cart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(26, 26, 26, 0.08);
}
.cart-drawer-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.cart-drawer-close {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.cart-drawer-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 22px;
}
.cart-empty {
  color: #8a8a8a;
  font-size: 14px;
  text-align: center;
  margin-top: 60px;
}

.cart-line {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(26, 26, 26, 0.06);
}
.cart-line-photo { display: block; flex-shrink: 0; }
.cart-line img {
  width: 64px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--cream);
}
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-line-name:hover { text-decoration: underline; }
.cart-line-meta { font-size: 12px; color: #8a8a8a; margin: 0 0 6px; }
.cart-line-row { display: flex; align-items: center; justify-content: space-between; }
.cart-line-price { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.cart-line-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.cart-line-qty-fixed { font-size: 13px; color: #8a8a8a; }
.cart-line.is-soldout { opacity: 0.6; }
.cart-line.is-soldout img { filter: grayscale(1); }
.cart-line-soldout {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand-red);
}
.cart-qty-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(26, 26, 26, 0.2);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-line-remove {
  border: none;
  background: transparent;
  color: var(--brand-red);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.cart-drawer-foot {
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(26, 26, 26, 0.08);
}
.cart-subtotal-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.cart-buy-now-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 0;
  text-align: center;
  text-decoration: none;
  margin-bottom: 10px;
}
.cart-buy-now-btn:hover { filter: brightness(1.08); }
.cart-buy-now-btn.is-disabled {
  background: #cfcfcf;
  color: #8a8a8a;
  cursor: not-allowed;
  pointer-events: none;
}
.cart-checkout-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  background: #f0f0f0;
  color: #9a9a9a;
  font-weight: 700;
  font-size: 12.5px;
  padding: 11px 0;
  cursor: not-allowed;
  text-align: center;
}
.cart-checkout-note {
  text-align: center;
  font-size: 11.5px;
  color: #9a9a9a;
  margin: 8px 0 0;
}
.cart-manual-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--brand-red);
  text-decoration: none;
  font-weight: 600;
}
.cart-manual-link:hover { text-decoration: underline; }

/* ---------- three-way buy action group (on every ProductCard) ---------- */
.buy-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.buy-action {
  flex: 1;
  border: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 9px 6px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buy-action.cart-add   { background: var(--brand-red); color: #fff; }
.buy-action.buy-depop  { background: var(--ink); color: #fff; }
.buy-action.buy-ig     { background: transparent; color: var(--ink); border: 1px solid rgba(26,26,26,0.25); }
.buy-action.buy-ig:hover,
.buy-action.cart-add:hover,
.buy-action.buy-depop:hover { filter: brightness(1.08); }

.product-sold-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  z-index: 2;
}
.product-hold-badge { background: #c77d13; }

/* ---------- Buy Options popup (cart drawer's Checkout button) ---------- */
.buy-options-card {
  width: min(420px, 90vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 18px;
  padding: 26px 26px 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}
.buy-options-card h2 { margin: 0 0 6px; color: var(--brand-red); font-size: 20px; }
.buy-options-subtotal { margin: 0 0 20px; font-size: 13px; color: #8a8a8a; }
.buy-options-desc { margin: 0 0 16px; font-size: 13.5px; line-height: 1.5; color: #5a5a5a; }
.buy-options-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.buy-option-btn {
  border: 1px solid rgba(26, 26, 26, 0.15);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  padding: 13px 0;
  cursor: pointer;
  text-align: center;
}
.buy-option-btn:hover { filter: brightness(0.97); }
.buy-option-btn.buy-option-primary { background: var(--brand-red); border-color: var(--brand-red); color: #fff; }
.buy-option-btn.buy-option-primary:hover { filter: brightness(1.08); }
.buy-option-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.buy-options-back {
  display: inline-block;
  border: none;
  background: none;
  color: var(--brand-red);
  font-weight: 700;
  font-size: 13px;
  padding: 0;
  margin-bottom: 14px;
  cursor: pointer;
}
.how-to-buy-link {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-red);
  text-decoration: none;
}
.how-to-buy-link:hover { text-decoration: underline; }
.buy-options-depop-links { display: flex; flex-direction: column; gap: 8px; }
.buy-option-depop-link {
  display: block;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  padding: 11px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buy-option-depop-link:hover { filter: brightness(1.15); }
.buy-options-ig-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(26, 26, 26, 0.15);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
  margin-bottom: 14px;
  white-space: pre-wrap;
}
.buy-options-error { margin: 12px 0 0; font-size: 12px; color: var(--brand-red); text-align: center; }

@media (max-width: 640px) {
  .cart-drawer { width: 100vw; }
}
