/* Milestone Timeline Section */

.milestone-timeline {
  position: relative;
  width: 100%;
}

.milestone-timeline-inner {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl, 48px);
}

/* Header */
.milestone-timeline-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 16px);
  width: 100%;
}

.milestone-timeline-title {
  margin: 0;
  line-height: 1.2;
}

.milestone-timeline-subtext {
  margin: 0;
  line-height: 1.5;
}

/* Title/subtext are richtext blocks rendered into a .rte wrapper.
   Typography lives on the WRAPPER (editor-safe). The inner <h2>/<p>
   inherits font + color so typography survives editor re-serialization. */
.milestone-timeline-title > *,
.milestone-timeline-subtext > * {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0 !important;
}

/* Timeline Steps Container */
.milestone-timeline-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl, 32px);
  width: 100%;
  position: relative;
}

@media (min-width: 768px) {
  .milestone-timeline-steps {
    flex-direction: row;
    gap: 0;
    align-items: center;
    position: relative;
  }
  
  /* Continuous horizontal line connecting all dots through their centers */
  .milestone-timeline-steps::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 2px;
    background-color: var(--mt-line, var(--clr-primary));
    opacity: 0.4;
    z-index: 0;
    /* Fade out on left and right edges */
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  }
}

/* Individual Step */
.milestone-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 16px);
  width: 100%;
  position: relative;
  flex: 1;
}

@media (min-width: 768px) {
  .milestone-step {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 0 var(--space-sm, 8px);
    justify-content: center;
    gap: var(--space-xs, 4px);
  }
}

/* Marker Row (Dot + Connector) */
.milestone-step-marker-row {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
  min-height: 24px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .milestone-step-marker-row {
    width: 100%;
    justify-content: center;
    position: relative;
    z-index: 1;
    margin: var(--space-sm, 8px) 0;
  }
}

/* Dot */
.milestone-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--mt-dot, var(--clr-primary));
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background-color: var(--clr-neutral-light);
  box-shadow: 0 0 0 4px var(--clr-neutral-light);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
  .milestone-dot {
    width: 20px;
    height: 20px;
    border-width: 4px;
    position: relative;
    z-index: 2;
  }
}

/* Connector Line */
.milestone-connector {
  flex: 1;
  height: 100%;
  display: block;
  opacity:1;
  width:4px;
  margin-left:0;
}

@media (min-width: 768px) {
  .milestone-connector {
    display: none; /* Hide individual connectors, use continuous line instead */
  }
}


/* Step Content */
.milestone-step-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 8px);
  width: 100%;
  transition: opacity 0.6s ease-out;
}

@media (min-width: 768px) {
  .milestone-step-content {
    margin-top: 0;
    align-items: flex-start;
    text-align: center;
    /* Align left edge of content with left edge of centered 20px dot */
    /* margin-left: calc(50% - 10px); */
    width: auto;
    margin-bottom: 0;
  }
}

/* Mirrored Content (Above Marker Row) - Just a duplicate, not actually mirrored */
.milestone-step-content-mirrored {
  margin-bottom: 0;
  margin-top: 0;
  transition: opacity 0.6s ease-out;
}

@media (min-width: 768px) {
  .milestone-step-content-mirrored {
    margin-bottom: 0;
    margin-top: 0;
    align-items: flex-start;
    text-align: center;
    /* Align left edge of content with left edge of centered 20px dot */
    /* margin-left: calc(50% - 10px); */
    width: auto;
  }
  
  /* Alternating opacity: odd steps (1, 3, 5...) hide top mirrored content */
  .milestone-step:nth-child(odd) .milestone-step-content-mirrored {
    opacity: 0;
  }
  
  /* Alternating opacity: even steps (2, 4, 6...) hide bottom content */
  .milestone-step:nth-child(even) .milestone-step-content:not(.milestone-step-content-mirrored) {
    opacity: 0;
  }
}

.milestone-step-title {
  margin: 0;
  line-height: 1.3;
}

.milestone-step-text {
  margin: 0;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .milestone-step-title,
  .milestone-step-text {
    text-align: center;
  }
}

/* Footer Button */
.milestone-timeline-footer {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: var(--space-lg, 24px);
}

.milestone-button {
  text-decoration: none;
}

/* Mobile: Vertical Layout with Alternating Sides */
@media (max-width: 767px) {
  .milestone-timeline-steps {
    position: relative;
    padding: 0 var(--space-md, 16px);
    gap: 0; /* Remove gap, using margin-bottom on steps instead */
  }
  
  /* Vertical center line */
  .milestone-timeline-steps::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    /* background-color: rgba(0, 0, 0, 0.1); */
    background-color: black;
    z-index: 0;
    /* Fade out on top and bottom edges */
    mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
  }
  
  .milestone-step {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    padding-bottom: var(--space-xl, 32px);
    z-index: 1;
    min-height: 60px; /* Ensure minimum height for proper spacing */
  }
  
  .milestone-step:last-child {
    margin-bottom: 0;
  }
  
  /* Odd steps (1, 3, 5...) - content on left, dot on center */
  .milestone-step:nth-child(odd) {
    flex-direction: row;
    justify-content: flex-start;
  }
  
  /* Even steps (2, 4, 6...) - content on right, dot on center */
  .milestone-step:nth-child(even) {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
  
  .milestone-step-marker-row {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    min-width: 24px;
    margin: 0;
    z-index: 2;
    height: 100%;
    justify-content: flex-start;
  }
  
  .milestone-dot {
    width: 20px;
    height: 20px;
    border-width: 4px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
  }
  
  
  
  /* Content positioning for odd steps (left side) */
  .milestone-step:nth-child(odd) .milestone-step-content {
    width: calc(50% - 24px);
    margin-right: var(--space-md, 16px);
    margin-left: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 8px);
  }
  
  /* Hide mirrored content for odd steps */
  .milestone-step:nth-child(odd) .milestone-step-content-mirrored {
    display: none;
  }
  
  /* Content positioning for even steps (right side) */
  .milestone-step:nth-child(even) .milestone-step-content {
    display: none; /* Hide regular content */
  }
  
  .milestone-step:nth-child(even) .milestone-step-content-mirrored {
    display: flex;
    flex-direction: column;
    width: calc(50% - 24px);
    margin-left: var(--space-md, 16px);
    margin-right: 0;
    text-align: left;
    gap: var(--space-sm, 8px);
  }
  
  .milestone-step-title,
  .milestone-step-text {
    margin: 0;
  }
}

/* Ensure dots align on single horizontal axis on tablet and desktop */
@media (min-width: 768px) {
  /* Ensure marker row centers the dot */
  .milestone-step-marker-row {
    justify-content: center;
  }
}



/* ---- 2026-09-24: dots on the line, and a readable mobile layout ---- */
@media (min-width: 768px) {
  .milestone-step-content,
  .milestone-step-content-mirrored {
    align-items: center;
    width: 100%;
  }
  /* This rule used to live only in the removed legacy stylesheet. */
  .milestone-timeline-button-above {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: var(--space-lg, 24px);
  }
}

/* Phones: a left rail instead of alternating sides, which squeezed each step's
   text into ~100px columns. */
@media (max-width: 767px) {
  .milestone-timeline-steps { padding: 0 0 0 36px; }
  .milestone-timeline-steps::before { display: none; }
  .milestone-step:nth-child(odd),
  .milestone-step:nth-child(even) { flex-direction: row; }
  .milestone-step-marker-row {
    left: -36px;
    transform: none;
    width: 20px;
    min-width: 20px;
  }
  .milestone-step:nth-child(odd) .milestone-step-content,
  .milestone-step:nth-child(even) .milestone-step-content-mirrored {
    width: 100%;
    margin: 0;
    text-align: left;
  }
  .milestone-connector { width: 2px; opacity: 0.4; }
}
