/*
 * .timeline — head + vertical timeline of numbered steps + side card and photo
 * (template-parts/flexible/timeline.php).
 * Figma: Implementation Services D 510:65760 / M 510:71525.
 *
 * Phones and tablets: one column, steps, then the card, then the photo.
 * Desktop: steps on the left, the 530 px column on the right.
 * Fluid sizes run linearly from the 375 px phone frame to 1430 px.
 */

.timeline {
  padding-top: var(--nv-section-y);
  padding-bottom: var(--nv-section-y);
  overflow: hidden;
}

/* .timeline__container — head → steps (40 → 100 px) */
.timeline__container {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 1.168rem + 5.687vw, 6.25rem);
}

/* .timeline__head */
.timeline__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(1.875rem, 1.4306rem + 1.8957vw, 3.125rem);
}

/* .timeline__eyebrow */
.timeline__eyebrow {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.3125rem;
  padding: calc(0.625rem - 0.14em) 0.625rem;
  color: var(--nv-green);
  font-weight: 500;
  font-size: clamp(0.875rem, 0.7417rem + 0.5687vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  /* @media (width >= 48em) .timeline__eyebrow — phone mocks track 5 %, desktop 10 % */
  @media (width >= 48em) {
    padding-block: calc(0.5625rem - 0.14em);
    letter-spacing: 0.1em;
  }

  /* .timeline__eyebrow::before — rhomb */
  &::before {
    content: "";
    flex-shrink: 0;
    width: 0.53rem;
    height: 0.53rem;
    margin-top: calc(0.5lh - 0.265rem);
    background: url("../../img/icons/rhomb.svg") center / contain no-repeat;
  }
}

/* .timeline__title — 1310 px, trimmed to cap / baseline; bold turns green */
.timeline__title {
  max-width: 81.875rem;
  margin-block: -0.14em;
  color: var(--nv-navy);
  font-weight: 400;
  font-size: var(--nv-fs-h2);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;

  & strong {
    color: var(--nv-green);
    font-weight: inherit;
  }
}

/* .timeline__subtitle — 40 → 75 px under the heading's baseline, line boxes trimmed (0.24em at 120 %) */
.timeline__subtitle {
  max-width: 65.25rem;
  margin-top: calc(clamp(0.625rem, 0.2917rem + 1.4219vw, 1.5625rem) - 0.24em);
  margin-bottom: -0.24em;
  color: var(--nv-navy);
  font-size: var(--nv-fs-lead);
  line-height: 1.2;
  letter-spacing: -0.03em;

  & > * + * {
    margin-top: calc(1.25rem - 0.48em);
  }
}

/* .timeline__body — steps, then the side column */
.timeline__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--nv-flow-gap);

  /* @media (width >= 64.0625em) .timeline__body — 530 px side column */
  @media (width >= 64.0625em) {
    grid-template-columns: minmax(0, 1fr) minmax(0, min(37.857%, 33.125rem));
    column-gap: clamp(2.5rem, 8vw, 7rem);
    align-items: start;
  }
}

/* .timeline__body--single — no side column: the steps take the full width */
.timeline__body--single {
  @media (width >= 64.0625em) {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* .timeline__steps — ink-aligned rows (the cap-height trim is 0.14em at 100 %, 0.24em at 120 %) */
.timeline__steps {
  --tl-trim: 0.14em;
  --tl-num-col: clamp(3.1875rem, 2.2325rem + 4.076vw, 5.875rem);
  --tl-marker-col: clamp(1.8125rem, 1.04rem + 3.318vw, 4rem);

  display: flex;
  flex-direction: column;
  gap: var(--nv-flow-gap);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--nv-navy);

  /* @media (width >= 48em) .timeline__steps */
  @media (width >= 48em) {
    --tl-trim: 0.24em;
  }
}

/* .timeline__step — number | marker | text; the line runs from this marker to the next */
.timeline__step {
  position: relative;
  display: grid;
  grid-template-columns: var(--tl-num-col) var(--tl-marker-col) minmax(0, 1fr);
  align-items: start;

  /* .timeline__step:not(:last-child)::before — vertical line to the next marker */
  &:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 0.75rem;
    left: calc(var(--tl-num-col) + 0.75rem);
    width: 0;
    height: calc(100% + var(--nv-flow-gap));
    border-left: 1px solid rgba(19, 33, 50, 0.3);
  }
}

/* .timeline__number — 32 → 40 px */
.timeline__number {
  margin-top: calc(var(--tl-trim) * -1);
  font-weight: 500;
  font-size: clamp(2rem, 1.8225rem + 0.758vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.02em;

  /* @media (width >= 48em) .timeline__number */
  @media (width >= 48em) {
    line-height: 1.2;
  }
}

/* .timeline__marker — "eye": 24 px ring (20 %) with a 12 px dot */
.timeline__marker {
  position: relative;
  z-index: 1;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background-color: rgba(168, 217, 95, 0.2);

  /* .timeline__marker::after — dot */
  &::after {
    content: "";
    position: absolute;
    inset: 0.375rem;
    border-radius: 50%;
    background-color: var(--nv-green);
  }
}

/* .timeline__step-body */
.timeline__step-body {
  display: flex;
  flex-direction: column;
  gap: clamp(0.625rem, 0.403rem + 0.948vw, 1.25rem);
}

/* .timeline__step-title — 23 → 32 px */
.timeline__step-title {
  margin-block: calc(var(--tl-trim) * -1);
  font-weight: 600;
  font-size: clamp(1.4375rem, 1.2375rem + 0.853vw, 2rem);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;

  /* @media (width >= 48em) .timeline__step-title */
  @media (width >= 48em) {
    line-height: 1.2;
  }

  & > * {
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
  }
}

/* .timeline__step-text — 16 → 23 px, navy at 70 % */
.timeline__step-text {
  color: rgba(19, 33, 50, 0.7);
  margin-block: calc(var(--tl-trim) * -1);
  font-size: clamp(1rem, 0.8445rem + 0.6635vw, 1.4375rem);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;

  /* @media (width >= 48em) .timeline__step-text */
  @media (width >= 48em) {
    line-height: 1.22;
  }

  /* @media (width >= 64.0625em) .timeline__step-text — the desktop mock wraps at ~590 px, not at the 600 px column */
  @media (width >= 64.0625em) {
    max-width: 36.9rem;
  }

  & > * {
    margin: 0;
  }

  & > * + * {
    margin-top: 0.75em;
  }
}

/* @media (width >= 64.0625em) .timeline__step:is(:nth-child(4), :nth-child(5)) .timeline__step-text on
   Implementation — the design wraps the texts of steps 04 and 05 in 445 and 464 px boxes (Figma phase 2 Implementation frame) */
@media (width >= 64.0625em) {
  .page-id-124 .timeline__step:nth-child(4) .timeline__step-text {
    max-width: 27.8125rem;
  }

  .page-id-124 .timeline__step:nth-child(5) .timeline__step-text {
    max-width: 29rem;
  }
}

/* .timeline__aside — card, then the photo (20 px apart) */
.timeline__aside {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* .timeline__card — blue card over a photo, tinted blue */
.timeline__card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--nv-radius-s);
  background-color: var(--nv-blue);
  color: var(--nv-white);

  /* .timeline__card::before — blue tint, 80 % */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: rgba(33, 91, 135, 0.8);
  }

  /* .timeline__card::after — navy → light-blue gradient, 80 % */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(173deg, rgba(19, 33, 50, 0) 30%, rgba(19, 33, 50, 0.6) 82%, var(--nv-blue-light) 112%);
    opacity: 0.8;
  }
}

/* .timeline__card-media — photo behind the tint (the ::before / ::after sit above it) */
.timeline__card-media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

/* .timeline__card-image */
.timeline__card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .timeline__card-body — 50 px around, title → text 30 px */
.timeline__card-body {
  display: flex;
  flex-direction: column;
  gap: 1.875rem;
  padding: 3.125rem;

  /* @media (width >= 48em) .timeline__card-body — ink gap 31.6 px in the desktop mock */
  @media (width >= 48em) {
    gap: 2rem;
  }
}

/* .timeline__card-title — 23 → 32 px */
.timeline__card-title {
  margin-block: -0.14em;
  font-weight: 500;
  font-size: clamp(1.4375rem, 1.2375rem + 0.853vw, 2rem);
  line-height: 1;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;

  /* @media (width >= 48em) .timeline__card-title — the desktop mock tracks 2 % */
  @media (width >= 48em) {
    letter-spacing: -0.02em;
  }

  & > * {
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
  }
}

/* .timeline__card-text — 20 → 23 px, 100 % on phones, 120 % from 48em (trims 0.14em / 0.24em) */
.timeline__card-text {
  margin-block: -0.14em;
  font-size: clamp(1.25rem, 1.1834rem + 0.2844vw, 1.4375rem);
  line-height: 1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;

  /* @media (width >= 48em) .timeline__card-text */
  @media (width >= 48em) {
    margin-block: -0.24em;
    line-height: 1.2;
  }

  & > * {
    margin: 0;
  }

  & > * + * {
    margin-top: 0.75em;
  }
}

/* .timeline__photo — 530 × 481 desktop, 335 × 340 phone; the frame sets the shape */
.timeline__photo {
  aspect-ratio: 335 / 340;
  overflow: hidden;
  border-radius: var(--nv-radius-s);

  /* @media (width >= 48em) .timeline__photo */
  @media (width >= 48em) {
    aspect-ratio: 530 / 481;
  }
}

/* .timeline__photo-image */
.timeline__photo-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
