/* ==========================================================================
   Journey: Find, Choose, Book. A path with a traveller dot that follows the
   scroll, three step cards with tiny animated scenes, and a "free" badge.
   Content is always visible; js/journey.js only adds the live behaviour.
   ========================================================================== */

.journey {
  position: relative;
  --p: 0;
}

.journey__steps {
  display: grid;
  gap: var(--space-7);
}

.journey__step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 3.75rem;
}

.journey__step > :not(.journey__node) {
  transition: opacity 0.4s ease;
}

.journey__step h3 {
  font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem);
  letter-spacing: -0.02em;
}

.journey__step p {
  color: var(--color-text-muted);
}

.journey__step .scene {
  order: 3;
  margin-top: var(--space-3);
}

/* ---- Path --------------------------------------------------------------- */
.journey__track {
  position: absolute;
  left: calc(1.25rem - 2px);
  top: 1.25rem;
  height: var(--track-h, calc(100% - 3rem));
  width: 4px;
  border-radius: 4px;
  background: var(--gg-line);
}

.journey__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gg-green);
  transform: scaleY(var(--p));
  transform-origin: 50% 0;
}

.journey__dot {
  position: absolute;
  left: 50%;
  top: calc(var(--p) * 100%);
  width: 1.25rem;
  height: 1.25rem;
  translate: -50% -50%;
  border: 4px solid var(--gg-ink);
  border-radius: 50%;
  background: var(--gg-green);
  box-shadow: 0 0 0 6px rgba(81, 186, 108, 0.28);
}

.journey__node {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--gg-ink);
  color: var(--gg-white);
  font-size: var(--fs-small);
  line-height: 1;
  font-weight: var(--fw-heavy);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, scale 0.4s var(--ease-spring);
}

.journey__node:hover {
  scale: 1.12;
}

/* ---- Live state (set by js/journey.js) ----------------------------------- */
.journey--live .journey__step > :not(.journey__node) {
  opacity: 0.45;
}

.journey--live .journey__step.is-past > :not(.journey__node) {
  opacity: 0.75;
}

.journey--live .journey__step.is-active > :not(.journey__node) {
  opacity: 1;
}

.journey--live .journey__step.is-past .journey__node,
.journey--live .journey__step.is-active .journey__node {
  background: var(--gg-green);
  color: var(--gg-ink);
}

.journey--live .journey__step.is-active .journey__node {
  box-shadow: 0 0 0 6px rgba(81, 186, 108, 0.3);
}

/* ---- Scenes ------------------------------------------------------------- */
.scene {
  position: relative;
  display: grid;
  align-content: center;
  gap: var(--space-3);
  height: 11.5rem;
  padding: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--gg-line);
  border-radius: var(--radius-md);
  background: var(--gg-tint);
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.journey--live .journey__step.is-active .scene {
  border-color: var(--gg-green);
  box-shadow: 0 18px 40px rgba(24, 37, 27, 0.12);
}

/* 1. Find: search bar that types, icon chips that pop */
.scene__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 3rem;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--gg-white);
  border: 2px solid var(--gg-ink);
  font-weight: var(--fw-bold);
}

.scene__bar .icon {
  color: var(--gg-green-deep);
}

.scene__caret {
  width: 2px;
  height: 1.2em;
  background: var(--gg-ink);
}

.scene__chips {
  display: flex;
  gap: var(--space-2);
}

.scene__chip {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 14px;
  background: var(--gg-white);
  color: var(--gg-green-deep);
  box-shadow: 0 6px 14px rgba(24, 37, 27, 0.08);
}

/* 2. Choose: three profile cards, one gets picked */
.scene__profs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.prof {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: var(--space-3) var(--space-2);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--gg-white);
}

.prof__av {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--gg-tint);
  color: var(--gg-green-deep);
}

.prof__line {
  width: 80%;
  height: 0.4rem;
  border-radius: 0.4rem;
  background: var(--gg-line);
}

.prof__line--short {
  width: 52%;
}

.prof__tick {
  position: absolute;
  right: -0.5rem;
  top: -0.5rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--gg-green);
  color: var(--gg-ink);
  scale: 0;
}

.prof__tick .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* 3. Book: route pills highlight in turn, then "Sorted" */
.scene__routes {
  display: grid;
  gap: 0.4rem;
}

.route {
  padding: 0.35rem 0.9rem;
  border: 2px solid var(--gg-line);
  border-radius: var(--radius-pill);
  background: var(--gg-white);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
}

.scene__confirm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  border-radius: inherit;
  background: var(--gg-green);
  color: var(--gg-ink);
  font-size: 1.5rem;
  font-weight: var(--fw-heavy);
  opacity: 0;
  pointer-events: none;
}

.scene__tick {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--gg-ink);
  color: var(--gg-green);
}

/* ---- Scene animations: restart each time a step becomes active ----------- */
@keyframes gg-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes gg-caret {
  50% { opacity: 0; }
}

@keyframes gg-flash {
  35% { transform: translateY(-5px); border-color: var(--gg-green); box-shadow: 0 10px 18px rgba(24, 37, 27, 0.14); }
}

@keyframes gg-pick {
  to { transform: translateY(-7px) scale(1.07); border-color: var(--gg-green); box-shadow: 0 14px 22px rgba(24, 37, 27, 0.18); }
}

@keyframes gg-pick-tick {
  to { scale: 1; }
}

@keyframes gg-route {
  0%, 100% { border-color: var(--gg-line); background: var(--gg-white); }
  8%, 28% { border-color: var(--gg-ink); background: var(--gg-ink); color: var(--gg-white); }
  36% { border-color: var(--gg-line); background: var(--gg-white); color: inherit; }
}

@keyframes gg-confirm {
  0%, 72% { opacity: 0; clip-path: circle(0% at 50% 50%); }
  84%, 96% { opacity: 1; clip-path: circle(80% at 50% 50%); }
  100% { opacity: 0; clip-path: circle(80% at 50% 50%); }
}

.scene__caret {
  animation: gg-caret 1s steps(1) infinite;
}

.journey--live .journey__step.is-active .scene__chip {
  animation: gg-pop 0.55s var(--ease-spring) both;
}

.journey--live .journey__step.is-active .scene__chip:nth-child(1) { animation-delay: 0.2s; }
.journey--live .journey__step.is-active .scene__chip:nth-child(2) { animation-delay: 0.32s; }
.journey--live .journey__step.is-active .scene__chip:nth-child(3) { animation-delay: 0.44s; }
.journey--live .journey__step.is-active .scene__chip:nth-child(4) { animation-delay: 0.56s; }

.journey--live .journey__step.is-active .prof--1 { animation: gg-flash 0.8s ease 0.2s both; }
.journey--live .journey__step.is-active .prof--3 { animation: gg-flash 0.8s ease 0.9s both; }
.journey--live .journey__step.is-active .prof--2 { animation: gg-pick 0.7s var(--ease-spring) 1.7s both; }
.journey--live .journey__step.is-active .prof__tick { animation: gg-pick-tick 0.5s var(--ease-spring) 1.95s both; }

.journey--live .journey__step.is-active .route { animation: gg-route 4.5s ease-in-out infinite; }
.journey--live .journey__step.is-active .route--2 { animation-delay: 1.5s; }
.journey--live .journey__step.is-active .route--3 { animation-delay: 3s; }
.journey--live .journey__step.is-active .scene__confirm { animation: gg-confirm 4.5s ease-in-out infinite; }

/* ---- Desktop: path runs left to right -------------------------------------- */
@media (min-width: 1024px) {
  .journey__steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
  }

  .journey__step {
    padding: 3.75rem var(--space-5) 0 0;
  }

  .journey__track {
    left: 1.25rem;
    right: calc(33.333% - 1.25rem);
    top: calc(1.25rem - 2px);
    bottom: auto;
    width: auto;
    height: 4px;
  }

  .journey__fill {
    transform: scaleX(var(--p));
    transform-origin: 0 50%;
  }

  .journey__dot {
    left: calc(var(--p) * 100%);
    top: 50%;
  }
}

/* ---- Free badge on the statement panel ------------------------------------- */
.statement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.statement__hl {
  padding: 0;
  background: none;
  color: inherit;
}

.statement__badge {
  position: relative;
  flex: none;
  width: clamp(7rem, 16vw, 11rem);
  height: auto;
  color: var(--gg-ink);
}

.statement__badge text {
  fill: currentColor;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.statement__core {
  fill: var(--gg-ink);
}

.statement__ring {
  transform-origin: 100px 100px;
}

@media (max-width: 639.98px) {
  .statement__badge {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey__step > *,
  .journey__node,
  .journey__step .scene,
  .scene__caret,
  .scene__chip,
  .prof,
  .prof__tick,
  .route,
  .scene__confirm {
    animation: none !important;
    transition: none !important;
  }
  .prof__tick {
    scale: 1;
  }
}
