.sf-timeline-wrapper {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 40px 20px;
}

.sf-timeline-grid {
  display: grid;
  /* 7 columns: 1 left connector + 5 items + 1 right connector */
  grid-template-columns: 50px repeat(5, 1fr) 50px;
  grid-row-gap: var(--row-gap);
  --row-gap: 50px;
  --arrow-h: 56px;
  position: relative;
}

.sf-item {
  display: flex;
  flex-direction: column;
}

.sf-arrow {
  height: var(--arrow-h);
  background-color: var(--item-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  position: relative;
  z-index: 1;
}
.sf-date {
  text-align: center;
  line-height: 1.2;
}

/* --- Right pointing items (Row 1 and 3) --- */
.sf-dir-right .sf-arrow {
  clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%, 10% 50%);
  width: 110%;
  transform: translateX(-5%);
}
.sf-dir-right.sf-pos-first .sf-arrow {
  clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%);
  width: 105%;
  transform: none;
}
.sf-dir-right.sf-pos-last .sf-arrow {
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 10% 50%);
  width: 105%;
  transform: translateX(-5%);
}

/* --- Left pointing items (Row 2) --- */
.sf-dir-left .sf-arrow {
  clip-path: polygon(100% 0%, 10% 0%, 0% 50%, 10% 100%, 100% 100%, 90% 50%);
  width: 110%;
  transform: translateX(5%);
}
.sf-dir-left.sf-pos-first .sf-arrow { 
  /* Item 6 in grid column 6 (visually far right) */
  clip-path: polygon(100% 0%, 10% 0%, 0% 50%, 10% 100%, 100% 100%);
  width: 105%;
  transform: none;
}
.sf-dir-left.sf-pos-last .sf-arrow {
  /* Item 10 in grid column 2 (visually far left) */
  clip-path: polygon(100% 0%, 0% 0%, 0% 100%, 100% 100%, 90% 50%);
  width: 105%;
  transform: translateX(5%);
}

.sf-title {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: #1A202C;
  line-height: 1.4;
  padding: 0 15px;
}

/* --- Curved Connectors --- */
.sf-connector {
  position: relative;
}

.sf-connector-right {
  grid-column: 7;
  grid-row: 1;
  height: calc(100% + var(--row-gap));
}
.sf-connector-right::after {
  content: "";
  position: absolute;
  top: 0;
  left: -20px;
  width: calc(100% + 20px);
  height: calc(100% + var(--arrow-h));
  border: var(--arrow-h) solid #D53F8C; /* Color of Item 6 */
  border-left: 0;
  border-radius: 0 1000px 1000px 0;
  box-sizing: border-box;
  z-index: 0;
}

.sf-connector-left {
  grid-column: 1;
  grid-row: 2;
  height: calc(100% + var(--row-gap));
}
.sf-connector-left::after {
  content: "";
  position: absolute;
  top: 0;
  right: -20px;
  width: calc(100% + 20px);
  height: calc(100% + var(--arrow-h));
  border: var(--arrow-h) solid #319795; /* Color of Item 11 */
  border-right: 0;
  border-radius: 1000px 0 0 1000px;
  box-sizing: border-box;
  z-index: 0;
}

.sf-curve-icon {
  position: absolute;
  top: calc( (100% + var(--arrow-h)) / 2 );
  background: #1A365D;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-50%);
}
.sf-connector-right .sf-curve-icon {
  right: -10px;
}
.sf-connector-left .sf-curve-icon {
  left: -10px;
}

/* --- Responsive Layout (Tablet & Mobile) --- */
@media (max-width: 900px) {
  .sf-timeline-wrapper {
    padding: 30px 15px;
  }
  .sf-timeline-grid {
    grid-template-columns: 30px repeat(5, 1fr) 30px;
    --row-gap: 40px;
  }
  .sf-title {
    font-size: 13px;
    padding: 0 5px;
  }
  .sf-date {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .sf-timeline-grid {
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  .sf-connector-right, .sf-connector-left {
    display: none;
  }
  .sf-item {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    margin-bottom: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
  }
  
  /* Reset arrow transformations for mobile */
  .sf-arrow, 
  .sf-dir-right .sf-arrow, 
  .sf-dir-right.sf-pos-first .sf-arrow, 
  .sf-dir-right.sf-pos-last .sf-arrow,
  .sf-dir-left .sf-arrow,
  .sf-dir-left.sf-pos-first .sf-arrow,
  .sf-dir-left.sf-pos-last .sf-arrow {
    width: 130px;
    height: auto;
    min-height: 80px;
    margin: 0;
    transform: none;
    flex-shrink: 0;
    /* On vertical mobile, they all point right */
    clip-path: polygon(0% 0%, 85% 0%, 100% 50%, 85% 100%, 0% 100%);
  }
  
  .sf-title {
    text-align: left;
    margin: 0;
    padding: 15px 20px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    font-size: 15px;
  }
}
