/* Browser-local wishlist drawer. Loaded after the cart drawer so both panels
   share the same overlay, motion language and responsive behavior. */
#wishlistDrawer {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 150;
  width: min(480px, calc(100vw - 20px));
  padding: 6px;
  overflow: hidden;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 82px -30px rgba(36, 38, 43, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(calc(100% + 28px), 0, 0);
  transition:
    transform 520ms var(--ease),
    opacity 320ms var(--ease),
    visibility 0s 520ms;
}

#wishlistDrawer.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
}

.wd-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--white);
  border-radius: calc(var(--radius-xl) - 5px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 8px 30px -22px rgba(36, 38, 43, 0.42);
}

.wd-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 16px 18px 15px 22px;
  border-bottom: 1px solid rgba(36, 38, 43, 0.08);
}

.wd-head::before {
  content: "";
  position: absolute;
  top: 0;
  right: 22px;
  left: 22px;
  height: 3px;
  background: var(--brand);
  border-radius: 0 0 3px 3px;
}

.wd-head h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--graphite);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.wd-count {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  color: var(--white);
  background: var(--brand);
  border-radius: 999px;
  font: 700 0.75rem/1 var(--font-sans);
}

.wd-close,
.wd-remove {
  display: grid;
  place-items: center;
  color: var(--graphite);
  background: var(--paper);
  border: 0;
  border-radius: var(--radius-m);
  transition:
    color 260ms var(--ease),
    background-color 260ms var(--ease),
    transform 260ms var(--ease);
}

.wd-close {
  width: 44px;
  height: 44px;
}

.wd-close:hover,
.wd-remove:hover {
  color: var(--white);
  background: var(--graphite);
}

.wd-close:active,
.wd-remove:active {
  transform: scale(0.96);
}

.wd-close svg,
.wd-remove svg {
  width: 18px;
  height: 18px;
}

.wd-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fbfbfa;
  scrollbar-color: rgba(36, 38, 43, 0.22) transparent;
  scrollbar-width: thin;
}

.wd-empty,
.wd-state {
  display: flex;
  min-height: 100%;
  padding: 56px 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
}

.wd-empty__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 22px;
  color: var(--brand);
  background: var(--brand-tint);
  border-radius: var(--radius-l);
}

.wd-empty__icon svg {
  width: 30px;
  height: 30px;
}

.wd-empty strong,
.wd-state strong {
  max-width: 300px;
  color: var(--graphite);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.25;
}

.wd-empty p,
.wd-state p {
  max-width: 330px;
  margin: 10px 0 22px;
  font-size: 0.92rem;
}

.wd-empty .btn,
.wd-state .btn {
  min-height: 48px;
}

.wd-state--loading {
  gap: 16px;
  font-weight: 650;
}

.wd-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(150, 33, 31, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: wd-spin 780ms linear infinite;
}

@keyframes wd-spin {
  to { transform: rotate(360deg); }
}

.wd-list {
  margin: 0;
  padding: 6px 22px 0;
  list-style: none;
}

.wd-item {
  position: relative;
  min-height: 120px;
  margin: 0;
  padding: 19px 0;
  border-bottom: 1px solid rgba(36, 38, 43, 0.08);
}

.wd-item:last-child {
  border-bottom: 0;
}

.wd-product {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 15px;
  padding-right: 42px;
  color: var(--graphite);
  text-decoration: none;
}

.wd-image {
  display: block;
  width: 94px;
  height: 80px;
  overflow: hidden;
  background: var(--paper);
  border-radius: var(--radius-m);
  box-shadow: inset 0 0 0 1px rgba(36, 38, 43, 0.07);
}

.wd-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms var(--ease);
}

.wd-product:hover .wd-image img {
  transform: scale(1.05);
}

.wd-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
}

.wd-placeholder svg {
  width: 28px;
  height: 28px;
}

.wd-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.wd-category {
  margin-bottom: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 100%;
}

.wd-meta strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--graphite);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  transition: color 240ms var(--ease);
}

.wd-product:hover .wd-meta strong {
  color: var(--brand);
}

.wd-price {
  margin-top: auto;
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.wd-price del {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.wd-price ins {
  text-decoration: none;
}

.wd-stock {
  margin-top: 4px;
  color: var(--steel);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.wd-remove {
  position: absolute;
  top: 17px;
  right: 0;
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--steel);
}

.wd-footer {
  flex: 0 0 auto;
  padding: 14px 22px max(22px, env(safe-area-inset-bottom));
  background: var(--white);
  border-top: 1px solid rgba(36, 38, 43, 0.08);
}

.wd-footer[hidden] {
  display: none;
}

.wd-footer .btn {
  width: 100%;
  min-height: 50px;
}

.wd-close:focus-visible,
.wd-remove:focus-visible,
.wd-product:focus-visible,
.wd-footer a:focus-visible,
.wd-empty a:focus-visible,
.wd-state button:focus-visible {
  outline: 3px solid rgba(150, 33, 31, 0.34);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  #wishlistDrawer {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    border-radius: 0;
  }

  .wd-shell {
    border-radius: 0;
  }

  .wd-head {
    min-height: 72px;
    padding-right: 16px;
    padding-left: 18px;
  }

  .wd-head::before {
    right: 18px;
    left: 18px;
  }

  .wd-list,
  .wd-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .wd-empty,
  .wd-state {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #wishlistDrawer,
  .wd-close,
  .wd-remove,
  .wd-image img {
    transition: none;
  }

  .wd-spinner {
    animation-duration: 1.6s;
  }
}

@media (prefers-reduced-transparency: reduce) {
  #wishlistDrawer {
    background: var(--paper);
  }
}

/* Brief, non-blocking confirmation after a wishlist action. */
.wishlist-toast {
  top: 94px;
  right: 24px;
  bottom: auto;
  left: auto;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  width: min(390px, calc(100vw - 48px));
  min-height: 62px;
  padding: 11px 18px 11px 12px;
  gap: 12px;
  color: var(--white);
  background: var(--graphite);
  border-radius: var(--radius-m);
  box-shadow: 0 18px 44px -18px rgba(21, 22, 25, 0.66);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(calc(100% + 40px), 0, 0);
  transition:
    transform 420ms var(--ease),
    opacity 240ms var(--ease);
}

.wishlist-toast.show {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.wishlist-toast__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--white);
  background: var(--brand);
  border-radius: 50%;
  transition: color 240ms var(--ease), background-color 240ms var(--ease);
}

.wishlist-toast__icon svg {
  width: 17px;
  height: 17px;
  color: currentColor;
  fill: currentColor;
  stroke: currentColor;
}

.wishlist-toast.is-removal .wishlist-toast__icon {
  color: var(--graphite);
  background: var(--paper);
}

.wishlist-toast__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  line-height: 1.2;
}

.wishlist-toast__copy strong {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
}

.wishlist-toast__copy > span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.78rem;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .wishlist-toast {
    top: 76px;
    right: 12px;
    left: 12px;
    width: auto;
    transform: translate3d(0, calc(-100% - 96px), 0);
  }

  .wishlist-toast.show {
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wishlist-toast,
  .wishlist-toast__icon {
    transition: none;
  }
}
