/* Header cart icon, slide-in cart panel (assets/js/asf-cart.js) and cart/checkout touches. */

/* ---------- Header icon ---------- */
.asf-header-inner .asf-primary-nav { margin-left: auto; }
.asf-site .asf-cart-toggle { position: relative; z-index: calc(var(--asf-layer-menu) + 1); order: 3; display: inline-flex; align-items: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0 2px; color: inherit; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-decoration: none; text-transform: uppercase; }
.asf-site .asf-cart-toggle:hover .asf-cart-icon, .asf-site .asf-cart-toggle:focus-visible .asf-cart-icon { color: var(--asf-coral); }
.asf-cart-toggle:focus-visible { outline: 2px solid var(--asf-coral); outline-offset: 4px; border-radius: 6px; }
.asf-cart-icon { flex: none; width: 24px; height: 24px; transition: color 200ms; }
.asf-cart-count { position: absolute; top: 4px; left: 14px; display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border: 2px solid var(--asf-navy); border-radius: 999px; background: var(--asf-coral); color: var(--asf-navy); font-size: 11px; font-weight: 900; letter-spacing: 0; line-height: 1; }
.asf-cart-count[hidden] { display: none; }
.asf-cart-toggle.has-items .asf-cart-count { animation: asf-cart-pop 360ms var(--asf-ease); }
@keyframes asf-cart-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

@media (max-width: 860px) {
  .asf-site .asf-cart-toggle { margin-left: auto; }
  .asf-header-inner .asf-menu-toggle { order: 4; }
  .asf-cart-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .asf-site .asf-cart-toggle { justify-content: center; }
}

/* ---------- Panel ---------- */
body.asf-cart-locked { overflow: hidden; }
.asf-cart-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(16, 21, 47, .5); opacity: 0; transition: opacity 300ms var(--asf-ease); }
.asf-cart-backdrop.is-open { opacity: 1; }
.asf-cart-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; display: flex; flex-direction: column; width: min(420px, 100vw); max-width: 100%; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--asf-cream); color: var(--asf-ink); box-shadow: -24px 0 60px rgba(16, 21, 47, .25); transform: translate3d(100%, 0, 0); transition: transform 320ms var(--asf-ease); outline: none; }
.asf-cart-panel.is-open { transform: translate3d(0, 0, 0); }
.asf-cart-panel[hidden], .asf-cart-backdrop[hidden] { display: none; }
.asf-cart-panel.is-busy .asf-cart-body { opacity: .6; pointer-events: none; }

.asf-cart-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--asf-line-dark); }
.asf-site .asf-cart-title { margin: 0; color: var(--asf-navy); font-family: var(--asf-font-display); font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }
.asf-cart-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px; border: 0; border-radius: 999px; background: transparent; color: var(--asf-navy); cursor: pointer; }
.asf-cart-close:hover, .asf-cart-close:focus-visible { background: rgba(16, 21, 47, .08); }
.asf-cart-close:focus-visible { outline: 2px solid var(--asf-navy); outline-offset: 2px; }

.asf-cart-notice { max-height: 0; margin: 0; padding: 0 24px; overflow: hidden; background: #e7f3e3; color: #234d1a; font-size: 14px; font-weight: 700; transition: max-height 240ms var(--asf-ease), padding 240ms var(--asf-ease); }
.asf-cart-notice.is-visible { max-height: 6em; padding: 10px 24px; }
.asf-cart-notice.is-error { background: #fde8e4; color: #8a1f10; }

.asf-cart-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px; transition: opacity 160ms; }
.asf-cart-loading, .asf-cart-empty { margin: 24px 0; color: var(--asf-ink-soft); }
.asf-cart-empty p { margin: 0 0 16px; font-size: 1.05rem; }

.asf-cart-items { margin: 0; padding: 0; list-style: none; }
.asf-cart-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 18px 0; border-bottom: 1px solid var(--asf-line-dark); }
.asf-cart-item:last-child { border-bottom: 0; }
.asf-cart-thumb { display: block; width: 64px; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 2px 4px 4px 2px; background: var(--asf-lavender); box-shadow: 2px 3px 8px rgba(16, 21, 47, .18); }
.asf-cart-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.asf-site .asf-cart-name { display: block; color: var(--asf-navy); font-size: 1rem; font-weight: 800; line-height: 1.25; text-decoration: none; }
.asf-site .asf-cart-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.asf-cart-each { margin: 4px 0 10px; color: var(--asf-ink-soft); font-size: 13px; }
.asf-cart-line { margin: 0; color: var(--asf-navy); font-size: 1rem; font-weight: 800; white-space: nowrap; }
.asf-cart-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }

.asf-qty { display: inline-flex; align-items: center; border: 1.5px solid var(--asf-navy); border-radius: 999px; background: var(--asf-white); }
.asf-qty-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--asf-navy); font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; }
.asf-qty-btn:hover:not([disabled]), .asf-qty-btn:focus-visible { background: var(--asf-navy); color: var(--asf-cream); }
.asf-qty-btn:focus-visible { outline: 2px solid var(--asf-coral); outline-offset: 1px; }
.asf-qty-btn[disabled] { opacity: .35; cursor: default; }
.asf-qty-value { min-width: 2ch; color: var(--asf-navy); font-size: 1rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.asf-cart-remove { min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--asf-ink-soft); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.asf-cart-remove:hover, .asf-cart-remove:focus-visible { color: #b3261e; }

.asf-cart-foot { padding: 18px 24px 22px; border-top: 1px solid var(--asf-line-dark); background: var(--asf-white); }
.asf-cart-foot[hidden] { display: none; }
.asf-cart-subtotal { display: flex; justify-content: space-between; gap: 12px; margin: 0; color: var(--asf-navy); font-size: 1.1rem; font-weight: 700; }
.asf-cart-subtotal strong { font-weight: 900; font-variant-numeric: tabular-nums; }
.asf-cart-postage { margin: 4px 0 16px; color: var(--asf-ink-soft); font-size: 13px; }
.asf-cart-actions { display: grid; gap: 10px; }
.asf-site .asf-cart-btn { display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 22px; border: 1.5px solid var(--asf-navy); border-radius: 999px; background: transparent; color: var(--asf-navy); font-size: 15px; font-weight: 800; text-decoration: none; transition: background-color 200ms, border-color 200ms, color 200ms; }
.asf-site .asf-cart-btn:hover, .asf-site .asf-cart-btn:focus-visible { background: var(--asf-navy); color: var(--asf-cream); }
.asf-site .asf-cart-btn.is-primary { background: var(--asf-navy); color: var(--asf-cream); }
.asf-site .asf-cart-btn.is-primary:hover, .asf-site .asf-cart-btn.is-primary:focus-visible { border-color: var(--asf-coral); background: var(--asf-coral); color: var(--asf-navy); }
.asf-cart-empty .asf-cart-btn { display: inline-flex; }

/* "Buy from Joy" while the book is being added. */
.asf-site a.is-loading[href*="add-to-cart="] { opacity: .7; cursor: progress; }

/* ---------- Checkout: back to the cart ---------- */
.asf-site .asf-checkout-back { margin: 0 0 24px; font-size: 15px; }
.asf-site .asf-checkout-back a { color: var(--asf-plum); font-weight: 700; text-underline-offset: 3px; }

/* ---------- Cart block quantity controls in the theme's colours ---------- */
.asf-checkout-body .wc-block-components-quantity-selector { border-radius: 999px; border-color: var(--asf-navy); overflow: hidden; }
.asf-checkout-body .wc-block-components-quantity-selector::after { border-color: var(--asf-navy); border-radius: 999px; }
.asf-site .asf-checkout-body .wc-block-components-quantity-selector__button { min-width: 40px; color: var(--asf-navy); font-size: 18px; font-weight: 700; opacity: 1; }
.asf-site .asf-checkout-body .wc-block-components-quantity-selector__button:disabled { opacity: .35; }
.asf-site .asf-checkout-body .wc-block-components-quantity-selector__input { color: var(--asf-navy); font-weight: 800; }
.asf-site .asf-checkout-body .wc-block-cart-item__remove-link { color: var(--asf-ink-soft); font-size: 13px; text-decoration: underline; }

@media (max-width: 430px) {
  .asf-cart-head, .asf-cart-body, .asf-cart-foot { padding-left: 18px; padding-right: 18px; }
  .asf-cart-item { grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; }
  .asf-cart-thumb { width: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .asf-cart-panel, .asf-cart-backdrop, .asf-cart-notice { transition: none; }
  .asf-cart-toggle.has-items .asf-cart-count { animation: none; }
}

@media (forced-colors: active) {
  .asf-cart-count { border-color: CanvasText; }
  .asf-qty-btn[disabled] { opacity: 1; color: GrayText; }
}
