/* ==========================================================================
   Suria Peptides — Cart Drawer & Shared Cart Components
   Built entirely from the site's existing design tokens (--near-black,
   --gold, --ivory, etc. — defined per-page in each page's own inline
   :root block). No new colors, no new fonts introduced here.
   ========================================================================== */

/* ---------- CART COUNT BADGE (on header cart icon) ---------- */

.cart-btn{
  position: relative;
}

.cart-count-badge{
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 100px;
  background: var(--gold);
  color: var(--near-black);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-family: 'Inter', sans-serif;
}

.cart-count-badge[hidden]{ display: none; }

/* ---------- BACKDROP ---------- */

.cart-drawer-backdrop{
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(10, 9, 8, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-drawer-backdrop.is-open{
  opacity: 1;
  pointer-events: auto;
}

/* ---------- DRAWER PANEL ---------- */

.cart-drawer{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  width: min(420px, 100vw);
  background: var(--near-black);
  border-left: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -30px 0 60px rgba(0,0,0,0.5);
}

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

@media (prefers-reduced-motion: reduce){
  .cart-drawer{ transition: none; }
  .cart-drawer-backdrop{ transition: none; }
}

.cart-drawer-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.cart-drawer-header h2{
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 21px;
  color: var(--ivory);
}

.cart-drawer-close{
  width: 36px;
  height: 36px;
  border-radius: 100px;
  border: 1px solid var(--hairline);
  background: none;
  color: var(--ivory-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.cart-drawer-close:hover{
  border-color: var(--gold);
  color: var(--gold-bright);
}

.cart-drawer-body{
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px;
}

.cart-empty{
  padding: 60px 0;
  text-align: center;
  color: var(--ivory-faint);
  font-size: 14px;
}

.cart-item{
  display: flex;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--hairline);
}

.cart-item-media{
  flex-shrink: 0;
  width: 72px;
  height: 108px;
  border-radius: 6px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cart-item-media img{
  max-width: 84%;
  max-height: 84%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cart-item-info{
  flex: 1;
  min-width: 0;
}

.cart-item-name{
  font-family: 'Fraunces', serif;
  font-size: 15.5px;
  font-weight: 400;
  color: var(--ivory);
  margin-bottom: 3px;
}

.cart-item-strength{
  font-size: 12px;
  color: var(--ivory-dim);
  margin-bottom: 6px;
}

.cart-item-price{
  font-size: 12px;
  color: var(--gold-bright);
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}

.cart-item-controls{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cart-qty-stepper{
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--hairline);
  border-radius: 3px;
}

.cart-qty-btn{
  width: 28px;
  height: 28px;
  background: none;
  color: var(--ivory-dim);
  font-size: 14px;
  transition: color 0.2s ease;
}

.cart-qty-btn:hover{ color: var(--gold-bright); }

.cart-qty-value{
  min-width: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--ivory);
}

.cart-item-remove{
  background: none;
  color: var(--ivory-faint);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.cart-item-remove:hover{ color: var(--gold-bright); }

.cart-drawer-footer{
  flex-shrink: 0;
  padding: 20px 24px 26px;
  border-top: 1px solid var(--hairline);
}

.cart-subtotal-row{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 15px;
  color: var(--ivory);
  margin-bottom: 6px;
}

.cart-subtotal-row span:last-child{
  color: var(--gold-bright);
  font-size: 13px;
}

.cart-subtotal-note{
  font-size: 11px;
  color: var(--ivory-faint);
  line-height: 1.5;
  margin-bottom: 18px;
}

.btn-checkout{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  background: linear-gradient(120deg, var(--gold-bright), var(--gold));
  color: var(--near-black);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  border-radius: 3px;
  transition: filter 0.25s ease;
}

.btn-checkout:hover{ filter: brightness(1.08); }

body.cart-open{
  overflow: hidden;
}

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