/* ==========================================================================
   TechAbbot – delivery approach journey
   Markup: partials/approach.html (generated by tools/build-approach.js)
   Behaviour: js/approach.js

   Five stages joined by a straight line. The line draws itself from stage 01
   to stage 05 each time the section scrolls into view; each marker lights up
   as the line reaches it and, in the horizontal layout, the details panel
   switches to that stage.

     below 768px    vertical journey: markers down the left, line top to bottom
     768px and up   horizontal journey: five markers in a row, the selected
                    stage's details in a panel underneath

   Marker states (set by the script once it is running, .journey.is-ready):
     default      upcoming: white, grey outline
     .is-current  where the line has just arrived: gradient fill, enlarged
     .is-done     completed: green outline, tinted fill, check badge
   Without the script every stage is drawn as completed and shown in full.
   ========================================================================== */

.journey {
  --j-future: #7F919E;
  --j-future-line: #C9D6DE;
  --j-marker: 48px;

  padding-block: clamp(52px, 6.5vw, 96px);
  background:
    radial-gradient(40% 44% at 0% 0%, rgba(8, 113, 167, 0.09), transparent 70%),
    radial-gradient(40% 44% at 100% 100%, rgba(38, 150, 94, 0.09), transparent 70%),
    var(--c-bg-alt);
}

/* Heading block ----------------------------------------------------------- */

.journey__head {
  max-width: 900px;
  margin-inline: auto;
  text-align: center;
}

.journey__title {
  margin: 14px 0 0;
  font-size: clamp(1.625rem, 1.2rem + 1.9vw, 2.5rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.journey__accent { color: var(--c-blue); }

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .journey__accent {
    background: var(--gradient-logo);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    -webkit-text-fill-color: transparent;
  }
}

.journey__intro {
  max-width: 46em;
  margin: 16px auto 0;
  color: var(--c-text-muted);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
}

/* Track and line ------------------------------------------------------------ */

.journey__track {
  position: relative;
  margin-top: clamp(34px, 4.4vw, 60px);
}

.journey__line {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 64px;
  overflow: visible;
  pointer-events: none;
}

/* Once the script has measured the markers the drawing is in page pixels. */
.journey.is-ready .journey__line { height: 100%; }

.journey__line path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html:not(.js) .journey__line path { vector-effect: non-scaling-stroke; }

.journey__line-track { stroke: #D3DEE6; }

/* Stages (vertical layout first) ---------------------------------------------- */

.journey__stages {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.journey-stage__head { margin: 0; font: inherit; }

.journey-stage__toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: var(--j-marker);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

html:not(.js) .journey-stage__toggle { cursor: default; }

/* Marker */

.journey-stage__marker {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--j-marker);
  height: var(--j-marker);
  border: 2px solid var(--c-green);
  border-radius: 50%;
  background: #E8F4EF;
  color: var(--c-green-strong);
  transition: transform 320ms ease, background-color 320ms ease, border-color 320ms ease, color 320ms ease, box-shadow 320ms ease;
}

.journey-stage__marker svg {
  display: block;
  width: 46%;
  height: 46%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Check badge on a completed stage. */
.journey-stage__marker::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-bg-alt);
  border-radius: 50%;
  background: var(--c-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 70% no-repeat;
  transform: scale(1);
  transition: transform 260ms ease;
}

/* Upcoming */
.journey.is-ready .journey-stage:not(.is-done):not(.is-current) .journey-stage__marker {
  border-color: var(--j-future-line);
  background: var(--c-bg);
  color: var(--j-future);
}

.journey.is-ready .journey-stage:not(.is-done) .journey-stage__marker::after { transform: scale(0); }

/* Current */
.journey.is-ready .journey-stage.is-current .journey-stage__marker {
  border-color: transparent;
  background: linear-gradient(135deg, var(--c-green), #0871A7);
  color: #fff;
  box-shadow: 0 0 0 7px rgba(38, 150, 94, 0.16), 0 14px 24px -12px rgba(8, 113, 167, 0.8);
  transform: scale(1.12);
}

/* Journey complete: the last stage keeps the filled marker, and pulses twice. */
.journey.is-finished .journey-stage:last-child .journey-stage__marker {
  border-color: transparent;
  background: linear-gradient(135deg, var(--c-green), #0871A7);
  color: #fff;
  box-shadow: 0 0 0 7px rgba(38, 150, 94, 0.16), 0 14px 24px -12px rgba(8, 113, 167, 0.8);
}

.journey.is-finished .journey-stage:last-child .journey-stage__marker::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--c-green);
  border-radius: 50%;
  opacity: 0;
  animation: journey-complete 1.1s ease-out 2;
}

@keyframes journey-complete {
  from { opacity: 0.8; transform: scale(1); }
  to { opacity: 0; transform: scale(1.9); }
}

.journey-stage__toggle:hover .journey-stage__marker { border-color: var(--c-blue); }

/* Number and title */

.journey-stage__label {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.journey-stage__number {
  color: var(--c-green-strong);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  transition: color 320ms ease;
}

.journey-stage__title {
  color: var(--c-text);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  transition: color 320ms ease;
}

.journey.is-ready .journey-stage:not(.is-done):not(.is-current) .journey-stage__number { color: #5E6F7C; }
.journey.is-ready .journey-stage:not(.is-done):not(.is-current) .journey-stage__title { color: var(--c-text-muted); }
.journey.is-ready .journey-stage.is-current .journey-stage__title { color: var(--c-blue); }

/* Expand indicator for the vertical layout. */
.js .journey-stage__toggle::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: solid var(--c-text-muted);
  border-width: 0 2px 2px 0;
  transform: translateY(-3px) rotate(45deg);
  transition: transform var(--ease);
}

.js .journey-stage.is-selected .journey-stage__toggle::after { transform: translateY(2px) rotate(225deg); }

/* Details */

.journey-stage__detail {
  margin-top: 10px;
  padding-left: calc(var(--j-marker) + 16px);
}

.journey-stage__kicker { display: none; }

.journey-stage__text {
  margin: 0;
  color: var(--c-text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.journey-stage__activities { margin-top: 16px; }

.journey-stage__subhead {
  margin: 0;
  color: var(--c-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.journey-stage__list {
  display: grid;
  gap: 8px 24px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.journey-stage__list li {
  position: relative;
  padding-left: 26px;
}

.journey-stage__list li::before {
  content: "";
  position: absolute;
  top: 0.15em;
  left: 0;
  width: 17px;
  height: 17px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2326965E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 12.5l3 3 5-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Call to action */

.journey__cta {
  margin: clamp(28px, 3.6vw, 44px) 0 0;
  text-align: center;
}

/* Vertical layout only ------------------------------------------------------ */

@media (max-width: 767.98px) {
  /* Activities open one stage at a time; descriptions always stay visible. */
  .js .journey-stage:not(.is-selected) .journey-stage__activities { display: none; }

  /* No script: a plain gradient line down the marker column. */
  html:not(.js) .journey__line { display: none; }

  html:not(.js) .journey__stages::before {
    content: "";
    position: absolute;
    top: 24px;
    bottom: 24px;
    left: 22.5px;
    z-index: -1;
    width: 3px;
    background: linear-gradient(180deg, var(--c-green), #0871A7);
  }
}

/* Horizontal layout --------------------------------------------------------- */

@media (min-width: 768px) {
  .journey { --j-marker: 64px; }

  .journey__stages {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
  }

  .journey-stage__toggle {
    flex-direction: column;
    gap: 14px;
    padding: 0 6px 6px;
    text-align: center;
  }

  .js .journey-stage__toggle::after { content: none; }

  .journey-stage__label {
    flex: none;
    align-items: center;
    gap: 4px;
  }

  .journey-stage__title { font-size: clamp(1rem, 0.8rem + 0.7vw, 1.25rem); }

  /* The selected stage's title is underlined towards its panel. */
  .journey-stage__title::after {
    content: "";
    display: block;
    width: 28px;
    height: 3px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--c-green), #0871A7);
    transform: scaleX(0);
    transition: transform 220ms ease;
  }

  .js .journey-stage.is-selected .journey-stage__title::after { transform: scaleX(1); }

  /* No script: each stage's details sit in its own column. */
  .journey-stage__detail {
    margin-top: 14px;
    padding: 0 10px;
  }

  /* With the script: the stages are one grid row, the details one panel below. */
  .js .journey-stage { display: contents; }

  .js .journey-stage__head { grid-row: 1; }

  .js .journey-stage__detail {
    position: relative;
    grid-row: 2;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(20px, 3vw, 44px);
    margin-top: 30px;
    padding: clamp(22px, 2.8vw, 36px);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    background: linear-gradient(90deg, var(--c-green), #0871A7) top / 100% 3px no-repeat, var(--c-bg);
    box-shadow: 0 22px 44px -32px rgba(37, 55, 70, 0.6);
    animation: journey-detail 320ms ease both;
  }

  /* Every panel occupies the same cell, so the row is as tall as the longest
     one and nothing below moves while the panels change. */
  .js .journey-stage:not(.is-selected) .journey-stage__detail {
    visibility: hidden;
    animation: none;
    pointer-events: none;
  }

  /* Notch pointing at the selected stage's marker. */
  .js .journey-stage__detail::before {
    content: "";
    position: absolute;
    top: -9px;
    left: calc((var(--stage) + 0.5) * 20%);
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border: solid var(--c-green);
    border-width: 3px 0 0 3px;
    border-color: color-mix(in srgb, var(--c-green) calc(100% - var(--stage) * 25%), #0871A7);
    background: var(--c-bg);
    transform: rotate(45deg);
  }

  .js .journey-stage__kicker {
    display: block;
    margin: 0 0 10px;
    color: var(--c-text);
    font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
  }

  .js .journey-stage__text { font-size: 1rem; }

  .js .journey-stage__activities { margin-top: 0; }

  .js .journey-stage__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@keyframes journey-detail {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 768px) and (max-width: 959.98px) {
  .js .journey-stage__detail { grid-template-columns: minmax(0, 1fr); }
}

/* The run and its marker transitions play under reduced-motion settings as
   well, at the site owner's request. */

.journey .journey-stage__marker,
.journey .journey-stage__number,
.journey .journey-stage__title { transition-duration: 320ms !important; }

.journey .journey-stage__marker::after,
.journey .journey-stage__title::after { transition-duration: 240ms !important; }
