/* Big Brave Life: the cart sheet (assets/cart.js). Full screen up to 640px, a 420px panel on
   the right above it. Tokens come from bbl.css (navy, ink, cream, theme-bg/soft/accent, shadows).
   Contrast: navy on white 11.58, muted-2 #4F5B64 on white > 6, teal-dark #1F5E56 on #E3F1EC 6.9. */

html.bbl-cart-lock, html.bbl-cart-lock body { overflow: hidden; }

.bbl-cart { position: fixed; inset: 0; z-index: 90; }
.bbl-cart[hidden] { display: none; }
.bbl-cart [hidden] { display: none !important; }

.bbl-cart-scrim {
  position: absolute; inset: 0; background: rgba(22, 59, 92, .36);
  opacity: 0; transition: opacity .32s ease;
}
.bbl-cart.is-open .bbl-cart-scrim { opacity: 1; }

.bbl-cart-panel {
  --cart-pad: 20px;
  position: absolute; inset: 0; display: flex; flex-direction: column;
  height: 100%; height: 100dvh;
  background: var(--bbl-white); color: var(--bbl-ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  transform: translateY(100%); transition: transform .38s cubic-bezier(.22, 1, .36, 1);
  will-change: transform; outline: none;
}
.bbl-cart.is-open .bbl-cart-panel { transform: none; }

@media (min-width: 641px) {
  .bbl-cart-panel {
    --cart-pad: 24px;
    inset: 12px 12px 12px auto; width: 420px; height: auto; max-height: none;
    border-radius: 28px; overflow: hidden;
    box-shadow: 0 2px 6px rgba(22, 59, 92, .08), 0 40px 80px -30px rgba(22, 59, 92, .45);
    transform: translateX(calc(100% + 24px));
  }
}

/* ---------------------------------------------------------------- header */
.bbl-cart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto;
  padding: max(12px, env(safe-area-inset-top)) calc(var(--cart-pad) - 8px) 12px var(--cart-pad);
  border-bottom: 1px solid var(--bbl-line, rgba(22, 59, 92, .14));
}
/* Two classes: beats the sales pages' large h2 rule. */
.bbl-cart .bbl-cart-title {
  display: inline-flex; align-items: center; gap: 10px; margin: 0; max-width: none;
  font-family: var(--font-display); font-size: 24px; line-height: 1.1; font-weight: 800; letter-spacing: -.015em; color: var(--bbl-navy);
  outline: none;
}
.bbl-cart-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 8px;
  border-radius: 999px; background: var(--bbl-navy); color: var(--bbl-white);
  font-family: var(--font-body); font-size: 13px; line-height: 1; font-weight: 800; letter-spacing: 0;
}
.bbl-cart-close {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: #F4EEE6; color: var(--bbl-navy); cursor: pointer; transition: background-color .18s ease;
}
.bbl-cart-close:hover { background: #ECE3D7; }
.bbl-cart-icon { display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bbl-cart :focus-visible { outline: 3px solid var(--bbl-navy); outline-offset: 3px; }
/* The panel and its heading take focus only as a starting point (open, after Add): no ring. */
.bbl-cart .bbl-cart-panel:focus, .bbl-cart .bbl-cart-title:focus { outline: none; }

/* ---------------------------------------------------------------- scrolling body */
.bbl-cart-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 16px var(--cart-pad) 24px;
}

/* Progress: gift, then shipping (only with a printed line). Text carries the meaning. */
.bbl-cart-progress {
  padding: 14px 16px 16px; border-radius: 20px; background: var(--theme-soft, #FCEEEB);
}
.bbl-cart-progress-msg { display: grid; gap: 6px; margin-bottom: 12px; }
.bbl-cart-goal {
  display: flex; align-items: flex-start; gap: 10px; margin: 0;
  font-size: 15px; line-height: 1.4; color: var(--bbl-ink);
}
.bbl-cart-goal > .bbl-cart-icon {
  width: 26px; height: 26px; padding: 4px; margin-top: -2px; border-radius: 50%;
  background: var(--bbl-white); color: var(--bbl-navy); box-shadow: 0 1px 2px rgba(22, 59, 92, .12);
}
.bbl-cart-goal.is-done > .bbl-cart-icon { background: var(--bbl-navy); color: var(--bbl-white); box-shadow: none; }
.bbl-cart-goal strong { color: var(--bbl-navy); font-weight: 800; }
.bbl-cart-goal .bbl-tbc { vertical-align: .05em; }

.bbl-cart-bar { display: flex; gap: 6px; align-items: center; }
.bbl-cart-seg { position: relative; flex: 1 1 0; height: 8px; border-radius: 999px; background: rgba(22, 59, 92, .1); margin-right: 12px; }
.bbl-cart-seg.is-ship { flex-grow: 2; }
.bbl-cart-seg-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--bbl-navy);
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
}
.bbl-cart-node {
  position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--bbl-white); color: var(--bbl-navy); box-shadow: 0 0 0 2px rgba(22, 59, 92, .14);
  transition: background-color .3s ease, color .3s ease, box-shadow .3s ease;
}
.bbl-cart-seg.is-done .bbl-cart-node { background: var(--bbl-navy); color: var(--bbl-white); box-shadow: 0 0 0 3px var(--theme-soft, #FCEEEB); }

/* ---------------------------------------------------------------- lines */
.bbl-cart-lines { list-style: none; margin: 8px 0 0; padding: 0; }
.bbl-cart-line {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 16px 0; border-bottom: 1px solid var(--bbl-line, rgba(22, 59, 92, .14));
}
.bbl-cart-line:last-child { border-bottom: 0; }

/* Colour tile: a printed page on the line's theme colour. */
.bbl-cart-tile {
  position: relative; display: block; width: 52px; height: 64px; border-radius: 12px; background: var(--theme-bg);
  overflow: hidden;
}
.bbl-cart-tile::before {
  content: ""; position: absolute; left: 13px; top: 12px; width: 26px; height: 36px; border-radius: 3px;
  background: var(--bbl-white) linear-gradient(rgba(22, 59, 92, .22), rgba(22, 59, 92, .22)) 5px 9px / 12px 2px no-repeat;
  box-shadow: 0 6px 12px -6px rgba(22, 59, 92, .45); transform: rotate(-5deg);
}
.bbl-cart-tile::after {
  content: ""; position: absolute; left: 18px; top: 26px; width: 16px; height: 12px; transform: rotate(-5deg);
  background: repeating-linear-gradient(rgba(22, 59, 92, .14) 0 2px, transparent 2px 5px);
}
.bbl-cart-tile.is-print::before { border-radius: 2px 4px 4px 2px; box-shadow: inset 3px 0 0 var(--theme-accent), 0 6px 12px -6px rgba(22, 59, 92, .45); }
/* The unlocked gift: its cover, name, line and "Free". */
.bbl-cart-gift { display: flex; gap: 12px; align-items: center; margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bbl-white); }
.bbl-cart-gift img { flex: 0 0 auto; width: 48px; height: 62px; object-fit: cover; border-radius: 4px; box-shadow: 0 6px 12px -6px rgba(22, 59, 92, .45); }
.bbl-cart-gift-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 13.5px; line-height: 1.35; color: var(--bbl-ink); }
.bbl-cart-gift-text strong { font-size: 14.5px; color: var(--bbl-navy); }
.bbl-cart-gift-free { font-weight: 800; color: var(--bbl-teal); }
/* With the product photo: the render fills the tile, no drawn page. */
.bbl-cart-tile.has-img { width: 64px; height: 64px; }
.bbl-cart-tile.has-img::before, .bbl-cart-tile.has-img::after { content: none; }
.bbl-cart-tile.has-img img { display: block; width: 100%; height: 100%; object-fit: cover; }

.bbl-cart-line-main { min-width: 0; }
.bbl-cart-line-title {
  margin: 0 0 6px; font-size: 16px; line-height: 1.3; font-weight: 800; color: var(--bbl-navy);
  overflow-wrap: anywhere;
}
.bbl-cart-line-title .bbl-tbc { margin: 2px 0 0; }
.bbl-cart-line-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font-size: 13px; line-height: 1.3; color: var(--bbl-muted-2, #4F5B64); }
.bbl-cart-age {
  display: inline-flex; align-items: center; min-height: 22px; padding: 2px 9px; border-radius: 999px;
  background: #F4EEE6; color: var(--bbl-navy); font-weight: 800; font-size: 12px; letter-spacing: .03em;
}
.bbl-cart-pair {
  display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 3px 10px; border-radius: 8px;
  background: #E3F1EC; color: #1F5E56; font-size: 13px; line-height: 1.35; font-weight: 800;
}
.bbl-cart-pair-amount { font-variant-numeric: tabular-nums; }

.bbl-cart-line-side { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.bbl-cart-line-price { margin: 0; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.bbl-cart-was { color: var(--bbl-muted-2, #4F5B64); font-size: 13px; text-decoration-thickness: 1.5px; }
.bbl-cart-now { color: var(--bbl-navy); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bbl-cart-remove {
  display: inline-flex; align-items: center; justify-content: flex-end; min-height: 44px; min-width: 44px; margin: 2px -4px -12px 0; padding: 0 4px;
  border: 0; background: none; color: var(--bbl-muted-2, #4F5B64); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.bbl-cart-remove:hover { color: var(--bbl-navy); }

/* Empty cart */
.bbl-cart-empty { padding: 36px 8px 8px; text-align: center; }
.bbl-cart-empty-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 22px; line-height: 1.2; font-weight: 800; color: var(--bbl-navy); }
.bbl-cart-empty-sub { margin: 0 auto; max-width: 30ch; color: var(--bbl-muted-2, #4F5B64); font-size: 15px; }

/* ---------------------------------------------------------------- one suggestion */
.bbl-cart-suggest { margin-top: 8px; padding: 14px 14px 14px 16px; border-radius: 20px; background: var(--bbl-cream); border: 1px solid #F0E6D8; }
.bbl-cart-suggest-eyebrow {
  margin: 0 0 10px; font-size: 12px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--bbl-navy);
}
.bbl-cart-suggest-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.bbl-cart-suggest-row > .bbl-cart-tile { align-self: start; }
.bbl-cart-suggest-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 8px 0 0; line-height: 1.2; }
.bbl-cart-suggest-price .bbl-cart-now { font-size: 16px; }
.bbl-cart-suggest-note { font-size: 13px; color: #1F5E56; font-weight: 700; }
.bbl-cart-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px 0 12px;
  border: 0; border-radius: 999px; background: var(--bbl-navy); color: var(--bbl-white); cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 800; transition: background-color .18s ease, transform .18s ease;
}
.bbl-cart-add:hover { background: #0F2D47; transform: translateY(-1px); }
.bbl-cart-add .bbl-cart-icon { stroke-width: 2.5; }

/* ---------------------------------------------------------------- sticky footer (thumb zone) */
.bbl-cart-foot {
  flex: 0 0 auto; display: grid; gap: 6px;
  padding: 10px var(--cart-pad) env(safe-area-inset-bottom);
  background: var(--bbl-white); box-shadow: 0 -1px 0 var(--bbl-line, rgba(22, 59, 92, .14)), 0 -12px 24px -18px rgba(22, 59, 92, .35);
}
.bbl-cart.is-empty .bbl-cart-foot { box-shadow: none; padding-top: 4px; }
.bbl-cart-totals { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; }
.bbl-cart-total-label { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0; font-size: 15px; font-weight: 700; color: var(--bbl-ink); }
.bbl-cart-save {
  display: inline-flex; align-items: center; min-height: 22px; padding: 2px 9px; border-radius: 999px;
  background: #E3F1EC; color: #1F5E56; font-size: 12.5px; font-weight: 800;
}
.bbl-cart-ship { font-size: 13px; font-weight: 600; color: var(--bbl-muted, #667178); }
.bbl-cart-total { margin: 0; font-family: var(--font-display); font-size: 22px; line-height: 1; font-weight: 800; color: var(--bbl-navy); font-variant-numeric: tabular-nums; }
.bbl-cart .bbl-cart-checkout {
  display: flex; width: 100%; min-height: 52px; padding: 12px 20px; gap: 10px; font-size: 17px; line-height: 1.25;
}
.bbl-cart .bbl-cart-checkout.is-multi { position: relative; font-size: 16px; }
/* Review-only marker: pinned to the button edge so the button keeps one line. */
.bbl-cart .bbl-cart-checkout .bbl-tbc { position: absolute; bottom: -8px; right: 16px; margin: 0; font-size: 10px; line-height: 14px; }
.bbl-cart-dismiss {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; padding: 0 12px; margin: -4px 0 0;
  border: 0; background: none; cursor: pointer; color: var(--bbl-muted-2, #4F5B64);
  font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.bbl-cart-dismiss:hover { color: var(--bbl-navy); }

@media (min-width: 641px) {
  .bbl-cart-head { padding-top: 14px; padding-bottom: 14px; }
  .bbl-cart-foot { padding-bottom: 10px; }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bbl-cart-panel, .bbl-cart-scrim, .bbl-cart-seg-fill, .bbl-cart-node, .bbl-cart-add { transition: none; }
  .bbl-cart-panel { transform: none; }
}

/* A line priced with a discount code: the same row as the pair saving, in the code's colour. */
.bbl-cart-pair.is-code { color: var(--bbl-teal, #2B7A70); }
