/* ─── Basket drawer ──────────────────────────────────────────────────────── */

.ymr-cart {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.ymr-cart__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--text-color) 45%, transparent);
  opacity: 0;
  transition: opacity var(--hover-duration) var(--timing);
}

.ymr-cart__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  background: var(--paper);
  box-shadow: var(--shadow-lift);
  transform: translateX(100%);
  transition: transform 0.35s var(--timing);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary-color) 55%, var(--bg-color)) var(--bg-light);
}

.ymr-cart.is-open {
  .ymr-cart__backdrop { opacity: 1; }
  .ymr-cart__panel { transform: none; }
}

.ymr-cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px dashed var(--line-dash);
}

.ymr-cart__title {
  font-size: 32px;
}

.ymr-cart__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: transparent;

  &:hover {
    border-color: var(--ink);
  }
}

.ymr-cart__view {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 24px 24px;
}

.ymr-cart__empty {
  color: var(--muted);
  font-size: 15px;
}

.ymr-cart__items {
  display: flex;
  flex-direction: column;
}

.ymr-cart__item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line-dash);
}

.ymr-cart__thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.ymr-cart__item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ymr-cart__item-name {
  font: 600 22px/1.1 var(--title-font);
}

.ymr-cart__item-gift {
  font-size: 19px;
  color: var(--red);
}

.ymr-cart__qty {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.ymr-cart__qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  font-weight: 700;

  &:hover {
    border-color: var(--ink);
  }
}

.ymr-cart__qty-n {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
}

.ymr-cart__item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.ymr-cart__remove {
  padding: 4px 0;
  background: none;
  border: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

.ymr-cart__foot {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;
  padding-top: 20px;
}

.ymr-cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;

  strong {
    font-size: 22px;
    font-weight: 800;
  }
}

.ymr-cart__note {
  font-size: 14px;
  color: var(--muted);
}

.ymr-cart__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ymr-cart__gift {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 8px 0 0;
  padding: 16px;
  border: 1px dashed var(--line-dash);
  border-radius: var(--radius-sm);

  legend {
    padding: 0 6px;
    font-size: 22px;
    color: var(--red);
  }
}

.ymr-cart__error {
  margin-top: 12px;
  color: var(--negative-color);
  font-size: 14px;
  font-weight: 600;

  &:empty {
    display: none;
  }
}

.ymr-cart__actions {
  display: flex;
  gap: 10px;

  .btn--main {
    flex: 1;
  }
}

.ymr-cart__done {
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.ymr-cart__stamp {
  --size: 132px;
  font-size: 13px;
  transform: rotate(-12deg);
}

.ymr-cart__done-title {
  font-size: 36px;
}

.ymr-cart__done-text {
  color: var(--muted);
  max-width: 340px;
}

/* "Added to basket" toast */
.ymr-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: no-preference) {
  .ymr-toast:not([hidden]) {
    animation: ymr-toast-in 0.3s var(--timing);
  }
}

@keyframes ymr-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
