/**
 * ambe traders — Seed Hold Ledger (cart)
 * Unique layout: dark split hero + manifest ledger rows
 * + glass checkout ticket + mobile dock bar
 */

.page-cart-hold {
  --hd-ink: #0E1F18;
  --hd-forest: #0B3D2E;
  --hd-deep: #041912;
  --hd-mid: #1A5C45;
  --hd-lime: #C8E86C;
  --hd-gold: #E8C547;
  --hd-cream: #F7F9F4;
  --hd-paper: #FFFFFF;
  --hd-muted: #5C6F64;
  --hd-line: rgba(11, 61, 46, 0.1);
  --hd-glass: rgba(255, 255, 255, 0.94);
  --hd-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hd-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--hd-cream);
}

.page-cart-hold .page-main {
  padding-top: 0;
  overflow-x: clip;
}

.a51-hold { padding-bottom: 5.5rem; }

/* ——— Reveal ——— */
.a51-hold-reveal,
.a51-bay-reveal,
.a51-satchel-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s var(--hd-ease), transform 0.65s var(--hd-ease);
}

.a51-hold-reveal.is-visible,
.a51-bay-reveal.is-visible,
.a51-satchel-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ——— Hero ——— */
.a51-hold-hero {
  position: relative;
  padding: clamp(2.4rem, 5.5vw, 3.8rem) 0 clamp(2.8rem, 6vw, 4rem);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}

.a51-hold-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(480px 260px at 88% 72%, rgba(200, 232, 108, 0.12), transparent 58%),
    conic-gradient(from 230deg at 18% 22%, rgba(232, 197, 71, 0.2), transparent 40%),
    linear-gradient(128deg, var(--hd-deep) 0%, var(--hd-forest) 54%, #134832 100%);
}

.a51-hold-hero-bg::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--hd-cream);
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 70%);
}

.a51-hold-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.15fr auto;
  gap: clamp(1.25rem, 4vw, 2.25rem);
  align-items: end;
}

.a51-hold-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(200, 232, 108, 0.92);
}

.a51-hold-hero-copy h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2rem, 4.8vw, 3.35rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.a51-hold-hero-copy h1 em {
  font-style: normal;
  color: var(--hd-lime);
}

.a51-hold-lede {
  margin: 0;
  max-width: 44ch;
  font-size: 1.02rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.76);
}

.a51-hold-stats {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.a51-hold-stat {
  min-width: 92px;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  text-align: center;
}

.a51-hold-stat strong {
  display: block;
  font-family: var(--a51-font-display, 'Cormorant Garamond', serif);
  font-size: 1.22rem;
  color: #fff;
  line-height: 1.1;
}

.a51-hold-stat span {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.a51-hold-stat--accent {
  background: rgba(200, 232, 108, 0.16);
  border-color: rgba(200, 232, 108, 0.35);
}

.a51-hold-stat--accent strong {
  color: var(--hd-lime);
}

.a51-hold-tag {
  display: inline-flex;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(200, 232, 108, 0.28);
  color: var(--hd-forest);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ——— Stage ——— */
.a51-hold-stage {
  position: relative;
  margin-top: -1.5rem;
  z-index: 2;
}

/* ——— Flash ——— */
.a51-hold-flash,
.a51-bay-flash,
.a51-satchel-flash {
  margin: 0 0 1rem;
  padding: 0.85rem 1.05rem;
  border-radius: 16px;
  font-weight: 700;
  font-size: 0.92rem;
}

.a51-bay-flash--ok,
.a51-hold-flash.a51-bay-flash--ok {
  background: rgba(200, 232, 108, 0.35);
  color: var(--hd-forest);
}

.a51-bay-flash--err,
.a51-hold-flash.a51-bay-flash--err {
  background: #fde8e8;
  color: #8a1f1f;
}

/* ——— Empty ——— */
.a51-hold-empty {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.75rem;
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2rem);
  border-radius: 24px;
  background: var(--hd-paper);
  border: 1px dashed rgba(11, 61, 46, 0.22);
  box-shadow: 0 20px 48px rgba(11, 61, 46, 0.07);
}

.a51-hold-empty-visual {
  position: relative;
  width: 140px;
  height: 100px;
  display: grid;
  place-items: center;
}

.a51-hold-empty-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  height: 4px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    var(--hd-line) 0 12px,
    transparent 12px 20px
  );
}

.a51-hold-empty-packet {
  width: 56px;
  height: 68px;
  border-radius: 14px 14px 18px 18px;
  background: linear-gradient(155deg, var(--hd-mid), var(--hd-deep));
  box-shadow: 0 14px 32px rgba(11, 61, 46, 0.25);
  position: relative;
  animation: a51HdFloat 3s ease-in-out infinite alternate;
}

.a51-hold-empty-packet::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 12px;
  right: 12px;
  height: 14px;
  border: 2px solid var(--hd-lime);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

@keyframes a51HdFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.a51-hold-empty-copy h2 {
  margin: 0.45rem 0 0.5rem;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
}

.a51-hold-empty-copy p {
  margin: 0 0 1.15rem;
  color: var(--hd-muted);
  max-width: 42ch;
}

.a51-hold-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.a51-hold-ghost {
  font-weight: 800;
  color: var(--hd-forest);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ——— Layout ——— */
.a51-hold-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(1rem, 2.5vw, 1.35rem);
  align-items: start;
}

.a51-hold-manifest {
  border-radius: 24px;
  background: var(--hd-paper);
  border: 1px solid var(--hd-line);
  box-shadow: 0 20px 48px rgba(11, 61, 46, 0.07);
  overflow: hidden;
}

.a51-hold-manifest-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
  padding: 1.25rem 1.35rem 1rem;
  background:
    linear-gradient(120deg, rgba(200, 232, 108, 0.14), transparent 55%),
    var(--hd-cream);
  border-bottom: 1px solid var(--hd-line);
}

.a51-hold-manifest-head h2 {
  margin: 0.4rem 0 0.25rem;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
}

.a51-hold-manifest-head p {
  margin: 0;
  color: var(--hd-muted);
  font-size: 0.88rem;
}

.a51-hold-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.a51-hold-pills li {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--hd-paper);
  border: 1px solid var(--hd-line);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--hd-mid);
}

.a51-hold-lines {
  list-style: none;
  margin: 0;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* ——— Ledger rows ——— */
.a51-hold-row,
.a51-bay-ticket,
.a51-satchel-sachet {
  display: grid;
  grid-template-columns: auto 88px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  background: var(--hd-cream);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-12px);
  transition:
    transform 0.28s var(--hd-snap),
    border-color 0.2s,
    box-shadow 0.28s,
    background 0.2s;
}

.a51-hold-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--hd-lime), var(--hd-gold));
  opacity: 0;
  transition: opacity 0.2s;
}

.a51-hold-row.is-visible,
.a51-bay-ticket.is-visible,
.a51-satchel-sachet.is-visible,
.a51-bay-ticket-reveal.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.55s var(--hd-ease) calc(var(--hold-i, var(--sachet-i, var(--bay-i, 0))) * 0.05s),
    transform 0.55s var(--hd-ease) calc(var(--hold-i, var(--sachet-i, var(--bay-i, 0))) * 0.05s),
    border-color 0.2s,
    box-shadow 0.28s,
    background 0.2s;
}

.a51-hold-row:hover {
  background: var(--hd-paper);
  border-color: rgba(200, 232, 108, 0.45);
  box-shadow: 0 12px 28px rgba(11, 61, 46, 0.08);
  transform: translateX(4px);
}

.a51-hold-row:hover::before {
  opacity: 1;
}

.a51-hold-row-index {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--hd-mid);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.a51-hold-row-media {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.a51-hold-row-frame {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(200, 232, 108, 0.25), rgba(26, 92, 69, 0.12));
  border: 1px solid var(--hd-line);
  transform: rotate(-3deg);
  transition: transform 0.35s var(--hd-ease);
}

.a51-hold-row-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  transition: transform 0.4s var(--hd-ease);
}

.a51-hold-row:hover .a51-hold-row-frame {
  transform: rotate(2deg) scale(1.04);
}

.a51-hold-row:hover .a51-hold-row-media img {
  transform: scale(1.05);
}

.a51-hold-row-body h3 {
  margin: 0 0 0.2rem;
  font-family: var(--a51-font-sans);
  font-size: 0.98rem;
  font-weight: 800;
}

.a51-hold-row-body h3 a:hover {
  color: var(--hd-forest);
}

.a51-hold-row-variant {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  color: var(--hd-muted);
}

.a51-hold-row-unit {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--hd-mid);
}

.a51-hold-row-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.a51-hold-qty,
.a51-bay-qty,
.a51-satchel-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.18rem;
  border-radius: 12px;
  background: var(--hd-paper);
  border: 1px solid var(--hd-line);
}

.a51-hold-qty-btn,
.a51-bay-qty-btn,
.a51-satchel-qty-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: var(--hd-cream);
  color: var(--hd-forest);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.a51-hold-qty-btn:hover {
  background: var(--hd-forest);
  color: var(--hd-lime);
}

.a51-hold-qty input,
.a51-bay-qty input,
.a51-satchel-qty input {
  width: 40px;
  border: 0;
  background: transparent;
  text-align: center;
  font: inherit;
  font-weight: 800;
  color: var(--hd-ink);
  outline: none;
}

.a51-hold-row-update {
  border: 0;
  background: transparent;
  color: var(--hd-mid);
  font-weight: 800;
  font-size: 0.76rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.a51-hold-row-total,
.a51-bay-ticket-total,
.a51-crate-line-total,
.a51-satchel-line-total {
  font-size: 1.05rem;
  color: var(--hd-forest);
  font-weight: 800;
}

/* ——— Checkout ticket ——— */
.a51-hold-ticket,
.a51-bay-dispatch,
.a51-satchel-seal {
  position: sticky;
  top: 100px;
  padding: 1.35rem 1.25rem 1.4rem;
  border-radius: 24px;
  background: var(--hd-glass);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 24px 56px rgba(11, 61, 46, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
}

.a51-hold-ticket-progress {
  margin-bottom: 1rem;
}

.a51-hold-ticket-progress small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hd-muted);
}

.a51-hold-gauge,
.a51-bay-gauge,
.a51-satchel-gauge {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--hd-line);
  overflow: hidden;
  position: relative;
}

.a51-hold-gauge::after,
.a51-bay-gauge::after,
.a51-satchel-gauge::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--satchel-gauge, var(--bay-gauge, 0)) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hd-lime), var(--hd-gold));
  transition: width 1s var(--hd-ease);
}

.a51-hold-ticket h2 {
  margin: 0.55rem 0 1rem;
  font-size: 1.35rem;
  color: var(--hd-ink);
}

.a51-hold-figures {
  margin: 0 0 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.a51-hold-figures > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  background: var(--hd-cream);
  border: 1px solid var(--hd-line);
}

.a51-hold-figures dt {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hd-muted);
}

.a51-hold-figures dd {
  margin: 0;
  font-weight: 800;
  color: var(--hd-ink);
}

.a51-hold-figures-total {
  background: rgba(200, 232, 108, 0.2) !important;
  border-color: rgba(200, 232, 108, 0.4) !important;
}

.a51-hold-figures-total dd {
  color: var(--hd-forest);
  font-size: 1.12rem;
}

.a51-hold-ticket-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.a51-hold-update-all {
  border: 1px solid var(--hd-line);
  background: transparent;
  color: var(--hd-muted);
  border-radius: 14px;
  padding: 0.68rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.a51-hold-update-all:hover {
  border-color: var(--hd-mid);
  color: var(--hd-forest);
}

.a51-hold-ship-note,
.a51-bay-ship-note,
.a51-satchel-ship-note {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  color: var(--hd-muted);
}

.a51-hold-ship-note em {
  color: var(--hd-forest);
  font-style: normal;
  font-weight: 800;
}

.a51-hold-form.is-updating {
  opacity: 0.72;
  pointer-events: none;
}

/* ——— Buttons ——— */
.a51-hold-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1.2rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s var(--hd-snap), box-shadow 0.25s, background 0.2s;
}

.a51-hold-btn--primary {
  background: var(--hd-forest);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11, 61, 46, 0.22);
}

.a51-hold-btn--primary:hover {
  transform: translateY(-2px);
  background: var(--hd-mid);
}

.a51-hold-ticket-actions .a51-hold-btn--primary {
  width: 100%;
}

.a51-hold-ticket-actions .a51-hold-ghost {
  text-align: center;
}

/* ——— Shortcuts ——— */
.a51-hold-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.a51-hold-shortcut {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.7rem;
  row-gap: 0.08rem;
  padding: 1rem 1.05rem;
  border-radius: 20px;
  background: var(--hd-paper);
  border: 1px solid var(--hd-line);
  transition: transform 0.28s var(--hd-snap), border-color 0.2s, box-shadow 0.28s;
}

.a51-hold-shortcut:hover {
  transform: translateY(-4px);
  border-color: rgba(200, 232, 108, 0.55);
  box-shadow: 0 16px 36px rgba(11, 61, 46, 0.1);
}

.a51-hold-shortcut span {
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 800;
  font-size: 0.72rem;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--hd-forest);
  color: var(--hd-lime);
}

.a51-hold-shortcut strong {
  font-size: 0.92rem;
  color: var(--hd-ink);
}

.a51-hold-shortcut small {
  font-size: 0.76rem;
  color: var(--hd-muted);
}

/* ——— Mobile bar ——— */
.a51-hold-mobile,
.a51-bay-mobile-bar,
.a51-satchel-mobile-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: rgba(4, 25, 18, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(200, 232, 108, 0.25);
  color: #fff;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.a51-hold-mobile-copy strong {
  display: block;
  color: var(--hd-lime);
  font-size: 1.1rem;
}

.a51-hold-mobile-copy small {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.75rem;
}

/* ——— Responsive ——— */
@media (max-width: 960px) {
  .a51-hold-hero-grid,
  .a51-hold-layout,
  .a51-hold-empty {
    grid-template-columns: 1fr;
  }

  .a51-hold-ticket {
    position: relative;
    top: 0;
  }

  .a51-hold-row,
  .a51-bay-ticket,
  .a51-satchel-sachet {
    grid-template-columns: auto 76px 1fr;
  }

  .a51-hold-row-controls {
    grid-column: 2 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .a51-hold-shortcuts {
    grid-template-columns: 1fr 1fr;
  }

  .a51-hold-mobile,
  .a51-bay-mobile-bar,
  .a51-satchel-mobile-bar {
    display: flex;
  }
}

@media (max-width: 560px) {
  .a51-hold-row,
  .a51-bay-ticket,
  .a51-satchel-sachet {
    grid-template-columns: 72px 1fr;
  }

  .a51-hold-row-index {
    display: none;
  }

  .a51-hold-row-media {
    width: 72px;
    height: 72px;
  }

  .a51-hold-shortcuts {
    grid-template-columns: 1fr;
  }

  .a51-hold-empty-visual {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .a51-hold-empty-packet {
    animation: none !important;
  }

  .a51-hold-reveal,
  .a51-bay-reveal,
  .a51-satchel-reveal,
  .a51-hold-row,
  .a51-bay-ticket,
  .a51-satchel-sachet {
    opacity: 1 !important;
    transform: none !important;
  }
}
