/* ============================================================
   SnackYak — shop UI (dual CTAs · header cart · cart drawer)
   Uses the brand tokens defined in site.css (:root).
   ============================================================ */

/* ---------- Per-card CTAs: Order now / Add to cart / Chat & order ---------- */
.card-cta { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.card-cta-row { display: flex; flex-wrap: wrap; gap: 8px; }   /* secondary pair... */
.card-cta-row > * { flex: 1 1 150px; min-width: 0; }          /* ...side-by-side when each half clears ~150px, else each wraps to its own full-width row so long labels never clip */
.btn-buy { width: 100%; }                        /* hero, full row */

/* shared look - selector list keeps specificity equal to each button's own
   colour rule below, so source order (not specificity) decides the borders. */
.btn-buy, .btn-add, .btn-order {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--label); font-weight: 500; font-size: 12.5px;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 12px 10px; min-height: 46px;
  border: 1.5px solid transparent; border-radius: var(--radius);
  transition: transform .15s var(--ease), background .2s, color .2s, border-color .2s, box-shadow .2s;
  cursor: pointer;
}
.card-cta span { white-space: nowrap; }
.card-cta svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* Hero: Order now - express, bypasses chat & basket, straight to checkout */
.btn-buy {
  background: var(--brown); color: var(--cream); border-color: var(--brown);
  box-shadow: 0 12px 24px -14px rgba(26,20,16,.85);
}
.btn-buy:hover { background: #2A2017; border-color: #2A2017; transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(26,20,16,.9); }
.btn-buy:active { transform: translateY(0) scale(.99); }

/* Primary: Add to cart (build a basket) */
.btn-add {
  background: var(--orange); color: var(--cream); border-color: var(--orange);
  box-shadow: 0 10px 22px -14px var(--orange);
}
.btn-add:hover { background: #A9501F; border-color: #A9501F; transform: translateY(-1px); }
.btn-add:active { transform: translateY(0) scale(.99); }

/* Secondary: Chat & order (express WhatsApp) */
.btn-order { background: transparent; color: var(--chilli); border-color: rgba(184,52,28,.42); }
.btn-order svg { fill: currentColor; }
.btn-order:hover {
  background: var(--chilli); color: #fff; border-color: var(--chilli);
  transform: translateY(-1px); box-shadow: 0 10px 22px -14px var(--chilli);
}
.btn-order:active { transform: translateY(0) scale(.99); }

/* ---------- Header cart button + count badge ---------- */
.cart-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: none; background: transparent; color: currentColor;
  border-radius: 50%; transition: background .2s, transform .15s;
}
.cart-btn:hover { background: rgba(26,20,16,.07); transform: translateY(-1px); }
.site-header:not(.solid) .cart-btn:hover { background: rgba(246,238,223,.14); }
.cart-btn svg { width: 22px; height: 22px; }
.cart-count {
  position: absolute; top: 1px; right: -1px; display: none;
  min-width: 18px; height: 18px; padding: 0 4px;
  align-items: center; justify-content: center;
  background: var(--chilli); color: var(--cream);
  font-family: var(--label); font-weight: 500; font-size: 10.5px; line-height: 1;
  border-radius: 100px; box-shadow: 0 0 0 2px var(--cream);
}
.site-header:not(.solid) .cart-count { box-shadow: 0 0 0 2px var(--brown); }
.cart-btn.has-items .cart-count { display: inline-flex; }

/* ---------- Overlay + drawer ---------- */
.cart-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,20,16,.46);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .35s var(--ease), visibility 0s linear .35s;
}
/* blur lives ONLY on the open state — a live backdrop-filter on a hidden
   full-screen layer re-blurs the whole viewport every scroll frame (jank). */
.cart-overlay.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  transition: opacity .35s var(--ease), visibility 0s;
}

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
  width: min(420px, 92vw); display: flex; flex-direction: column;
  background: var(--cream); color: var(--ink);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px -30px rgba(26,20,16,.6);
  transform: translateX(100%); visibility: hidden;
  transition: transform .4s var(--ease), visibility 0s linear .4s;
}
.cart-drawer.open { transform: translateX(0); visibility: visible; transition: transform .4s var(--ease), visibility 0s; }

.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.cart-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; }
.cart-close {
  width: 38px; height: 38px; border: 1px solid var(--line); background: transparent;
  border-radius: 50%; font-size: 14px; color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; transition: all .2s;
}
.cart-close:hover { border-color: var(--ink); color: var(--ink); }

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

/* line items */
.cart-item { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: none; }
.ci-thumb {
  width: 62px; height: 74px; flex: 0 0 auto; border-radius: var(--radius);
  overflow: hidden; background: var(--kraft); border: 1px solid var(--line);
}
.ci-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ci-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ci-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ci-top h3 { font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.15; }
.ci-remove {
  flex: 0 0 auto; background: none; border: none; color: var(--ink-soft);
  font-size: 13px; line-height: 1; padding: 2px 4px; transition: color .2s;
}
.ci-remove:hover { color: var(--chilli); }
.ci-unit { font-family: var(--label); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.ci-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 100px; background: var(--cream); }
.qty-btn {
  width: 30px; height: 30px; border: none; background: transparent; color: var(--ink);
  font-size: 17px; line-height: 1; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s;
}
.qty-btn:hover { background: var(--kraft); color: var(--chilli); }
.qty-n { min-width: 26px; text-align: center; font-family: var(--sans); font-weight: 700; font-size: 15px; }
.ci-line { font-family: var(--sans); font-weight: 700; font-size: 16px; }

/* footer / checkout */
.cart-foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 18px 24px 24px; background: var(--cream-2); }
.cart-subtotal { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.cart-subtotal span { font-family: var(--label); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.cart-subtotal strong { font-family: var(--sans); font-weight: 700; font-size: 24px; }
.btn-checkout {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--whatsapp); color: #fff;
  font-family: var(--label); font-weight: 500; font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  padding: 16px 20px; border: none; border-radius: var(--radius);
  box-shadow: 0 12px 26px -14px rgba(184,52,28,.9);
  transition: background .2s, transform .15s, box-shadow .2s;
}
.btn-checkout svg { width: 19px; height: 19px; fill: currentColor; }
.btn-checkout:hover { background: var(--whatsapp-d); transform: translateY(-1px); }
.btn-checkout:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.cart-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); text-align: center; }

/* empty state */
.cart-empty { text-align: center; padding: 54px 20px; color: var(--ink-soft); }
.cart-empty svg { width: 38px; height: 38px; opacity: .38; display: block; margin: 0 auto 14px; }
.cart-empty p { font-family: var(--serif); font-size: 20px; color: var(--ink); margin: 0 0 4px; }
.cart-empty span { font-size: 14px; }

/* scroll lock while drawer is open */
body.cart-open { overflow: hidden; }

/* ---------- Toast ---------- */
.sy-toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 250;
  transform: translate(-50%, 16px);
  background: var(--brown); color: var(--cream);
  font-family: var(--label); font-size: 13px; letter-spacing: .04em;
  padding: 13px 20px; border-radius: 100px; max-width: 90vw;
  box-shadow: 0 16px 34px -16px rgba(0,0,0,.6);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.sy-toast.in { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .cart-drawer { width: 100vw; }
  .btn-buy, .btn-add, .btn-order { font-size: 12px; padding: 12px 8px; }
  .cart-head h2 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .cart-overlay, .cart-drawer, .sy-toast,
  .btn-buy, .btn-add, .btn-order, .btn-checkout, .cart-btn, .qty-btn { transition: none; }
}

/* ---------- Spice-level label (collections cards) ---------- */
.product-card .heat .spice {
  margin-left: 7px;
  font-family: var(--label); font-weight: 500;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--orange); white-space: nowrap;
}
@media (max-width: 640px) {
  .product-card .heat .spice { font-size: 10.5px; letter-spacing: .06em; margin-left: 6px; }
}

/* ---------- Deep-link arrival from the homepage ---------- */
.product-card { scroll-margin-top: calc(var(--header-h) + 22px); }
.product-card .ph image-slot { scroll-margin-top: calc(var(--header-h) + 22px); }
.product-card.card-flash { animation: sy-card-flash 1.9s var(--ease); }
@keyframes sy-card-flash {
  0%   { box-shadow: 0 0 0 0 rgba(196,98,42,0);   border-color: var(--line); }
  12%  { box-shadow: 0 0 0 4px rgba(196,98,42,.55); border-color: var(--orange); }
  55%  { box-shadow: 0 0 0 4px rgba(196,98,42,.22); border-color: var(--orange); }
  100% { box-shadow: 0 0 0 0 rgba(196,98,42,0);   border-color: var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .product-card.card-flash { animation: none; border-color: var(--orange); }
}

/* ---------- Razorpay checkout button state ---------- */
.btn-checkout .icon-lock {
  width: 16px; height: 16px; flex-shrink: 0; opacity: .85;
}
.btn-checkout.loading {
  opacity: .7; cursor: wait;
}
.btn-checkout.loading .icon-lock { display: none; }

/* ---------- Payment success screen ---------- */
.pay-success {
  text-align: center;
  padding: 56px 28px 40px;
}
.pay-tick {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #e6f4ea;
  color: #2e7d32;
  font-size: 30px; line-height: 64px;
  margin: 0 auto 22px;
  font-weight: 700;
}
.pay-success h3 {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--ink);
  margin: 0 0 10px;
}
.pay-success p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.pay-ref {
  margin-top: 18px !important;
  font-family: var(--label);
  font-size: 11.5px !important;
  letter-spacing: .04em;
  color: var(--ink-faint, #bbb) !important;
  word-break: break-all;
}

/* ---------- Checkout customer details form ---------- */
.cart-form { display: grid; gap: 8px; margin-bottom: 14px; }
.cf-input {
  width: 100%; box-sizing: border-box;
  font-family: var(--sans); font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; transition: border-color .15s, box-shadow .15s;
}
.cf-input::placeholder { color: var(--ink-soft); opacity: .85; }
.cf-input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(196,98,42,.15); }
.cf-addr { resize: vertical; min-height: 54px; line-height: 1.45; }
.cf-input.cf-invalid { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,.14); }
.cf-error { margin: 2px 0 0; font-family: var(--label); font-size: 12.5px; color: #c0392b; letter-spacing: .02em; }
