/* The bag drawer: a dialog that slides in from the right (from the bottom on a phone). */
.bag {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; border: 0;
  width: min(440px, 100vw); height: 100dvh; max-height: none; max-width: none;
  background: var(--paper); color: var(--ink);
  box-shadow: -18px 0 0 rgba(22, 8, 7, .18);
}
.bag::backdrop { background: rgba(22, 8, 7, .62); }
@media (prefers-reduced-motion: no-preference) {
  .bag[open] { animation: bag-in .42s var(--ease); }
  .bag[open]::backdrop { animation: fade-in .3s ease; }
}
@keyframes bag-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.bag__panel { display: flex; flex-direction: column; height: 100%; }
.bag__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px 16px 24px; background: var(--night); color: var(--paper); border-bottom: 3px solid var(--marigold);
}
.bag__title { font: 400 1.9rem/1 var(--display); color: var(--marigold); }
.bag__title:focus { outline: none; }
.bag__title:focus-visible { outline: 3px solid var(--marigold); outline-offset: 4px; }
.bag__close {
  width: 48px; height: 48px; border: 2px solid rgba(245, 233, 217, .4); background: transparent; color: var(--paper);
  font-size: 1.8rem; line-height: 1; transition: background-color .2s var(--ease);
}
.bag__close:hover { background: rgba(245, 233, 217, .14); }
.bag__body { flex: 1; overflow-y: auto; padding: 8px 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.bag__lines { display: grid; }
.bag__line {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid rgba(30, 13, 11, .16);
}
.bag__thumb { display: grid; place-items: center; height: 96px; }
.bag__thumb > .jar { width: 54px; }
.bag__thumb .trio-pic { width: 66px; }
.bag__thumb .jar::before { display: none; }
.bag__info { display: grid; gap: 4px; justify-items: start; }
.bag__name { font: 400 1.2rem/1.05 var(--display); text-decoration: none; }
.bag__name:hover { text-decoration: underline; }
.bag__each { font-size: 1rem; color: var(--ink-soft); }
.qty { display: inline-flex; align-items: center; border: 2px solid var(--ink); margin-top: 4px; }
.qty button {
  width: 44px; height: 44px; border: 0; background: transparent; font: 700 1.25rem/1 var(--text);
  transition: background-color .2s var(--ease);
}
.qty button:hover:not(:disabled) { background: var(--marigold); }
.qty button:disabled { opacity: .35; cursor: not-allowed; }
.qty output, .qty input { min-width: 36px; text-align: center; font-weight: 800; }
.bag__end { display: grid; justify-items: end; gap: 6px; }
.bag__line-total { font-weight: 800; font-size: 1.1rem; }
.bag__remove {
  min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--ink-soft);
  font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  transition: color .2s var(--ease);
}
.bag__remove:hover { color: var(--roast); }
.bag__free p { font-weight: 700; }
.bag__meter { display: block; height: 10px; margin-top: 8px; background: var(--paper-2); border: 2px solid var(--ink); }
.bag__meter span { display: block; height: 100%; background: var(--roast); transition: width .5s var(--ease); }
.bag__sums { display: grid; gap: 6px; }
.bag__sums div { display: flex; justify-content: space-between; gap: 12px; }
.bag__sums dd { margin: 0; font-weight: 700; }
.bag__total { padding-top: 10px; margin-top: 4px; border-top: 2px solid var(--ink); font-size: 1.25rem; font-weight: 800; }
.bag__ships, .bag__rule { color: var(--ink-soft); font-size: 1rem; }
.bag__checkout { width: 100%; }
.bag__note {
  padding: 14px 16px; background: var(--night); color: var(--paper); font-weight: 600;
  border-left: 0; outline-offset: 3px;
}
.bag__empty { font: 400 1.6rem/1.1 var(--display); margin-top: 18px; }

@media (max-width: 599px) {
  .bag { inset: auto 0 0 0; width: 100vw; height: min(92dvh, 760px); box-shadow: 0 -12px 0 rgba(22, 8, 7, .18); }
  @media (prefers-reduced-motion: no-preference) { .bag[open] { animation-name: bag-up; } }
  .bag__body { padding: 4px 16px 24px; }
}
@keyframes bag-up { from { transform: translateY(60px); opacity: 0; } }
