/* ==========================================================================
   Flossie's Cards basket (WP8 part 2): the header's basket badge, live region and mini-basket, ADD TO
   BASKET with its quantity stepper, and the basket page. Ported from the mock's section 4 (mini-basket)
   and the product view's quantity controls. EVERY colour is a token from shop.css's :root block; this
   file holds none (FrameTest::colours_only_in_root_tokens scans every stylesheet and script).
   Sections: 1 header badge + live region, 2 mini-basket dropdown, 3 ADD TO BASKET + quantity,
   4 basket page, 5 responsive.
   ========================================================================== */

/* ---------- 1. Header: the filled bag once it holds items, and the polite live region ---------- */
.basket-icon.has-items { background: var(--color-badge-bg); border-color: var(--color-badge-bg); color: var(--color-badge-text); }
.basket-icon.has-items::before { border-color: var(--color-badge-bg); }
.basket-icon.bump { animation: basket-bump .4s ease; }
@keyframes basket-bump { 50% { transform: scale(1.2); } }
/* The live region sits between the header and the main content, in the flow (it never covers anything and is
   not part of the header whose height header.js freezes while it sticks), as wide as the content, and keeps zero
   height while empty: an element hidden with display: none at the moment its text changes may not be announced,
   so it is never hidden that way. */
.basket-notice {
  width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--container-max) - 2 * var(--gutter)); margin: 0 auto; padding: 0; border: 0;
  background: var(--color-surface-alt); color: var(--color-text); font-size: var(--fs-sm); line-height: var(--lh-body); text-align: left;
}
.basket-notice:not(:empty) { margin-bottom: var(--space-3); padding: 10px var(--space-4); border-left: 3px solid var(--color-topbar-bg); }

/* ---------- 2. Mini-basket dropdown (mock section 4, R3, R10/R11) ----------
   Opens on click (and on hover with a mouse); Esc, the close button or a click outside closes it. */
.mini-basket {
  display: none; position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  width: min(360px, calc(100vw - 32px)); padding: var(--space-5);
  background: var(--color-surface); box-shadow: var(--shadow-dropdown); border-top: 3px solid var(--color-kraft);
  color: var(--color-text); font-size: var(--fs-sm); text-align: left;
}
.mini-basket::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 14px; } /* hover bridge */
.basket.is-open .mini-basket { display: block; }
.mb-head { display: flex; align-items: flex-start; justify-content: space-between; margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-2) 0; }
.mb-head .widget-title { margin: var(--space-3) 0 0; font-size: var(--fs-sm); }
.mb-close { color: var(--color-text-muted); }
.mb-close:hover { color: var(--color-text); }
.mb-message, .mb-notice { margin: 0 0 var(--space-2); padding: 8px var(--space-3); background: var(--color-surface-alt); border-left: 3px solid var(--color-topbar-bg); }
.mb-message:empty { display: none; }   /* not a live region: the header's strip announces for it */
.mb-list { margin: 0; padding: 0; list-style: none; }
.mb-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) var(--tap); align-items: center; gap: var(--space-3); padding: 10px 0; border-bottom: var(--hairline) solid var(--color-border); }
.mb-item img, .mb-no-photo { display: block; width: 56px; height: 56px; object-fit: cover; background: var(--color-surface-alt); }
.mb-name { display: block; color: var(--color-text); line-height: 1.35; }
.mb-qty { color: var(--color-text-muted); }
.mb-remove-form { margin: 0; }
.mb-remove { display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: var(--color-text-muted); }
.mb-remove:hover { color: var(--color-error); }
.mb-subtotal { display: flex; justify-content: space-between; margin: var(--space-4) 0 0; padding: 10px var(--space-3); background: var(--color-surface-alt); color: var(--color-heading); font-weight: 700; }
.mb-delivery { margin: 10px 0 0; color: var(--color-heading); font-weight: 700; }
.mb-hint { margin: 10px 0 0; color: var(--color-text-muted); }
.mb-blocked { color: var(--color-stock-low); font-weight: 700; }
.mb-progress { display: block; width: 100%; height: 4px; margin-top: 6px; border: 0; background: var(--color-border); appearance: none; -webkit-appearance: none; }
.mb-progress::-webkit-progress-bar { background: var(--color-border); }
.mb-progress::-webkit-progress-value { background: var(--color-kraft); }
.mb-progress::-moz-progress-bar { background: var(--color-kraft); }
.mb-buttons { display: grid; gap: var(--space-2); margin: var(--space-4) 0 0; }
.mb-empty { margin: 0; color: var(--color-text-muted); }

/* ---------- 3. ADD TO BASKET (the card page and Quick View print the component) ---------- */
.add-to-basket-slot { display: flex; flex-direction: column; align-items: center; margin: 0 0 var(--space-4); }
.add-to-basket-slot:empty { display: none; }
form.add-to-basket { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin: 0; }
.quantity { display: inline-flex; border: var(--hairline) solid var(--color-border-strong); background: var(--color-surface); }
/* the - and + buttons need the script (WP10's layout sets html.js when scripts run); without it only the box shows */
.qty-btn { display: none; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; background: none; color: var(--color-text); }
html.js .qty-btn { display: flex; }
.qty-btn:hover:not(:disabled) { background: var(--color-latte); }
.qty-btn:disabled { opacity: .45; cursor: not-allowed; }
input.qty {
  width: 52px; height: var(--tap); padding: 0; border: 0;
  border-left: var(--hairline) solid var(--color-border); border-right: var(--hairline) solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); text-align: center; appearance: textfield; -moz-appearance: textfield;
}
html:not(.js) .quantity input.qty { border: 0; }   /* the component's box without its buttons: one border, the .quantity one */
input.qty::-webkit-outer-spin-button, input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* the message next to the button ("... has been added", "Only 2 left ..."): zero height while empty, still a live region */
.add-to-basket-notice { width: 100%; max-width: 46ch; margin: 0; padding: 0; border: 0; background: var(--color-surface-alt); font-size: var(--fs-sm); text-align: left; }
.add-to-basket-notice:not(:empty) { margin-top: var(--space-3); padding: 10px var(--space-4); border-left: 3px solid var(--color-topbar-bg); }
.add-to-basket-notice.is-error:not(:empty) { border-left-color: var(--color-error); }

/* ---------- 4. Basket page ---------- */
/* Papertree's progress strip: large, light, uppercase; the current step dark; the separators are decoration */
.checkout-steps {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-6); padding: 0; list-style: none;
  color: var(--color-text-muted); font-size: var(--fs-h1); font-weight: 300; text-transform: uppercase; letter-spacing: var(--tracking-caps);
}
.checkout-steps li { display: flex; align-items: center; }
.step-sep { margin-right: var(--space-4); color: var(--color-kraft); }
.checkout-steps .is-current { color: var(--color-heading); font-weight: 400; }
.basket-page .notice { margin: 0 0 var(--space-5); padding: 10px var(--space-4); background: var(--color-surface-alt); border-left: 3px solid var(--color-topbar-bg); font-size: var(--fs-sm); }
.basket-empty { margin: 0 0 var(--space-5); }
.basket-table { width: 100%; margin: 0 0 var(--space-6); border-collapse: collapse; font-size: var(--fs-sm); }
.basket-table th { padding: 0 var(--space-3) var(--space-3); border-bottom: var(--hairline) solid var(--color-border-strong); color: var(--color-heading); font-size: var(--fs-caps-heading); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); text-align: left; }
.basket-table td { padding: var(--space-3); border-bottom: var(--hairline) solid var(--color-border); vertical-align: middle; }
.basket-table th:first-child, .basket-table td:first-child { padding-left: 0; }
.bl-thumb { width: 72px; }
.bl-thumb img, .bl-thumb .no-photo { display: block; width: 56px; height: 56px; object-fit: cover; background: var(--color-surface-alt); }
.bl-name a { color: var(--color-text); font-size: var(--fs-base); }
.bl-name a:hover { color: var(--color-link-hover); }
.bl-price, .bl-total { white-space: nowrap; }
.bl-total { color: var(--color-heading); font-weight: 700; }
.basket-qty { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.basket-qty input.qty { border: var(--hairline) solid var(--color-border-strong); }
.button.is-small { min-height: var(--tap); padding: 0 var(--space-3); font-size: var(--fs-xs); }   /* 44 px tall, like every target */
.basket-remove { margin: 0; }
.basket-totals { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: var(--grid-gap); align-items: start; }
.basket-message { margin: 0; padding: 0; border: 0; background: var(--color-surface-alt); font-size: var(--fs-sm); }
.basket-message:not(:empty) { margin-bottom: var(--space-3); padding: 10px var(--space-4); border-left: 3px solid var(--color-topbar-bg); }
.basket-delivery { margin: 0; }
.basket-delivery fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.basket-delivery legend { padding: 0; }
.delivery-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px var(--space-3); align-items: start; padding: var(--space-3) 0; border-bottom: var(--hairline) solid var(--color-border); cursor: pointer; }
.delivery-option input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--color-topbar-bg); }
.do-name { font-weight: 700; }
.do-price { white-space: nowrap; color: var(--color-heading); font-weight: 700; }
.do-desc, .do-collect { grid-column: 2 / span 2; color: var(--color-text-muted); font-size: var(--fs-sm); }
.do-collect { font-weight: 700; }
.basket-delivery-submit { margin-top: var(--space-3); }
.basket-delivery.is-js .basket-delivery-submit { display: none; }   /* with the script a choice applies in place */
.basket-collection { margin: var(--space-3) 0 0; color: var(--color-heading); font-weight: 700; }
.basket-hint { margin: var(--space-3) 0 0; color: var(--color-text-muted); font-size: var(--fs-sm); }
.basket-summary { padding: var(--space-5); background: var(--color-surface-alt); }
.basket-sums { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); margin: 0; }
.basket-sums dt, .basket-sums dd { margin: 0; }
.basket-sums dd { text-align: right; white-space: nowrap; }
.basket-sums .is-total { padding-top: var(--space-3); border-top: var(--hairline) solid var(--color-border-strong); color: var(--color-heading); font-size: var(--fs-price-lg); font-weight: 700; }
.basket-blocked { margin: var(--space-4) 0 0; padding: 10px var(--space-4); background: var(--color-surface); border-left: 3px solid var(--color-stock-low); color: var(--color-heading); font-size: var(--fs-sm); font-weight: 700; }
.basket-proceed { width: 100%; margin-top: var(--space-4); }

/* ---------- 5. Responsive ---------- */
@media (max-width: 849.98px) {
  .basket-totals { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 599.98px) {
  .checkout-steps { gap: var(--space-1) var(--space-3); font-size: var(--fs-sm); }
  .step-sep { margin-right: var(--space-3); }
  /* each line becomes a block: photo at the left, remove at the right, the figures stacked between (the ARIA
     table roles in the markup keep the table a table for assistive technology) */
  .basket-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .basket-table tr { display: grid; grid-template-columns: 72px minmax(0, 1fr) var(--tap); gap: 0 var(--space-3); padding: var(--space-3) 0; border-bottom: var(--hairline) solid var(--color-border); }
  .basket-table td { display: block; padding: 2px 0; border: 0; }
  .bl-thumb { grid-row: 1 / span 4; }
  .bl-remove { grid-column: 3; grid-row: 1; }
  .bl-name, .bl-price, .bl-qty, .bl-total { grid-column: 2; }
  .bl-price::before { content: "Price: "; }
  .bl-total::before { content: "Total: "; }
}
