/* Pink Peppers — one-page checkout (v2).
   Mobile: one scroll (bag → offers → contact → delivery → payment → bill) with a pay bar fixed to the bottom.
   Desktop ≥960px: details form on the left, bag + offers on the right, bill sticks while you fill the form.
   Uses the store tokens from global.css; fallbacks keep it standalone. */
.cx {
  --cx-pink: var(--pink, #bc7681);
  --cx-pink-dk: var(--pink-dk, #9c5a66);
  --cx-blush: var(--blush, #ffe7eb);
  --cx-blush-2: var(--blush-2, #fff4f6);
  --cx-ink: var(--ink, #141414);
  --cx-ink-2: var(--ink-2, #4a4642);
  --cx-muted: var(--muted, #7a736c);
  --cx-line: var(--line, #ece4dd);
  --cx-bg: var(--bg, #fbf7f3);
  --cx-card: #fff;
  --cx-good: #2f7a52;          /* savings / unlocked */
  --cx-good-bg: #eaf5ee;
  --cx-head: var(--font-head, "Fraunces", Georgia, serif);
  --cx-body: var(--font-body, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --cx-r: 14px;
  --cx-rs: 10px;
  font-family: var(--cx-body);
  color: var(--cx-ink);
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}
.cx *, .cx *::before, .cx *::after { box-sizing: border-box; }
.cx :where(button) { font: inherit; color: inherit; cursor: pointer; }
.cx :where(img) { display: block; max-width: 100%; }
.cx [hidden] { display: none !important; }
.cx :focus-visible { outline: 2px solid var(--cx-pink); outline-offset: 2px; }

.cx-wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Top line */
.cx-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 0 10px; flex-wrap: wrap; }
.cx-top h1 { font-family: var(--cx-head); font-weight: 400; font-size: clamp(28px, 4vw, 40px); margin: 0; line-height: 1.05; letter-spacing: -.01em; }
.cx-top .cx-sub { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--cx-muted); }
.cx-top .cx-sub span { display: inline-flex; align-items: center; gap: 6px; }
.cx-top svg { width: 15px; height: 15px; }

/* Grid */
.cx-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.cx-col { display: grid; gap: 14px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.cx-card { min-width: 0; }
@media (min-width: 960px) {
  .cx { padding-bottom: 56px; }
  .cx-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); grid-template-areas: "form order" "form bill"; grid-template-rows: auto 1fr; column-gap: 36px; row-gap: 14px; }
  .cx-order { grid-area: order; }
  .cx-form { grid-area: form; }
  .cx-billbox { grid-area: bill; position: sticky; top: 16px; }
}

.cx-card { background: var(--cx-card); border: 1px solid var(--cx-line); border-radius: var(--cx-r); padding: 16px; }
.cx-card > h2, .cx-card > header h2 { font-family: var(--cx-head); font-weight: 400; font-size: 21px; margin: 0; letter-spacing: -.005em; display: flex; align-items: center; gap: 10px; }
.cx-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cx-n { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--cx-ink); color: #fff; font: 600 12px/24px var(--cx-body); text-align: center; }
.cx-n.done { background: var(--cx-good); }
.cx-hint { font-size: 12.5px; color: var(--cx-muted); margin: 0; }

/* Savings banner */
.cx-save { background: var(--cx-good-bg); color: var(--cx-good); border-radius: var(--cx-rs); padding: 10px 14px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cx-save svg { width: 16px; height: 16px; flex: none; }

/* Offer ladder */
.cx-ladder { background: linear-gradient(180deg, var(--cx-blush-2), #fff 70%); border-color: #f3d9de; }
.cx-ladder h3 { font: 600 15.5px/1.35 var(--cx-body); margin: 0 0 2px; }
.cx-ladder h3 b { color: var(--cx-pink-dk); }
.cx-ladder p { margin: 0; font-size: 13px; color: var(--cx-ink-2); }
.cx-track { position: relative; margin: 26px 10px 4px; height: 6px; border-radius: 6px; background: #f1e3e5; }
.cx-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; background: var(--cx-pink); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.cx-stop { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #ead1d6; display: grid; place-items: center; font: 600 11px var(--cx-body); color: var(--cx-muted); transition: .3s; }
.cx-stop.on { background: var(--cx-pink); border-color: var(--cx-pink); color: #fff; }
.cx-stop span { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 600 11px var(--cx-body); color: var(--cx-ink-2); }
.cx-stop.first span { left: -4px; transform: none; }
.cx-stop.last span { left: auto; right: -4px; transform: none; }
.cx-stop svg { width: 12px; height: 12px; }

/* Bag lines */
.cx-lines { display: grid; gap: 14px; }
.cx-line { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.cx-line img, .cx-gift-ic { width: 68px; height: 68px; border-radius: var(--cx-rs); object-fit: cover; background: #f4ede6; }
.cx-line .t { font-size: 14px; font-weight: 500; margin: 0 0 2px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cx-line .v { font-size: 12.5px; color: var(--cx-muted); }
.cx-line .pr { text-align: right; font-size: 14px; font-weight: 600; white-space: nowrap; }
.cx-line .pr s { display: block; font-weight: 400; font-size: 12px; color: var(--cx-muted); }
.cx-line .ctl { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.cx-qty { display: inline-flex; align-items: center; border: 1px solid var(--cx-line); border-radius: 999px; height: 34px; }
.cx-qty button { width: 34px; height: 32px; border: 0; background: none; font-size: 17px; line-height: 1; border-radius: 999px; }
.cx-qty button:hover { background: var(--cx-blush-2); }
.cx-qty output { min-width: 18px; text-align: center; font-size: 14px; font-weight: 600; }
.cx-rm { border: 0; background: none; padding: 4px 0; font-size: 12.5px; color: var(--cx-muted); text-decoration: underline; text-underline-offset: 2px; }
.cx-gift-ic { display: grid; place-items: center; background: var(--cx-blush); color: var(--cx-pink-dk); }
.cx-gift-ic svg { width: 28px; height: 28px; }
.cx-line.gift .pr { color: var(--cx-good); }
.cx-line.locked { opacity: .9; }
.cx-line.locked .cx-gift-ic { background: #fff; border: 1.5px dashed #e3c4ca; }
.cx-line.locked .pr { color: var(--cx-muted); font-weight: 500; font-size: 12.5px; }

/* In-bag upgrade nudge (other colour of a piece already in the bag) */
.cx-nudge { margin-top: 14px; display: flex; align-items: center; gap: 12px; background: #fff8e9; border: 1px solid #f2e2bd; border-radius: var(--cx-rs); padding: 10px 12px; font-size: 13px; }
.cx-nudge img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.cx-nudge p { margin: 0; flex: 1; line-height: 1.35; }
.cx-nudge b { font-weight: 600; }

/* Small pill button */
.cx-add { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--cx-ink); background: #fff; border-radius: 999px; height: 32px; padding: 0 14px; font-size: 13px; font-weight: 600; transition: .15s; }
.cx-add:hover { background: var(--cx-ink); color: #fff; }
.cx-add.added { background: var(--cx-good); border-color: var(--cx-good); color: #fff; }

/* Add-on rail */
.cx-addons header p { margin: 2px 0 0; }
.cx-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(138px, 1fr); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: thin; }
@media (min-width: 960px) { .cx-rail { grid-auto-columns: calc((100% - 20px) / 3); } }
.cx-tile { scroll-snap-align: start; border: 1px solid var(--cx-line); border-radius: var(--cx-rs); overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.cx-tile img { aspect-ratio: 1; width: 100%; object-fit: cover; background: #f4ede6; }
.cx-tile .b { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cx-tile .t { font-size: 12.5px; line-height: 1.3; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.cx-tile .p { font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.cx-tile .p s { font-weight: 400; font-size: 11.5px; color: var(--cx-muted); }
.cx-tile .chip { font-size: 10.5px; font-weight: 600; color: var(--cx-good); background: var(--cx-good-bg); border-radius: 999px; padding: 2px 7px; align-self: flex-start; }
.cx-tile .cx-add { margin-top: auto; justify-content: center; width: 100%; }

/* Form */
.cx-form { display: grid; gap: 14px; min-width: 0; }
.cx-field { display: grid; gap: 5px; }
.cx-field label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cx-ink-2); }
.cx-field label small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--cx-muted); }
.cx-field input, .cx-field textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid #d9d0c8; border-radius: var(--cx-rs); background: #fff; color: var(--cx-ink); }
.cx-field textarea { resize: vertical; min-height: 76px; }
.cx-field input:focus, .cx-field textarea:focus { outline: 2px solid var(--cx-pink); outline-offset: 0; border-color: var(--cx-pink); }
.cx-field.bad input, .cx-field.bad textarea { border-color: #c0392b; background: #fff8f7; }
.cx-field .msg { font-size: 12.5px; color: var(--cx-muted); min-height: 0; }
.cx-field.bad .msg { color: #b0352a; }
.cx-field .ok { color: var(--cx-good); font-weight: 500; }
.cx-pre { display: flex; align-items: stretch; border: 1px solid #d9d0c8; border-radius: var(--cx-rs); background: #fff; overflow: hidden; }
.cx-pre span { display: grid; place-items: center; padding: 0 12px; background: #f7f2ed; color: var(--cx-ink-2); font-size: 15px; border-right: 1px solid #e6ddd5; }
.cx-pre input { border: 0; border-radius: 0; }
.cx-pre:focus-within { outline: 2px solid var(--cx-pink); border-color: var(--cx-pink); }
.cx-pre input:focus { outline: 0; }
.cx-field.bad .cx-pre { border-color: #c0392b; }
.cx-row2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.cx-fields { display: grid; gap: 12px; }
.cx-link { border: 0; background: none; padding: 0; font-size: 13.5px; color: var(--cx-pink-dk); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }

/* Returning shopper */
.cx-saved { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--cx-ink); border-radius: var(--cx-rs); padding: 12px 14px; }
.cx-saved svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--cx-pink-dk); }
.cx-saved div { flex: 1; font-size: 14px; line-height: 1.45; }
.cx-saved b { display: block; }
.cx-eta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--cx-ink-2); background: #f7f2ed; border-radius: var(--cx-rs); padding: 9px 12px; }
.cx-eta svg { width: 16px; height: 16px; flex: none; color: var(--cx-pink-dk); }

/* Payment options */
.cx-pays { display: grid; gap: 10px; }
.cx-pay { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: start; border: 1.5px solid var(--cx-line); border-radius: var(--cx-rs); padding: 14px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.cx-pay:has(input:checked) { border-color: var(--cx-ink); background: #fffdfb; }
.cx-pay input { appearance: none; width: 20px; height: 20px; margin: 1px 0 0; border: 1.5px solid #bdb3aa; border-radius: 50%; display: grid; place-items: center; }
.cx-pay input:checked { border-color: var(--cx-ink); }
.cx-pay input:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--cx-ink); }
.cx-pay input:disabled + div { opacity: .5; }
.cx-pay b { display: block; font-size: 15px; font-weight: 600; }
.cx-pay .d { font-size: 13px; color: var(--cx-muted); }
.cx-pay .tag { font-size: 12px; font-weight: 700; color: var(--cx-good); background: var(--cx-good-bg); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.cx-pay .tag.fee { color: var(--cx-ink-2); background: #f3eee9; font-weight: 600; }
.cx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cx-chips span { font-size: 11.5px; font-weight: 600; border: 1px solid var(--cx-line); border-radius: 6px; padding: 3px 7px; color: var(--cx-ink-2); background: #fff; }
.cx-switch { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--cx-good-bg); color: #1f5a3b; border-radius: var(--cx-rs); padding: 10px 12px; font-size: 13.5px; }
.cx-switch p { margin: 0; }

/* Bill */
.cx-bill { display: grid; gap: 8px; font-size: 14px; margin-top: 4px; }
.cx-bill .r { display: flex; justify-content: space-between; gap: 12px; }
.cx-bill .r span:first-child { color: var(--cx-ink-2); }
.cx-bill .r.neg span:last-child, .cx-bill .r.free span:last-child { color: var(--cx-good); font-weight: 500; }
.cx-bill .r.tot { border-top: 1px dashed var(--cx-line); padding-top: 12px; margin-top: 4px; font-size: 17px; font-weight: 700; }
.cx-bill .r.tot span:first-child { color: var(--cx-ink); }
.cx-bill .you { text-align: right; font-size: 13px; color: var(--cx-good); font-weight: 600; }
.cx-code { display: flex; gap: 8px; margin-top: 10px; }
.cx-code input { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 10px 14px; border: 1px solid #d9d0c8; border-radius: 999px; text-transform: uppercase; }
.cx-code button { border: 1px solid var(--cx-ink); background: #fff; border-radius: 999px; padding: 0 18px; font-weight: 600; font-size: 14px; }
.cx-codemsg { font-size: 12.5px; margin: 6px 0 0; color: var(--cx-pink-dk); }
.cx-codemsg.ok { color: var(--cx-good); }

.cx-paybtn { width: 100%; min-height: 54px; border: 0; border-radius: 999px; background: var(--cx-ink); color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .01em; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: background .15s, transform .1s; }
.cx-paybtn:hover { background: #000; }
.cx-paybtn:active { transform: scale(.99); }
.cx-paybtn[disabled] { opacity: .55; cursor: not-allowed; }
.cx-paybtn svg { width: 16px; height: 16px; }
.cx-desk-pay { margin-top: 14px; display: none; }
@media (min-width: 960px) { .cx-desk-pay { display: block; } }
.cx-legal { font-size: 12px; color: var(--cx-muted); margin: 10px 0 0; text-align: center; }
.cx-legal a { text-decoration: underline; }

.cx-trust { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cx-trust li { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--cx-ink-2); background: #fff; border: 1px solid var(--cx-line); border-radius: var(--cx-rs); padding: 10px; line-height: 1.3; }
.cx-trust svg { width: 18px; height: 18px; flex: none; color: var(--cx-pink-dk); }

.cx-err { display: none; background: #fdecea; color: #8c2a20; border-radius: var(--cx-rs); padding: 12px 14px; font-size: 14px; }
.cx-err.show { display: block; }

.cx-empty { text-align: center; padding: 18px 8px; font-size: 14px; color: var(--cx-ink-2); }
.cx-empty a { text-decoration: underline; font-weight: 600; }

/* Mobile pay bar */
.cx-bar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-top: 1px solid var(--cx-line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 14px; box-shadow: 0 -8px 24px rgba(20,20,20,.06); }
.cx-bar .amt { display: grid; line-height: 1.2; min-width: 0; }
.cx-bar .amt b { font-size: 18px; }
.cx-bar .amt button { border: 0; background: none; padding: 0; font-size: 12px; color: var(--cx-good); font-weight: 600; text-align: left; white-space: nowrap; }
.cx-bar .cx-paybtn { flex: 1; min-height: 50px; }
@media (min-width: 960px) { .cx-bar { display: none; } }

/* Toast */
.cx-toast { position: fixed; z-index: 60; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--cx-ink); color: #fff; border-radius: 999px; padding: 10px 18px; font-size: 13.5px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
.cx-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 960px) { .cx-toast { bottom: 28px; } }

.cx-pulse { animation: cxPulse .6s ease; }
@keyframes cxPulse { 0% { transform: scale(1); } 40% { transform: scale(1.015); box-shadow: 0 0 0 4px rgba(188,118,129,.18); } 100% { transform: scale(1); } }

@media (max-width: 380px) { .cx-row2 { grid-template-columns: 1fr; } .cx-trust { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .cx * { transition: none !important; animation: none !important; } }

/* Keep the store's Design A/B preview switch from covering the pay bar; checkout should have no distractions. */
body:has(.cx) .theme-sw { display: none !important; }
