/* Homepage only: keep DOM order 1–8 while the visual route turns between rows. */
.home-service-flow {
  background: #fff;
}

.home-service-flow__panel {
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.home-service-flow__heading {
  margin-bottom: 64px;
}

.home-service-flow__heading .home-service-flow__lead {
  color: #366877;
  font-size: 18px;
}

.home-service-flow__symbols {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

.home-service-flow__steps {
  --flow-disc: 220px;
  --flow-column-gap: 32px;
  --flow-row-gap: 68px;
  --flow-line: #92c9ce;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: "step1 step2 step3 step4" "step8 step7 step6 step5";
  gap: var(--flow-row-gap) var(--flow-column-gap);
  isolation: isolate;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.home-service-flow__step {
  position: relative;
  min-width: 0;
  text-align: center;
}

.home-service-flow__step:nth-child(1) { grid-area: step1; }
.home-service-flow__step:nth-child(2) { grid-area: step2; }
.home-service-flow__step:nth-child(3) { grid-area: step3; }
.home-service-flow__step:nth-child(4) { grid-area: step4; }
.home-service-flow__step:nth-child(5) { grid-area: step5; }
.home-service-flow__step:nth-child(6) { grid-area: step6; }
.home-service-flow__step:nth-child(7) { grid-area: step7; }
.home-service-flow__step:nth-child(8) { grid-area: step8; }

.home-service-flow__disc {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: var(--flow-disc);
  height: var(--flow-disc);
  margin: 0 auto;
  padding: 30px 18px 22px;
  border: 1.5px solid #d8eeee;
  border-radius: 50%;
  background: #f7fcfe;
  box-shadow: 0 8px 24px rgba(12, 95, 128, .05);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background .25s ease;
}

.home-service-flow__step:hover .home-service-flow__disc {
  transform: translateY(-4px);
  border-color: #168cbd;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(22, 140, 189, .15);
}

.home-service-flow__number {
  position: absolute;
  top: -18px;
  left: calc(50% - 22px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #168cbd;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 10px rgba(22, 140, 189, .22);
}

.home-service-flow__step:nth-child(even) .home-service-flow__number {
  background: #167e79;
  box-shadow: 0 4px 10px rgba(22, 126, 121, .22);
}

.home-service-flow__icon {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  fill: none;
  stroke: #168cbd;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-service-flow__icon-accent {
  stroke: #25bcb5;
}

.home-service-flow__disc h3 {
  max-width: 170px;
  margin: 0;
  color: #0c5f80;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  text-wrap: balance;
}

.home-service-flow__step > p {
  position: relative;
  z-index: 1;
  max-width: 290px;
  margin: 24px auto 0;
  color: #456571;
  font-size: 14.5px;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.home-service-flow__connector {
  position: absolute;
  top: calc(var(--flow-disc) / 2);
  left: 50%;
  width: calc(100% + var(--flow-column-gap));
  height: 0;
  border-top: 2px dashed var(--flow-line);
  pointer-events: none;
}

.home-service-flow__connector::after {
  display: none !important;
}

.home-service-flow__step:last-child .home-service-flow__connector {
  display: none;
}

.home-service-flow__footer {
  margin-top: 54px;
  padding-top: 36px;
  border-top: 1px solid rgba(22, 140, 189, .15);
  text-align: center;
}

.home-service-flow__footer p {
  margin: 0 0 20px;
  color: #456571;
  font-size: 14px;
  line-height: 1.8;
}

.home-service-flow__footer .theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.home-service-flow__footer a:focus-visible {
  outline: 3px solid #0c5f80;
  outline-offset: 5px;
}

@media (min-width: 1200px) {
  .home-service-flow__step:nth-child(n+5) .home-service-flow__connector {
    right: 50%;
    left: auto;
  }

  .home-service-flow__step:nth-child(n+5) .home-service-flow__connector::after {
    transform: rotate(135deg);
  }

  .home-service-flow__step:nth-child(4) .home-service-flow__connector {
    width: calc(50% + 26px);
    height: calc(100% + var(--flow-row-gap));
    border: 2px dashed var(--flow-line);
    border-left: 0;
    border-radius: 0 40px 40px 0;
  }

  .home-service-flow__step:nth-child(4) .home-service-flow__connector::after {
    top: calc(50% - 4px);
    right: -5px;
    left: auto;
    transform: rotate(45deg);
  }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
  .home-service-flow__panel { padding: 0; }
  .home-service-flow__steps { --flow-disc: 208px; --flow-column-gap: 24px; --flow-row-gap: 62px; }
  .home-service-flow__disc h3 { font-size: 18px; }
}

/* Tablets: two columns, with a turn on alternating sides. */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .home-service-flow__panel { padding: 0; }
  .home-service-flow__steps {
    --flow-disc: 220px;
    --flow-column-gap: 38px;
    --flow-row-gap: 58px;
    padding: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "step1 step2" "step4 step3" "step5 step6" "step8 step7";
  }

  .home-service-flow__step:nth-child(3) .home-service-flow__connector,
  .home-service-flow__step:nth-child(7) .home-service-flow__connector {
    right: 50%;
    left: auto;
  }

  .home-service-flow__step:nth-child(3) .home-service-flow__connector::after,
  .home-service-flow__step:nth-child(7) .home-service-flow__connector::after {
    transform: rotate(135deg);
  }

  .home-service-flow__step:nth-child(even):not(:last-child) .home-service-flow__connector {
    width: calc(50% + 24px);
    height: calc(100% + var(--flow-row-gap));
    border: 2px dashed var(--flow-line);
    border-left: 0;
    border-radius: 0 36px 36px 0;
  }

  .home-service-flow__step:nth-child(even):not(:last-child) .home-service-flow__connector::after {
    top: calc(50% - 4px);
    right: -5px;
    left: auto;
    transform: rotate(45deg);
  }

  .home-service-flow__step:nth-child(4) .home-service-flow__connector {
    right: 50%;
    left: auto;
    border-left: 2px dashed var(--flow-line);
    border-right: 0;
    border-radius: 36px 0 0 36px;
  }

  .home-service-flow__step:nth-child(4) .home-service-flow__connector::after {
    right: auto;
    left: -5px;
  }
}

/* Phones: a single readable sequence; full copy stays visible at any text size. */
@media (max-width: 767.98px) {
  .home-service-flow__panel { padding: 0; border-radius: 0; }
  .home-service-flow__heading { margin-bottom: 30px; }
  .home-service-flow__heading h2 { font-size: 28px; }
  .home-service-flow__heading .home-service-flow__lead { font-size: 16px; }
  .home-service-flow__steps {
    --flow-row-gap: 24px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "step1" "step2" "step3" "step4" "step5" "step6" "step7" "step8";
    padding: 0;
  }

  .home-service-flow__step {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 8px 16px;
    padding: 24px 18px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(12, 95, 128, .035);
    text-align: left;
  }

  .home-service-flow__disc { display: contents; }
  .home-service-flow__number {
    top: 14px;
    left: 13px;
    width: 27px;
    height: 27px;
    border-width: 3px;
    font-size: 11px;
    z-index: 2;
  }

  .home-service-flow__icon {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 50px;
    height: 62px;
    padding: 17px 7px 5px;
    border-radius: 25px;
    background: #edf8fc;
  }

  .home-service-flow__step:nth-child(even) .home-service-flow__icon { background: #e7f8f7; }
  .home-service-flow__disc h3 { grid-column: 2; max-width: none; font-size: 18px; text-wrap: wrap; }
  .home-service-flow__step > p { grid-column: 2; max-width: none; margin: 0; font-size: 14px; line-height: 1.85; }
  .home-service-flow__connector {
    top: 100%;
    left: 50%;
    width: 0;
    height: var(--flow-row-gap);
    border-top: 0;
    border-left: 2px dashed var(--flow-line);
  }

  .home-service-flow__connector::after {
    top: calc(50% - 5px);
    left: -5px;
    transform: rotate(45deg);
  }

  .home-service-flow__footer { margin-top: 28px; padding-top: 24px; }
}

@media (max-width: 374.98px) {
  .home-service-flow__panel { padding-inline: 12px; }
  .home-service-flow__step { padding-inline: 14px; column-gap: 12px; grid-template-columns: 42px minmax(0, 1fr); }
  .home-service-flow__icon { width: 42px; }
  .home-service-flow__number { left: 9px; }
  .home-service-flow__heading h2 { font-size: 25px; }
}

/* Route corrections: keep the numbered sequence connected through each row. */
@media (min-width: 1200px) {
  .home-service-flow__step:nth-child(-n+3) .home-service-flow__connector {
    top: calc(var(--flow-disc) / 2);
    right: auto;
    left: 50%;
    width: calc(100% + var(--flow-column-gap));
    height: 0;
    border: 0;
    border-top: 2px dashed var(--flow-line);
    border-radius: 0;
  }

  .home-service-flow__step:nth-child(4) .home-service-flow__connector {
    top: calc(var(--flow-disc) / 2);
    right: auto;
    left: 50%;
    width: 0;
    height: calc(100% + var(--flow-row-gap));
    border: 0;
    border-left: 2px dashed var(--flow-line);
    border-radius: 0;
  }

  .home-service-flow__step:nth-child(4) .home-service-flow__connector::after {
    top: auto;
    right: auto;
    bottom: -5px;
    left: -5px;
    transform: rotate(45deg);
  }

  .home-service-flow__step:nth-child(n+5):nth-child(-n+7) .home-service-flow__connector {
    top: calc(var(--flow-disc) / 2);
    right: 50%;
    left: auto;
    width: calc(100% + var(--flow-column-gap));
    height: 0;
    border: 0;
    border-top: 2px dashed var(--flow-line);
    border-radius: 0;
  }

  .home-service-flow__step:nth-child(n+5):nth-child(-n+7) .home-service-flow__connector::after {
    top: -5px;
    right: auto;
    bottom: auto;
    left: -5px;
    transform: rotate(135deg);
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .home-service-flow__step:nth-child(1) .home-service-flow__connector,
  .home-service-flow__step:nth-child(3) .home-service-flow__connector,
  .home-service-flow__step:nth-child(5) .home-service-flow__connector,
  .home-service-flow__step:nth-child(7) .home-service-flow__connector {
    top: calc(var(--flow-disc) / 2);
    right: auto;
    left: 50%;
    width: calc(100% + var(--flow-column-gap));
    height: 0;
    border: 0;
    border-top: 2px dashed var(--flow-line);
    border-radius: 0;
  }

  .home-service-flow__step:nth-child(3) .home-service-flow__connector,
  .home-service-flow__step:nth-child(7) .home-service-flow__connector {
    right: 50%;
    left: auto;
  }

  .home-service-flow__step:nth-child(3) .home-service-flow__connector::after,
  .home-service-flow__step:nth-child(7) .home-service-flow__connector::after {
    left: -5px;
    transform: rotate(135deg);
  }

  .home-service-flow__step:nth-child(2) .home-service-flow__connector,
  .home-service-flow__step:nth-child(4) .home-service-flow__connector,
  .home-service-flow__step:nth-child(6) .home-service-flow__connector {
    top: calc(var(--flow-disc) / 2);
    right: auto;
    left: 50%;
    width: 0;
    height: calc(100% + var(--flow-row-gap));
    border: 0;
    border-left: 2px dashed var(--flow-line);
    border-radius: 0;
  }

  .home-service-flow__step:nth-child(2) .home-service-flow__connector::after,
  .home-service-flow__step:nth-child(4) .home-service-flow__connector::after,
  .home-service-flow__step:nth-child(6) .home-service-flow__connector::after {
    top: auto;
    right: auto;
    bottom: -5px;
    left: -5px;
    transform: rotate(45deg);
  }
}
