/* ==========================================================================
   COACH KAL — KAL FAVOURITES CART (cart.js)
   Nav cart button, cart drawer, toast, add-to-cart buttons, quantity stepper.
   Builds on style.css tokens.
   ========================================================================== */

/* ---------- nav cart button ---------- */
.nav__cart {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; color: inherit;
  transition: background-color .3s, transform .3s var(--ease);
}
.nav__cart svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.nav__cart:hover { background: rgba(20,23,24,.07); }
.nav.on-dark .nav__cart:hover { background: rgba(244,241,234,.12); }
.nav__cart-count {
  position: absolute; top: 3px; right: 1px; min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 99px;
  background: var(--ink); color: var(--paper); font: 600 10.5px/1 var(--f-mono);
  box-shadow: 0 0 0 2px var(--paper);
}
html:not([data-sport="none"]) .nav__cart-count { background: var(--accent); color: var(--accent-ink); }
.nav.on-dark .nav__cart-count { box-shadow: 0 0 0 2px var(--ink); }
.nav__cart-count[hidden] { display: none; }
.nav__cart.is-bump { animation: cartBump .55s var(--ease); }
@keyframes cartBump { 0% { transform: scale(1); } 35% { transform: scale(1.22) rotate(-6deg); } 100% { transform: scale(1); } }

/* ---------- add-to-cart on cards ---------- */
.favcard__add {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px;
  background: var(--ink); color: var(--paper); border-radius: 2px;
  font: 600 11.5px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase;
  transition: background-color .3s, color .3s;
}
.favcard__add-ico { display: grid; place-items: center; width: 28px; height: 28px; background: var(--card); color: var(--ink); border-radius: 1px; }
.favcard[data-accent="tennis"] .favcard__add-ico, .favcard[data-accent="more"] .favcard__add-ico { color: #fff; }
.favcard__add-ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.favcard__add:hover { background: var(--graphite); }
.favcard__add.is-in-cart { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.favcard__add.is-in-cart:hover { background: rgba(20,23,24,.06); }

/* ---------- quantity stepper ---------- */
.qty { display: inline-flex; align-items: stretch; height: 56px; box-shadow: inset 0 0 0 1.5px var(--ink); border-radius: 2px; background: rgba(255,255,255,.5); }
.qty button { width: 46px; font-size: 22px; line-height: 1; color: var(--ink); }
.qty button:hover:not(:disabled) { background: rgba(20,23,24,.07); }
.qty button:disabled { opacity: .3; cursor: not-allowed; }
.qty input, .qty output {
  width: 46px; display: grid; place-items: center; text-align: center;
  font: 600 17px/1 var(--f-mono); color: var(--ink); background: none; border: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty--sm { height: 36px; }
.qty--sm button { width: 34px; font-size: 18px; }
.qty--sm output { width: 30px; font-size: 14px; }

/* product page: qty + add to cart */
.pdp__cart { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.pdp__add { flex: 1 1 220px; justify-content: space-between; }
.pdp__add.is-in-cart { background: var(--ink); color: var(--paper); }
.pdp__add.is-in-cart .btn__chip { background: var(--accent); color: var(--accent-ink); }

/* ---------- drawer ---------- */
.cart {
  margin: 0 0 0 auto; padding: 0; border: 0; max-width: none; max-height: none;
  width: min(460px, 100vw); height: 100dvh; height: 100vh; height: 100dvh;
  background: transparent; color: var(--ink); overflow: visible;
}
.cart::backdrop { background: rgba(20,23,24,.55); backdrop-filter: blur(2px); }
.cart[open] { animation: cartIn .45s var(--ease); }
.cart[open]::backdrop { animation: fadeIn .35s ease; }
@keyframes cartIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } }
.cart__panel { height: 100%; display: grid; grid-template-rows: auto 1fr auto; background: var(--paper); box-shadow: -24px 0 60px -30px rgba(0,0,0,.5); }
.cart :focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.cart__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 22px 16px; border-bottom: 1px solid var(--hair); }
.cart__step { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.cart__title {
  font-family: var(--f-display); font-weight: 850; font-stretch: 72%; font-variation-settings: "wdth" 72;
  text-transform: uppercase; line-height: .95; font-size: 34px; outline: none;
}
.cart__close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--hair); flex: none; }
.cart__close:hover { background: var(--ink); color: var(--paper); }
.cart__close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.cart__body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 22px 18px; }
.cart__list { display: grid; }
.cart__item { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--hair); }
.cart__thumb { width: 80px; height: 100px; overflow: hidden; background: var(--grey); display: grid; place-items: center; }
.cart__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart__ph svg, .cart__empty-ico svg { width: 30px; height: 30px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.cart__info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cart__meta { color: var(--muted); font-size: 10.5px; }
.cart__name { font-weight: 700; font-size: 16px; line-height: 1.25; text-decoration: none; }
a.cart__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.cart__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.cart__price { font-weight: 700; font-size: 16px; }
.cart__price .mono { font-weight: 500; font-size: 10.5px; color: var(--muted); }
.cart__remove { align-self: flex-start; font-size: 10.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; }
.cart__remove:hover { color: var(--ink); }

.cart__empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 64px 12px; color: var(--muted); }
.cart__empty-ico { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--grey); }
.cart__empty-title { font-family: var(--f-display); font-weight: 850; font-stretch: 72%; font-variation-settings: "wdth" 72; text-transform: uppercase; font-size: 26px; color: var(--ink); }

.cart__foot { padding: 16px 22px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); display: grid; gap: 12px; background: #fff; }
html[data-sport="none"] .cart .btn--accent { background: var(--ink); color: var(--paper); }
html[data-sport="none"] .cart .btn--accent .btn__chip { background: var(--paper); color: var(--ink); }
.cart__total { display: flex; align-items: baseline; justify-content: space-between; }
.cart__total .mono { color: var(--muted); font-size: 11px; }
.cart__total strong { font-size: 26px; font-weight: 750; }
.cart__fine { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.cart__clear, .cart__back { justify-self: center; font-size: 11px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 6px; }
.cart__clear:hover, .cart__back:hover { color: var(--ink); }

/* checkout step */
.cart__how { counter-reset: how; display: grid; gap: 10px; margin: 14px 0 6px; padding: 14px 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--hair); }
.cart__how li { counter-increment: how; position: relative; padding-left: 32px; font-size: 14px; line-height: 1.45; }
.cart__how li::before {
  content: counter(how); position: absolute; left: 0; top: 0; width: 22px; height: 22px; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font: 600 11px/1 var(--f-mono);
}
.cart__progress { color: var(--muted); font-size: 11px; margin-top: 14px; }
.cart__list--buy .cart__item { align-items: start; }
.cart__buy { align-self: flex-start; margin-top: 4px; }
.cart__item.is-opened .cart__buy { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.cart__item.is-opened .cart__thumb { opacity: .55; }
.cart__soon { color: var(--muted); font-size: 10.5px; padding: 6px 0; }
.cart__code { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cart__code strong { color: var(--ink); font-weight: 600; background: rgba(20,23,24,.08); padding: 2px 6px; }
.cart__copy { font-size: 10px; padding: 4px 8px; box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); }
.cart__copy:hover { background: var(--ink); color: var(--paper); }

/* ---------- toast ---------- */
.cart-toast {
  position: fixed; z-index: 400; left: 50%; bottom: 22px; transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 14px; background: var(--ink); color: var(--paper); border-radius: 2px;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.45); font-size: 14px;
  transition: transform .45s var(--ease), opacity .3s; opacity: 0; pointer-events: none;
}
.cart-toast.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.cart-toast p { min-width: 0; }
.cart-toast__ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.cart-toast__btn { flex: none; font-size: 11px; padding: 10px 12px; background: var(--paper); color: var(--ink); border-radius: 2px; }
html:not([data-sport="none"]) .cart-toast__btn { background: var(--accent); color: var(--accent-ink); }

@media (max-width: 600px) {
  .cart { width: 100vw; }
  .cart__head, .cart__body, .cart__foot { padding-left: 16px; padding-right: 16px; }
  .favcard__add { padding: 0 10px 0 4px; font-size: 10.5px; gap: 6px; min-height: 36px; }
  .favcard__add-ico { width: 24px; height: 24px; }
  .favcard__foot .favcard__more { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cart[open], .cart[open]::backdrop, .nav__cart.is-bump { animation: none; }
  .cart-toast { transition: none; }
}

/* ---------- Coach Kal's own products: order form, pay-now (Nov 2026) ---------- */
.cart__own { color: var(--ink); font-weight: 600; }
.cart__opt { font-size: 10.5px; color: var(--muted); }
.cart__sec { padding: 16px 0 6px; }
.cart__sec + .cart__sec { border-top: 1px solid var(--hair); margin-top: 14px; }
.cart__sec-title {
  font-family: var(--f-display); font-weight: 850; font-stretch: 72%; font-variation-settings: "wdth" 72;
  text-transform: uppercase; font-size: 22px; line-height: 1; margin-bottom: 10px;
}
.cart__list--sum { gap: 0; background: #fff; box-shadow: inset 0 0 0 1px var(--hair); padding: 6px 14px; margin-bottom: 14px; }
.cart__sumrow { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--hair); }
.cart__sumrow:last-child { border-bottom: 0; }
.cart__sumrow .mono { color: var(--muted); font-size: 10.5px; }
.cart__sumrow--total { font-size: 16px; }
.cart__form { display: grid; gap: 12px; }
.cart__fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.cart__fld { display: grid; gap: 5px; grid-column: span 3; min-width: 0; align-content: start; }
.cart__fld--full { grid-column: 1 / -1; }
.cart__fld--city { grid-column: 1 / -1; }
.cart__fld--sm { grid-column: span 3; }
@media (min-width: 480px) { .cart__fld--city { grid-column: span 2; } .cart__fld--sm { grid-column: span 2; } }
.cart__fld > span { font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cart__fld em { font-style: normal; text-transform: none; letter-spacing: 0; }
.cart__fld input, .cart__fld textarea {
  width: 100%; min-height: 44px; padding: 9px 11px; font: 500 16px/1.35 var(--f-body); color: var(--ink);
  background: #fff; border: 0; box-shadow: inset 0 0 0 1.5px var(--hair); border-radius: 0;
}
.cart__fld textarea { min-height: 64px; resize: vertical; }
.cart__fld input:focus, .cart__fld textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.cart__fld [aria-invalid="true"] { box-shadow: inset 0 0 0 2px #C2412D; }
.cart__pay { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.cart__pay legend { font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; padding: 0; }
.cart__pay label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--hair); font-size: 15px; cursor: pointer; }
.cart__pay label:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }
.cart__pay input { width: 18px; height: 18px; accent-color: var(--ink); }
.cart__msg { font-size: 13.5px; color: #8a2f1f; min-height: 1.2em; }
.cart__done { margin: 14px 0; padding: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--hair); border-left: 4px solid var(--ink); display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; }
.cart__done-title { font-weight: 750; font-size: 18px; }
.cart__paynow { display: grid; gap: 10px; margin: 4px 0 12px; }

/* coupon code + gift (lesson packages) */
.cart__coupon { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; }
.cart__coupon .cart__fld { grid-column: auto; }
.cart__coupon input { text-transform: uppercase; letter-spacing: .04em; }
.cart__coupon-btn { min-height: 44px; padding-inline: 18px; }
.cart__coupon-msg { grid-column: 1 / -1; margin: 0; min-height: 0; }
.cart__sumrow--off strong { color: #2F8F4E; }
.cart__sumrow--off .cart__copy { margin-left: 6px; }
.cart__gift { border: 0; margin: 0; padding: 12px; display: grid; gap: 10px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--hair); }
.cart__check { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 15px; cursor: pointer; }
.cart__check input { width: 18px; height: 18px; accent-color: var(--ink); }
.cart__gift [hidden] { display: none; }
.cart__coupon-msg.is-ok { color: #2F8F4E; }
