/* ============================================================================
   Slide-out cart drawer.
   Consumes tokens.css. Panel geometry and type follow the DP ramp so the drawer
   reads as part of the site rather than a bolted-on plugin.
   ============================================================================ */

.dp-drawer[hidden] { display: none; }

/* Set only while the drawer owns the viewport, and removed on close.
   NOT scrollbar-gutter: reserving the gutter shrinks the area a position:fixed element
   is laid out against, so the drawer's right:0 landed 15px in from the screen edge and
   left a visible strip beside it. Compensating the vanished scrollbar on BODY instead
   keeps the page from shifting AND leaves the drawer flush to the viewport.
   --dp-sbw is measured and set by the drawer script at lock time. */
html.dp-noscroll { overflow: hidden; }
html.dp-noscroll body { padding-right: var(--dp-sbw, 0px); }

.dp-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;                     /* above the fixed strip + header (90) */
}

.dp-drawer__scrim {
  position: absolute;
  inset: 0;
  background: var(--dpx-bg-a414676p45, rgba(46, 36, 30, .45));
  opacity: 0;
  transition: opacity .28s var(--dp-ease-cta);
  /* Every popup blurs the page behind it, like the picker and mobile menu. */
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}
.dp-drawer.is-open .dp-drawer__scrim { opacity: 1; }

.dp-drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 400px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  background: var(--dp-surface);
  box-shadow: -8px 0 32px var(--dpx-shadow-a000p12, rgba(0, 0, 0, .12));
  transform: translateX(100%);
  transition: transform .32s var(--dp-ease-cta);
  will-change: transform;
}
.dp-drawer.is-open .dp-drawer__panel { transform: translateX(0); }

/* A drawer that flies in is exactly the motion a reduced-motion preference is about:
   still appear, just do not travel. */
@media (prefers-reduced-motion: reduce) {
  .dp-drawer__scrim,
  .dp-drawer__panel { transition: none; }
}

/* --- Head ---------------------------------------------------------------- */
.dp-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--dp-s-5);
  padding: var(--dp-s-9) var(--dp-s-9) var(--dp-s-7);
  border-bottom: 1px solid var(--dp-hair-row);
}
.dp-drawer__title {
  margin: 0;
  font-size: var(--dp-fs-h3);
  font-weight: var(--dp-fw-semi);
  line-height: 22px;
  letter-spacing: -.4px;
  color: var(--dp-ink);
}
.dp-drawer__x {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 0;
  border-radius: var(--dp-r-pill);
  background: var(--dp-surface-alt);
  color: var(--dp-ink);
  cursor: pointer;
  transition: background-color .2s var(--dp-ease-cta);
}
.dp-drawer__x:hover { background: var(--dpx-bg-e9f3ff, #FDEFEB); color: var(--dpx-fg-blue, var(--dp-blue)); }
.dp-drawer__x:focus-visible { outline: 2px solid var(--dpx-fg-blue, var(--dp-blue)); outline-offset: 2px; }

/* --- Body ---------------------------------------------------------------- */
.dp-drawer__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;                    /* lets the item list scroll inside the flex column */
  overflow: hidden;
}

.dp-drawer__items {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: var(--dp-s-7) var(--dp-s-9);
  list-style: none;
  display: grid;
  gap: var(--dp-s-7);
  align-content: start;
}

.dp-drawer__item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--dp-s-6);
  padding-bottom: var(--dp-s-7);
  border-bottom: 1px solid var(--dp-hair-row);
}
.dp-drawer__item:last-child { border-bottom: 0; padding-bottom: 0; }

.dp-drawer__media {
  width: 72px; height: 72px;
  border-radius: var(--dp-r-3xs);
  background: var(--dp-surface-alt);
  overflow: hidden;
}
.dp-drawer__media img,
.dp-drawer__media a { display: block; width: 100%; height: 100%; }
.dp-drawer__media img { object-fit: contain; }

.dp-drawer__detail { min-width: 0; }
.dp-drawer__name {
  margin: 0;
  font-size: var(--dp-fs-base);
  font-weight: var(--dp-fw-semi);
  line-height: 18px;
  letter-spacing: -.2px;
  color: var(--dp-ink);
}
.dp-drawer__name a { color: inherit; }
.dp-drawer__name a:hover { color: var(--dpx-fg-blue, var(--dp-blue)); }
.dp-drawer__meta {
  margin: 2px 0 0;
  font-size: var(--dp-fs-sm);
  line-height: 16px;
  color: var(--dp-ink-50);
}

.dp-drawer__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--dp-s-5);
  margin-top: var(--dp-s-5);
}

.dp-drawer__qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--dp-hair-row);
  border-radius: var(--dp-r-pill);
}
/* 32px is the minimum comfortable tap target, and the padding has to live on the BUTTON
   — putting it on the wrapper leaves a small hit area inside a large-looking control. */
.dp-drawer__step {
  width: 32px; height: 32px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: var(--dp-r-pill);
  color: var(--dp-ink);
  font-size: var(--dp-fs-lg);
  line-height: 1;
  cursor: pointer;
  transition: background-color .18s var(--dp-ease-cta), color .18s var(--dp-ease-cta);
}
.dp-drawer__step:hover { background: var(--dpx-bg-e9f3ff, #FDEFEB); color: var(--dpx-fg-blue, var(--dp-blue)); }
.dp-drawer__step:focus-visible { outline: 2px solid var(--dpx-fg-blue, var(--dp-blue)); outline-offset: -2px; }
.dp-drawer__n {
  min-width: 22px;
  text-align: center;
  font-size: var(--dp-fs-base);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.2px;
}

.dp-drawer__price {
  font-size: var(--dp-fs-base);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.2px;
  color: var(--dp-ink);
  white-space: nowrap;
}
.dp-drawer__price del { color: var(--dp-ink-50); font-weight: var(--dp-fw-regular); margin-right: 4px; }

.dp-drawer__remove {
  margin-top: var(--dp-s-3);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--dp-fs-sm);
  color: var(--dp-ink-50);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.dp-drawer__remove:hover { color: var(--dp-alert); }
.dp-drawer__remove:focus-visible { outline: 2px solid var(--dpx-fg-blue, var(--dp-blue)); outline-offset: 2px; }

/* --- Free shipping progress ----------------------------------------------- */
/* Sits directly under the header so it is the first thing read on open, and it is the
   one element in the drawer that changes as the cart does — hence the animated fill. */
.dp-drawer__ship {
  flex: 0 0 auto;
  padding: var(--dp-s-5) var(--dp-s-9) var(--dp-s-6);
  border-bottom: 1px solid var(--dp-hair-row);
  background: var(--dp-surface-alt);
}
.dp-drawer__shipTxt {
  margin: 0 0 var(--dp-s-3);
  font-size: var(--dp-fs-sm);
  line-height: 16px;
  letter-spacing: -.2px;
  color: var(--dp-ink-50);
}
.dp-drawer__shipTxt strong { color: var(--dp-ink); font-weight: var(--dp-fw-semi); }
.dp-drawer__shipTrack {
  height: 6px;
  border-radius: var(--dp-r-pill);
  background: var(--dpx-bg-a414676p1, rgba(46, 36, 30, .1));
  overflow: hidden;
}
.dp-drawer__shipFill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--dp-blue);
  transition: width .45s var(--dp-ease-cta);
}
.dp-drawer__ship.is-won .dp-drawer__shipTxt { color: var(--dp-ink); font-weight: var(--dp-fw-semi); }
.dp-drawer__ship.is-won .dp-drawer__shipFill { background: var(--dpx-bg-16a34a, #16A34A); }
@media (prefers-reduced-motion: reduce) {
  .dp-drawer__shipFill { transition: none; }
}

/* --- Upsells --------------------------------------------------------------- */
.dp-drawer__upsells {
  flex: 0 0 auto;
  padding: var(--dp-s-6) var(--dp-s-9);
  border-top: 1px solid var(--dp-hair-row);
  background: var(--dp-surface-alt);
}
.dp-drawer__upsellsH {
  margin: 0 0 var(--dp-s-5);
  font-size: 11px;
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.1px;
  text-transform: uppercase;
  color: var(--dp-ink-50);
}
.dp-drawer__upsell {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--dp-s-5);
}
.dp-drawer__upsell + .dp-drawer__upsell { margin-top: var(--dp-s-5); }
.dp-drawer__upsellImg {
  width: 40px; height: 40px;
  border-radius: var(--dp-r-4xs);
  background: var(--dp-surface);
  overflow: hidden;
}
.dp-drawer__upsellImg img { width: 100%; height: 100%; object-fit: contain; }
.dp-drawer__upsellTxt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dp-drawer__upsellName {
  font-size: var(--dp-fs-sm);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.2px;
  color: var(--dp-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dp-drawer__upsellName:hover { color: var(--dpx-fg-blue, var(--dp-blue)); }
.dp-drawer__upsellPrice { font-size: 11px; color: var(--dp-ink-50); letter-spacing: -.1px; }
.dp-drawer__from { text-transform: lowercase; }
.dp-drawer__upsellAdd {
  height: 28px;
  padding: 0 var(--dp-s-6);
  border: 1px solid var(--dpx-fg-blue, var(--dp-blue));
  border-radius: var(--dp-r-pill);
  background: var(--dp-surface);
  font-size: var(--dp-fs-sm);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.2px;
  color: var(--dpx-fg-blue, var(--dp-blue));
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .18s var(--dp-ease-cta), color .18s var(--dp-ease-cta);
}
.dp-drawer__upsellAdd:hover { background: var(--dp-blue); color: var(--dp-on-dark); }
.dp-drawer__upsellAdd:focus-visible { outline: 2px solid var(--dpx-fg-blue, var(--dp-blue)); outline-offset: 2px; }
.dp-drawer__upsellAdd[disabled] { opacity: .5; cursor: default; }

/* --- Foot ---------------------------------------------------------------- */
.dp-drawer__foot {
  flex: 0 0 auto;
  padding: var(--dp-s-9);
  border-top: 1px solid var(--dp-hair-row);
  background: var(--dp-surface);
}
.dp-drawer__sub {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--dp-s-5);
  font-size: var(--dp-fs-lg);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.32px;
  color: var(--dp-ink);
}
.dp-drawer__note {
  margin: var(--dp-s-2) 0 var(--dp-s-7);
  font-size: var(--dp-fs-sm);
  line-height: 16px;
  color: var(--dp-ink-50);
}

.dp-drawer__checkout {
  display: block;
  padding: 14px var(--dp-s-7);
  border-radius: var(--dp-r-pill);
  background: var(--dp-blue);
  color: var(--dp-on-dark);
  font-size: var(--dp-fs-base);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.28px;
  text-align: center;
  transition: background-color .2s var(--dp-ease-cta);
}
.dp-drawer__checkout:hover { background: var(--dpx-bg-0067d1, #bc3915); color: var(--dp-on-dark); }
.dp-drawer__checkout:focus-visible { outline: 2px solid var(--dp-ink); outline-offset: 2px; }

.dp-drawer__viewcart {
  display: block;
  margin-top: var(--dp-s-5);
  font-size: var(--dp-fs-base);
  font-weight: var(--dp-fw-medium);
  letter-spacing: -.28px;
  text-align: center;
  color: var(--dp-ink-50);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dp-drawer__viewcart:hover { color: var(--dpx-fg-blue, var(--dp-blue)); }

/* --- Empty --------------------------------------------------------------- */
.dp-drawer__empty {
  flex: 1 1 auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--dp-s-3);
  padding: var(--dp-s-12) var(--dp-s-9);
  text-align: center;
}
.dp-drawer__emptyh {
  margin: 0;
  font-size: var(--dp-fs-h3);
  font-weight: var(--dp-fw-semi);
  letter-spacing: -.4px;
  color: var(--dp-ink);
}
.dp-drawer__emptyb {
  margin: 0 0 var(--dp-s-5);
  font-size: var(--dp-fs-base);
  color: var(--dp-ink-50);
}

/* While the drawer is refreshing, dim it rather than replacing it with a spinner —
   the previous contents stay readable and the panel does not jump. */
.dp-drawer__body.is-busy { opacity: .55; pointer-events: none; transition: opacity .15s linear; }

/* --- Mobile -------------------------------------------------------------- */
@media (max-width: 480px) {
  .dp-drawer__panel { width: 100%; max-width: 100%; }
  .dp-drawer__head  { padding: var(--dp-s-7); }
  .dp-drawer__items { padding: var(--dp-s-7); }
  .dp-drawer__foot  { padding: var(--dp-s-7); }
}


/* ---------------------------------------------------------------------------
   Add-to-cart toast.
   Sits bottom-CENTRE, clear of the sticky add-to-cart bar on product pages, and
   carries its own "View cart" which opens the drawer rather than navigating —
   the point of adding without a reload is not to lose the page you were on.
   --------------------------------------------------------------------------- */
.dp-toast {
  position: fixed;
  /* Centred horizontally. The transform does double duty here — it carries the entrance
     animation AND the centring — so every state below has to keep the -50%, or the toast
     snaps to the left edge the moment it becomes visible. */
  left: 50%;
  bottom: 120px;                 /* above the sticky bar, which is 90 + 11 */
  z-index: 210;                  /* above the drawer scrim */
  max-width: calc(100vw - 32px);
  opacity: 0;
  transform: translate(-50%, 10px) scale(.98);
  transition: opacity .28s var(--dp-ease-cta), transform .28s var(--dp-ease-cta);
  pointer-events: none;
}
.dp-toast[hidden] { display: none; }
.dp-toast.is-live { opacity: 1; transform: translateX(-50%); pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  .dp-toast { transition: opacity .2s linear; transform: translateX(-50%); }
  .dp-toast.is-live { transform: translateX(-50%); }
}

.dp-toast__in {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--dp-s-5);
  padding: var(--dp-s-5) var(--dp-s-6);
  border: 1px solid var(--dp-hair-panel);
  border-radius: var(--dp-r-2xs);
  background: var(--dp-surface);
  box-shadow: 0 14px 40px var(--dpx-shadow-a414676p16, rgba(46, 36, 30, .16));
}
.dp-toast__img {
  width: 40px; height: 40px;
  border-radius: var(--dp-r-4xs);
  background: var(--dp-surface-alt);
  overflow: hidden;
}
.dp-toast__img img { width: 100%; height: 100%; object-fit: contain; }
.dp-toast__txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dp-toast__title {
  font-size: var(--dp-fs-base); font-weight: var(--dp-fw-semi);
  letter-spacing: -.28px; color: var(--dp-ink);
}
.dp-toast__name {
  font-size: var(--dp-fs-sm); color: var(--dp-ink-50);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dp-toast__btn {
  height: 32px; padding: 0 var(--dp-s-7);
  border: 0; border-radius: var(--dp-r-pill);
  background: var(--dp-blue); color: var(--dp-on-dark);
  font-size: var(--dp-fs-sm); font-weight: var(--dp-fw-semi);
  letter-spacing: -.2px; cursor: pointer; white-space: nowrap;
  transition: background-color .18s var(--dp-ease-cta);
}
.dp-toast__btn:hover { background: var(--dpx-bg-0067d1, #bc3915); }
.dp-toast__btn:focus-visible { outline: 2px solid var(--dp-ink); outline-offset: 2px; }
.dp-toast__x {
  display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: var(--dp-r-pill);
  background: none; color: var(--dp-ink-50); cursor: pointer;
}
.dp-toast__x:hover { color: var(--dp-ink); }

/* A button mid-request should not look pressable. */
.single_add_to_cart_button.is-busy,
.dp-satc__btn.is-busy { opacity: .65; cursor: progress; }

@media (max-width: 809px) {
  /* Full width between 16px gutters on a phone — which IS centred, and reads better than
     a narrow pill. The horizontal translate MUST be cancelled here: with left:16px still
     applied, translateX(-50%) dragged the toast 179px off the left edge of the screen, where
     it was invisible but perfectly "shown". Only the vertical entrance offset survives. */
  .dp-toast { right: 16px; left: 16px; bottom: 196px; transform: translateY(10px) scale(.98); }   /* clear of the 164 mobile bar */
  .dp-toast.is-live { transform: none; }
  .dp-toast__in { grid-template-columns: auto minmax(0, 1fr) auto; }
  .dp-toast__x { display: none; }
}


/* Mobile AND reduced motion: the mobile block above is declared after the reduced-motion one,
   so it wins on file order and would reinstate the slide. Both states, spelled out. */
@media (max-width: 809px) and (prefers-reduced-motion: reduce) {
  .dp-toast,
  .dp-toast.is-live { transform: none; }
}
