/* =====================================================================
   Animated product cards — the same little scenes as the CRM's
   "See what CRM can do" tour. A card plays when it scrolls into view
   (js adds .play) and replays every few seconds while it stays visible.
   ===================================================================== */

.art-stage {
  --accent: #1a73e8;
  position: relative;
  height: 290px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(100% 80% at 100% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), color-mix(in srgb, var(--accent) 18%, var(--surface)));
  user-select: none;
  isolation: isolate;
}
.art-stage.tall {
  height: 360px;
}
.art-stage.round {
  border-radius: var(--radius);
}
.art-stage .glow {
  position: absolute;
  inset: -30%;
  z-index: -1;
  background: radial-gradient(40% 40% at 50% 55%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%);
  animation: artDrift 9s ease-in-out infinite alternate;
}
@keyframes artDrift {
  to {
    transform: translate(6%, -4%) scale(1.1);
  }
}
.art {
  position: absolute;
  inset: 0;
  color: var(--ink);
  font-family: var(--text);
}
/* Not on screen yet: hold every scene at its start. */
.art-stage:not(.play) .art,
.art-stage:not(.play) .art * {
  animation: none !important;
}
.art .ms {
  font-size: 20px;
}

.a-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.08);
}
.a-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 20px);
  animation: aToast 600ms var(--spring) forwards;
}
.a-toast .ms {
  font-size: 18px;
  color: var(--accent);
}
@keyframes aToast {
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@keyframes aPop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
}
@keyframes aPopSmall {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}
@keyframes aPopIn {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes aSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 1 · inbox: channels fly into one inbox */
.inbox .src {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  animation: aFly 1100ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.inbox .src .ms {
  font-size: 16px;
  color: var(--c);
}
.inbox .s0 { left: 6%; top: 18%; --dx: 120px; --dy: 60px; animation-delay: 200ms; }
.inbox .s1 { right: 6%; top: 16%; --dx: -110px; --dy: 66px; animation-delay: 580ms; }
.inbox .s2 { left: 4%; top: 60%; --dx: 130px; --dy: -20px; animation-delay: 960ms; }
.inbox .s3 { right: 4%; top: 62%; --dx: -120px; --dy: -24px; animation-delay: 1340ms; }
.inbox .box {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 230px;
  padding: 12px 14px;
  transform: translate(-50%, -50%);
  animation: aPop 600ms var(--spring) both;
}
.inbox .box-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.inbox .box-head .ms {
  font-size: 18px;
  color: var(--accent);
}
.inbox .count {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  animation: aPopSmall 400ms 1.6s var(--spring) both;
}
.inbox .row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  animation: aSlideIn 450ms var(--ease) forwards;
}
.inbox .row:nth-of-type(2) { animation-delay: 900ms; }
.inbox .row:nth-of-type(3) { animation-delay: 1280ms; }
.inbox .row:nth-of-type(4) { animation-delay: 1660ms; }
.inbox .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.inbox .a-toast {
  animation-delay: 2.4s;
}
@keyframes aFly {
  0% { opacity: 0; transform: scale(0.6); }
  25% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.4); }
}

/* 2 · pipeline: a deal glides across */
.pipeline {
  display: flex;
  gap: 10px;
  padding: 54px 18px 24px;
}
.pipeline .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 55%, transparent);
  backdrop-filter: blur(6px);
  animation: aSlideIn 500ms var(--ease) both;
}
.pipeline .col:nth-child(2) { animation-delay: 120ms; }
.pipeline .col:nth-child(3) { animation-delay: 240ms; }
.pipeline .col b {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.pipeline .ghost {
  height: 34px;
  border-radius: 10px;
  background: var(--card);
  opacity: 0.6;
}
.pipeline .ghost.short {
  width: 70%;
}
.pipeline .deal {
  position: absolute;
  top: 90px;
  left: 28px;
  width: calc((100% - 56px) / 3 - 20px);
  padding: 10px;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  animation: aTravel 3.4s 500ms cubic-bezier(0.65, 0, 0.35, 1) both;
}
.pipeline .deal-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline .deal-amt {
  font-size: 11px;
  color: var(--muted);
}
.pipeline .won {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #188038;
  color: #fff;
  display: grid;
  place-items: center;
  transform: scale(0);
  animation: aStamp 500ms 3.8s var(--spring) forwards;
}
.pipeline .won .ms {
  font-size: 16px;
}
.pipeline .spark {
  position: absolute;
  right: 18%;
  top: 108px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: aSpark 900ms 3.8s ease-out forwards;
}
@keyframes aTravel {
  0%, 12% { transform: none; }
  30% { transform: translate(0, -10px) rotate(-3deg) scale(1.05); }
  45%, 55% { transform: translate(calc(100% + 30px), 0); }
  65% { transform: translate(calc(100% + 30px), -10px) rotate(3deg) scale(1.05); }
  85%, 100% { transform: translate(calc(200% + 60px), 0); }
}
@keyframes aStamp {
  to { transform: scale(1); }
}
@keyframes aSpark {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(0); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(46px); }
}

/* 3 · quote on WhatsApp, M-Pesa paid */
.quote .phone-ui {
  position: absolute;
  left: 50%;
  top: 22px;
  width: 236px;
  padding: 10px;
  border-radius: 22px;
  transform: translateX(-50%);
  animation: aPhoneIn 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.quote .ph-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.quote .ph-head small {
  display: block;
  font-size: 10px;
  color: #188038;
}
.quote .av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #128c7e;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
}
.quote .doc {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px auto;
  width: 78%;
  padding: 8px 10px;
  border-radius: 12px 12px 4px 12px;
  background: #d9fdd3;
  color: #1f1f1f;
  font-size: 11px;
  opacity: 0;
  transform-origin: 100% 100%;
  animation: aBubble 500ms 600ms var(--spring) forwards;
}
.quote .doc .ms {
  color: #d93025;
}
.quote .doc small {
  display: block;
  color: #5f6368;
}
.quote .msg {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 12px 12px 12px 4px;
  background: var(--surface-2);
  font-size: 11px;
  opacity: 0;
  transform-origin: 0 100%;
  animation: aBubble 500ms 1.5s var(--spring) forwards;
}
.quote .mpesa {
  position: absolute;
  left: 50%;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 280px;
  max-width: calc(100% - 24px);
  padding: 10px 12px;
  opacity: 0;
  transform: translate(-50%, 30px);
  animation: aUp 700ms 2.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-size: 12px;
}
.quote .mpesa small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.quote .ok {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #188038;
  color: #fff;
  display: grid;
  place-items: center;
  animation: aOkPulse 1.4s 2.9s ease-out;
}
.quote .mtag {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #188038 16%, transparent);
  color: #188038;
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  animation: aPopIn 400ms 3.4s var(--spring) forwards;
}
@keyframes aPhoneIn {
  from { opacity: 0; transform: translate(-50%, 30px) rotate(-4deg); }
}
@keyframes aBubble {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: none; }
}
@keyframes aUp {
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes aOkPulse {
  from { box-shadow: 0 0 0 0 rgba(24, 128, 56, 0.5); }
  to { box-shadow: 0 0 0 14px rgba(24, 128, 56, 0); }
}

/* 4 · field check-in */
.field svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.field .road {
  fill: none;
  stroke: var(--card);
  stroke-width: 12;
  stroke-linecap: round;
  opacity: 0.9;
}
.field .trail {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: aDraw 2.2s 300ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.field .stop {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  animation: aPopSmall 500ms var(--spring) both;
}
.field .stop .ms {
  font-size: 18px;
}
.field .st0 { left: 6%; top: 66%; }
.field .st1 { left: 46%; top: 34%; animation-delay: 200ms; }
.field .pin {
  position: absolute;
  left: 80%;
  top: 12%;
  color: var(--accent);
  opacity: 0;
  transform: translateY(-40px);
  animation: aDrop 700ms 2.3s var(--spring) forwards;
}
.field .pin .ms {
  font-size: 44px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.3));
}
.field .ring {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 18px;
  height: 8px;
  margin-left: -9px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: aRipple 1.6s 2.9s ease-out infinite;
}
.field .ring.r2 {
  animation-delay: 3.7s;
}
.field .a-toast {
  animation-delay: 3.1s;
}
@keyframes aDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes aDrop {
  to { opacity: 1; transform: none; }
}
@keyframes aRipple {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(4); }
}

/* 5 · targets */
.targets {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 20px 20px;
}
.targets .ring-card {
  position: relative;
  width: 150px;
  height: 150px;
  padding: 12px;
  border-radius: 24px;
  animation: aPopSmall 600ms var(--spring) both;
}
.targets svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.targets circle {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}
.targets .track {
  stroke: var(--line);
}
.targets .fill {
  stroke: var(--accent);
  stroke-dasharray: 314;
  stroke-dashoffset: 56;
  animation: aRingFill 2s 400ms cubic-bezier(0.65, 0, 0.35, 1) both;
}
.targets .pct {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.targets .pct b {
  font: 600 26px/1.1 var(--font);
  animation: aPopIn 500ms 2.2s var(--spring) both;
}
.targets .pct small {
  font-size: 10px;
  color: var(--muted);
}
.targets .chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  width: 160px;
  height: 150px;
  padding: 34px 14px 14px;
  border-radius: 24px;
  animation: aSlideIn 600ms 150ms var(--ease) both;
}
.targets .bar {
  flex: 1;
  height: var(--h);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(to top, color-mix(in srgb, var(--accent) 45%, transparent), var(--accent));
  transform-origin: bottom;
  animation: aGrow 700ms var(--spring) both;
}
.targets .badge {
  position: absolute;
  top: 10px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #188038;
  animation: aPopIn 500ms 1.4s var(--spring) both;
}
.targets .badge .ms {
  font-size: 16px;
}
@keyframes aRingFill {
  from { stroke-dashoffset: 314; }
}
@keyframes aGrow {
  from { transform: scaleY(0); }
}

/* 6 · automation: when → if → then */
.auto {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 20px 50px;
}
.auto .rule {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 250px;
  max-width: 100%;
  padding: 10px 12px;
  font-size: 12.5px;
  opacity: 0;
  animation: aSlideIn 500ms var(--ease) forwards;
}
.auto .rule:nth-child(2) { animation-delay: 700ms; }
.auto .rule:nth-child(3) { animation-delay: 1400ms; }
.auto .rule b {
  flex: none;
  padding: 3px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.auto .rule .ms {
  margin-left: auto;
  font-size: 18px;
  color: var(--muted);
}
.auto .rule + .rule::before {
  content: '';
  position: absolute;
  left: 30px;
  top: -18px;
  width: 2px;
  height: 18px;
  background: var(--accent);
  transform-origin: top;
  animation: aGrowDown 300ms both;
  animation-delay: inherit;
}
.auto .rule.fire {
  animation: aSlideIn 500ms 1400ms var(--ease) forwards, aFire 900ms 2.2s ease-out;
}
@keyframes aGrowDown {
  from { transform: scaleY(0); }
}
@keyframes aFire {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  100% { box-shadow: 0 0 0 16px transparent; }
}
.auto .a-toast {
  animation-delay: 2.6s;
}

/* 7 · roles & data residency */
.secure .shield {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 60%, #fff), var(--accent));
  box-shadow: 0 12px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: aPopSmall 600ms var(--spring) both;
}
.secure .shield .ms {
  font-size: 44px;
}
.secure .halo {
  position: absolute;
  inset: -2px;
  border-radius: 28px;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: aRipple2 2s 700ms ease-out infinite;
}
@keyframes aRipple2 {
  from { opacity: 0.8; transform: scale(1); }
  to { opacity: 0; transform: scale(1.9); }
}
.secure .role {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  animation: aPopSmall 500ms var(--spring) both;
}
.secure .role .ms {
  font-size: 16px;
  color: var(--accent);
}
.secure .r0 { left: 8%; top: 16%; animation-delay: 600ms; }
.secure .r1 { right: 8%; top: 18%; animation-delay: 800ms; }
.secure .r2 { left: 6%; top: 58%; animation-delay: 1000ms; }
.secure .r3 { right: 6%; top: 60%; animation-delay: 1200ms; }
.secure .a-toast {
  animation-delay: 1.8s;
}

/* Copy that sits under an art stage */
.art-copy {
  padding: 22px 26px 26px;
}

@media (max-width: 700px) {
  .art-stage,
  .art-stage.tall {
    height: 270px;
  }
  .targets .ring-card,
  .targets .chart {
    width: 132px;
    height: 132px;
  }
  .inbox .src {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .art *,
  .art-stage .glow {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }
}
