/* Curated Space cart — header cart button, slide-out panel and "Add to cart" buttons (see /cart.js) */

/* ---------- Header cart button (the only item on the right of the header) ---------- */
/* Same border, fill and hover as the nav pill, and the same height, so the two read as a pair */
.cart-toggle {
  position: relative; flex: 0 0 auto; width: 46px; height: 46px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(17,17,17,0.11); border-radius: 999px; background: rgba(255,255,255,0.7);
  box-shadow: 0 1px 2px rgba(17,17,17,0.03);
  color: var(--ink); cursor: pointer; transition: background .25s, color .25s, border-color .25s;
}
.cart-toggle:hover { background: rgba(17,17,17,0.05); border-color: rgba(17,17,17,0.16); color: var(--accent); }
.cart-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cart-toggle svg { width: 20px; height: 20px; display: block; }
.cart-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; border: 2px solid #fff; box-sizing: content-box;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px;
  text-align: center; font-variant-numeric: tabular-nums; pointer-events: none;
}
.cart-badge[hidden] { display: none; }
/* Quick scale "pop" when an item is added (cart.js adds .is-pop) */
.cart-badge.is-pop { animation: cs-badge-pop .32s cubic-bezier(.2,.7,.2,1); }
@keyframes cs-badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Mobile: a bare 40px icon, mirroring the hamburger on the left so the brand stays centred */
@media (max-width: 860px) {
  .cart-toggle { width: 40px; height: 40px; margin-right: -4px; border: none; background: none; box-shadow: none; }
  .cart-toggle:hover { background: none; }
  .cart-toggle svg { width: 22px; height: 22px; }
  .cart-badge { top: 1px; right: 0; min-width: 15px; height: 15px; line-height: 15px; padding: 0 4px; font-size: 9.5px; border-width: 1.5px; }
}

/* ---------- "Add to cart" buttons ---------- */
.cs-add-to-cart {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; font-family: inherit; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; transition: background .2s, color .2s, filter .25s, transform .25s;
}
.cs-add-to-cart:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* In the launch-price block on the (dark) product pages */
.cs-add-to-cart--hero {
  margin-top: clamp(20px, 2.6vw, 26px); min-width: 220px; padding: 14px 34px;
  border: none; background: var(--accent); color: #fff; font-size: 15px;
}
.cs-add-to-cart--hero:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cs-add-to-cart--hero:focus-visible { outline-color: #fff; }

/* On the Accessories cards */
.cs-add-to-cart--card {
  width: 100%; min-height: 42px; margin-top: 14px; padding: 10px 16px;
  border: 1px solid var(--ink); background: #fff; color: var(--ink); font-size: 14px;
}
.cs-add-to-cart--card:hover { background: var(--ink); color: #fff; }
@media (max-width: 767px) {
  .cs-add-to-cart--card { min-height: 40px; padding: 9px 10px; font-size: 13px; margin-top: 12px; }
}

/* "Added ✓" state (about 1.5s after a click). cart.js pins the button's width so the shorter label doesn't shift it. */
.cs-add-to-cart.is-added { white-space: nowrap; }

/* ---------- Toast: "Added to cart" (~3s) and "Cart cleared" with Undo (~5s) ---------- */
/* Fixed above the page and the cart panel, clear of the iPhone home bar. Hidden, it takes no taps (visibility: hidden). */
.cs-toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 220;
  width: calc(100% - 32px); max-width: 420px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px 14px 20px; border-radius: 12px;
  /* The faint border keeps the edge visible on the black product pages */
  background: #111; color: #fff; border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 12px 32px -8px rgba(17,17,17,0.35), 0 2px 6px rgba(17,17,17,0.12);
  opacity: 0; visibility: hidden; transform: translate(-50%, 12px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
.cs-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .25s ease, transform .25s ease; }
/* While the panel is open ("Cart cleared"), centre the toast over the panel so Undo sits with the empty cart */
html.cs-cart-open .cs-toast { left: calc(100% - min(220px, 50%)); max-width: 408px; }
.cs-toast-text { min-width: 0; }
.cs-toast-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
/* Long names are cut with an ellipsis */
.cs-toast-item { margin: 2px 0 0; font-size: 13px; line-height: 1.35; color: rgba(255,255,255,0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-toast-item[hidden], .cs-toast-action[hidden] { display: none; }
/* "View cart" or "Undo" */
.cs-toast-action {
  flex: 0 0 auto; min-height: 40px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  color: #fff; font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,0.4);
  transition: text-decoration-color .2s;
}
.cs-toast-action:hover { text-decoration-color: #fff; }
.cs-toast-action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

/* ---------- Panel ---------- */
html.cs-cart-open { overflow: hidden; scrollbar-gutter: stable; }

.cs-cart-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(17,17,17,0.4);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s;
}
.cs-cart {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
  width: min(440px, 100%); display: flex; flex-direction: column;
  background: #fff; color: var(--ink); outline: none;
  box-shadow: -24px 0 48px -24px rgba(17,17,17,0.3);
  transform: translateX(100%); visibility: hidden;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), visibility 0s linear .35s;
}
html.cs-cart-open .cs-cart-backdrop { opacity: 1; visibility: visible; transition: opacity .3s ease; }
html.cs-cart-open .cs-cart { transform: none; visibility: visible; transition: transform .35s cubic-bezier(.2,.7,.2,1); }

.cs-cart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 18px 24px; border-bottom: 1px solid rgba(17,17,17,0.08);
}
.cs-cart-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.cs-cart-close {
  width: 40px; height: 40px; padding: 0; border: none; border-radius: 999px; background: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer;
  transition: background .2s;
}
.cs-cart-close:hover { background: rgba(17,17,17,0.06); }
.cs-cart-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cs-cart-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px; }
.cs-cart-list { list-style: none; margin: 0; padding: 0; }
.cs-cart-list[hidden], .cs-cart-empty[hidden], .cs-cart-foot[hidden], .cs-cart-clear[hidden] { display: none; }

/* "Clear cart": a quiet text button, right-aligned above the first line (hidden when the cart is empty) */
.cs-cart-tools { display: flex; justify-content: flex-end; margin-top: 8px; margin-bottom: -10px; }
.cs-cart-clear {
  min-height: 32px; padding: 4px 0; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 14px; color: #666; transition: color .2s;
}
.cs-cart-clear:hover, .cs-cart-clear:focus-visible { color: var(--accent); }
.cs-cart-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* One line: image | details + controls | line total */
.cs-line {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 18px 0; border-bottom: 1px solid rgba(17,17,17,0.08);
}
.cs-line:last-child { border-bottom: none; }
.cs-line-media {
  width: 64px; height: 64px; border-radius: 12px; background: #f5f5f7; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.cs-line-media img { width: 100%; height: 100%; object-fit: contain; padding: 6px; mix-blend-mode: multiply; display: block; }
.cs-line-media .media-fallback { font-size: 9px; padding: 4px; border: none; background: transparent; }
.cs-line-info { min-width: 0; }
.cs-line-name { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.cs-line-meta { margin: 3px 0 0; font-size: 12px; line-height: 1.4; color: rgba(17,17,17,0.5); }
.cs-line-unit { margin: 6px 0 0; font-size: 13px; color: rgba(17,17,17,0.6); }
.cs-line-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.cs-line-total { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }

.cs-qty {
  display: inline-flex; align-items: center; height: 34px;
  border: 1px solid rgba(17,17,17,0.16); border-radius: 999px;
}
.cs-qty-btn {
  width: 32px; height: 32px; padding: 0; border: none; border-radius: 999px; background: none;
  font-size: 17px; line-height: 1; color: var(--ink); cursor: pointer;
}
.cs-qty-btn:hover:not(:disabled) { background: rgba(17,17,17,0.06); }
.cs-qty-btn:disabled { color: rgba(17,17,17,0.25); cursor: default; }
.cs-qty-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cs-qty-value { min-width: 24px; text-align: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.cs-line-remove {
  padding: 4px 0; border: none; background: none; font-size: 13px; color: rgba(17,17,17,0.55);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.cs-line-remove:hover { color: var(--accent); }
.cs-line-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.cs-cart-empty { padding: 56px 0; text-align: center; }
.cs-cart-empty-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.cs-cart-empty-text { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: rgba(17,17,17,0.55); }
.cs-cart-empty-text a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.cs-cart-empty-text a:hover { color: var(--accent); }

.cs-cart-foot {
  padding: 18px 24px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(17,17,17,0.08); background: #fff;
}
.cs-cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.cs-cart-note { margin: 6px 0 14px; font-size: 12.5px; font-weight: 300; line-height: 1.5; color: rgba(17,17,17,0.55); }
.cs-cart-order {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 12px 20px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  transition: filter .25s;
}
.cs-cart-order:hover { color: #fff; filter: brightness(1.08); }
.cs-cart-order:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cs-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 480px) {
  .cs-cart-head { padding: 14px 12px 14px 18px; }
  .cs-cart-body { padding: 0 18px; }
  .cs-cart-foot { padding-left: 18px; padding-right: 18px; }
  .cs-line { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; }
  .cs-line-media { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-cart, .cs-cart-backdrop, html.cs-cart-open .cs-cart, html.cs-cart-open .cs-cart-backdrop { transition: none; }
  .cs-add-to-cart, .cs-add-to-cart--hero:hover { transition: none; transform: none; }
  .cart-badge.is-pop { animation: none; }
  /* The toast just appears and disappears, no slide */
  .cs-toast, .cs-toast.is-visible { transition: none; transform: translate(-50%, 0); }
}
