/* The basket page */
.basket { padding: var(--space-4) 0 var(--section-gap); background: var(--cream); }
.basket h1 { margin: 0 0 var(--space-3); }
.basket [hidden] { display: none !important; }
.basket-empty { padding: var(--space-4); text-align: center; background: #fff; border: 1px solid var(--edge); border-radius: 20px; }
.basket-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: var(--space-3); align-items: start; }
.basket-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.basket-item { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: var(--space-2); align-items: start; padding: var(--space-2); background: #fff; border: 1px solid var(--edge); border-radius: 20px; }
.basket-cover { width: 96px; overflow: hidden; border-radius: 6px; }
.basket-cover svg { display: block; width: 100%; height: auto; }
.basket-text h2 { margin: 0 0 0.25rem; font-size: 1.2rem; line-height: 1.25; overflow-wrap: anywhere; }
.basket-meta { margin: 0 0 0.25rem; font-size: 0.95rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.basket-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.6rem; }
.basket-controls .qty output { min-width: 1.5rem; text-align: center; }
.basket-price { margin: 0; font-weight: 700; white-space: nowrap; }
.basket-summary { position: sticky; top: 96px; padding: var(--space-3); background: #fff; border: 1px solid var(--edge); border-radius: 20px; }
.basket-summary h2 { margin: 0 0 var(--space-2); font-size: 1.3rem; }
/* Standard or Express delivery: two tappable cards, the chosen one outlined */
.speed { display: grid; gap: 0.5rem; margin: 0 0 var(--space-2); padding: 0; border: 0; min-width: 0; }
.speed[hidden] { display: none; }
.speed legend { margin-bottom: 0.4rem; padding: 0; font-weight: 700; }
.speed-option { position: relative; display: block; cursor: pointer; }
.speed-option input { position: absolute; top: 50%; right: 0.9rem; width: 1.25rem; height: 1.25rem; margin: -0.625rem 0 0; accent-color: var(--ink); }
.speed-card { display: grid; gap: 0.1rem; padding: 0.65rem 2.8rem 0.65rem 0.9rem; background: #fff; border: 2px solid var(--edge); border-radius: 12px; }
.speed-top { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: baseline; }
.speed-price { font-weight: 600; }
.speed-when { font-size: 0.9rem; color: var(--ink-soft); }
.speed-tag { justify-self: start; margin-top: 0.25rem; padding: 0.1rem 0.55rem; font-size: 0.8rem; font-weight: 700; color: #8A1C1C; background: #FDE3E1; border-radius: 999px; }
.speed-option input:checked + .speed-card { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.speed-option input:focus-visible + .speed-card { outline: 3px solid var(--c4); outline-offset: 2px; }
.basket-totals { margin: 0 0 var(--space-2); }
.basket-totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; }
.basket-totals dt, .basket-totals dd { margin: 0; }
.basket-total { margin-top: 0.3rem; padding-top: 0.6rem !important; font-size: 1.2rem; font-weight: 700; border-top: 1px solid var(--edge); }
.basket-note { margin: 0 0 var(--space-2); font-size: 0.92rem; color: var(--ink-soft); }
.basket-summary > :last-child { margin-bottom: 0; }
/* Coupon codes: a quiet link that opens a small box */
.basket-discount dd { color: #1E8A55; font-weight: 600; }
.coupon { margin: -0.4rem 0 var(--space-2); }
.coupon summary { display: inline-block; padding: 0.3rem 0; font-size: 0.95rem; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.coupon summary::-webkit-details-marker { display: none; }
.coupon-row { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.coupon-row .field { flex: 1 1 auto; min-width: 0; text-transform: uppercase; }
.coupon-row .field::placeholder { text-transform: none; }
.coupon-row .btn { flex: none; }
.coupon-msg { margin: 0.4rem 0 0; font-size: 0.92rem; font-weight: 600; }
.coupon-msg:empty { display: none; }
.coupon-msg.is-bad { color: #B3261E; }

/* "Email me my basket" */
.save-basket .coupon-row { flex-wrap: wrap; }
.save-basket .coupon-row .field { flex: 1 1 12rem; text-transform: none; }
.save-basket .field-help { margin: 0.4rem 0 0; }

/* "What stopped you?" after leaving the payment page */
.left-ask { margin: 0 0 var(--space-3); padding: 1rem 1.1rem; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.left-q { margin: 0 0 0.6rem; }
.left-q span { font-size: 0.85rem; color: var(--ink-soft); }
.left-btns { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.left-btn { padding: 0.5rem 0.85rem; font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--ink); background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; cursor: pointer; }
.left-btn:hover, .left-btn:focus-visible { background: var(--tint-yellow); }
.left-thanks, .left-reply { margin: 0 0 0.4rem; }
.coupon-applied { margin: -0.4rem 0 var(--space-2); font-size: 0.95rem; color: #1E8A55; }
.coupon-applied .link-btn { font-size: 0.9rem; }
.basket-pay, .basket-more { display: flex; width: 100%; margin-bottom: var(--space-2); text-align: center; white-space: normal; }
.basket-pay { font-size: 1.2rem; padding-top: 0.85em; padding-bottom: 0.85em; }
.basket-pay-ways { margin: calc(-1 * var(--space-2) + 0.4rem) 0 var(--space-2); text-align: center; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.03em; color: var(--ink-soft); }
.basket-summary .buy-consent { margin-bottom: var(--space-2); }
@media (max-width: 860px) {
  .basket-grid { grid-template-columns: minmax(0, 1fr); }
  .basket-summary { position: static; }
}
/* Checkout, kept in reach at the foot of a phone or tablet screen */
.basket-bar { display: none; }
@media (max-width: 860px) {
  .basket-bar:not([hidden]) {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    padding: 0.6rem 16px calc(0.6rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--edge);
    box-shadow: 0 -6px 18px rgba(30, 42, 68, 0.12);
  }
  .basket-bar-btn { display: flex; width: 100%; max-width: 520px; margin: 0 auto; font-size: 1.15rem; }
  /* Room at the end of the page, so the bar never covers the last of it */
  .basket { padding-bottom: calc(var(--section-gap) + 76px); }
  .basket h1 { margin-bottom: var(--space-2); }
}
@media (max-width: 480px) {
  .basket-item { grid-template-columns: 72px minmax(0, 1fr); }
  .basket-cover { width: 72px; }
  .basket-price { grid-column: 2; }
}

/* "Ivy's book is ready!", just after adding it */
.basket-celebrate {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 var(--space-2);
  padding: 0.8rem 1rem;
  background: #FFF6DA;
  border: 2px solid var(--marigold, #FFC93C);
  border-radius: 20px;
  animation: basket-pop 0.5s cubic-bezier(.3, 1.5, .6, 1) both;
}
.basket-celebrate strong { font-family: var(--display); font-size: 1.15rem; }
.basket-celebrate-icon { flex: none; width: 40px; height: 40px; }
.basket-celebrate-icon svg { width: 100%; height: 100%; }
.basket-item.is-new .basket-cover { animation: basket-wiggle 0.9s ease 0.3s both; }
@keyframes basket-pop { from { opacity: 0; transform: translateY(-8px) scale(0.97); } }
@keyframes basket-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg) scale(1.06); } 60% { transform: rotate(4deg) scale(1.04); } }
.calm .basket-celebrate, .calm .basket-item.is-new .basket-cover { animation: none; }

/* Checkout steps and the Shipping Address page */
.checkout-steps { margin: 0 0 var(--space-2); font-size: 0.95rem; color: var(--ink-soft); }
.checkout-steps strong { color: var(--ink); }
.shipping-form { padding: var(--space-3); background: #fff; border: 1px solid var(--edge); border-radius: 20px; }
.shipping-lead { margin: 0 0 var(--space-2); }
.shipping-postcode { max-width: 12rem; }
.shipping-country { margin: 0 0 var(--space-2); color: var(--ink-soft); }
.shipping-form .optional { font-weight: 400; color: var(--ink-soft); }
.shipping-books { margin: 0 0 var(--space-2); padding: 0; list-style: none; font-size: 0.95rem; }
.shipping-books li { padding: 0.25rem 0; overflow-wrap: anywhere; }
