/**
 * Process Timeline widget — adapted from milestone-process-timeline-v2.html.
 *
 * Changes vs the standalone HTML version:
 *   - No #id selectors (the widget can appear multiple times per page);
 *     the JS targets .mms-tl-steps / .mms-tl-connectors classes instead.
 *   - Brand colors flow through CSS custom properties (--mms-tl-*) so the
 *     widget's Elementor Style controls can override them per instance:
 *       --mms-tl-grad-a / --mms-tl-grad-b  → step-number gradient
 *       --mms-tl-connector                 → SVG stroke + mobile line top
 *       --mms-tl-connector-2               → mobile line bottom
 *   - Font stack unchanged (DM Sans is the site's brand font and already
 *     loaded by the theme; the standalone file's Google Fonts <link> is
 *     intentionally NOT enqueued here).
 */

/* ── ISOLATION RESET ─────────────────────────────────────────────── */
.mms-timeline, .mms-timeline *, .mms-timeline *::before, .mms-timeline *::after {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}
.mms-timeline h1,.mms-timeline h2,.mms-timeline h3,.mms-timeline h4 {
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 700; margin: 0; padding: 0; border: none; background: none;
}
.mms-timeline p { margin: 0; padding: 0; font-family: 'DM Sans', sans-serif !important; }

/* ── ROOT ─────────────────────────────────────────────────────────── */
.mms-timeline {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 18px;
  background: transparent;
  padding: 60px 24px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════
   DESKTOP (> 1024px) — 3-COL OFFSET GRID WITH CURVED SVG CONNECTORS
   Layout (4 steps):
     [1][2][ ]
     [ ][3][4]
   Steps 2 and 3 share the center column. 1→2 horizontal, 2→3 vertical
   S-curve, 3→4 horizontal. With a step count other than 4, the explicit
   placements below simply don't match and steps auto-flow the 3-col grid
   (JS skips the SVG in that case too).
═══════════════════════════════════════════════════════════════════ */
.mms-timeline .steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

/* Offset placement — center column shared by steps 2 + 3 (4-step layout) */
.mms-timeline .steps[data-count="4"] .step[data-step="1"] { grid-column: 1; grid-row: 1; }
.mms-timeline .steps[data-count="4"] .step[data-step="2"] { grid-column: 2; grid-row: 1; }
.mms-timeline .steps[data-count="4"] .step[data-step="3"] { grid-column: 2; grid-row: 2; }
.mms-timeline .steps[data-count="4"] .step[data-step="4"] { grid-column: 3; grid-row: 2; }

.mms-timeline .connector-lines {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.mms-timeline .connector-lines path {
  fill: none;
  stroke: var(--mms-tl-connector, #c5cfe8);
  stroke-width: 1.5;
}

.mms-timeline .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
  padding: 40px 24px;
}

.mms-timeline .step-bubble {
  width: 72px; height: 72px;
  border-radius: 6px;
  background: white;
  box-shadow: 0 4px 20px rgba(23, 30, 59, 0.12);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mms-timeline .step:hover .step-bubble {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(23, 30, 59, 0.18);
}

.mms-timeline .step-number {
  width: 48px; height: 48px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--mms-tl-grad-a, #171e3b) 0%, var(--mms-tl-grad-b, #1e3295) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 1.1rem; font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.mms-timeline .step-title {
  font-size: 1rem; font-weight: 700;
  color: #171e3b;
  margin-bottom: 8px;
  line-height: 1.3;
  font-family: 'DM Sans', sans-serif !important;
}
.mms-timeline .step-desc {
  font-size: 0.875rem; font-weight: 400;
  color: #6b7280;
  line-height: 1.6;
  max-width: 240px;
  margin: 0 auto;
  font-family: 'DM Sans', sans-serif !important;
}

/* ═══════════════════════════════════════════════════════════════════
   TABLET LANDSCAPE (≤ 1024px) — keep staircase, tighter
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .mms-timeline { padding: 48px 20px; }
  .mms-timeline .steps { max-width: 760px; }
  .mms-timeline .step { padding: 32px 12px; }
  .mms-timeline .step-bubble { width: 64px; height: 64px; }
  .mms-timeline .step-number { width: 42px; height: 42px; font-size: 1rem; }
  .mms-timeline .step-desc { max-width: 200px; }
}

/* ═══════════════════════════════════════════════════════════════════
   TABLET PORTRAIT (≤ 768px) — SWITCH TO VERTICAL STACK
   SVG connectors hidden; a vertical gradient line replaces them.
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mms-timeline { padding: 40px 20px; }

  .mms-timeline .steps {
    grid-template-columns: 1fr;
    max-width: 520px;
    gap: 0;
    padding-left: 4px;       /* so the vertical line sits flush inside */
  }
  .mms-timeline .connector-lines { display: none; }

  /* Reset staircase placement so steps stack in source order */
  .mms-timeline .steps .step {
    grid-column: 1;
    grid-row: auto;
  }

  .mms-timeline .step {
    flex-direction: row;
    text-align: left;
    align-items: center;     /* vertically center text against the bubble */
    gap: 22px;
    padding: 0 0 36px 0;
    width: 100%;
    position: relative;
  }
  .mms-timeline .step:last-child { padding-bottom: 0; }

  /* Vertical connector — one line per step, drawn between THIS bubble's
     bottom and the NEXT bubble's top. Skipped on the final step. */
  .mms-timeline .step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 36px;                /* half of 72px bubble */
    top: 72px;                 /* bottom of this bubble */
    bottom: -4px;              /* overlap slightly into next step */
    width: 2px;
    transform: translateX(-1px);
    background: linear-gradient(to bottom, var(--mms-tl-connector, #c5cfe8), var(--mms-tl-connector-2, #8fa3d4));
    z-index: 0;
  }

  .mms-timeline .step-bubble {
    flex-shrink: 0;
    margin-bottom: 0;
    z-index: 1;
  }

  .mms-timeline .step-desc {
    max-width: none;
    margin: 0;
  }

  /* Touch feedback for the bubble (replaces hover on no-hover devices) */
  .mms-timeline .step:active .step-bubble {
    transform: scale(0.98);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE PORTRAIT (≤ 480px) — tighter bubble, tighter type
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .mms-timeline { padding: 32px 16px; }
  .mms-timeline .steps { max-width: 100%; padding-left: 0; }

  .mms-timeline .step {
    gap: 16px;
    padding-bottom: 28px;
  }

  .mms-timeline .step-bubble {
    width: 56px;
    height: 56px;
    border-radius: 5px;
  }
  .mms-timeline .step-number {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
    border-radius: 3px;
  }

  /* Adjust connector line to new bubble size */
  .mms-timeline .step:not(:last-child)::before {
    left: 28px;            /* half of 56px bubble */
    top: 56px;             /* bottom of 56px bubble */
  }

  .mms-timeline .step-title { font-size: 0.95rem; margin-bottom: 4px; }
  .mms-timeline .step-desc  { font-size: 0.82rem; line-height: 1.55; }
}
