/* ===================================================================
   OptiFinance — Process Page Timeline
   Horizontal stepper with animated circles, connecting lines,
   and sliding content panels
   =================================================================== */

/* --- Page Hero --- */
.journey-hero {
  padding: 8rem 0 4rem;
  background: linear-gradient(180deg, var(--color-wash) 0%, var(--color-bg) 100%);
}

.journey-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-primary);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: color var(--transition);
}

.journey-hero .back-link:hover {
  color: var(--color-primary-hover);
}

.journey-hero .back-link svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition);
}

.journey-hero .back-link:hover svg {
  transform: translateX(-3px);
}

.journey-hero .kicker {
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.journey-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 1rem;
  line-height: 1.15;
}

.journey-hero .subtitle {
  font-size: 1.15rem;
  color: var(--color-body);
  line-height: 1.7;
  max-width: 600px;
}

/* --- Timeline Section --- */
.timeline-section {
  padding: 3rem 0 5rem;
  overflow: visible;
}

/* --- Horizontal Stepper Track --- */
.timeline-stepper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  margin-bottom: 3rem;
  padding: 0 1rem;
}

/* The connecting line behind the circles */
.timeline-stepper::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 28px;
  right: 28px;
  height: 3px;
  background: var(--color-border);
  z-index: 0;
  border-radius: 2px;
}

/* Animated progress line */
.timeline-stepper::after {
  content: "";
  position: absolute;
  top: 28px;
  left: 28px;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
  z-index: 1;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Individual Step Node --- */
.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  cursor: pointer;
  flex: 1;
  padding: 0 0.25rem;
  border: none;
  background: none;
  font-family: inherit;
  outline: none;
}

.step-node:focus-visible .step-circle {
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* --- Circle --- */
.step-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--color-border);
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-body);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

/* Pulse ring on hover */
.step-circle::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-node:hover .step-circle::after {
  border-color: var(--color-primary-glow);
}

/* Active state */
.step-node.active .step-circle {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
  transform: scale(1.12);
  box-shadow: 0 8px 24px rgba(110, 143, 168, 0.35);
}

.step-node.active .step-circle::after {
  border-color: rgba(110, 143, 168, 0.2);
  animation: pulseRing 2s ease-out infinite;
}

/* Completed state */
.step-node.completed .step-circle {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* --- Step Label (below circle) --- */
.step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-body);
  text-align: center;
  line-height: 1.35;
  max-width: 140px;
  transition: color var(--transition);
}

.step-node.active .step-label {
  color: var(--color-heading);
}

.step-node:hover .step-label {
  color: var(--color-primary);
}

/* --- Content Panel --- */
.step-content-panel {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-content-panel.visible {
  padding: 2.5rem 3rem;
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
  box-shadow: 0 12px 40px rgba(46, 58, 70, 0.08);
}

.step-content-panel .panel-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.step-content-panel .panel-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-content-panel .panel-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-heading);
  margin: 0;
}

.step-content-panel .panel-body {
  color: var(--color-body);
  font-size: 1.05rem;
  line-height: 1.75;
  margin: 0;
}

.step-content-panel .panel-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.step-content-panel .panel-nav button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-white);
  color: var(--color-body);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.step-content-panel .panel-nav button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.step-content-panel .panel-nav button svg {
  width: 16px;
  height: 16px;
}

/* --- CTA Section --- */
.journey-cta {
  text-align: center;
  padding: 4rem 0 6rem;
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-wash) 100%);
}

.journey-cta h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--color-heading);
  margin-bottom: 0.75rem;
}

.journey-cta p {
  color: var(--color-body);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.journey-cta .cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Animations --- */
@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Staggered entry for step nodes */
.step-node {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.5s ease forwards;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-node:nth-child(1) { animation-delay: 0.1s; }
.step-node:nth-child(2) { animation-delay: 0.2s; }
.step-node:nth-child(3) { animation-delay: 0.3s; }
.step-node:nth-child(4) { animation-delay: 0.4s; }
.step-node:nth-child(5) { animation-delay: 0.5s; }
.step-node:nth-child(6) { animation-delay: 0.6s; }

/* --- Responsive: Tablet --- */
@media (max-width: 900px) {
  .timeline-stepper {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem 2rem;
    padding: 0;
  }

  .timeline-stepper::before,
  .timeline-stepper::after {
    display: none;
  }

  .step-node {
    flex: 0 0 calc(33.333% - 1.5rem);
  }

  .step-label {
    max-width: 120px;
  }

  .step-content-panel.visible {
    padding: 2rem;
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
  .journey-hero {
    padding: 7rem 0 3rem;
  }

  .timeline-stepper {
    gap: 1rem 1.5rem;
  }

  .step-node {
    flex: 0 0 calc(33.333% - 1rem);
  }

  .step-circle {
    width: 48px;
    height: 48px;
    font-size: 0.85rem;
  }

  .step-label {
    font-size: 0.75rem;
    max-width: 100px;
  }

  .step-content-panel.visible {
    padding: 1.5rem;
  }

  .step-content-panel .panel-title {
    font-size: 1.15rem;
  }

  .step-content-panel .panel-body {
    font-size: 0.95rem;
  }
}
