.timeline { position: relative; max-width: 850px; margin: 0 auto; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 12px; bottom: 12px; left: 24px; width: 3px; background: var(--teal); }
.timeline li { display: flex; gap: 20px; align-items: flex-start; position: relative; }
.timeline > li + li { margin-top: 22px; }
.step-index { display: grid; place-items: center; flex: 0 0 50px; height: 50px; border-radius: 50%; background: var(--black); color: var(--ivory); font-weight: 700; font-size: 21px; }
.timeline article {
  --engraving-size: 108px;
  --corner-width: 88px;
  --corner-height: 64px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--engraving-size);
  grid-template-areas: "heading heading" "description engraving";
  gap: 8px 20px;
  align-content: center;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 20px 26px;
  border-radius: var(--radius);
  background-color: var(--ivory);
  box-shadow: var(--shadow);
}
.timeline article > h3 {
  grid-area: heading;
  padding: 0 var(--corner-width);
  text-align: center;
  overflow-wrap: break-word;
}
.timeline article > p {
  grid-area: description;
  /* Keep the first line below the ornament even when the description wraps. */
  margin-top: 28px;
  color: var(--umber);
  overflow-wrap: break-word;
}
.timeline article::before { content: ""; }
.timeline article::before, .timeline .step-corner {
  position: absolute;
  top: 9px;
  left: 13px;
  width: var(--corner-width);
  height: var(--corner-height);
  background: var(--step-corner, none) top left / contain no-repeat;
  pointer-events: none;
}
.timeline article::after {
  content: "";
  grid-area: engraving;
  width: var(--engraving-size);
  height: var(--engraving-size);
  background: var(--step-engraving, none) center / contain no-repeat;
  opacity: .30;
  pointer-events: none;
}
[dir="rtl"] .timeline article {
  grid-template-columns: var(--engraving-size) minmax(0, 1fr);
  grid-template-areas: "heading heading" "engraving description";
}

.timeline > li:nth-child(1) {
  --step-corner: url("../images/dividers/timeline-corners/ribbon-knot.png");
  --step-engraving: url("../images/icons/timeline/online-form.png");
}
.timeline > li:nth-child(2) {
  --step-corner: url("../images/dividers/timeline-corners/guiding-star.png");
  --step-engraving: url("../images/icons/timeline/arrival.png");
}
.timeline > li:nth-child(3) {
  --step-corner: url("../images/dividers/timeline-corners/sage.png");
  --step-engraving: url("../images/icons/timeline/medical.png");
}
.timeline > li:nth-child(4) {
  --step-corner: url("../images/dividers/timeline-corners/seal.png");
  --step-engraving: url("../images/icons/timeline/signing.png");
}
.timeline > li:nth-child(5) {
  --step-corner: url("../images/dividers/timeline-corners/flame.png");
  --step-engraving: url("../images/icons/timeline/learning.png");
}

.text-imprint { display: grid; gap: 13px; margin-top: 24px; }
.text-imprint i:nth-child(2) { width: 35%; }
.text-imprint i:nth-child(3) { width: 44%; }

@media (min-width: 711px) {
  .timeline { max-width: 810px; }
  /* Split the original marker space and gap evenly around the card. */
  .timeline > li { gap: 10px; }
  .timeline .step-index, .timeline > li::after { flex: 0 0 25px; }
  .timeline > li::after { content: ""; }
  .timeline::before { left: calc(50% - 1px); width: 2px; }
  .timeline article { min-height: 180px; }
}

@media (max-width: 710px) {
  .timeline article {
    --engraving-size: 80px;
    --corner-width: 58px;
    --corner-height: 43px;
    gap: 8px 14px;
  }
  .timeline article > p { margin-top: 6px; }
  [dir="rtl"] .timeline::before { right: 24px; left: auto; }
}

@media (max-width: 490px) {
  .timeline li { gap: 12px; }
  .timeline::before { left: 17px; }
  .timeline article {
    --engraving-size: 60px;
    --corner-width: 36px;
    --corner-height: 28px;
    gap: 8px 10px;
    padding: 18px 16px;
  }
  .timeline article::before, .timeline .step-corner { top: 8px; left: 8px; }
  .timeline article > p { margin-top: 0; }
  .step-index { flex-basis: 36px; height: 36px; font-size: 16px; }
  [dir="rtl"] .timeline::before { right: 17px; }
}

@media (max-width: 350px) {
  .timeline article { --engraving-size: 48px; }
}

.timeline .step-index {
  visibility: hidden;
}
