/* ==========================================================================
   Cart drawer — "Tu pedido" (owned by the cart piece). Prefix: .ct-
   One decorative motif: plain hairlines. Type does the rest.
   Motion: only the functional drawer slide + backdrop fade (and image fade-in).
   ========================================================================== */
#cart {
  --ct-pad: 20px;
  --ct-w: 460px;
  --ct-thumb-w: 80px;
  --ct-radius: var(--radius-md); /* one surface radius: thumbs, notices; controls are pills */
  --ct-gap: 14px;
  --ct-hair: rgba(110, 33, 41, .13);
  --ct-hair-strong: rgba(110, 33, 41, .19);
  --ct-tray: var(--c-cream-100); /* the "what happens next" tray + footer share this one tone */
}
@media (min-width: 380px) { #cart { --ct-gap: 16px; --ct-thumb-w: 88px; } }
@media (min-width: 768px) { #cart { --ct-pad: 32px; --ct-thumb-w: 88px; --ct-gap: 18px; } }

#cart .ct {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
}

#cart .ct-backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
#cart .ct.is-open .ct-backdrop { opacity: 1; }

#cart .ct-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, var(--ct-w));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-in);
  outline: none;
  overflow: hidden;
}
#cart .ct.is-open .ct-panel {
  transform: none;
  transition: transform var(--dur-slow) var(--ease-out);
}

/* Header ------------------------------------------------------------------ */
#cart .ct-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: calc(var(--safe-top) + 18px) calc(var(--ct-pad) - 10px) 14px var(--ct-pad);
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
#cart .ct-panel.is-scrolled .ct-head { box-shadow: 0 1px 0 var(--ct-hair), 0 12px 20px -18px rgba(63, 18, 23, .3); }
#cart .ct-head__text {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 14px;
  min-width: 0;
}
#cart .ct-title {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: var(--fw-regular);
  line-height: 1.1;
  letter-spacing: -.015em;
  color: var(--color-text-brand);
}
#cart .ct-count {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1;
  color: var(--color-text-muted);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}
#cart .ct-close {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-brand);
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
#cart .ct-close svg { width: 22px; height: 22px; }
@media (hover: hover) { #cart .ct-close:hover { background: var(--c-blush-50); } }
#cart .ct-close:active { background: var(--c-blush-100); transform: scale(.94); }
#cart .ct-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Scrolling body -------------------------------------------------------- */
#cart .ct-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--ct-pad);
  scrollbar-width: thin;
  scrollbar-color: var(--c-cream-400) transparent;
}

/* Line items ------------------------------------------------------------ */
#cart .ct-list { flex: none; margin: 0; padding: 0; list-style: none; }

/* "¿Cómo sigue?" — follows the list at a fixed distance, as a short three-line timeline.
   It opens a tinted tray that runs on into the footer: whatever height is left over
   belongs to this tray (never a gap between the items and the steps). */
/* integration: when the drawer is taller than its content (one item on a laptop), the spare height
   stays white under the list and the tray sits on the footer, so "¿Cómo sigue?" → total → Continuar
   read as one block instead of a tinted tray with an empty band in it. */
#cart .ct-list:not(:empty) { margin-bottom: var(--space-6); }
#cart .ct-steps {
  flex: none;
  margin: auto calc(-1 * var(--ct-pad)) 0;
  padding: 16px var(--ct-pad) var(--space-4);
  background: var(--ct-tray);
  box-shadow: inset 0 1px 0 var(--ct-hair);
}
#cart .ct-steps[hidden] { display: none; }
#cart .ct-steps__title {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-brand);
}
#cart .ct-steps__list {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
#cart .ct-steps__list li {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  min-height: 22px;
}
/* The thread that ties the three numbers together */
#cart .ct-steps__list li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 10.5px;
  top: 22px;
  height: 6px;
  border-left: 1px solid var(--c-burgundy-200);
}
#cart .ct-steps__n {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--c-burgundy-200);
  background: var(--color-surface);
  font-family: var(--font-display);
  font-size: .75rem;
  font-weight: var(--fw-medium);
  line-height: 1;
  color: var(--color-text-brand);
  font-variant-numeric: lining-nums;
}
#cart .ct-steps__list li > span:last-child {
  font-size: .8125rem;
  line-height: 1.35;
  letter-spacing: .005em;
  color: var(--color-text-muted);
}

#cart .ct-item {
  display: grid;
  grid-template-columns: var(--ct-thumb-w) minmax(0, 1fr) auto;
  grid-template-areas:
    "media info    info"
    "media actions price"
    "media max     max";
  grid-template-rows: auto auto 1fr;
  column-gap: var(--ct-gap);
  padding: 16px 0;
  border-bottom: 1px solid var(--ct-hair);
}
#cart .ct-item:last-child { border-bottom: 0; }

#cart .ct-item__media {
  grid-area: media;
  align-self: start;
  position: relative;
  display: block;
  width: var(--ct-thumb-w);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: var(--ct-radius);
  overflow: hidden;
  background: var(--color-surface-sunken);
  cursor: pointer;
}
/* A hairline keeps pale photos from bleeding into the cream. */
#cart .ct-item__media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(63, 18, 23, .07);
  pointer-events: none;
}
#cart .ct-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
#cart .ct-item__media.is-loaded img { opacity: 1; }
#cart .ct-item__media.is-broken { background-size: 72% auto; }
#cart .ct-item__media.is-broken img { display: none; }

#cart .ct-item__info { grid-area: info; min-width: 0; }
#cart .ct-item__name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: var(--fw-medium);
  line-height: 1.2;
  letter-spacing: -.005em;
  color: var(--color-text);
  text-wrap: balance;
}
#cart .ct-item__link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  letter-spacing: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { #cart .ct-item__link:hover { text-decoration-color: var(--color-line-strong); } }
#cart .ct-item__link:focus-visible { outline: none; border-radius: 2px; box-shadow: var(--focus-ring); }

/* "22 cm · $ 29.000 c/u" — the unit price rides the size line (or stands alone when there is no size). */
#cart .ct-item__variant {
  margin-top: 2px;
  font-size: .8125rem;
  line-height: 1.4;
  letter-spacing: .01em;
  color: var(--color-text-muted);
}
#cart .ct-item__unit { font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
#cart .ct-item__unit:empty { display: none; }
#cart .ct-item__variant[hidden] { display: none; }
#cart .ct-item__label + .ct-item__unit::before { content: "·"; margin: 0 .45em; color: var(--c-ink-300); }

/* Money speaks the site's one voice: Jost, "$ 52.000", same as the menu, sheet and checkout. */
#cart .ct-item__price {
  grid-area: price;
  align-self: start;
  margin-top: 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: var(--fw-medium);
  line-height: 1.2;
  letter-spacing: .005em;
  color: var(--color-text);
  font-variant-numeric: lining-nums tabular-nums;
  text-align: right;
  margin-bottom: -6px;
  white-space: nowrap;
}

/* Stepper + Quitar follow the text at one fixed distance (10px to the visible pill), in every row:
   with or without a size line, with a one- or two-line name. The 44px hit areas overhang by 6px. */
#cart .ct-item__actions {
  grid-area: actions;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin: 4px 0 -6px;
}

#cart .ct-item__max {
  grid-area: max;
  margin-top: 8px;
  font-size: .75rem;
  line-height: 1.4;
  color: var(--color-text-brand);
}
#cart .ct-item__max[hidden] { display: none; }

/* Quantity: a hairline pill drawn inside full 44px buttons; fixed value width so pills align. */
#cart .ct-stepper {
  position: relative;
  margin-left: -6px; /* optical: the pill's edge, not the hit area, lines up with the name */
  border: 0;
  background: none;
}
#cart .ct-stepper::before {
  content: "";
  position: absolute;
  inset: 6px 6px;
  border: 1px solid var(--c-burgundy-200);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  pointer-events: none;
}
#cart .ct-stepper button {
  position: relative;
  width: var(--tap);
  height: var(--tap);
  border-radius: 0;
  background: none;
  color: var(--color-text-brand);
}
#cart .ct-stepper button::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: transparent;
  transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
#cart .ct-stepper button:first-child::before { left: 12px; right: 8px; }
#cart .ct-stepper button:last-child::before { left: 8px; right: 12px; }
#cart .ct-stepper button svg { position: relative; width: 12px; height: 12px; }
#cart .ct-stepper button:first-child svg { margin-left: 4px; }
#cart .ct-stepper button:last-child svg { margin-right: 4px; }
@media (hover: hover) {
  #cart .ct-stepper button:hover { background: none; }
  #cart .ct-stepper button:not(:disabled):hover::before { background: var(--c-blush-100); }
}
#cart .ct-stepper button:active { background: none; }
#cart .ct-stepper button:not(:disabled):active::before { background: var(--c-blush-200); }
#cart .ct-stepper button:disabled { color: var(--c-ink-300); cursor: default; }
#cart .ct-stepper button:disabled svg { opacity: .7; }
#cart .ct-stepper button:focus-visible { box-shadow: none; }
#cart .ct-stepper button:focus-visible::before { box-shadow: 0 0 0 2px var(--color-focus); }
#cart .ct-stepper .ds-stepper__value {
  position: relative;
  min-width: 2.4ch;
  font-size: .9375rem;
  font-weight: var(--fw-medium);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--color-text);
}

#cart .ct-remove {
  min-height: var(--tap);
  min-width: var(--tap);
  border: 0;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  background: none;
  text-align: center;
  font-size: .8125rem;
  letter-spacing: .02em;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-decoration-color: var(--color-line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: .3em;
  transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { #cart .ct-remove:hover { color: var(--color-text-brand); text-decoration-color: currentColor; } }
#cart .ct-remove:active { color: var(--color-accent-pressed); }
/* Inset ring: stays inside the content column instead of poking into the gutter. */
#cart .ct-remove:focus-visible { outline: none; color: var(--color-text-brand); box-shadow: inset 0 -2px 0 var(--color-focus); text-decoration-color: transparent; }

/* Undo notice, left where the removed line was */
#cart .ct-undo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 12px 0;
  padding: 0 6px 0 var(--space-4);
  border-radius: var(--ct-radius);
  background: var(--c-blush-50);
  box-shadow: inset 0 0 0 1px var(--c-blush-200);
  font-size: .8125rem;
  line-height: 1.4;
  color: var(--color-text-muted);
}
#cart .ct-undo p { min-width: 0; padding-block: 10px; }
#cart .ct-undo strong { font-weight: var(--fw-medium); color: var(--color-text); }
#cart .ct-undo__btn {
  flex: none;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font-size: .8125rem;
  font-weight: var(--fw-medium);
  letter-spacing: .02em;
  color: var(--color-text-brand);
  text-decoration: underline;
  text-underline-offset: .3em;
  text-decoration-thickness: 1px;
}
@media (hover: hover) { #cart .ct-undo__btn:hover { background: var(--c-blush-100); } }
#cart .ct-undo__btn:active { background: var(--c-blush-200); }
#cart .ct-undo__btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--color-focus); }
#cart .ct-undo-slot:empty { display: none; }
#cart .ct-undo-slot { flex: none; width: 100%; padding-top: 4px; text-align: left; }
#cart .ct-undo-slot .ct-undo { margin: 0; }

/* Footer: one total line + CTAs, always within thumb reach --------------- */
#cart .ct-foot {
  position: relative;
  padding: 14px var(--ct-pad) max(var(--space-2), var(--safe-bottom));
  background: var(--ct-tray);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
#cart .ct-panel.has-more .ct-foot { box-shadow: 0 -1px 0 var(--ct-hair), 0 -14px 24px -18px rgba(63, 18, 23, .2); }
#cart .ct[data-empty="true"] .ct-foot { background: var(--color-surface); }
#cart .ct-sum {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 14px;
}
#cart .ct-sum__label { display: grid; gap: 3px; min-width: 0; }
#cart .ct-sum__title {
  font-size: var(--text-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-brand);
}
#cart .ct-sum__note {
  font-size: .8125rem;
  line-height: 1.3;
  color: var(--color-text-muted);
}
#cart .ct-sum__total {
  font-family: var(--font-sans);
  font-size: 1.375rem;
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  letter-spacing: .005em;
  color: var(--color-text);
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

/* Reassurance: one line under the CTA, never a card cut by the footer. */
#cart .ct-assure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
  font-size: .75rem;
  line-height: 1.35;
  letter-spacing: .01em;
  color: var(--color-text-muted);
  text-align: center;
}
#cart .ct-assure svg { flex: none; width: 15px; height: 15px; color: var(--color-text-brand); }
#cart .ct-assure[hidden] { display: none; }

#cart .ct-cta { gap: var(--space-3); font-size: var(--text-base); letter-spacing: .04em; }
#cart .ct-cta svg { width: 20px; height: 20px; transition: transform var(--dur-fast) var(--ease-out); }
@media (hover: hover) { #cart .ct-cta:hover svg { transform: translateX(3px); } }

#cart .ct-more {
  display: block;
  margin: 0 auto;
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  font-size: .875rem;
  letter-spacing: .02em;
  color: var(--color-text-brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--color-line-strong);
  text-underline-offset: .32em;
  transition: text-decoration-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { #cart .ct-more:hover { text-decoration-color: currentColor; } }
#cart .ct-more:active { background: var(--c-blush-50); }
#cart .ct-more:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Empty state ------------------------------------------------------------ */
#cart .ct-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0 var(--space-2);
  text-align: center;
}
#cart .ct-empty__art { width: 168px; color: var(--color-text-brand); }
#cart .ct-empty__svg { width: 100%; height: auto; }
#cart .ct-empty__title {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: var(--fw-regular);
  line-height: 1.2;
  color: var(--color-text);
}
#cart .ct-empty__text {
  max-width: 32ch;
  margin-top: var(--space-2);
  text-wrap: balance;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

#cart .ct-picks { width: 100%; margin-top: var(--space-7); text-align: left; }
#cart .ct-picks__label {
  padding-bottom: 10px;
  font-size: var(--text-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-brand);
}
#cart .ct-picks__list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ct-hair); }
#cart .ct-picks__list li { border-bottom: 1px solid var(--ct-hair); }
#cart .ct-pick {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { #cart .ct-pick:hover .ct-pick__go { transform: translateX(3px); } #cart .ct-pick:hover .ct-pick__name { text-decoration-color: var(--color-line-strong); } }
#cart .ct-pick:active { background: var(--c-blush-50); }
#cart .ct-pick:focus-visible { outline: none; box-shadow: var(--focus-ring); }
#cart .ct-pick__media {
  position: relative;
  display: block;
  width: 44px;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface-sunken);
}
#cart .ct-pick__media img { width: 100%; height: 100%; object-fit: cover; }
#cart .ct-pick__media.ds-img-fallback { background-size: 80% auto; }
#cart .ct-pick__text { display: grid; gap: 1px; min-width: 0; }
#cart .ct-pick__name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: var(--fw-medium);
  line-height: 1.2;
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
#cart .ct-pick__price { font-size: .8125rem; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
#cart .ct-pick__go { color: var(--color-text-brand); transition: transform var(--dur-fast) var(--ease-out); }
#cart .ct-pick__go svg { width: 18px; height: 18px; }

/* Empty: center the content when there is room; auto margins collapse to 0 when it overflows,
   so nothing ever spills above the scroll origin (justify-content:center would). */
#cart .ct[data-empty="true"] .ct-body { display: flex; flex-direction: column; padding-bottom: var(--space-4); }
#cart .ct[data-empty="true"] .ct-empty { margin-block: auto; }
#cart .ct[data-empty="true"] .ct-foot { box-shadow: none; padding-top: var(--space-2); padding-bottom: max(var(--space-4), var(--safe-bottom)); }

/* Very small phones: tighter thumbnails so names keep two words a line. */
@media (max-width: 359px) {
  #cart { --ct-pad: 16px; --ct-thumb-w: 68px; --ct-gap: 12px; }
  #cart .ct-title { font-size: 1.625rem; }
}

/* Short phones (SE, 360×740, browser chrome showing): the total goes on one line and the
   delivery note steps aside — the "¿Cómo sigue?" tray already says it. Rows stay visible. */
@media (max-height: 820px) {
  #cart .ct-sum__note { display: none; }
  #cart .ct-sum { align-items: baseline; margin-bottom: 12px; }
  #cart .ct-sum__total { font-size: 1.25rem; }
  #cart .ct-foot { padding-top: 12px; }
  #cart .ct-assure { margin-top: 8px; }
  #cart .ct-head { padding-top: calc(var(--safe-top) + 12px); padding-bottom: 10px; }
}
@media (max-height: 560px) {
  #cart .ct-assure { display: none; }
}

@media (forced-colors: active) {
  #cart .ct-panel { border-left: 1px solid CanvasText; }
  #cart .ct-stepper::before { border-color: CanvasText; }
}
