/* PayManzo — Warm Market. "See it working": checkout widget, MoMo phone,
   market-crate showcase tiles. Default = static final frame; motion only
   under prefers-reduced-motion: no-preference and while on screen. */

.wm-demo-row { display: grid; gap: var(--space-8); margin-top: var(--space-6); align-items: center; justify-items: center; }
.wm-demo-row > * { min-width: 0; }
/* checkout + phone read as one centred composition, not two floating widgets */
@media (min-width: 900px) {
  .wm-demo-row { grid-template-columns: minmax(0, 440px) 260px; justify-content: center; column-gap: clamp(3rem, 2rem + 6vw, 8rem); }
  .wm-demo-row > .wm-co { margin-inline: 0; }
}

/* ---------- checkout widget ---------- */
.wm-co {
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  padding: var(--card-pad);
  background: var(--cream);
  border: var(--card-border);
  border-radius: var(--radius-soft);
  box-shadow: var(--card-shadow-lg);
}
.wm-co-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.wm-co-merchant { font-weight: 700; font-size: var(--text-sm); color: var(--cocoa-soft); }
.wm-co-amount { font: 800 clamp(1.9rem, 1.6rem + 1.2vw, 2.5rem)/1.1 var(--font-display); letter-spacing: -0.03em; }
.wm-co-secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--leaf-soft);
  border: 2px solid var(--cocoa);
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: var(--text-xs);
  white-space: nowrap;
}
.wm-co-secure svg { width: 13px; height: 13px; color: var(--wa); }
.wm-co-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: var(--space-5) 0 var(--space-4);
  padding: 4px;
  background: var(--sand);
  border: 2px solid var(--cocoa);
  border-radius: var(--radius-pill);
}
.wm-co-tab {
  position: relative;
  z-index: 1;
  min-height: var(--control-h);
  padding: 6px 4px;
  background: none;
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--cocoa-soft);
  font: 800 var(--text-sm) var(--font-body);
  cursor: pointer;
}
.wm-co-tab[aria-selected="true"] { color: var(--cocoa); }
.wm-co-tab:focus-visible { outline-offset: -3px; }
.wm-co-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  background: var(--ochre);
  border: 2px solid var(--cocoa);
  border-radius: var(--radius-pill);
  transform: translateX(calc(var(--tab-i, 0) * 100%));
  transition: transform var(--dur-mid) var(--ease-bounce);
}
.wm-co-panel { display: grid; gap: 7px; border-radius: 14px; }
.wm-co-panel:focus-visible { outline-offset: 4px; }
.wm-co-label { margin-top: var(--space-1); font-weight: 800; font-size: var(--text-xs); color: var(--cocoa-soft); }
.wm-co-nets { display: flex; flex-wrap: wrap; gap: 6px; }
.wm-net {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  background: #fff;
  border: 2px dashed var(--cocoa-soft);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: var(--text-xs);
  white-space: nowrap;
}
.wm-net::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--clay)); flex: none; }
.wm-net.is-on { border-style: solid; border-color: var(--cocoa); background: var(--leaf-soft); }
.wm-co-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 8px 14px;
  background: #fff;
  border: 2px solid var(--cocoa-soft);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.wm-co-cardno { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-co-brands { display: flex; gap: 4px; flex: none; }
.wm-co-brands i { padding: 2px 6px; border-radius: 6px; font-size: var(--text-2xs); font-weight: 800; font-style: italic; background: var(--sand); }
.wm-co-brands i + i { font-style: normal; background: var(--ochre-soft); }
.wm-co-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wm-co-btn {
  display: grid;
  place-items: center;
  min-height: var(--btn-h);
  margin-top: var(--space-2);
  padding: 8px;
  background: var(--clay-btn);
  color: #fff;
  border: 2px solid var(--cocoa);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-press);
  font-weight: 800;
  text-align: center;
}
.wm-co-note { font-size: var(--text-xs); color: var(--cocoa-soft); }
.wm-co-crypto { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin-top: 4px; }
.wm-co-qr { width: 84px; height: 84px; padding: 8px; background: #fff; border: 2px solid var(--cocoa); border-radius: 16px; color: var(--cocoa); }
.wm-co-meta { min-width: 0; }
.wm-co-addr { font-weight: 800; font-family: var(--font-code); }
.wm-co-caption { margin-top: var(--space-4); text-align: center; font-size: var(--text-xs); color: var(--cocoa-soft); font-style: italic; }

/* ---------- MoMo phone (cream screen, cocoa frame) ---------- */
.momo-phone {
  position: relative;
  width: 232px;
  max-width: 100%;
  margin: 0 auto var(--space-9); /* room for the absolute .mp-cap */
  padding: 12px;
  background: var(--cocoa);
  border-radius: 40px;
  box-shadow: var(--shadow-warm), var(--card-shadow-lg-ochre);
}
.momo-phone::before { content: ""; position: absolute; top: 18px; left: 50%; width: 54px; height: 12px; margin-left: -27px; border-radius: 99px; background: #1F130C; z-index: 3; }
.momo-phone-screen {
  position: relative;
  height: 390px;
  padding: 36px 14px 14px;
  background: var(--cream);
  border-radius: 30px;
  overflow: hidden;
}
.mp-bar { position: absolute; top: 10px; left: 18px; right: 18px; display: flex; justify-content: space-between; font-size: var(--text-2xs); font-weight: 800; color: var(--cocoa-soft); }
.mp-card {
  position: absolute;
  left: 14px;
  right: 14px;
  padding: 14px;
  border: 2px solid var(--cocoa);
  border-radius: 20px;
  font-size: var(--text-xs);
  line-height: 1.4;
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) var(--ease-bounce);
}
.mp-checkout { top: 40px; background: #fff; text-align: center; }
.mp-shop { font-weight: 700; color: var(--cocoa-soft); }
.mp-amt { font: 800 1.7rem/1.15 var(--font-display); }
.mp-meta { font-weight: 700; color: var(--wa); }
.mp-prompt { top: 150px; background: var(--ochre-soft); opacity: 0; transform: translateY(24px); }
.mp-prompt .chip { min-height: 28px; padding: 2px 10px 2px 6px; font-size: var(--text-2xs); margin-bottom: var(--space-2); }
.mp-pin { display: flex; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.mp-pin i { position: relative; width: 12px; height: 12px; border: 2px solid var(--cocoa); border-radius: 50%; }
.mp-pin i::after { content: ""; position: absolute; inset: 1px; border-radius: 50%; background: var(--cocoa); opacity: 0; transition: opacity 150ms ease; }
.mp-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; text-align: center; font-weight: 800; }
.mp-btns span { padding: 5px; border: 2px solid var(--cocoa); border-radius: 99px; background: var(--cream); }
.mp-btns .go { background: var(--leaf); color: #fff; }
.mp-done { top: 150px; background: var(--leaf-soft); text-align: center; opacity: 0; transform: translateY(24px) scale(0.96); }
.mp-done-title { font: 800 1.05rem/1.2 var(--font-display); color: var(--wa); margin-bottom: 4px; }
.mp-cap {
  position: absolute;
  left: 50%;
  bottom: -40px;
  padding: 4px 14px;
  background: var(--cream);
  border: 2px solid var(--cocoa);
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: var(--text-xs);
  white-space: nowrap;
  transform: translateX(-50%);
}
/* states */
.momo-phone-screen[data-state="prompt"] .mp-prompt,
.momo-phone-screen[data-state="pin"] .mp-prompt { opacity: 1; transform: none; }
.momo-phone-screen[data-state="pin"] .mp-pin i::after,
.momo-phone-screen[data-state="done"] .mp-pin i::after { opacity: 1; }
.momo-phone-screen[data-state="pin"] .mp-pin i:nth-child(2)::after { transition-delay: 150ms; }
.momo-phone-screen[data-state="pin"] .mp-pin i:nth-child(3)::after { transition-delay: 300ms; }
.momo-phone-screen[data-state="pin"] .mp-pin i:nth-child(4)::after { transition-delay: 450ms; }
.momo-phone-screen[data-state="done"] .mp-done { opacity: 1; transform: none; }
.momo-phone-screen[data-state="done"] .mp-checkout { opacity: 0.55; }

/* ---------- showcase: market crates ---------- */
.wm-show { display: grid; gap: var(--card-gap); margin-top: var(--space-9); }
@media (min-width: 640px) {
  .wm-show { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "card qr" "spark qr" "map map" "hook hook" "cal link"; }
}
@media (min-width: 1040px) {
  .wm-show { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "card qr map map" "spark qr map map" "hook hook cal link"; }
}
@media (min-width: 640px) {
  .wm-t-card { grid-area: card; } .wm-t-qr { grid-area: qr; } .wm-t-spark { grid-area: spark; } .wm-t-map { grid-area: map; }
  .wm-t-hook { grid-area: hook; } .wm-t-cal { grid-area: cal; } .wm-t-link { grid-area: link; }
}
.wm-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  overflow: hidden;
  padding: var(--card-pad);
  background: var(--sand);
  border: var(--card-border);
  border-radius: var(--radius-soft);
  box-shadow: var(--card-shadow);
  transition: transform var(--dur-mid) var(--ease-bounce);
}
.wm-tile:hover { transform: translateY(-3px); }
.wm-tile h3 { font-size: var(--text-h4); line-height: var(--leading-snug); }
.wm-tile-text p, .wm-hook-sub { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--cocoa-soft); }
.wm-t-qr, .wm-t-cal { background: var(--ochre-soft); }
.wm-t-map, .wm-t-link { background: var(--leaf-soft); }
.wm-t-hook { background: var(--sand-2); }

/* card flip */
.wm-t-card { justify-content: space-between; }
.wm-flip { width: 100%; max-width: 260px; margin-inline: auto; aspect-ratio: 1.586; perspective: 900px; }
.wm-flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.wm-flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  border: 2px solid var(--cocoa);
  border-radius: 16px;
  color: var(--cream);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.wm-flip-front { background: linear-gradient(135deg, var(--clay) 0%, var(--clay-deep) 100%); }
.wm-flip-back { padding-inline: 0; background: var(--wood-dark); transform: rotateY(180deg); }
.wm-card-chip { width: 34px; height: 25px; border-radius: 6px; background: var(--ochre); border: 2px solid rgba(58, 36, 24, 0.4); }
.wm-card-num { font-weight: 800; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.wm-card-brand { align-self: flex-end; font-size: var(--text-xs); font-weight: 800; font-style: italic; }
.wm-stripe { height: 30px; margin-top: 4px; background: var(--cocoa); }
.wm-secure { align-self: center; margin-bottom: 14px; padding: 4px 12px; background: var(--cream); color: var(--wa); border-radius: 99px; font-size: var(--text-xs); font-weight: 800; }

/* QR */
.wm-t-qr { justify-content: space-between; }
.wm-qr { display: grid; justify-items: center; gap: var(--space-3); margin-block: auto; }
.wm-qr-box { position: relative; width: 100%; max-width: 190px; padding: 12px; background: #fff; border: 2px solid var(--cocoa); border-radius: 20px; overflow: hidden; }
.wm-qr-svg { display: block; width: 100%; height: auto; aspect-ratio: 1; color: var(--cocoa); shape-rendering: crispEdges; }
.wm-qr-scan {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 70%, rgba(198, 93, 59, 0.25) 94%, var(--clay) 98%, transparent 100%);
  transform: translateY(-100%);
}
.wm-qr-tags { display: flex; gap: 6px; }
.wm-qr-tags span { padding: 3px 12px; border: 2px solid var(--cocoa); border-radius: 99px; background: var(--cream); font-size: var(--text-xs); font-weight: 800; }

/* sparkline */
.wm-spark { position: relative; height: 84px; margin-top: auto; }
.wm-spark svg { width: 100%; height: 100%; overflow: visible; }
.wm-spark-cover { position: absolute; inset: -6px -6px -6px 0; background: var(--sand); transform-origin: right center; transform: scaleX(0); }
.wm-spark-tag { position: absolute; right: 0; top: -6px; font-size: var(--text-2xs); font-weight: 800; color: var(--cocoa-soft); font-style: italic; }

/* map */
.wm-map { margin-block: auto; display: flex; justify-content: center; }
.wm-map-svg { width: 100%; max-width: 300px; height: auto; overflow: visible; }
.wm-map-svg .d { fill: var(--cocoa); opacity: 0.55; }
.wm-map-svg .hub { fill: var(--wood-dark); }
.wm-map-svg .gh { fill: var(--clay); }
.wm-map-svg .gh-ring { fill: none; stroke: var(--clay); stroke-width: 0.14; opacity: 0.7; transform-box: fill-box; transform-origin: center; }
@media (min-width: 640px) and (max-width: 1039px) { .wm-t-map { display: grid; grid-template-columns: 1fr 1fr; align-items: center; column-gap: var(--card-gap); } }
@media (min-width: 1040px) { .wm-map-svg { max-width: 360px; } }
@media (min-width: 640px) { .wm-qr-box { max-width: 220px; } } /* QR fills its double-height tile */

/* webhook log */
.wm-hook-head { display: flex; align-items: center; gap: 12px; }
.wm-ping { position: relative; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--leaf); }
.wm-ping i { position: absolute; inset: 0; border-radius: 50%; background: var(--leaf); opacity: 0; }
.wm-hook-sub { margin-top: calc(var(--space-2) - var(--space-4)); } /* h3 -> text = 8px, like the other tiles */
.wm-hook-log { list-style: none; display: grid; gap: 6px; margin-top: auto; font: var(--text-xs)/1.4 var(--font-code); }
.wm-hook-log li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 12px; overflow: hidden; white-space: nowrap; background: var(--cream); border: 2px dashed var(--cocoa-soft); border-radius: 14px; }
.wm-hook-log em { margin-left: auto; font-style: normal; color: var(--cocoa-soft); }
.wm-ok { padding: 1px 7px; border-radius: 8px; background: var(--leaf); color: #fff; font-weight: 800; }

/* calendar */
.wm-cal { width: 100%; max-width: 320px; margin: auto auto 0; }
.wm-cal-grid { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); }
.wm-cal-grid .day { position: relative; z-index: 1; display: grid; place-items: center; aspect-ratio: 1; font-size: var(--text-2xs); font-weight: 700; color: var(--cocoa-soft); }
.wm-cal-grid .day.bill { color: var(--cocoa); font-weight: 800; }
.wm-cal-grid .day.bill::after { content: ""; position: absolute; bottom: 10%; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--clay); opacity: var(--paid, 1); transition: opacity 300ms; }
.wm-cal-hi { position: absolute; left: 0; top: 0; z-index: 0; width: calc(100% / 7); height: 25%; padding: 2px; transform: translate(calc(var(--c, 0) * 100%), calc(var(--r, 2) * 100%)); transition: transform 520ms var(--ease-bounce); }
.wm-cal-hi::before { content: ""; display: block; width: 100%; height: 100%; border: 2px solid var(--cocoa); border-radius: 50%; background: var(--cream); }

/* chat */
.wm-chat { display: grid; gap: var(--space-2); margin-top: auto; font-size: var(--text-xs); }
.wm-bubble { max-width: 90%; padding: 8px 12px; border: 2px solid var(--cocoa); border-radius: 16px; }
.wm-bubble-in { justify-self: start; background: var(--cream); border-bottom-left-radius: 4px; }
.wm-bubble-out { display: grid; justify-self: end; background: #fff; border-bottom-right-radius: 4px; }
.wm-bubble-out > * { grid-area: 1 / 1; }
.wm-typing { display: flex; gap: 4px; align-items: center; opacity: 0; }
.wm-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cocoa-soft); }
.wm-bubble-link { display: grid; gap: 6px; color: var(--c-at); font-weight: 700; overflow-wrap: anywhere; }
.wm-bubble-link b { justify-self: start; padding: 3px 10px; border-radius: 99px; background: var(--wa); color: #fff; }

/* pause tile motion until the grid is on screen */
.wm-show:not(.is-live) *, .wm-show:not(.is-live) *::before, .wm-show:not(.is-live) *::after { animation-play-state: paused !important; }

@media (prefers-reduced-motion: no-preference) {
  .wm-flip-inner { animation: wm-flip 7s var(--ease-out) infinite both; }
  .wm-qr-scan { animation: wm-scan 3.2s cubic-bezier(0.45, 0, 0.55, 1) infinite both; }
  .wm-spark-cover { animation: wm-draw 6s ease-out infinite both; }
  .wm-map-svg .gh-ring { animation: wm-ring 2.4s ease-out infinite both; }
  .wm-map-svg .hub { animation: wm-blink 3s infinite both; }
  .wm-map-svg .hub:nth-of-type(2n) { animation-delay: 1.2s; }
  .wm-ping i { animation: wm-ping 1.8s ease-out infinite both; }
  .wm-hook-log li { animation: wm-log-in 6s var(--ease-out) infinite both; }
  .wm-hook-log li:nth-child(2) { animation-delay: 0.7s; }
  .wm-hook-log li:nth-child(3) { animation-delay: 1.4s; }
  .wm-typing { animation: wm-typing 6s infinite both; }
  .wm-typing i { animation: wm-dot 0.9s infinite both; }
  .wm-typing i:nth-child(2) { animation-delay: 0.15s; }
  .wm-typing i:nth-child(3) { animation-delay: 0.3s; }
  .wm-bubble-link { animation: wm-link-in 6s var(--ease-out) infinite both; }
}
@media (prefers-reduced-motion: reduce) {
  .mp-card, .wm-co-pill, .wm-cal-hi, .wm-tile { transition: none; }
}

@keyframes wm-flip { 0%, 35% { transform: rotateY(0); } 48%, 80% { transform: rotateY(180deg); } 93%, 100% { transform: rotateY(360deg); } }
@keyframes wm-scan { 0% { opacity: 0; transform: translateY(-100%); } 10% { opacity: 1; } 80% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(0); } }
@keyframes wm-draw { 0% { transform: scaleX(1); } 40%, 100% { transform: scaleX(0); } }
@keyframes wm-ring { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3.2); opacity: 0; } }
@keyframes wm-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes wm-ping { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(3); opacity: 0; } }
@keyframes wm-log-in { 0% { opacity: 0; transform: translateY(8px); } 8%, 82% { opacity: 1; transform: none; } 92%, 100% { opacity: 0; transform: none; } }
@keyframes wm-typing { 0%, 32% { opacity: 1; } 36%, 100% { opacity: 0; } }
@keyframes wm-dot { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-3px); opacity: 1; } }
@keyframes wm-link-in { 0%, 34% { opacity: 0; transform: translateY(6px) scale(0.97); } 40%, 92% { opacity: 1; transform: none; } 98%, 100% { opacity: 0; transform: none; } }
