/* DNAx Journey — kit-to-report animated timeline.
   4 scenes on a horizontal track: Order → Sample → Lab → Report.
   Scroll-driven progress with looping micro-animations per scene. */

.journey-section {
  padding: 80px 0 96px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(207,232,218,0.0) 0%, rgba(207,232,218,0.35) 30%, rgba(191,224,220,0.35) 70%, rgba(207,232,218,0.0) 100%);
}
.journey-section .container-wide { position: relative; }
.journey-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
  align-items: end; margin-bottom: 56px;
}
.journey-head h2 {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(40px, 4.6vw, 72px); letter-spacing: -0.024em; line-height: 1.02;
  max-width: 14ch;
}
.journey-head h2 em { font-style: normal; color: var(--blue-900); }
.journey-head p { color: var(--ink-2); font-size: 17px; line-height: 1.55; max-width: 48ch; }
@media (max-width: 820px) { .journey-head { grid-template-columns: 1fr; gap: 18px; } }

/* Track */
.journey-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 36px 0 28px;
}
.journey-track::before {
  content: "";
  position: absolute;
  top: 148px;
  left: 6%;
  right: 6%;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    var(--rule-2) 0 6px,
    transparent 6px 12px
  );
  z-index: 0;
}
.journey-track::after {
  content: "";
  position: absolute;
  top: 148px;
  left: 6%;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, #1F8A5B, var(--blue-700));
  z-index: 1;
  transition: width 1.4s cubic-bezier(.22,.7,.25,1);
}
.journey-track.in-view::after { width: calc(94% - 6%); }
@media (max-width: 820px) {
  .journey-track { grid-template-columns: 1fr; gap: 36px; }
  .journey-track::before, .journey-track::after { display: none; }
}

/* Each scene */
.scene {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px 0;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .8s ease, transform .8s ease;
}
.scene.in { opacity: 1; transform: translateY(0); }
.scene-stage {
  width: 168px; height: 168px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--rule);
  display: grid; place-items: center;
  position: relative;
  box-shadow: 0 12px 32px -16px rgba(14,17,22,0.18);
  overflow: hidden;
}
.scene-stage::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(46,99,242,0.06), transparent 70%);
  pointer-events: none;
}
.scene-num {
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  padding: 4px 12px; border-radius: 999px;
  z-index: 5;
  box-shadow: 0 4px 12px -4px rgba(14,17,22,0.25);
}
.scene-tag {
  margin-top: 22px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: #1F8A5B;
}
.scene h3 {
  margin-top: 8px; font-family: var(--font-display); font-size: 24px;
  font-weight: 500; letter-spacing: -0.012em; text-align: center;
}
.scene p {
  margin-top: 8px; text-align: center; font-size: 14px;
  color: var(--fg-muted); max-width: 22ch; line-height: 1.55;
}

/* ===== Scene 1: Order placed ===== */
.scene-order .pkg { position: relative; width: 96px; height: 96px; }
.scene-order .pkg svg { width: 100%; height: 100%; }
.scene-order .pkg .box-top { transform-origin: 24px 32px; animation: lid-pop 4s ease-in-out infinite; }
.scene-order .pkg .check {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-check 4s ease-out infinite;
}
.scene-order .pkg .receipt {
  transform-origin: center;
  animation: receipt-print 4s ease-out infinite;
}
@keyframes lid-pop {
  0%, 12%, 100% { transform: translateY(0) rotate(0); }
  18% { transform: translateY(-4px) rotate(-6deg); }
  24%, 88% { transform: translateY(0) rotate(0); }
}
@keyframes draw-check {
  0%, 30% { stroke-dashoffset: 40; }
  60% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
@keyframes receipt-print {
  0% { transform: translateY(-100%) scaleY(0); opacity: 0; }
  30% { transform: translateY(-30%) scaleY(0.4); opacity: 0.5; }
  60%, 100% { transform: translateY(0) scaleY(1); opacity: 1; }
}

/* ===== Scene 2: Tube + drop ===== */
.scene-tube .tube-wrap { position: relative; width: 70px; height: 110px; }
.scene-tube .drop {
  position: absolute;
  left: 50%; top: -2px;
  width: 10px; height: 14px;
  background: var(--blue-500);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transform: translate(-50%, -100%);
  animation: drop-fall 2.6s ease-in infinite;
  filter: drop-shadow(0 2px 2px rgba(46,99,242,0.4));
}
.scene-tube .drop::before {
  content: ""; position: absolute; left: 50%; top: -6px;
  width: 4px; height: 6px; background: var(--blue-500);
  border-radius: 50%;
  transform: translateX(-50%);
}
@keyframes drop-fall {
  0% { transform: translate(-50%, -100%); opacity: 0; }
  10% { opacity: 1; }
  60% { transform: translate(-50%, 24px); opacity: 1; }
  68% {
    transform: translate(-50%, 30px) scale(1.4, 0.5);
    opacity: 0.9;
  }
  72% { transform: translate(-50%, 32px) scale(1.6, 0.3); opacity: 0; }
  100% { transform: translate(-50%, -100%); opacity: 0; }
}
.scene-tube .tube-fill {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  height: 22%; background: linear-gradient(180deg, rgba(46,99,242,0.65), rgba(26,63,184,0.85));
  border-radius: 0 0 14px 14px;
  animation: tube-fill 2.6s ease-in-out infinite;
}
@keyframes tube-fill {
  0%, 65% { height: 22%; }
  72% { height: 30%; }
  80% { height: 28%; }
  100% { height: 22%; }
}
.scene-tube .liquid-surface {
  position: absolute; left: 14px; right: 14px;
  height: 6px;
  background: rgba(46,99,242,0.85);
  border-radius: 50%;
  animation: surface 2.6s ease-in-out infinite;
}
@keyframes surface {
  0%, 65% { bottom: calc(22% + 14px); transform: scaleX(1); }
  72% { bottom: calc(30% + 14px); transform: scaleX(1.05); }
  80% { bottom: calc(28% + 14px); transform: scaleX(0.97); }
  100% { bottom: calc(22% + 14px); transform: scaleX(1); }
}

/* ===== Scene 3: Shipping / Lab ===== */
.scene-lab .lab-wrap { position: relative; width: 130px; height: 100px; }
.scene-lab .truck {
  position: absolute;
  left: 0; bottom: 18px;
  animation: truck-roll 5s ease-in-out infinite;
}
.scene-lab .truck svg { width: 56px; height: 38px; }
.scene-lab .road {
  position: absolute; left: 0; right: 0; bottom: 14px;
  height: 1px; background: var(--rule-2);
}
.scene-lab .road::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px;
  background: repeating-linear-gradient(to right, transparent 0 4px, var(--rule-2) 4px 10px);
  animation: road-move 1s linear infinite;
}
@keyframes truck-roll {
  0% { left: -10%; opacity: 0; }
  15% { opacity: 1; }
  50% { left: 50%; opacity: 1; }
  60% { left: 50%; opacity: 0; }
  100% { left: 50%; opacity: 0; }
}
@keyframes road-move {
  to { background-position: -14px 0; }
}
.scene-lab .building {
  position: absolute;
  right: 0; bottom: 15px;
  width: 56px; height: 56px;
}
.scene-lab .pulse {
  position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(31,138,91,0.4);
  transform: translate(-50%,-50%);
  animation: lab-pulse 2.4s ease-out infinite;
}
.scene-lab .pulse.p2 { animation-delay: 0.8s; }
.scene-lab .pulse.p3 { animation-delay: 1.6s; }
@keyframes lab-pulse {
  0% { transform: translate(-50%,-50%) scale(0.4); opacity: 0; }
  20% { opacity: 0.8; }
  100% { transform: translate(-50%,-50%) scale(3.2); opacity: 0; }
}

/* ===== Scene 4: Report ===== */
.scene-report .report { position: relative; width: 90px; height: 110px; }
.scene-report .doc {
  position: absolute; left: 0; top: 0;
  width: 80px; height: 100px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 6px 14px -6px rgba(14,17,22,0.18);
  overflow: hidden;
  animation: doc-rise 4s ease-out infinite;
}
@keyframes doc-rise {
  0% { transform: translate(0, 20px); opacity: 0; }
  40% { transform: translate(0, 0); opacity: 1; }
  100% { transform: translate(0, 0); opacity: 1; }
}
.scene-report .doc .doc-head {
  height: 16px; background: var(--blue-900);
  display: flex; align-items: center; padding: 0 6px;
  font-family: var(--font-mono); font-size: 7px; color: rgba(255,255,255,0.7);
  letter-spacing: 0.12em;
}
.scene-report .doc .line {
  height: 3px; background: var(--rule);
  margin: 4px 6px;
  border-radius: 2px;
  transform-origin: left;
  transform: scaleX(0);
  animation: line-write 4s ease-out infinite;
}
.scene-report .doc .line.l1 { animation-delay: 0.6s; width: 80%; }
.scene-report .doc .line.l2 { animation-delay: 0.9s; width: 60%; }
.scene-report .doc .line.l3 { animation-delay: 1.2s; width: 90%; }
.scene-report .doc .bar-mini { background: var(--blue-50); }
.scene-report .doc .bar-mini::after {
  content: ""; display: block; height: 100%;
  background: var(--blue-500);
  transform: scaleX(0); transform-origin: left;
  animation: bar-grow 4s ease-out infinite;
}
.scene-report .doc .bar-mini.b1::after { animation-delay: 1.4s; --r: 70%; }
.scene-report .doc .bar-mini.b2::after { animation-delay: 1.6s; --r: 45%; }
.scene-report .doc .bar-mini.b3::after { animation-delay: 1.8s; --r: 85%; }
.scene-report .doc .bar-mini { height: 4px; margin: 3px 6px; border-radius: 2px; overflow: hidden; }
@keyframes line-write {
  0%, 10% { transform: scaleX(0); }
  40% { transform: scaleX(1); }
  100% { transform: scaleX(1); }
}
@keyframes bar-grow {
  0%, 30% { transform: scaleX(0); }
  60% { transform: scaleX(var(--r, 60%)); }
  100% { transform: scaleX(var(--r, 60%)); }
}
.scene-report .seal {
  position: absolute;
  right: -10px; bottom: 8px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #1F8A5B;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(31,138,91,0.6);
  transform: scale(0) rotate(-30deg);
  animation: seal-stamp 4s ease-out infinite;
}
.scene-report .seal svg { width: 18px; height: 18px; }
@keyframes seal-stamp {
  0%, 65% { transform: scale(0) rotate(-30deg); opacity: 0; }
  72% { transform: scale(1.3) rotate(8deg); opacity: 1; }
  80% { transform: scale(1) rotate(0deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Connector arrows between scenes (sit between stages on track line) */
.scene .arrow-fly {
  position: absolute;
  top: 98px;
  right: -22px;
  width: 44px;
  height: 24px;
  pointer-events: none;
  z-index: 4;
}
.scene .arrow-fly::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 0; height: 1px;
  background: var(--blue-700);
  transform: translateY(-50%);
  animation: arrow-grow 5s ease-in-out infinite;
}
.scene .arrow-fly::after {
  content: "";
  position: absolute; right: 0; top: 50%;
  width: 0; height: 0;
  border-left: 6px solid var(--blue-700);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: translateY(-50%);
  opacity: 0;
  animation: arrow-head 5s ease-in-out infinite;
}
@keyframes arrow-grow {
  0%, 20% { width: 0; }
  50% { width: 100%; }
  90%, 100% { width: 100%; }
}
@keyframes arrow-head {
  0%, 40% { opacity: 0; }
  55%, 100% { opacity: 1; }
}
.scene:last-child .arrow-fly { display: none; }
@media (max-width: 820px) {
  .scene .arrow-fly { display: none; }
}

/* Stagger entrance */
.journey-track.in-view .scene:nth-child(1) { transition-delay: 0.0s; }
.journey-track.in-view .scene:nth-child(2) { transition-delay: 0.4s; }
.journey-track.in-view .scene:nth-child(3) { transition-delay: 0.8s; }
.journey-track.in-view .scene:nth-child(4) { transition-delay: 1.2s; }

@media (prefers-reduced-motion: reduce) {
  .scene, .scene-stage *, .scene .arrow-fly::before, .scene .arrow-fly::after,
  .journey-track::after { animation: none !important; transition: none !important; }
  .scene { opacity: 1; transform: none; }
  .journey-track::after { width: calc(94% - 6%); }
}
