/* ==========================================================================
   YOPPY v7 cart.css — cart button + drawer chrome for style.css pages
   (product.html). This is a MIRROR of the cart block in assets/css/b2c.css:
   index.html / our-story.html keep using b2c.css and must NOT load this file
   (duplicate selectors would double-apply). If the drawer design changes,
   update both files.
   Token bridging: style.css lacks --green / --cream-soft / --ink-500 etc.,
   so every var() here carries a literal fallback matching the b2c values.
   ========================================================================== */

/* ----- Header cart button + live badge ---------------------------------- */
.cart-btn {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(26, 26, 26, 0.12));
  background: var(--white, #ffffff);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink, #1A1A1A);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cart-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm, 0 2px 8px rgba(26, 26, 26, 0.08)); }
.cart-btn svg { width: 22px; height: 22px; }
.cart-count {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red, #EA1F25);
  color: var(--white, #ffffff);
  font-size: 0.72rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cart-count.is-empty { transform: scale(0); }
.cart-count.bump { animation: cart-bump 0.4s ease; }
@keyframes cart-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ----- Drawer ------------------------------------------------------------ */
.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 26, 26, 0.5);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 200;
}
body.cart-open .cart-overlay { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--cream, #FBF4E4);
  z-index: 210;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg, 0 26px 60px rgba(26, 26, 26, 0.18));
  will-change: transform;
}
body.cart-open .cart-drawer { transform: translateX(0); }

.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line, rgba(26, 26, 26, 0.12));
}
.cart-header h2 {
  font-family: var(--font-display, "Anton", sans-serif);
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 0.98;
  text-transform: uppercase;
  margin: 0;
}
.cart-close {
  width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--line, rgba(26, 26, 26, 0.12));
  background: var(--white, #ffffff);
  font-size: 1.2rem; line-height: 1;
  cursor: pointer;
  transition: transform 0.18s ease;
}
.cart-close:hover { transform: rotate(90deg); }

.cart-body { flex: 1; overflow-y: auto; padding: 1rem 1.4rem; overscroll-behavior: contain; }
.cart-empty { color: rgba(26, 26, 26, 0.62); text-align: center; padding: 3rem 1rem; }

.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.9rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line, rgba(26, 26, 26, 0.12));
}
.cart-line-thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--white, #ffffff); }
.cart-line-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-line-name { font-weight: 800; display: block; }
.cart-line-meta { font-size: 0.8rem; color: rgba(26, 26, 26, 0.62); }
.cart-line-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
.cart-line-total { font-weight: 800; }
.cart-line-remove {
  background: none; border: none; color: var(--red, #EA1F25); font-size: 0.78rem; font-weight: 700;
  min-height: 44px; padding: 0 0.4rem; display: inline-flex; align-items: center; cursor: pointer;
}

.qty-stepper {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line, rgba(26, 26, 26, 0.12)); border-radius: 999px;
  background: var(--white, #ffffff); margin-top: 0.4rem;
}
.qty-step {
  width: 44px; height: 44px; border: none; background: transparent;
  font-size: 1.15rem; line-height: 1; color: var(--ink, #1A1A1A);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.qty-input {
  width: 40px; height: 44px; text-align: center; border: none; background: transparent;
  font-weight: 800; font-family: inherit; color: var(--ink, #1A1A1A);
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cart-foot { padding: 1.1rem 1.4rem 1.4rem; border-top: 1px solid var(--line, rgba(26, 26, 26, 0.12)); background: var(--paper, #fdf9ef); }
.cart-row { display: flex; justify-content: space-between; font-size: 0.95rem; padding: 0.25rem 0; }
.cart-total { font-weight: 800; font-size: 1.15rem; border-top: 1px dashed var(--line, rgba(26, 26, 26, 0.12)); margin-top: 0.4rem; padding-top: 0.6rem; }
.cart-ship-free { color: #0D6334; font-weight: 800; }
.cart-hint { font-size: 0.82rem; color: rgba(26, 26, 26, 0.7); margin: 0.5rem 0 0; }
.cart-hint.free { color: #0D6334; font-weight: 700; }
.cart-secure { font-size: 0.76rem; color: rgba(26, 26, 26, 0.62); text-align: center; margin: 0.7rem 0 0; }
.cart-note { font-size: 0.85rem; text-align: center; margin: 0.5rem 0 0; min-height: 1em; }

/* cart.js renders its checkout CTA with .btn .btn-primary .btn-block;
   style.css has .btn/.btn-primary but no .btn-block. */
.btn-block { width: 100%; white-space: normal; }
.cart-foot .btn-block { margin-top: 0.7rem; }

/* ----- Behavior guards (mirrors b2c.css mobile hardening) ---------------- */
body.cart-open { position: fixed; width: 100%; overflow: hidden; }
@media (hover: none) {
  .cart-btn:hover, .cart-close:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cart-drawer, .cart-overlay { transition-duration: 0.001ms; }
  .cart-count.bump { animation: none; }
}
