/*
 * STRUCTURE AUDIT — cart families across Projects (layout / hierarchy; not palette):
 * 1. a36 / a97 default — vertical line list + sticky aside summary (desktop L/R); mobile dock.
 * 2. a119 / legacy tc-cart — same L/R list + summary column + dock.
 * 3. a115 platebundle — grid split with aside pb-tally (right column family).
 * 4. a109 sowtote / st-split — asymmetric split + sticky st-totals beside bins.
 * 5. a113 manila — sticky summary aside beside lines.
 * 6. a103 seedflat — flat cell grid + bottom drip score (summary below, not aside).
 * 7. a103 xylo — vertical chime lines + bottom resonance rail.
 * 8. a103 wheelbarrow — hose rows + footer score columns.
 * 9. a96 ledger — folio slip strips + bottom sticky tally ribbon.
 * 10. a97 belt / a115 belt — vertical plate stack + in-flow pass window.
 * 11. a102 / a105 skyhook — top sticky hook total; zigzag packet string.
 * 12. a100 blotter — book spread recto seal opposite list.
 * 13. a94 wiretag — horizontal wire tags + twine aside.
 * 14. a106 clip rail — horizontal hang rail + rail-end score split.
 * 15. a104 mulchcrate — crate slats grid + tag in second column.
 * 16. a37 — due strip first, then stacked glass lines (summary above list).
 * 17. a119 tg-cart — checkout STEPPER + summary HERO first + pack DRAWER tile grid (no aside).
 * 18. a110 harvestcrate / pouch / wheelbarrow — themed row + footer variants.
 * 19. a93 furrow / cloche — sidebar or tray cousins of L/R family.
 *
 * CHOSEN — DEW_BERTH_RAIL (bk-*) — Appily onehundredtwenty only; iso: a120-cart-iso.php
 * - Aisle-grouped horizontal packet rails + full-width bk-berth settlement deck.
 * - Mobile: rails become stacked compact pods; sticky bk-dock with total + checkout.
 * - Empty: SVG tray scene + three pick cards.
 */

.page-a120-cart {
  overflow-x: clip;
  background: linear-gradient(
    180deg,
    var(--at-canvas) 0%,
    color-mix(in srgb, var(--at-canvas-deep) 35%, var(--at-canvas)) 42%,
    var(--at-canvas) 100%
  );
}

.bk-cart {
  padding: var(--at-space-5) 0 var(--at-space-7);
  min-width: 0;
}

.bk-cart__inner {
  max-width: 46rem;
}

@media (min-width: 1024px) {
  .bk-cart__inner {
    max-width: 52rem;
  }
}

.page-a120-cart .bk-pod.ds-card {
  padding: 0;
  overflow: hidden;
}

.page-a120-cart .bk-pick.ds-card {
  padding: var(--at-space-3);
}

.bk-cart__notice {
  margin-bottom: var(--at-space-4);
  padding: 0.65rem 0.85rem;
  border-radius: var(--at-radius-md);
  background: color-mix(in srgb, var(--at-terra) 12%, var(--at-surface));
  border: 1px solid var(--at-line);
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
  font-weight: 600;
}

.bk-cart__mast {
  margin-bottom: var(--at-space-5);
  max-width: 40rem;
}

.bk-cart__mast .ds-lede {
  margin-top: var(--at-space-2);
}

/* —— Aisle rails —— */
.bk-aisle {
  margin-bottom: var(--at-space-5);
  min-width: 0;
}

.bk-aisle__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: var(--at-space-3);
  padding-bottom: var(--at-space-2);
  border-bottom: 1px solid color-mix(in srgb, var(--at-line) 70%, transparent);
}

.bk-aisle__title {
  margin: 0;
  font-family: var(--at-font-display);
  font-size: var(--at-text-lg);
  font-weight: 700;
  color: var(--at-ink);
}

.bk-aisle__count {
  margin: 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  color: var(--at-ink-soft);
}

.bk-rail {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--at-space-2);
  display: flex;
  flex-direction: column;
  gap: var(--at-space-3);
  min-width: 0;
}

.bk-pod {
  width: 100%;
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  grid-template-areas: "media body";
  align-items: stretch;
  min-width: 0;
  transition: opacity 0.25s var(--at-ease), transform 0.25s var(--at-ease);
}

.bk-pod.is-removing {
  opacity: 0.45;
  transform: scale(0.98);
}

.bk-pod__media {
  grid-area: media;
  display: block;
  overflow: hidden;
  border-radius: var(--at-radius-md) 0 0 var(--at-radius-md);
  background: var(--at-dew);
  min-height: 5.75rem;
}

.bk-pod__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s var(--at-ease);
}

.bk-pod__media:hover img,
.bk-pod__media:focus-visible img {
  transform: scale(1.03);
}

.bk-pod__ph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 5.75rem;
  background: linear-gradient(145deg, var(--at-dew), var(--at-canvas-deep));
}

.bk-pod__body {
  grid-area: body;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name name"
    "unit line"
    "qty remove"
    "undo undo";
  gap: 0.35rem 0.75rem;
  align-items: center;
  padding: var(--at-space-3) var(--at-space-3) var(--at-space-3) var(--at-space-2);
  min-width: 0;
}

.bk-pod__name {
  grid-area: name;
  margin: 0;
  font-family: var(--at-font-display);
  font-size: var(--at-text-sm);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.bk-pod__unit {
  grid-area: unit;
}

.bk-pod__qty {
  grid-area: qty;
}

.bk-pod__line {
  grid-area: line;
  text-align: right;
}

.bk-pod__remove {
  grid-area: remove;
  justify-self: end;
}

.bk-pod__undo {
  grid-area: undo;
}

.bk-pod__name a {
  color: inherit;
  text-decoration: none;
}

.bk-pod__name a:hover,
.bk-pod__name a:focus-visible {
  color: var(--at-moss);
  text-decoration: underline;
}

.bk-pod__unit {
  margin: 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  color: var(--at-ink-soft);
}

.bk-pod__qty {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--at-line);
  border-radius: var(--at-radius-pill);
  overflow: hidden;
  background: var(--at-canvas);
  align-self: flex-start;
}

.bk-pod__qty button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: var(--at-ink);
}

.bk-pod__qty button:hover {
  background: var(--at-dew);
}

.bk-pod__qty button:focus-visible {
  outline: 2px solid var(--at-moss);
  outline-offset: -2px;
}

.bk-pod__qty input {
  width: 2.75rem;
  min-height: 2.75rem;
  border: 0;
  text-align: center;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-md);
  font-weight: 600;
  background: transparent;
  -moz-appearance: textfield;
}

.bk-pod__qty input::-webkit-outer-spin-button,
.bk-pod__qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bk-pod__line {
  margin: 0;
  font-family: var(--at-font-ui);
  font-weight: 700;
  font-size: var(--at-text-md);
  color: var(--at-terra);
}

.bk-pod__line.is-flash {
  animation: bk-line-flash 0.45s var(--at-ease);
}

@keyframes bk-line-flash {
  0% { color: var(--at-terra); }
  40% { color: var(--at-moss); transform: scale(1.02); }
  100% { color: var(--at-terra); transform: scale(1); }
}

.bk-pod__remove {
  margin-top: 0;
  padding: 0.35rem 0.5rem;
  min-height: 2.75rem;
  border: 0;
  background: transparent;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  font-weight: 600;
  color: var(--at-ink-soft);
  text-decoration: underline;
  cursor: pointer;
}

.bk-pod__remove:hover,
.bk-pod__remove:focus-visible {
  color: var(--at-terra);
}

.bk-pod__undo {
  margin: 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.bk-pod__undo-btn {
  min-height: 2.75rem;
  padding: 0 0.65rem;
  border-radius: var(--at-radius-pill);
  border: 1px solid var(--at-line);
  background: var(--at-surface);
  font-weight: 600;
  cursor: pointer;
}

.bk-pod__undo-btn:focus-visible {
  outline: 2px solid var(--at-moss);
  outline-offset: 2px;
}

.bk-pod.is-removing .bk-pod__remove {
  display: none;
}

/* —— Berth settlement —— */
.bk-berth {
  margin-top: var(--at-space-6);
}

.bk-berth__panel {
  padding: var(--at-space-5);
  background: color-mix(in srgb, var(--at-moss) 8%, var(--at-surface));
  border-color: color-mix(in srgb, var(--at-moss) 22%, var(--at-line));
  box-shadow: var(--at-shadow-md);
}

.bk-berth__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--at-space-4);
  margin-bottom: var(--at-space-4);
}

.bk-berth__head .ds-title {
  font-size: var(--at-text-xl);
}

.bk-berth__ship {
  margin: var(--at-space-2) 0 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
  color: var(--at-ink-soft);
}

.bk-berth__due {
  margin: 0;
  text-align: right;
  font-family: var(--at-font-ui);
}

.bk-berth__due span {
  display: block;
  font-size: var(--at-text-xs);
  color: var(--at-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bk-berth__due strong {
  display: block;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  color: var(--at-terra);
  line-height: 1.1;
  transition: color 0.2s var(--at-ease), transform 0.2s var(--at-ease);
}

.bk-berth__due.is-flash strong {
  color: var(--at-moss);
  transform: scale(1.02);
}

.bk-berth__rows {
  display: grid;
  gap: var(--at-space-2);
  margin: 0 0 var(--at-space-5);
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
}

.bk-berth__rows > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.35rem;
  border-bottom: 1px dashed var(--at-line);
}

.bk-berth__rows dt {
  margin: 0;
  color: var(--at-ink-soft);
  font-weight: 500;
}

.bk-berth__rows dd {
  margin: 0;
  font-weight: 700;
}

.bk-berth__grand {
  border-bottom: 0;
  padding-top: var(--at-space-2);
  font-size: var(--at-text-md);
}

.bk-berth__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--at-space-3);
  align-items: center;
}

.bk-berth__checkout {
  flex: 1 1 12rem;
  min-height: 3rem;
  font-size: var(--at-text-md);
}

.bk-berth__actions .ds-btn--ghost {
  min-height: 2.75rem;
}

/* —— Mobile dock —— */
.bk-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 180;
  padding: var(--at-space-3) var(--at-gutter);
  padding-bottom: max(var(--at-space-3), env(safe-area-inset-bottom, 0px));
  gap: var(--at-space-3);
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--at-surface) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--at-line);
  box-shadow: 0 -8px 28px rgba(24, 36, 28, 0.12);
}

.bk-dock__sum {
  font-family: var(--at-font-ui);
  min-width: 0;
}

.bk-dock__sum span {
  display: block;
  font-size: var(--at-text-xs);
  color: var(--at-ink-soft);
}

.bk-dock__sum strong {
  font-size: var(--at-text-lg);
  color: var(--at-terra);
}

.bk-dock .ds-btn {
  min-height: 2.75rem;
  flex-shrink: 0;
}

/* —— Empty —— */
.page-a120-cart.is-empty .bk-cart__mast {
  margin-bottom: var(--at-space-4);
}

.page-a120-cart.is-empty .bk-cart__mast .ds-lede {
  max-width: 42ch;
}

.bk-empty {
  padding: 0 0 var(--at-space-7);
  min-width: 0;
}

.page-a120-cart .bk-empty__panel.ds-card {
  padding: var(--at-space-5) var(--at-space-4);
  max-width: 22.5rem;
  margin-inline: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--at-space-3);
  background: color-mix(in srgb, var(--at-surface) 94%, var(--at-canvas));
  border-color: color-mix(in srgb, var(--at-moss) 18%, var(--at-line));
}

.bk-empty__scene {
  color: var(--at-moss);
  margin: 0;
  line-height: 0;
}

.bk-empty__svg {
  width: min(100%, 9.5rem);
  height: auto;
  margin-inline: auto;
  display: block;
}

.bk-empty__title {
  margin: 0;
  font-family: var(--at-font-display);
  font-size: var(--at-text-lg);
  font-weight: 400;
  line-height: 1.2;
  color: var(--at-ink);
}

.bk-empty__lede {
  margin: 0;
  max-width: 30ch;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
  line-height: 1.45;
  color: var(--at-ink-soft);
}

.bk-empty__cta {
  margin-top: var(--at-space-1);
  min-height: 2.75rem;
  min-width: min(100%, 14rem);
  justify-content: center;
}

.bk-empty__picks {
  margin-top: var(--at-space-6);
  text-align: left;
  max-width: 36rem;
  margin-inline: auto;
}

.bk-empty__grid {
  list-style: none;
  margin: var(--at-space-3) 0 0;
  padding: 0;
  display: grid;
  gap: var(--at-space-3);
}

@media (min-width: 480px) {
  .bk-empty__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.bk-pick {
  display: flex;
  flex-direction: column;
  gap: var(--at-space-2);
  padding: var(--at-space-3);
  text-decoration: none;
  color: var(--at-ink);
  height: 100%;
}

.bk-pick img,
.bk-pick__ph {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--at-radius-md);
}

.bk-pick__ph {
  display: block;
  background: var(--at-dew);
}

.bk-pick__copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
}

.bk-pick__copy strong {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.bk-pick__copy em {
  font-style: normal;
  font-weight: 700;
  color: var(--at-terra);
}

@media (max-width: 767px) {
  .bk-dock {
    display: flex;
  }

  .page-a120-cart.is-filled .bk-cart {
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
  }

  .bk-berth__checkout {
    display: none;
  }

  .bk-berth__due {
    display: none;
  }

  .bk-pod__media img,
  .bk-pod__ph {
    width: 100%;
    height: 100%;
    min-height: 5.75rem;
    object-fit: cover;
  }
}

@media (min-width: 640px) {
  .bk-pod {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }

  .bk-pod__media {
    min-height: 7.5rem;
  }

  .bk-pod__ph {
    min-height: 7.5rem;
  }

  .bk-pod__media img,
  .bk-pod__ph {
    min-height: 7.5rem;
    height: 100%;
    object-fit: cover;
  }
}

@media (min-width: 768px) {
  .bk-berth__actions {
    flex-wrap: nowrap;
  }

  .bk-berth__actions .ds-btn--ghost {
    flex: 0 1 auto;
  }

  .bk-berth__checkout {
    flex: 1 1 14rem;
  }
}

@media (min-width: 1024px) {
  .bk-berth__panel {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(11rem, 14rem);
    grid-template-areas:
      "head head"
      "rows actions";
    gap: var(--at-space-4) var(--at-space-5);
    align-items: start;
  }

  .bk-berth__head {
    grid-area: head;
    margin-bottom: 0;
  }

  .bk-berth__rows {
    grid-area: rows;
    margin-bottom: 0;
  }

  .bk-berth__actions {
    grid-area: actions;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
  }

  .bk-berth__checkout {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bk-pod,
  .bk-pod__media img,
  .bk-berth__due strong,
  .bk-pod__line.is-flash {
    transition: none;
    animation: none;
  }
}
