/* shared sheet: side drawer on desktop, bottom sheet on phones */
.sheet {
  margin: 0 0 0 auto; padding: 0; border: 0; max-width: none; max-height: none;
  width: min(480px, 100vw); height: 100dvh;
  background: var(--surface); color: var(--fg); border-left: 1px solid var(--line);
}
.sheet--quick { width: min(860px, 100vw); }
.sheet::backdrop { background: rgba(0, 0, 0, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[open] { animation: sheet-in 520ms var(--ease-out); }
.sheet[open]::backdrop { animation: fade-in 400ms var(--ease-out); }
@keyframes sheet-in { from { transform: translateX(100%); } }
@keyframes fade-in { from { opacity: 0; } }
.sheet__inner { position: relative; height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 24px; }
.sheet__close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px;
  border: 1.5px solid var(--fg); border-radius: 50%; background: var(--surface);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}

@media (max-width: 699px) {
  .sheet, .sheet--quick { margin: auto 0 0; width: 100vw; height: auto; max-height: 92dvh; border-radius: 14px 14px 0 0; }
  .sheet__inner { max-height: 92dvh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  @keyframes sheet-in { from { transform: translateY(100%); } }
}
@media (prefers-reduced-motion: reduce) {
  .sheet[open], .sheet[open]::backdrop { animation: none; }
}

/* quick buy */
.sheet--quick .sheet__inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.quick__gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; align-self: start; }
.quick__gallery img { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 1106 / 1422; object-fit: cover; background: var(--surface); }
.quick__body { padding-top: 40px; }
.quick__title { font-size: var(--fs-3); font-weight: 900; font-stretch: 112%; margin-bottom: 12px; }
.quick__more { display: inline-block; margin-top: 14px; font-size: var(--fs-0); }
@media (max-width: 699px) {
  /* plain stacking: a grid row can't size to this scrolling gallery, so the text rode up over the photos */
  .sheet--quick .sheet__inner { display: block; }
  .quick__gallery { margin-bottom: 24px; }
  .quick__gallery img { flex-basis: 72%; }
  .quick__body { padding-top: 0; }
}

/* bag */
.bag { display: flex; flex-direction: column; }
.bag__title { font-size: var(--fs-3); font-weight: 900; font-stretch: 112%; margin: 8px 0 20px; }
.bag__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.line { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.line img { width: 76px; aspect-ratio: 500 / 641; object-fit: cover; background: var(--surface); border-radius: 8px; }
.line__name { font-weight: 800; line-height: 1.2; }
.line__meta { font-size: var(--fs-0); color: var(--muted); }
.line__qty { display: inline-flex; align-items: center; margin-top: 8px; border: 1.5px solid var(--fg); border-radius: var(--radius); }
.line__qty button { width: 44px; height: 40px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; }
.line__qty output { min-width: 28px; text-align: center; font-weight: 700; }
.line__price { font-weight: 800; }
.line__remove { display: block; margin-top: 8px; padding: 6px 0; border: 0; background: none; font-size: var(--fs-0); text-decoration: underline; cursor: pointer; }
.bag__empty { font-size: var(--fs-2); }
.bag__foot { margin-top: auto; padding-top: 24px; }
.bag__subtotal { display: flex; justify-content: space-between; font-size: var(--fs-2); margin-bottom: 4px; }
.bag__ship, .bag__note { font-size: var(--fs-0); color: var(--muted); }
.bag__note { margin-top: 10px; text-align: center; }

/* thumbnail that flies to the bag */
.fly { position: fixed; z-index: 90; pointer-events: none; object-fit: cover; border-radius: var(--radius); }
