/* Steps list */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 24px;
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.step {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

@media (min-width: 600px) and (max-width: 899px) {
  .step {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 28px;
  }

  .step .scene {
    grid-column: 1;
    grid-row: 1;
  }

  .step .step-text {
    grid-column: 2;
    grid-row: 1;
  }
}

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font: 600 13px var(--font-mono);
  display: grid;
  place-items: center;
  flex: none;
}

.step-text p {
  color: var(--body);
}

/* Scene shell */
.scene {
  position: relative;
  height: 300px;
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(11, 31, 26, .07);
  box-shadow: var(--gloss);
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--grain);
  opacity: .16;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.scene-photo {
  background: radial-gradient(120% 90% at 50% 0%, #f4f9ff 0%, #d9e8fa 58%, #bfd6f3 100%);
}

.scene-check {
  background: radial-gradient(110% 100% at 50% 35%, #fffef6 0%, #fdf4bd 52%, #f4dc5c 100%);
}

.scene-ok {
  background: radial-gradient(110% 100% at 50% 35%, #f3fbf7 0%, #caeedd 52%, #8ad6b2 100%);
}

.stage {
  position: absolute;
  top: 0;
  left: 50%;
  width: 280px;
  height: 300px;
  margin-left: -140px;
  z-index: 1;
}

/* Shared bits */
.chat-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

.s-tl {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: #d9d6cc;
  width: var(--w, 60%);
  margin-top: 6px;
}

.s-tl-head {
  height: 6px;
  width: 50%;
  background: #3d4a46;
  margin-top: 0;
}

.s-tl-bold {
  height: 5px;
  background: #6b6a63;
}

/* Scene 1: photo in */
.phone {
  position: absolute;
  left: 40px;
  top: 34px;
  width: 200px;
  height: 300px;
  padding: 5px;
  border-radius: 32px;
  background: var(--dark);
  box-shadow: 0 30px 50px -22px rgba(11,31,26,.45), inset 0 0 0 1px rgba(255,255,255,.10);
}

.phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 50px;
  height: 12px;
  margin-left: -25px;
  border-radius: 999px;
  background: var(--dark);
  z-index: 2;
}

.phone-screen {
  position: relative;
  height: 100%;
  border-radius: 27px;
  background: #eef3f1;
  overflow: hidden;
}

.phone-head {
  height: 58px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 12px 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.phone-head .chat-avatar {
  width: 24px;
  height: 24px;
}

.phone-head .chat-avatar svg {
  width: 13px;
  height: 13px;
}

.phone-name {
  font: 600 13px var(--font-sans);
  color: var(--ink);
}

.s-fly {
  position: absolute;
  left: 110px;
  top: 112px;
  width: 112px;
  height: 96px;
  z-index: 3;
  padding: 4px;
  background: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: var(--shadow-md);
  opacity: 1;
  transform: none;
}

.s-fly::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.s-snap {
  height: 100%;
  border-radius: 10px;
  background: #fdfdfb;
  border: 1px solid #e7e3d8;
  padding: 10px 10px 0;
  position: relative;
  overflow: hidden;
}

.s-no {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font: 600 11px var(--font-mono);
  color: #6b6a63;
}

.s-meta {
  position: absolute;
  left: 112px;
  top: 170px;
  font: 500 11px var(--font-mono);
  color: var(--body);
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 1;
}

.s-meta svg {
  width: 11px;
  height: 11px;
  color: var(--brand);
}

.s-typing {
  position: absolute;
  left: 10px;
  top: 194px;
  width: 52px;
  height: 28px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
}

.s-typing i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.s-reply {
  position: absolute;
  left: 10px;
  top: 194px;
  max-width: 150px;
  padding: 7px 10px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  border: 1px solid var(--line);
  font: 500 12px/1.35 var(--font-sans);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  opacity: 1;
  transform: none;
}

/* Scene 2: checked */
.s-card {
  position: absolute;
  left: 14px;
  top: 28px;
  width: 252px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(11, 31, 26, .06);
  box-shadow: var(--shadow-md), var(--gloss);
}

.s-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.s-card-title {
  font: 600 13px var(--font-sans);
  color: var(--ink);
}

.s-status {
  position: relative;
  display: inline-grid;
  justify-self: end;
}

.s-status > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font: 500 11px var(--font-sans);
  justify-self: end;
  white-space: nowrap;
}

.s-status-a {
  background: var(--hivis-tint);
  color: var(--hivis-ink);
  opacity: 0;
}

.s-status-b {
  background: var(--brand-tint);
  color: var(--brand);
  opacity: 1;
  transform: none;
}

.s-status-b svg {
  width: 11px;
  height: 11px;
}

.s-card-body {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}

.s-thumb {
  position: relative;
  height: 92px;
  border-radius: 8px;
  background: #fdfdfb;
  border: 1px solid #e7e3d8;
  padding: 8px 7px 0;
  overflow: hidden;
}

.s-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 22px;
  background: linear-gradient(180deg, transparent, rgba(18, 163, 122, .35), transparent);
  opacity: 0;
  transform: translateY(-22px);
}

.s-rows {
  display: grid;
  gap: 8px;
  align-content: start;
}

.s-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr 18px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.s-lab {
  color: var(--muted);
}

.s-val {
  font: 500 12px var(--font-mono);
  color: var(--ink);
  white-space: nowrap;
  opacity: 1;
  transform: none;
}

.s-ok {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  display: grid;
  place-items: center;
  opacity: 1;
  transform: none;
}

.s-ok svg {
  width: 10px;
  height: 10px;
}

.s-due {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}

.s-due-label {
  font: 500 11px var(--font-sans);
  color: var(--muted);
}

.s-due-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #edf1ef;
  overflow: hidden;
}

.s-due-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-bright), var(--lime));
  transform-origin: left center;
  transform: scaleX(.42);
}

/* Scene 3: confirmed every evening */
.s-in {
  position: absolute;
  left: 14px;
  top: 22px;
  width: 252px;
  padding: 10px 12px;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
  opacity: 1;
  transform: none;
}

.s-from {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 12px var(--font-sans);
  color: var(--ink);
}

.s-from .chat-avatar {
  width: 18px;
  height: 18px;
}

.s-from .chat-avatar svg {
  width: 10px;
  height: 10px;
}

.s-text {
  font: 500 13px/1.35 var(--font-sans);
  color: var(--ink);
  text-wrap: balance;
}

.s-time {
  font-weight: 500;
  color: var(--muted);
}

.s-tally {
  position: absolute;
  left: 14px;
  top: 110px;
  width: 252px;
  display: grid;
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(11, 31, 26, .06);
  box-shadow: var(--shadow-sm), var(--gloss);
}

.s-tally .s-row {
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 10px;
  min-height: 28px;
  font-size: 12px;
}

.s-tally .s-row + .s-row {
  border-top: 1px solid #edf1ef;
}

.s-tally .s-lab {
  color: var(--body);
  font-weight: 500;
}

.s-tally .s-val {
  font: 600 13px var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.s-stamp {
  position: absolute;
  left: 14px;
  top: 218px;
  width: 252px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md), var(--gloss);
  opacity: 1;
  transform: none;
}

.s-stamp strong {
  display: block;
  font: 600 14px var(--font-sans);
  color: var(--ink);
}

.s-stamp > span:last-child > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.s-stamp-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  transform: none;
}

.s-stamp-icon svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 379px) {
  .stage {
    transform: scale(.92);
    transform-origin: top center;
  }
}
/* Desktop: scenes 2 and 3 wait their turn (home.js removes is-queued). */
@media (prefers-reduced-motion: no-preference) and (min-width: 900px) {
  .steps .scene.is-queued *,
  .steps .scene.is-queued *::after {
    animation-play-state: paused !important;
  }
}

/* Step scene loops: animation only while a scene is live. */
@media (prefers-reduced-motion: no-preference) {
  .scene.is-live .s-fly {
    animation: fly 7s cubic-bezier(.2, .9, .3, 1.1) infinite;
  }

  .scene.is-live .s-fly::after {
    animation: flash 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-meta {
    animation: meta 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-typing {
    animation: typing 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-typing i {
    animation: dot 900ms ease-in-out infinite;
  }

  .scene.is-live .s-typing i:nth-child(2) {
    animation-delay: 150ms;
  }

  .scene.is-live .s-typing i:nth-child(3) {
    animation-delay: 300ms;
  }

  .scene.is-live .s-reply {
    animation: reply 7s var(--ease-spring) infinite;
  }

  .scene.is-live .s-status-a {
    animation: status-a 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-status-b {
    animation: status-b 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-scan {
    animation: scan 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-row:nth-child(1) .s-val {
    animation: val-0 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-row:nth-child(2) .s-val {
    animation: val-1 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-row:nth-child(3) .s-val {
    animation: val-2 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-row:nth-child(1) .s-ok {
    animation: ok-0 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-row:nth-child(2) .s-ok {
    animation: ok-1 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-row:nth-child(3) .s-ok {
    animation: ok-2 7s var(--ease-out) infinite;
  }

  .scene.is-live .s-due-fill {
    animation: due 7s linear infinite;
  }

  .scene.is-live .s-in {
    animation: msg-in 7s var(--ease-spring) infinite;
  }

  .scene.is-live .s-stamp {
    animation: stamp 7s var(--ease-spring) infinite;
  }

  .scene.is-live .s-stamp-icon {
    animation: stamp-icon 7s var(--ease-out) infinite;
  }
}

/* Scene 1 keyframes */
@keyframes fly {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10% {
    opacity: 0;
    transform: translate(-96px, -92px) rotate(-10deg) scale(1.2);
  }
  14.3%, 20.4% {
    opacity: 1;
    transform: translate(-96px, -92px) rotate(-10deg) scale(1.2);
  }
  29.1%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes flash {
  0%, 13.5%, 20.4%, 100% {
    opacity: 0;
  }
  15.2% {
    opacity: .9;
  }
}

@keyframes meta {
  0%, 6% {
    opacity: 1;
  }
  9%, 30.8% {
    opacity: 0;
  }
  32.5%, 100% {
    opacity: 1;
  }
}

@keyframes typing {
  0%, 36% {
    opacity: 0;
  }
  37.7%, 47.3% {
    opacity: 1;
  }
  49%, 100% {
    opacity: 0;
  }
}

@keyframes dot {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes reply {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 48.1% {
    opacity: 0;
    transform: translateY(6px) scale(.94);
  }
  53.4%, 100% {
    opacity: 1;
    transform: none;
  }
}

/* Scene 2 keyframes */
@keyframes status-a {
  0%, 9% {
    opacity: 0;
  }
  10%, 69% {
    opacity: 1;
  }
  72.4%, 100% {
    opacity: 0;
  }
}

@keyframes status-b {
  0%, 6% {
    opacity: 1;
    transform: scale(1);
  }
  9% {
    opacity: 0;
    transform: scale(1);
  }
  10%, 69% {
    opacity: 0;
    transform: scale(.8);
  }
  74.2%, 100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scan {
  0%, 13.5% {
    opacity: 0;
    transform: translateY(-22px);
  }
  15.2% {
    opacity: 1;
    transform: translateY(-22px);
  }
  36% {
    opacity: 1;
    transform: translateY(92px);
  }
  36.9% {
    opacity: 0;
    transform: translateY(-22px);
  }
  38.6% {
    opacity: 1;
    transform: translateY(-22px);
  }
  58.6% {
    opacity: 1;
    transform: translateY(92px);
  }
  60.3%, 100% {
    opacity: 0;
    transform: translateY(92px);
  }
}

@keyframes val-0 {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 25.6% {
    opacity: 0;
    transform: translateX(6px);
  }
  30.8%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes val-1 {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 36.9% {
    opacity: 0;
    transform: translateX(6px);
  }
  42.1%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes val-2 {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 48.1% {
    opacity: 0;
    transform: translateX(6px);
  }
  53.3%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes ok-0 {
  0%, 6% {
    opacity: 1;
    transform: scale(1);
  }
  9% {
    opacity: 0;
    transform: scale(1);
  }
  10%, 29.1% {
    opacity: 0;
    transform: scale(.4);
  }
  32.6% {
    opacity: 1;
    transform: scale(1.18);
  }
  35.2%, 100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ok-1 {
  0%, 6% {
    opacity: 1;
    transform: scale(1);
  }
  9% {
    opacity: 0;
    transform: scale(1);
  }
  10%, 40.3% {
    opacity: 0;
    transform: scale(.4);
  }
  43.8% {
    opacity: 1;
    transform: scale(1.18);
  }
  46.4%, 100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ok-2 {
  0%, 6% {
    opacity: 1;
    transform: scale(1);
  }
  9% {
    opacity: 0;
    transform: scale(1);
  }
  10%, 51.5% {
    opacity: 0;
    transform: scale(.4);
  }
  55% {
    opacity: 1;
    transform: scale(1.18);
  }
  57.6%, 100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes due {
  0%, 6% {
    transform: scaleX(.42);
  }
  10%, 15.2% {
    transform: scaleX(0);
  }
  70.7%, 100% {
    transform: scaleX(.42);
  }
}

/* Scene 3 rows: their own timing, after the message and before the stamp */
@media (prefers-reduced-motion: no-preference) {
  .scene-ok.is-live .s-row:nth-child(1) .s-val,
  .scene-ok.is-live .s-row:nth-child(1) .s-ok {
    animation-name: tally-0;
  }

  .scene-ok.is-live .s-row:nth-child(2) .s-val,
  .scene-ok.is-live .s-row:nth-child(2) .s-ok {
    animation-name: tally-1;
  }

  .scene-ok.is-live .s-row:nth-child(3) .s-val,
  .scene-ok.is-live .s-row:nth-child(3) .s-ok {
    animation-name: tally-2;
  }
}

@keyframes tally-0 {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 24% {
    opacity: 0;
    transform: scale(.6);
  }
  28%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes tally-1 {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 31% {
    opacity: 0;
    transform: scale(.6);
  }
  35%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes tally-2 {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 38% {
    opacity: 0;
    transform: scale(.6);
  }
  42%, 100% {
    opacity: 1;
    transform: none;
  }
}

/* Scene 3 keyframes */
@keyframes msg-in {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 12% {
    opacity: 0;
    transform: translateY(-18px) scale(.96);
  }
  19.5%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes stamp {
  0%, 6% {
    opacity: 1;
    transform: none;
  }
  9% {
    opacity: 0;
    transform: none;
  }
  10%, 50% {
    opacity: 0;
    transform: translateY(16px) scale(.94);
  }
  57%, 100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes stamp-icon {
  0%, 6% {
    transform: scale(1);
  }
  10%, 54% {
    transform: scale(.4);
  }
  60% {
    transform: scale(1.18);
  }
  63%, 100% {
    transform: scale(1);
  }
}

/* Step scenes: the mock UI scales with the column; one dashed line joins the three step numbers */
.steps { --scene-h: 300px; --stage-s: 1; }
.scene { height: var(--scene-h); }
.stage { transform: scale(var(--stage-s)); transform-origin: top center; }
@media (max-width: 359.98px) {
  .steps { --stage-s: .92; }
}
@media (min-width: 360px) and (max-width: 599.98px), (min-width: 768px) and (max-width: 899.98px), (min-width: 1100px) {
  .steps { --scene-h: 344px; --stage-s: 1.15; }
}
@media (min-width: 1024px) and (max-width: 1099.98px) {
  .steps { --scene-h: 324px; --stage-s: 1.08; }
}
@media (min-width: 900px) {
  .steps { position: relative; }
  .steps::before {
    content: "";
    position: absolute;
    left: 14px;
    right: calc(100% / 3 - 30px);
    top: calc(var(--scene-h) + 36px);
    border-top: 2px dashed var(--line-strong);
  }
  .step-head { position: relative; width: fit-content; padding-right: 14px; background: var(--bg-soft); }
}
