/* ================= Cart & checkout ================= */
.cart { position: fixed; inset: 0; z-index: 80; }
.cart[hidden] { display: none; }
.cart__scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 9, 0.6);
  opacity: 0;
  transition: opacity .3s var(--ease-out);
}
.cart__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-4) 0;
  transform: translateX(100%);
  transition: transform .45s var(--ease-out);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.35);
}
.cart.is-open .cart__scrim { opacity: 1; }
.cart.is-open .cart__panel { transform: none; }

.cart__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule-dark);
}
.cart__eyebrow { color: var(--accent-text); margin-bottom: 6px; }
.cart__title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: .9;
  text-transform: uppercase;
  color: var(--on-dark-1);
}
.cart__close { min-height: 40px; color: var(--on-dark-2); }
.cart__close:hover { color: var(--accent-text); }

.cart__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-block: var(--s-2); }
.cart__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: start;
  align-items: center;
  gap: var(--s-2);
  padding-block: 12px;
  border-bottom: 1px solid var(--rule-dark);
}
.cart__item img { width: 56px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 3px; }
.cart__item-text { display: grid; gap: 3px; min-width: 0; }
.cart__item-title { color: var(--on-dark-1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart__item-series { color: var(--on-dark-3); font-size: 11.5px; }
.cart__remove { min-height: 40px; padding-inline: 6px; color: var(--on-dark-3); text-decoration: underline; text-underline-offset: 3px; }
.cart__remove:hover { color: var(--accent-text); }

.cart__empty { display: none; flex: 1; align-content: start; gap: var(--s-3); padding-top: var(--s-4); color: var(--on-dark-3); }
.cart.is-empty .cart__empty { display: grid; justify-items: start; }
.cart.is-empty .cart__list,
.cart.is-empty .cart__foot { display: none; }

.cart__foot {
  display: grid;
  gap: 12px;
  padding: var(--s-3) 0 calc(var(--s-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule-dark);
}
.cart__note { color: var(--on-dark-3); font-size: 14px; line-height: 1.5; }
.cart__request { min-height: 48px; text-align: center; }
.cart__clear { justify-self: center; min-height: 36px; color: var(--on-dark-3); }
.cart__clear:hover { color: var(--on-dark-1); }

@media (max-width: 560px) {
  .cart__panel { padding: var(--s-3) var(--gutter) 0; }
}

/* ---------- prices, licences, totals ---------- */
.cart__panel { overflow-y: auto; overscroll-behavior: contain; }
.cart__view[hidden] { display: none !important; }
.cart__view[data-view="cart"] { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cart__item-end { display: grid; justify-items: end; gap: 2px; }
.cart__price { color: var(--on-dark-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.cart__tier {
  justify-self: start;
  margin-top: 6px;
  min-height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid rgba(235, 233, 228, 0.25);
  border-radius: var(--r-chip);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23aaa' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  color: var(--on-dark-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.cart__tier option { background: var(--panel); color: var(--on-dark-1); }
.cart__tier--fixed { display: inline-flex; align-items: center; padding: 0 10px; font-size: 11px; background: none; cursor: default; }
.cart__total { display: flex; align-items: baseline; justify-content: space-between; color: var(--on-dark-2); }
.cart__total strong, .cart__summary-line strong {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: normal;
  color: var(--on-dark-1);
  font-variant-numeric: tabular-nums;
}
.cart__note a { color: var(--on-dark-1); text-decoration: underline; text-underline-offset: 3px; }
.cart__checkout, .cart__place { min-height: 48px; text-align: center; width: 100%; }

/* ---------- checkout form ---------- */
.cart__form { display: grid; gap: 14px; padding: var(--s-3) 0 calc(var(--s-4) + env(safe-area-inset-bottom)); }
.cart__back { justify-self: start; min-height: 36px; color: var(--on-dark-3); }
.cart__back:hover { color: var(--on-dark-1); }
.cart__summary-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--rule-dark);
  color: var(--on-dark-2);
}
.cart__field { display: grid; gap: 6px; }
.cart__field .meta { color: var(--on-dark-2); }
.cart__field em { font-style: normal; color: var(--on-dark-dim); text-transform: none; }
.cart__field input, .cart__field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(235, 233, 228, 0.22);
  border-radius: var(--r-chip);
  background: rgba(235, 233, 228, 0.04);
  color: var(--on-dark-1);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}
.cart__field input:focus, .cart__field textarea:focus { outline: none; border-color: var(--accent); }
.cart__agree { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; color: var(--on-dark-3); font-size: 14px; line-height: 1.5; cursor: pointer; }
.cart__agree input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.cart__agree a { color: var(--on-dark-1); text-decoration: underline; text-underline-offset: 3px; }
.cart__error { color: var(--accent); }

/* ---------- confirmation ---------- */
.cart__done { display: grid; gap: var(--s-2); padding-top: var(--s-4); outline: none; }
.cart__done-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  line-height: .9;
  text-transform: uppercase;
  color: var(--on-dark-1);
}
.cart__done-id { color: var(--on-dark-2); }
.cart__steps { list-style: decimal; padding-left: 1.2em; display: grid; gap: 8px; color: var(--on-dark-3); line-height: 1.5; }
.cart__steps strong { color: var(--on-dark-1); font-weight: 600; }
.cart__done .button-chip { justify-self: start; margin-top: var(--s-2); }

/* ---------- licence picker (quick view; light surface) ---------- */
.lic { display: grid; gap: 10px; }
.lic__opt { display: block; cursor: pointer; }
.lic__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lic__box {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--rule-light);
  border-radius: var(--r-chip);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.lic__opt:hover .lic__box { border-color: var(--on-light-3); }
.lic__opt input:checked + .lic__box { border-color: var(--ink); background: var(--tint-light); box-shadow: inset 0 0 0 1px var(--ink); }
.lic__opt input:focus-visible + .lic__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.lic__row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); }
.lic__name { font-weight: 600; color: var(--on-light-1); }
.lic__price { font-family: var(--font-display); font-size: 1.35rem; color: var(--on-light-1); font-variant-numeric: tabular-nums; }
.lic__blurb { font-size: 13.5px; line-height: 1.45; color: var(--on-light-3); }
.lic__only { color: var(--on-light-3); font-size: 11px; text-transform: none; letter-spacing: 0; line-height: 1.45; }

/* ---------- floating trigger: only once there is something to open ---------- */
.cart-fab {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 99px;
  background: var(--panel);
  color: var(--on-dark-1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform .45s var(--ease-out), opacity .3s var(--ease-out);
}
.cart-fab.is-on { transform: none; opacity: 1; pointer-events: auto; }
.cart-fab:hover { background: var(--accent); color: var(--accent-ink); }
.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.cart-fab:hover .cart-count { background: var(--panel); }
body.cart-open .cart-fab, body.sheet-open .cart-fab, body.qv-open .cart-fab, body.mnav-open .cart-fab { opacity: 0; pointer-events: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-5) + 40px + env(safe-area-inset-bottom));
  z-index: 90;
  max-width: calc(100vw - 2 * var(--gutter));
  padding: 12px 16px;
  border-radius: var(--r-chip);
  background: var(--panel);
  color: var(--on-dark-1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .35s var(--ease-out), opacity .25s var(--ease-out);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
/* the cart is its own confirmation: don't cover its buttons */
body.cart-open .toast { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .cart__panel, .cart__scrim, .cart-fab, .toast { transition: none; }
}
