/* dots.css: GlobalPrep signature motion. Every piece starts as the EXACT isotype and returns to it.
   Exact dot positions live in isotype.css (generated) and GP.BRAND (generated), both from
   assets/logos/source/Lockup - horizontal.svg via tools/brand.py.
   · GPDots         the isotype in HTML (uses .GPIso), optional gentle pulse
   · GPCaterpillar  SVG: rests as the isotype, drops into a row and crawls while it moves
   · GPButterfly    every wing is an isotype dot drawn to the body. Calm flutter
   · GPMeta         isotype → row → crawl → gather → wings (rest, crawl, gather, emerge, fly)
   · GPJourney      milestone track, the GPMeta rider follows the progress
   All loops stop under prefers-reduced-motion and show the isotype or the still butterfly. */

/* ── GPDots ───────────────────────────────────────────────────────────── */
.GPDots_pulse > i {
  animation: GPDots-lift 1.6s var(--ffj-ease-standard) infinite;
}
.GPDots_pulse > i:nth-child(2) { animation-delay: 0.14s; }
.GPDots_pulse > i:nth-child(3) { animation-delay: 0.28s; }
.GPDots_pulse > i:nth-child(4) { animation-delay: 0.42s; }

/* starts and ends at the exact rest position */
@keyframes GPDots-lift {
  0%, 55%, 100% { transform: none; }
  25% { transform: translateY(-22%); }
}

/* ── GPCaterpillar (SVG in the isotype box) ───────────────────────────── */
.GPCaterpillar {
  display: inline-block;
  width: 36px;
  height: auto;
  overflow: visible;
  vertical-align: bottom;
}

.GPCat_dot {
  transform: none;
  transition: transform 0.45s var(--ffj-ease-emphasized);
}

.GPCat_c {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.GPCaterpillar_crawling .GPCat_dot {
  transform: translate(calc(var(--lx) * 1px), calc(var(--ly) * 1px));
}

/* inchworm wave once the dots are in the row: tail to head */
.GPCaterpillar_crawling .GPCat_c {
  animation: GPCat-wave 0.9s var(--gp-ease-crawl) 0.45s infinite;
}
.GPCaterpillar_crawling .GPCat_dot:nth-child(2) .GPCat_c { animation-delay: 0.54s; }
.GPCaterpillar_crawling .GPCat_dot:nth-child(3) .GPCat_c { animation-delay: 0.63s; }
.GPCaterpillar_crawling .GPCat_dot:nth-child(4) .GPCat_c { animation-delay: 0.72s; }

@keyframes GPCat-wave {
  0%, 60%, 100% { transform: none; }
  30% { transform: translateY(-28%) scale(0.94, 1.06); }
}

/* ── GPButterfly ──────────────────────────────────────────────────────── */
.GPButterfly {
  display: inline-block;
  width: 64px;
  height: 64px;
  overflow: visible;
}

.GPButterfly_side { transform-origin: 50px 50px; }
.GPButterfly_all { transform-origin: 50px 50px; }

.GPButterfly_fluttering .GPButterfly_side {
  animation: GPButterfly-flutter 1.1s var(--gp-ease-flutter) infinite alternate;
}

.GPButterfly_fluttering .GPButterfly_all {
  animation: GPButterfly-float 3.4s ease-in-out infinite;
}

/* calm: the wings close to about half, never to a line */
@keyframes GPButterfly-flutter {
  from { transform: scaleX(1); }
  to { transform: scaleX(0.55); }
}

@keyframes GPButterfly-float {
  0%, 100% { transform: translate(0, 0) rotate(-2deg); }
  50% { transform: translate(1.5px, -4px) rotate(2.5deg); }
}

/* ── GPMeta: isotype → caterpillar → butterfly ────────────────────────── */
.GPMeta {
  display: inline-block;
  width: 160px;
  height: 160px;
  overflow: visible;
}

.GPMeta_dot {
  transform: none;
  transition: transform 0.6s var(--ffj-ease-emphasized), opacity 0.35s ease;
}

.GPMeta_c {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.6s var(--ffj-ease-emphasized);
}

/* the twin of dot 4 sits exactly on dot 4 until the split */
.GPMeta_crawl .GPMeta_dot {
  transform: translate(calc(var(--lx) * 1px), calc(var(--ly) * 1px));
}

.GPMeta_crawl .GPMeta_c {
  transform-origin: 50% 100%;
  animation: GPCat-wave 0.9s var(--gp-ease-crawl) 0.6s infinite;
}
.GPMeta_crawl .GPMeta_dot2 .GPMeta_c { animation-delay: 0.69s; }
.GPMeta_crawl .GPMeta_dot3 .GPMeta_c { animation-delay: 0.78s; }
.GPMeta_crawl .GPMeta_dot4 .GPMeta_c,
.GPMeta_crawl .GPMeta_dot5 .GPMeta_c { animation-delay: 0.87s; }

/* gather: each dot travels to its wing centre and grows to the wing radius */
.GPMeta_gather .GPMeta_dot,
.GPMeta_emerge .GPMeta_dot,
.GPMeta_fly .GPMeta_dot {
  transform: translate(calc(var(--wx) * 1px), calc(var(--wy) * 1px));
}

.GPMeta_gather .GPMeta_c,
.GPMeta_emerge .GPMeta_c,
.GPMeta_fly .GPMeta_c {
  transform: scale(var(--ws));
}

/* emerge: the drop-shaped wings and the body appear over the dots, then the dots leave */
.GPMeta_butterfly { opacity: 0; transition: opacity 0.5s ease; }
.GPMeta_emerge .GPMeta_butterfly,
.GPMeta_fly .GPMeta_butterfly { opacity: 1; }
.GPMeta_emerge .GPMeta_dot,
.GPMeta_fly .GPMeta_dot { opacity: 0; transition: transform 0.6s var(--ffj-ease-emphasized), opacity 0.4s ease 0.45s; }

.GPMeta_butterfly .GPButterfly_body {
  transform-origin: 50px 66px;
  transform: scaleY(0);
  transition: transform 0.6s var(--ffj-ease-emphasized) 0.1s;
}
.GPMeta_emerge .GPButterfly_body,
.GPMeta_fly .GPButterfly_body { transform: none; }

.GPMeta_fly .GPButterfly_side {
  animation: GPButterfly-flutter 1.1s var(--gp-ease-flutter) infinite alternate;
}

.GPMeta_butterfly { transform-origin: 50px 50px; }
.GPMeta_fly .GPMeta_butterfly {
  animation: GPButterfly-float 3.4s ease-in-out infinite;
}

/* ── GPJourney: milestone track ───────────────────────────────────────── */
.GPJourney {
  --track: 6px;
  position: relative;
  padding: 92px 36px 64px;
}

.GPJourney_rail {
  position: relative;
  height: var(--track);
}

.GPJourney_track,
.GPJourney_fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 6px;
}

.GPJourney_track {
  right: 0;
  background: var(--gp-teal);
  opacity: 0.15;
}

.GPJourney_fill {
  width: 0;
  background: linear-gradient(90deg, var(--gp-teal), var(--gp-teal-mid) 70%, var(--gp-amber));
  transition: width 1.4s var(--ffj-ease-emphasized);
}

.GPJourney_stop {
  position: absolute;
  top: 50%;
  width: var(--size, 16px);
  height: var(--size, 16px);
  border-radius: 50%;
  background: var(--color-white);
  border: 2px solid var(--gp-teal);
  transform: translate(-50%, -50%);
  transition: background 0.4s ease 0.3s, transform 0.4s var(--ffj-ease-snappy) 0.3s;
}

.GPJourney_stopDone {
  background: var(--gp-teal);
  transform: translate(-50%, -50%) scale(1.08);
}

.GPJourney_stopGoal { border-color: var(--gp-amber); border-width: 3px; }
.GPJourney_stopGoal.GPJourney_stopDone { background: var(--gp-amber); }

.GPJourney_label {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  width: max-content;
  max-width: 120px;
  transform: translateX(-50%);
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  color: var(--gp-teal);
}

/* keep the first and last labels inside the track */
.GPJourney_stop:first-of-type .GPJourney_label { left: -6px; transform: none; text-align: left; }
.GPJourney_stopGoal .GPJourney_label { left: auto; right: -6px; transform: none; text-align: right; }
@media (max-width: 600px) {
  .GPJourney { padding-left: 20px; padding-right: 20px; }
  .GPJourney_label { font-size: 11px; max-width: 64px; }
}

.GPJourney_rider {
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 96px;
  height: 96px;
  margin-left: -60px;
  transition: left 1.4s var(--ffj-ease-emphasized);
  z-index: 1;
  pointer-events: none;
}

.GPJourney_rider .GPMeta {
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .GPDots_pulse > i,
  .GPCaterpillar_crawling .GPCat_c,
  .GPButterfly_fluttering .GPButterfly_side,
  .GPButterfly_fluttering .GPButterfly_all,
  .GPMeta_crawl .GPMeta_c,
  .GPMeta_fly .GPButterfly_side,
  .GPMeta_fly .GPMeta_butterfly {
    animation: none !important;
  }
  .GPCat_dot, .GPMeta_dot, .GPMeta_c { transition: none !important; }
  .GPCaterpillar_crawling .GPCat_dot { transform: none; }
}
