body.drawer-open {
  overflow: hidden;
}

.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(17, 17, 17, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.cart-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(430px, 100vw);
  background: #fafafa;
  color: #111;
  box-shadow: -24px 0 70px rgba(17, 17, 17, 0.18);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  line-height: 1.42;
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.cart-drawer.is-open {
  transform: translateX(0);
}

.cart-drawer p,
.cart-drawer h3 {
  margin: 0;
}

.cart-drawer .summary-kicker,
.cart-drawer .card-kicker {
  color: #5f5f5f;
  font-size: 0.66rem;
  font-weight: 720;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.drawer-head,
.drawer-footer {
  padding: 24px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border-bottom: 1px solid rgba(17, 17, 17, 0.12);
}

.cart-drawer h3 {
  margin-top: 5px;
  font-size: 0.94rem;
  font-weight: 560;
  letter-spacing: 0;
  line-height: 1.18;
}

.drawer-close {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #111;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 520;
  line-height: 1;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.drawer-body {
  overflow: auto;
  padding: 28px;
}

.drawer-items {
  display: grid;
  gap: 20px;
}

.drawer-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.12);
}

.drawer-thumb-link {
  display: block;
  width: 104px;
  aspect-ratio: 1;
  color: inherit;
  text-decoration: none;
}

.drawer-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #e8e8e8;
}

.drawer-product-link {
  display: grid;
  gap: 7px;
  color: inherit;
  text-decoration: none;
}

.drawer-product-link:hover h3 {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.drawer-line {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.drawer-meta,
.cart-drawer .muted,
.drawer-note {
  color: #666;
}

.drawer-meta {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
}

.cart-color-swatches {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 22px;
}

.cart-color-swatch {
  display: block;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(17, 17, 17, 0.22);
  border-radius: 50%;
  background: var(--swatch-color);
}

.cart-color-swatch:not(.is-selected) {
  display: none;
}

.cart-color-swatch.is-selected {
  width: 18px;
  height: 18px;
  border: 2px solid #fafafa;
  outline: 1.5px solid #111;
}

.drawer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-row strong {
  font-size: 0.86rem;
  font-weight: 650;
  white-space: nowrap;
}

.drawer-qty {
  display: grid;
  grid-template-columns: 30px 32px 30px;
  min-height: 34px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: #fff;
}

.drawer-qty button {
  border: 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 520;
  line-height: 1;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.drawer-qty span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 650;
}

.drawer-remove {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 160ms ease;
}

.drawer-remove:hover,
.drawer-qty button:hover,
.drawer-close:hover {
  color: #111;
}

.drawer-close:hover {
  background: rgba(17, 17, 17, 0.04);
}

.drawer-qty button:hover {
  background: rgba(17, 17, 17, 0.05);
}

.cart-drawer .empty-state {
  display: grid;
  padding: 28px 0;
}

.drawer-footer {
  display: grid;
  gap: 14px;
  background: #f3f3f3;
  border-top: 1px solid rgba(17, 17, 17, 0.12);
}

.subtotal-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.subtotal-line strong {
  font-size: 1.4rem;
  font-weight: 520;
  letter-spacing: 0;
}

.drawer-note {
  max-width: 36ch;
  font-size: 0.78rem;
  line-height: 1.48;
}

.checkout-actions {
  display: grid;
  gap: 9px;
}

.cart-drawer .button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #111;
  border-radius: 0;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 680;
  letter-spacing: 0.11em;
  padding: 0 18px;
  text-align: center;
  text-transform: uppercase;
  transition:
    background 170ms ease,
    border-color 170ms ease,
    color 170ms ease;
}

.cart-drawer .button:hover {
  background: #262626;
  border-color: #262626;
  color: #fff;
}

.cart-drawer .button.secondary {
  background: transparent;
  color: #111;
}

.drawer-close:focus-visible,
.drawer-qty button:focus-visible,
.drawer-remove:focus-visible,
.cart-drawer .button:focus-visible {
  outline: 1px solid #111;
  outline-offset: 2px;
}

.cart-drawer .button.secondary:hover {
  background: #111;
  border-color: #111;
  color: #fff;
}

@media (max-width: 520px) {
  .cart-drawer {
    width: 100vw;
  }

  .drawer-head,
  .drawer-footer,
  .drawer-body {
    padding: 22px;
  }

  .drawer-item {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 13px;
  }

  .drawer-thumb-link {
    width: 82px;
  }

  .subtotal-line strong {
    font-size: 1.32rem;
  }
}
