/**
 * Appily Fortyseven — Seed Manifest cart
 * Dark dispatch board + settlement ribbon + boarding-pass lines + smart dock
 * Distinct from peer Appily list/sidebar cart patterns.
 */

.page-cart-manifest {
  --mf-ink: #1a121c;
  --mf-plum: #3d2b3f;
  --mf-deep: #160f1a;
  --mf-gold: #c9a86c;
  --mf-gold-soft: #e4d0a8;
  --mf-cream: #f7f2ec;
  --mf-sand: #efe6db;
  --mf-blush: #f3ebe6;
  --mf-muted: #8a7a84;
  --mf-line: rgba(201, 168, 108, 0.28);
  --mf-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mf-serif: 'Playfair Display', Georgia, serif;
  --mf-sans: 'Jost', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(201, 168, 108, 0.08) 0%, transparent 50%),
    var(--mf-cream);
  color: var(--mf-ink);
  font-family: var(--mf-sans);
}

.page-cart-manifest .page-main { padding-top: 0; }
.page-cart-manifest:has(.a47-mf-dock) { padding-bottom: 84px; }

.a47-mf { position: relative; }

/* ── Reveal ── */
.a47-mf-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s var(--mf-ease) calc(var(--a47-delay, 0) * 80ms),
    transform 0.75s var(--mf-ease) calc(var(--a47-delay, 0) * 80ms);
}
.a47-mf-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ════════════ DISPATCH BOARD ════════════ */
.a47-mf-board {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1.75rem, 4.5vw, 3rem) 0 0;
  background:
    radial-gradient(ellipse 65% 55% at 8% 40%, rgba(201, 168, 108, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 45% 40% at 92% 15%, rgba(92, 122, 74, 0.14) 0%, transparent 50%),
    linear-gradient(155deg, #21161f 0%, #2f2133 45%, #1a121c 100%);
  color: #fff;
}

.a47-mf-board-mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 25%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.a47-mf-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
  z-index: 0;
  animation: mfOrb 14s ease-in-out infinite alternate;
}
.a47-mf-orb--a {
  width: min(42vw, 360px);
  aspect-ratio: 1;
  top: -12%;
  right: 8%;
  background: rgba(201, 168, 108, 0.28);
}
.a47-mf-orb--b {
  width: min(36vw, 280px);
  aspect-ratio: 1;
  bottom: 10%;
  left: -4%;
  background: rgba(92, 122, 74, 0.22);
  animation-delay: -4s;
}
@keyframes mfOrb {
  to { transform: translate(18px, -12px) scale(1.08); }
}

.a47-mf-board-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.7fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: end;
  padding-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
}

.a47-mf-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mf-gold);
}
.a47-mf-kicker--ink { color: var(--mf-plum); }

.a47-mf-board-copy h1 {
  margin: 0 0 0.7rem;
  font-family: var(--mf-serif);
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: #fff;
}

.a47-mf-lede {
  margin: 0;
  max-width: 42ch;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.68);
}

.a47-mf-board-total {
  justify-self: end;
  text-align: right;
  padding: 1.15rem 1.35rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--mf-line);
  backdrop-filter: blur(12px);
  min-width: min(100%, 260px);
}
.a47-mf-board-total-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mf-gold-soft);
}
.a47-mf-board-total-value {
  display: block;
  font-family: var(--mf-serif);
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  font-weight: 700;
  line-height: 1;
  color: var(--mf-gold);
}
.a47-mf-board-total-meta {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.a47-mf-board-empty-mark {
  position: relative;
  justify-self: end;
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
}
.a47-mf-board-empty-mark em {
  position: relative;
  z-index: 1;
  font-family: var(--mf-serif);
  font-size: 2.4rem;
  font-style: normal;
  color: var(--mf-gold);
}
.a47-mf-pulse {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(201, 168, 108, 0.35);
  border-radius: 50%;
  animation: mfPulse 3.2s var(--mf-ease) infinite;
}
.a47-mf-pulse--delay { animation-delay: 1.1s; inset: 12%; }
@keyframes mfPulse {
  0% { transform: scale(0.82); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* Meter strip */
.a47-mf-meters {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}
.a47-mf-meters-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.a47-mf-meter {
  padding: 0.95rem 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.a47-mf-meter:last-child { border-right: 0; }
.a47-mf-meter em {
  display: block;
  margin-bottom: 0.25rem;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.a47-mf-meter strong {
  font-family: var(--mf-serif);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 700;
  color: #fff;
}

/* ════════════ STAGE ════════════ */
.a47-mf-stage {
  padding: clamp(1.75rem, 4vw, 2.75rem) 0 clamp(2.5rem, 5vw, 3.5rem);
}

.a47-mf-notice {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: #f8e8e8;
  border-left: 3px solid #a14a4a;
  color: #5a2a2a;
  font-size: 0.9rem;
}

/* Empty */
.a47-mf-empty {
  position: relative;
  text-align: center;
  padding: clamp(3rem, 8vw, 5rem) 1.5rem;
  background: #fff;
  border: 1px solid rgba(61, 43, 63, 0.08);
  overflow: hidden;
}
.a47-mf-empty-orbit {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
}
.a47-mf-empty-orbit span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(61, 43, 63, 0.12);
  border-radius: 50%;
  animation: mfOrbitSpin 12s linear infinite;
}
.a47-mf-empty-orbit span:nth-child(2) {
  inset: 16%;
  border-color: rgba(201, 168, 108, 0.45);
  animation-duration: 9s;
  animation-direction: reverse;
}
.a47-mf-empty-orbit span:nth-child(3) {
  inset: 34%;
  background: radial-gradient(circle, rgba(201, 168, 108, 0.35), transparent 70%);
  border: 0;
  animation: mfOrb 5s ease-in-out infinite alternate;
}
@keyframes mfOrbitSpin {
  to { transform: rotate(360deg); }
}
.a47-mf-empty h2 {
  margin: 0 0 0.5rem;
  font-family: var(--mf-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  color: var(--mf-plum);
}
.a47-mf-empty p {
  margin: 0 auto 1.5rem;
  max-width: 38ch;
  color: var(--mf-muted);
  line-height: 1.55;
}
.a47-mf-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

/* Settlement ribbon (not a sidebar) */
.a47-mf-settle {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto auto;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.25rem 1.4rem;
  background: linear-gradient(120deg, var(--mf-deep) 0%, var(--mf-plum) 100%);
  color: #fff;
  box-shadow: 0 22px 50px rgba(22, 15, 26, 0.18);
}
.a47-mf-settle-tag {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mf-gold);
}
.a47-mf-settle-copy h2 {
  margin: 0 0 0.35rem;
  font-family: var(--mf-serif);
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
}
.a47-mf-settle-copy p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.62);
}
.a47-mf-settle-copy em { color: var(--mf-gold-soft); font-style: italic; }

.a47-mf-settle-figures {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  min-width: 160px;
}
.a47-mf-settle-figures > div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 0.86rem;
}
.a47-mf-settle-figures dt {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
}
.a47-mf-settle-figures dd {
  margin: 0;
  font-weight: 700;
}
.a47-mf-settle-due {
  padding-top: 0.4rem;
  border-top: 1px solid rgba(201, 168, 108, 0.3);
  font-size: 1rem !important;
}
.a47-mf-settle-due dd { color: var(--mf-gold); font-family: var(--mf-serif); font-size: 1.2rem; }

.a47-mf-settle-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 200px;
}

/* Pass head */
.a47-mf-pass-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(61, 43, 63, 0.1);
}
.a47-mf-pass-head h2 {
  margin: 0.2rem 0 0;
  font-family: var(--mf-serif);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  color: var(--mf-plum);
}

/* Boarding passes */
.a47-mf-passes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.a47-mf-pass {
  display: grid;
  grid-template-columns: 52px 108px minmax(0, 1fr) auto auto;
  gap: 0;
  align-items: stretch;
  background: #fff;
  border: 1px solid rgba(61, 43, 63, 0.08);
  overflow: hidden;
  transition: transform 0.35s var(--mf-ease), box-shadow 0.35s var(--mf-ease);
}
.a47-mf-pass:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(42, 24, 48, 0.1);
}

.a47-mf-pass-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--mf-sand);
  border-right: 1px dashed rgba(61, 43, 63, 0.18);
  writing-mode: horizontal-tb;
}
.a47-mf-pass-spine span {
  font-family: var(--mf-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mf-plum);
  line-height: 1;
}
.a47-mf-pass-spine em {
  font-style: normal;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--mf-muted);
}

.a47-mf-pass-media {
  display: block;
  width: 108px;
  aspect-ratio: 1;
  background: var(--mf-blush);
  overflow: hidden;
}
.a47-mf-pass-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--mf-ease);
}
.a47-mf-pass:hover .a47-mf-pass-media img { transform: scale(1.06); }

.a47-mf-pass-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 1.15rem;
  min-width: 0;
}
.a47-mf-pass-body h3 {
  margin: 0 0 0.25rem;
  font-family: var(--mf-sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
.a47-mf-pass-body h3 a {
  color: var(--mf-ink);
  text-decoration: none;
}
.a47-mf-pass-body h3 a:hover { color: var(--mf-plum); }
.a47-mf-pass-variant {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--mf-muted);
}
.a47-mf-pass-unit {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mf-gold);
}
.a47-mf-pass-unit small {
  font-weight: 500;
  color: var(--mf-muted);
}

.a47-mf-pass-qty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  border-left: 1px solid rgba(61, 43, 63, 0.08);
  background: linear-gradient(180deg, #fffcf9 0%, #fff 100%);
}
.a47-mf-pass-qty-label {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mf-muted);
}
.a47-mf-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(61, 43, 63, 0.14);
  background: #fff;
}
.a47-mf-step {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--mf-plum);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.a47-mf-step:hover {
  background: var(--mf-plum);
  color: #fff;
}
.a47-mf-stepper input {
  width: 42px;
  height: 34px;
  border: 0;
  border-left: 1px solid rgba(61, 43, 63, 0.1);
  border-right: 1px solid rgba(61, 43, 63, 0.1);
  text-align: center;
  font-family: var(--mf-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mf-ink);
  background: transparent;
  -moz-appearance: textfield;
}
.a47-mf-stepper input::-webkit-outer-spin-button,
.a47-mf-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.a47-mf-pass-fare {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.25rem;
  min-width: 110px;
  padding: 0.85rem 1.15rem;
  background: var(--mf-deep);
  color: #fff;
}
.a47-mf-pass-fare span {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.a47-mf-pass-fare strong {
  font-family: var(--mf-serif);
  font-size: 1.15rem;
  color: var(--mf-gold);
}

/* Trust */
.a47-mf-trust {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.a47-mf-trust li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid rgba(61, 43, 63, 0.08);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mf-plum);
}
.a47-mf-trust li span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--mf-gold);
  box-shadow: 0 0 0 4px rgba(201, 168, 108, 0.18);
}

/* Buttons */
.a47-mf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.78rem 1.15rem;
  border: 1px solid transparent;
  font-family: var(--mf-sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}
.a47-mf-btn--sm { padding: 0.55rem 0.9rem; font-size: 0.7rem; }
.a47-mf-btn--gold {
  background: var(--mf-gold);
  color: var(--mf-deep);
}
.a47-mf-btn--gold:hover {
  background: var(--mf-gold-soft);
  transform: translateY(-1px);
}
.a47-mf-btn--outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.a47-mf-btn--outline:hover {
  border-color: var(--mf-gold);
  color: var(--mf-gold);
}
.a47-mf-btn--ghost {
  background: transparent;
  border-color: rgba(61, 43, 63, 0.16);
  color: var(--mf-plum);
}
.a47-mf-btn--ghost:hover {
  border-color: var(--mf-plum);
  background: rgba(61, 43, 63, 0.04);
}
.a47-mf-settle .a47-mf-btn--ghost {
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
}
.a47-mf-settle .a47-mf-btn--ghost:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.a47-mf-empty .a47-mf-btn--ghost {
  border-color: rgba(61, 43, 63, 0.16);
  color: var(--mf-plum);
}

/* Dock */
.a47-mf-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  transform: translateY(110%);
  transition: transform 0.35s var(--mf-ease);
  background: rgba(22, 15, 26, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(201, 168, 108, 0.25);
  color: #fff;
}
.a47-mf-dock.is-shown { transform: none; }
.a47-mf-dock-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}
.a47-mf-dock-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.a47-mf-dock-copy strong {
  font-family: var(--mf-serif);
  font-size: 1.25rem;
  color: var(--mf-gold);
}
.a47-mf-dock-copy span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

/* ════════════ RESPONSIVE ════════════ */
@media (max-width: 960px) {
  .a47-mf-board-inner {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .a47-mf-board-total,
  .a47-mf-board-empty-mark {
    justify-self: start;
    text-align: left;
  }
  .a47-mf-settle {
    grid-template-columns: 1fr;
  }
  .a47-mf-settle-actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }
  .a47-mf-settle-actions .a47-mf-btn--gold { flex: 1 1 auto; }
}

@media (max-width: 780px) {
  .a47-mf-meters-track { grid-template-columns: repeat(2, 1fr); }
  .a47-mf-meter:nth-child(2) { border-right: 0; }
  .a47-mf-meter:nth-child(3),
  .a47-mf-meter:nth-child(4) {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .a47-mf-pass {
    grid-template-columns: 44px 88px minmax(0, 1fr);
    grid-template-areas:
      "spine media body"
      "spine media qty"
      "fare fare fare";
  }
  .a47-mf-pass-spine { grid-area: spine; }
  .a47-mf-pass-media { grid-area: media; width: 88px; }
  .a47-mf-pass-body { grid-area: body; padding: 0.85rem 0.9rem 0.35rem; }
  .a47-mf-pass-qty {
    grid-area: qty;
    flex-direction: row;
    justify-content: flex-start;
    border-left: 0;
    padding: 0.35rem 0.9rem 0.85rem;
    background: transparent;
  }
  .a47-mf-pass-fare {
    grid-area: fare;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
  }
  .a47-mf-trust { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .a47-mf-pass {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-areas:
      "media body"
      "media qty"
      "fare fare";
  }
  .a47-mf-pass-spine { display: none; }
  .a47-mf-pass-media { width: 72px; }
  .a47-mf-settle-actions { flex-direction: column; }
  .a47-mf-settle-actions .a47-mf-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .a47-mf-reveal,
  .a47-mf-pass,
  .a47-mf-orb,
  .a47-mf-pulse,
  .a47-mf-empty-orbit span,
  .a47-mf-dock {
    animation: none !important;
    transition: none !important;
  }
  .a47-mf-reveal {
    opacity: 1;
    transform: none;
  }
  .a47-mf-dock { transform: none; }
}
