/* ==========================================================================
   Basket badge, slide-out drawer and return banner.

   Shared by every page that sells something (the home page, the sponsorship
   hub and the four category pages) and
   deliberately written against the brand custom properties already declared in
   each page's :root, with literal fallbacks so a page that drops one still
   renders sensibly.
   ========================================================================== */

.add-to-cart-btn {
  font-family: var(--sans, system-ui, sans-serif);
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
}
.add-to-cart-btn[disabled] { opacity: 0.75; cursor: default; }

/* ---- Floating badge ---- */
.cart-badge {
  position: fixed;
  right: clamp(0.9rem, 3vw, 1.6rem);
  bottom: clamp(0.9rem, 3vw, 1.6rem);
  z-index: 900;
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: var(--forest-900, #14241a);
  color: var(--offwhite, #f3eee2);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 40px -18px rgba(11, 22, 15, 0.75);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1), background-color 0.25s;
}
.cart-badge.is-visible { display: inline-flex; }
.cart-badge:hover, .cart-badge:focus-visible { transform: translateY(-2px); }
.cart-badge svg { width: 19px; height: 19px; flex: none; color: var(--honey-300, #e0b358); }
.cart-badge-count {
  min-width: 1.45em;
  padding: 0.1em 0.35em;
  border-radius: 999px;
  background: var(--honey, #c0871f);
  color: #1f1606;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}
.cart-badge-total { color: rgba(243, 238, 226, 0.82); font-weight: 500; }
/* Every "Add to basket" click pulses the badge, so the feedback is visible
   even when the button that was clicked is nowhere near the badge. */
.cart-badge.is-bumped { animation: cart-bump 0.52s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes cart-bump {
  0%   { transform: scale(1);    box-shadow: 0 18px 40px -18px rgba(11, 22, 15, 0.75), 0 0 0 0 rgba(224, 179, 88, 0.5); }
  38%  { transform: scale(1.11); box-shadow: 0 18px 40px -18px rgba(11, 22, 15, 0.75), 0 0 0 12px rgba(224, 179, 88, 0); }
  100% { transform: scale(1);    box-shadow: 0 18px 40px -18px rgba(11, 22, 15, 0.75), 0 0 0 0 rgba(224, 179, 88, 0); }
}
.cart-badge.is-bumped .cart-badge-count { animation: cart-count-flash 0.52s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes cart-count-flash {
  0%   { background: var(--honey, #c0871f); }
  38%  { background: var(--honey-300, #e0b358); transform: scale(1.18); }
  100% { background: var(--honey, #c0871f); }
}

/* ---- Backdrop + drawer ---- */
.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(12, 20, 14, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.cart-backdrop.is-open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 960;
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--paper, #fbf8f0);
  color: var(--ink, #1d211d);
  font-family: var(--sans, system-ui, sans-serif);
  border-left: 1px solid var(--line, rgba(29, 33, 29, 0.12));
  box-shadow: -24px 0 60px -30px rgba(12, 20, 14, 0.6);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1), visibility 0.32s;
}
.cart-drawer.is-open { transform: translateX(0); visibility: visible; }

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem clamp(1.1rem, 4vw, 1.6rem);
  border-bottom: 1px solid var(--line, rgba(29, 33, 29, 0.12));
}
.cart-head h2 {
  margin: 0;
  font-family: var(--serif, Georgia, serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cart-close {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line, rgba(29, 33, 29, 0.12));
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.cart-close:hover, .cart-close:focus-visible { background: rgba(29, 33, 29, 0.06); }
.cart-close svg { width: 16px; height: 16px; }

.cart-body { flex: 1; overflow-y: auto; padding: clamp(0.9rem, 3vw, 1.3rem) clamp(1.1rem, 4vw, 1.6rem); }
.cart-empty { margin: 2rem 0; color: var(--muted, #6b6f63); font-size: 0.97rem; line-height: 1.6; }

.cart-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line, rgba(29, 33, 29, 0.12));
}
.cart-lines .cart-line:last-child { border-bottom: 0; padding-bottom: 0; }
.cart-line-name { font-weight: 700; font-size: 0.99rem; line-height: 1.3; }
.cart-line-meta { grid-column: 1; font-size: 0.83rem; color: var(--muted, #6b6f63); }
.cart-line-price {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: start;
  font-family: var(--serif, Georgia, serif);
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
}
.cart-line-controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.5rem; }
.cart-step {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line, rgba(29, 33, 29, 0.12));
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.cart-step:hover:not([disabled]), .cart-step:focus-visible { border-color: var(--honey, #c0871f); }
.cart-step[disabled] { opacity: 0.4; cursor: default; }
.cart-qty { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.cart-remove {
  margin-left: auto;
  border: 0;
  background: transparent;
  padding: 0.2rem 0;
  color: var(--muted, #6b6f63);
  font-size: 0.83rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cart-remove:hover, .cart-remove:focus-visible { color: #8a2b2b; }

.cart-foot {
  border-top: 1px solid var(--line, rgba(29, 33, 29, 0.12));
  padding: clamp(1rem, 3vw, 1.4rem) clamp(1.1rem, 4vw, 1.6rem) clamp(1.2rem, 4vw, 1.6rem);
  background: var(--offwhite, #f3eee2);
}
.cart-totals { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.cart-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-size: 0.95rem; }
.cart-total-row b { font-family: var(--serif, Georgia, serif); font-size: 1.25rem; font-weight: 600; }
.cart-total-row.is-sub { color: var(--muted, #6b6f63); font-size: 0.88rem; }
.cart-checkout { width: 100%; }
.cart-note { margin: 0.85rem 0 0; font-size: 0.79rem; line-height: 1.55; color: var(--muted, #6b6f63); }
.cart-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.cart-status { margin: 0 0 0.9rem; font-size: 0.88rem; line-height: 1.5; }
.cart-status:empty { display: none; }
.cart-status.is-error { color: #8a2b2b; font-weight: 600; }
.cart-fallback { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.4rem; font-size: 0.86rem; }
.cart-fallback a { color: var(--forest-700, #234430); font-weight: 600; }

/* ---- Return banner ---- */
.cart-banner {
  position: fixed;
  left: 50%;
  top: 1rem;
  z-index: 970;
  width: min(560px, calc(100% - 2rem));
  transform: translate(-50%, -12px);
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius, 14px);
  background: var(--forest-900, #14241a);
  color: var(--offwhite, #f3eee2);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.93rem;
  line-height: 1.5;
  box-shadow: 0 22px 50px -24px rgba(11, 22, 15, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.cart-banner.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.cart-banner.is-cancelled { background: var(--charcoal, #23262a); }
.cart-banner svg { width: 20px; height: 20px; flex: none; margin-top: 0.1rem; color: var(--honey-300, #e0b358); }
.cart-banner-text strong { display: block; font-weight: 700; }
.cart-banner-close {
  margin-left: auto;
  flex: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.cart-banner-close:hover { opacity: 1; }

@media (max-width: 560px) {
  .cart-badge { left: clamp(0.9rem, 3vw, 1.6rem); justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .cart-badge, .cart-backdrop, .cart-drawer, .cart-banner { transition: none; }
  .cart-badge.is-bumped, .cart-badge.is-bumped .cart-badge-count { animation: none; }
}

/* ---- No-JS notice ---- */
.cart-noscript {
  margin: 0 0 1.4rem;
  padding: 0.85rem 1.05rem;
  border: 1px dashed currentColor;
  border-radius: calc(var(--radius, 14px) - 4px);
  background: rgba(192, 135, 31, 0.1);
  color: inherit;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.88rem;
  line-height: 1.55;
  opacity: 0.9;
}
.cart-noscript a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
