/* =====================================================================
   PACKAGE VISUALS — animated mini-mockups at the top of each package card.
   Built by pkg-visuals.js. Each scene has 4 steps; elements with class
   .s1–.s4 appear as the scene reaches that step, then the scene loops.
   All brands shown are fictional samples.
   ===================================================================== */

.pkg-badge { z-index: 6; }

/* Two packages per row on desktop so the visuals are large enough to read */
@media (min-width: 761px) {
  .pkg-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
}

.pkg-visual {
  position: relative;
  margin: -30px -28px 22px;
  height: 236px; /* adjusted to the scene scale by pkg-visuals.js */
  overflow: hidden;
  background:
    radial-gradient(260px 160px at 85% 0%, rgba(225,138,166,0.18), transparent 70%),
    linear-gradient(160deg, #f7efe0, #efe2c8);
  border-bottom: 1px solid rgba(36,26,20,0.1);
  cursor: default;
}
.pkg-visual:empty { display: none; }
.pkg-featured .pkg-visual { margin: -30px -28px 22px; }
.pkg-dark .pkg-visual {
  background:
    radial-gradient(260px 160px at 85% 0%, rgba(225,138,166,0.22), transparent 70%),
    linear-gradient(160deg, #3a2a20, #241a14);
  border-bottom-color: rgba(255,255,255,0.1);
}

.pv-stage {
  position: absolute; top: 0; left: 50%;
  width: 360px; height: 198px;
  transform: translateX(-50%) scale(var(--pv-scale, 1));
  transform-origin: top center;
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  color: #2a211b;
}

/* ---- step reveal ---- */
.pv-el { position: absolute; opacity: 0; transform: translateY(10px); transition: opacity .55s ease, transform .55s cubic-bezier(.2,.8,.2,1); }
.pv-el.from-r { transform: translateX(22px); }
.pv-el.from-l { transform: translateX(-22px); }
.pv-el.pop { transform: scale(.82); }
.pv-el.d1 { transition-delay: .12s; } .pv-el.d2 { transition-delay: .24s; } .pv-el.d3 { transition-delay: .36s; }
.on-0 .s0, .on-1 .s1, .on-2 .s2, .on-3 .s3, .on-4 .s4 { opacity: 1; transform: none; }
.pv-in { opacity: 0; transition: opacity .5s ease; }
.on-1 .pv-in.s1, .on-2 .pv-in.s2, .on-3 .pv-in.s3, .on-4 .pv-in.s4 { opacity: 1; }
.pv-out { transition: opacity .4s ease; }
.on-2 .pv-out.s2, .on-3 .pv-out.s3, .on-4 .pv-out.s4 { opacity: 0; }

/* ---- caption bar ---- */
.pv-caption {
  position: absolute; left: 0; right: 0; bottom: 0; height: 38px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 16px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(36,26,20,0.08);
  font-size: 0.72rem;
}
.pkg-dark .pv-caption { background: rgba(255,255,255,0.06); border-top-color: rgba(255,255,255,0.1); }
.pv-label { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.pv-label small { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--khaki-dark); flex: none; }
.pv-label b { font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; transition: opacity .25s; }
.pkg-dark .pv-label small { color: var(--khaki); }
.pkg-dark .pv-label b { color: var(--cream); }
.pv-dots { display: flex; gap: 5px; flex: none; }
.pv-dot {
  width: 16px; height: 6px; border-radius: 3px; border: 0; padding: 0; cursor: pointer;
  background: rgba(36,26,20,0.15); position: relative; overflow: hidden;
}
.pkg-dark .pv-dot { background: rgba(255,255,255,0.18); }
.pv-dot::after { content: ""; position: absolute; inset: 0; width: 0; background: var(--rose); border-radius: 3px; }
.pv-dot.done::after { width: 100%; }
.pv-dot.active::after { width: 100%; transition: width var(--pv-step, 2.4s) linear; }
.pkg-visual.paused .pv-dot.active::after { transition: none; }
.pv-dot:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* Matching list item highlight */
.pkg-list li { transition: background-color .35s ease, color .35s ease; border-radius: 3px; }
.pkg-list li.pv-hl { background: rgba(201,113,140,0.1); }
.pkg-dark .pkg-list li.pv-hl { background: rgba(225,138,166,0.14); }

/* ---- mockup primitives ---- */
.pv-win { background: #fff; border-radius: 8px; box-shadow: 0 14px 30px -16px rgba(36,26,20,0.5); border: 1px solid rgba(36,26,20,0.12); overflow: hidden; }
.pv-bar { height: 15px; background: #f1ebe0; display: flex; align-items: center; gap: 3px; padding: 0 6px; border-bottom: 1px solid rgba(36,26,20,0.08); position: relative; }
.pv-bar i { width: 5px; height: 5px; border-radius: 50%; background: #d8cbb8; display: block; }
.pv-bar i:nth-child(1) { background: #e3a3a3; } .pv-bar i:nth-child(2) { background: #e6cf91; } .pv-bar i:nth-child(3) { background: #a9d3b9; }
.pv-url { margin-left: 6px; height: 9px; padding: 0 6px; border-radius: 5px; background: #fff; font-size: 6px; font-weight: 700; color: #7b6d62; display: flex; align-items: center; gap: 3px; }
.pv-card { background: #fff; border-radius: 7px; box-shadow: 0 12px 26px -14px rgba(36,26,20,0.5); border: 1px solid rgba(36,26,20,0.1); padding: 7px 8px; font-size: 7.5px; }
.pv-cap { font-size: 5.8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #9c8140; }
.pv-row { display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-top: 4px; font-weight: 700; }
.pv-tick { width: 9px; height: 9px; border-radius: 50%; background: #4f8f80; color: #fff; display: inline-grid; place-items: center; font-size: 6px; line-height: 1; }
.pv-pill { display: inline-block; font-size: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 5px; border-radius: 8px; }
.pv-btn { display: inline-block; font-size: 6px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 7px; border-radius: 2px; }
.pv-toast { background: #241a14; color: #f7efe0; border-radius: 6px; padding: 6px 9px; font-size: 7.5px; font-weight: 800; box-shadow: 0 12px 24px -10px rgba(0,0,0,.5); display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.pv-toast .pv-tick { background: #e18aa6; }
.pv-line { height: 4px; border-radius: 2px; background: #e6dccd; }
.pv-img { overflow: hidden; border-radius: 3px; }
.pv-img svg { display: block; width: 100%; height: 100%; }
.pv-bars { display: flex; align-items: flex-end; gap: 3px; height: 30px; margin-top: 5px; }
.pv-bars span { flex: 1; background: #c9718c; border-radius: 2px 2px 0 0; height: 4px; transition: height .8s cubic-bezier(.2,.8,.2,1); }
.on-4 .pv-bars span:nth-child(1) { height: 40%; } .on-4 .pv-bars span:nth-child(2) { height: 62%; transition-delay: .1s; }
.on-4 .pv-bars span:nth-child(3) { height: 50%; transition-delay: .2s; } .on-4 .pv-bars span:nth-child(4) { height: 88%; transition-delay: .3s; }
.pv-stars { color: #e3d8c6; letter-spacing: 1px; position: relative; display: inline-block; font-size: 7px; }
.pv-stars::after { content: "★★★★★"; position: absolute; left: 0; top: 0; color: #c79a3a; width: 0; overflow: hidden; transition: width .9s ease .2s; white-space: nowrap; }
.on-2 .pv-stars::after { width: 100%; }

/* swap: show .a until step, then .b */
.pv-swap { position: relative; display: inline-block; }
.pv-swap .b { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .4s; white-space: nowrap; }
.pv-swap .a { transition: opacity .4s; }
.on-1 .sw1 .a, .on-2 .sw2 .a, .on-3 .sw3 .a, .on-4 .sw4 .a { opacity: 0; }
.on-1 .sw1 .b, .on-2 .sw2 .b, .on-3 .sw3 .b, .on-4 .sw4 .b { opacity: 1; }
.pv-strike { text-decoration: line-through; color: #a0948a; }

/* traveling pulse (automations / engine) */
.pv-wire { position: absolute; height: 2px; background: rgba(36,26,20,0.18); }
.pv-wire::after { content: ""; position: absolute; top: -2px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #c9718c; box-shadow: 0 0 0 3px rgba(201,113,140,.25); animation: pv-travel 1.6s linear infinite; }
.pkg-visual.paused .pv-wire::after { animation-play-state: paused; }
@keyframes pv-travel { from { left: 0; } to { left: calc(100% - 6px); } }

/* migration packet flight */
.pv-packet { position: absolute; left: 112px; top: 74px; opacity: 0; }
.on-1 .pk1, .on-2 .pk2, .on-3 .pk3, .on-4 .pk4 { animation: pv-fly 1.5s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes pv-fly {
  0% { opacity: 0; transform: translateX(0); }
  15% { opacity: 1; }
  80% { opacity: 1; transform: translateX(86px); }
  100% { opacity: 0; transform: translateX(98px); }
}
.pv-meter { height: 4px; border-radius: 2px; background: #e8decd; overflow: hidden; flex: 1; }
.pv-meter span { display: block; height: 100%; width: 0; background: #4f8f80; transition: width 1.2s ease .5s; }
.on-1 .m1 span, .on-2 .m2 span, .on-3 .m3 span, .on-4 .m4 span { width: 100%; }

/* platform ticker */
.pv-ticker { height: 14px; overflow: hidden; position: relative; }
.pv-ticker div { animation: pv-tick 7.5s steps(1) infinite; }
.pv-ticker span { display: block; height: 14px; line-height: 14px; font-size: 9px; font-weight: 800; }
.pkg-visual.paused .pv-ticker div { animation-play-state: paused; }
@keyframes pv-tick { 0% { transform: translateY(0); } 20% { transform: translateY(-14px); } 40% { transform: translateY(-28px); } 60% { transform: translateY(-42px); } 80% { transform: translateY(-56px); } }

/* order dots flying into shared inventory */
.pv-orb { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #e18aa6; box-shadow: 0 0 0 3px rgba(225,138,166,.25); opacity: 0; }
.on-3 .orb-l { animation: pv-orb-l 2.4s ease-in-out infinite; }
.on-3 .orb-r { animation: pv-orb-r 2.4s ease-in-out .9s infinite; }
.pkg-visual.paused .pv-orb { animation-play-state: paused; }
@keyframes pv-orb-l { 0% { opacity: 0; left: 80px; top: 100px; } 15% { opacity: 1; } 70% { opacity: 1; left: 170px; top: 134px; } 85%, 100% { opacity: 0; left: 176px; top: 136px; } }
@keyframes pv-orb-r { 0% { opacity: 0; left: 280px; top: 100px; } 15% { opacity: 1; } 70% { opacity: 1; left: 190px; top: 134px; } 85%, 100% { opacity: 0; left: 184px; top: 136px; } }

/* Larger caption when the card is wide (2-up desktop layout) */
.pv-wide .pv-caption { height: 46px; padding: 0 22px; font-size: 0.86rem; }
.pv-wide .pv-label small { font-size: 0.68rem; }
.pv-wide .pv-dot { width: 22px; height: 7px; }

@media (max-width: 480px) {
  .pv-caption { padding: 0 12px; font-size: 0.68rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pv-el, .pv-in, .pv-bars span, .pv-meter span, .pv-stars::after, .pv-dot.active::after { transition: none !important; }
  .pv-wire::after, .pv-ticker div, .pv-orb, .pv-packet { animation: none !important; }
}

/* ---- Store Care Plan: visual sits on the left of the banner ---- */
.care-plan .pkg-visual {
  flex: 0 0 460px; align-self: flex-start;
  margin: -30px 0 -30px -32px;
  border-bottom: 0; border-right: 1px solid rgba(36,26,20,0.1);
}
.care-plan .care-text { flex: 1; }
@media (max-width: 1000px) {
  .care-plan { flex-wrap: wrap; }
  .care-plan .pkg-visual { flex: 1 1 100%; margin: -30px -32px 6px -32px; border-right: 0; border-bottom: 1px solid rgba(36,26,20,0.1); }
}
@media (max-width: 760px) {
  .care-plan .pkg-visual { flex: none; align-self: stretch; margin: -26px -22px 6px -22px; }
}
