/* divtodiv — workflow diagrams: inline storytelling expand (20250612-story)
   Manual pain (top) -> divtodiv lit rail (middle) -> automated solution (bottom). */

.industries-sec .service-box.workflow-expanded {
  --iwp-light-cycle: 16s;
  --iwp-step-slot: calc(var(--iwp-light-cycle) / 5);
}

.industries-sec .service-box {
  position: relative;
  cursor: default;
}

.industries-sec .service-box.has-workflow-diagram {
  overflow: hidden;
}

.industries-sec .service-box.has-workflow-diagram .service-inner {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

@media (min-width: 992px) {
  .industries-sec .service-box.has-workflow-diagram.workflow-expanded .service-inner {
    opacity: 0.55;
    transform: scale(0.98);
    transform-origin: left center;
    pointer-events: none;
  }
}

.industry-workflow-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.industries-sec .service-box.workflow-expanded .industry-workflow-panel {
  grid-template-rows: 1fr;
}

.industry-workflow-panel > .iwp-inner {
  overflow: hidden;
  min-height: 0;
}

.iwp-content {
  padding: 0 72px 40px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease 0.08s, transform 0.4s ease 0.08s;
}

.industries-sec .service-box.workflow-expanded .iwp-content {
  opacity: 1;
  transform: translateY(0);
}

.iwp-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.iwp-label-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
}

.iwp-title {
  margin: 0 0 26px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 720px;
}

.iwp-title strong {
  font-weight: 500;
  color: #fff;
}

/* ---- flow framing (before / after edge labels) ----------------------- */
.iwp-flow {
  position: relative;
}

.iwp-edge {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.6s ease 0.28s;
}

.iwp-edge-top {
  color: rgba(255, 255, 255, 0.34);
  margin-bottom: 8px;
}

.iwp-edge-bottom {
  margin-top: 12px;
  text-align: right;
  color: rgba(255, 255, 255, 0.72);
}

.industries-sec .service-box.workflow-expanded .iwp-edge {
  opacity: 1;
}

/* ---- pipeline -------------------------------------------------------- */
.iwp-pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 26px;
  position: relative;
  isolation: isolate;
}

/* ambient brand orb behind the rail */
.iwp-orb {
  position: absolute;
  top: 94px;
  left: 50%;
  width: 360px;
  height: 360px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1), transparent 60%),
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.07), transparent 25%, rgba(255, 255, 255, 0.05) 50%, transparent 75%, rgba(255, 255, 255, 0.07));
  filter: blur(34px);
  opacity: 0;
  transition: opacity 0.9s ease 0.2s;
  animation: iwp-orb-spin 24s linear infinite;
}

.industries-sec .service-box.workflow-expanded .iwp-orb {
  opacity: 0.45;
}

@keyframes iwp-orb-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* the divtodiv rail through the circle centers */
.iwp-pipeline::before {
  content: "";
  position: absolute;
  top: 94px;
  left: 48px;
  right: 48px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  z-index: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}

.industries-sec .service-box.workflow-expanded .iwp-pipeline::before {
  transform: scaleX(1);
}

/* Cursor-driven glow: appears while hovering the pipeline, follows pointer X */
.iwp-cursor-glow {
  position: absolute;
  top: 94px;
  left: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  transform: translate(calc(var(--iwp-gx, 0px) - 50%), -50%);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    transparent 70%
  );
  filter: blur(8px);
  transition: opacity 0.25s ease;
  will-change: transform;
}

.iwp-pipeline.is-focusing .iwp-cursor-glow {
  opacity: 1;
}

/* While the user steers the light, pause the auto demo + reset circles to base */
.iwp-pipeline.is-focusing::after {
  opacity: 0 !important;
  animation-play-state: paused;
}

.iwp-pipeline.is-focusing .iwp-stage .iwp-stage-node {
  animation-name: none !important;
}

.iwp-pipeline.is-focusing .iwp-stage-node {
  transition:
    transform 0.3s cubic-bezier(0.34, 1.5, 0.64, 1),
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

.iwp-pipeline.is-focusing .iwp-stage-name,
.iwp-pipeline.is-focusing .iwp-divtodiv-pill {
  transition:
    color 0.3s ease,
    border-color 0.3s ease,
    background 0.3s ease;
}

/* Nearest step under the cursor lights up */
.iwp-pipeline.is-focusing .iwp-stage.is-near .iwp-stage-node {
  background-color: rgba(255, 255, 255, 0.92);
  border-color: #ffffff;
  color: #1b1b1b;
  transform: scale(1.08);
}

.iwp-pipeline.is-focusing .iwp-stage.is-near .iwp-stage-name {
  color: #ffffff;
}

.iwp-pipeline.is-focusing .iwp-stage.is-near .iwp-divtodiv-pill {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.iwp-pipeline.is-focusing .iwp-stage.is-near .iwp-pain {
  color: rgba(255, 255, 255, 0.7);
}

/* Delicate traveling glow aligned to circle centers (10/30/50/70/90%). */
.iwp-pipeline::after {
  content: "";
  position: absolute;
  top: 94px;
  left: 10%;
  width: 84px;
  height: 84px;
  margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.34) 0%,
    rgba(255, 255, 255, 0.1) 36%,
    transparent 68%
  );
  filter: blur(6px);
  animation: iwp-travel-x var(--iwp-light-cycle, 16s) linear infinite;
  animation-play-state: paused;
}

.industries-sec .service-box.workflow-expanded .iwp-pipeline::after {
  animation-play-state: running;
}

@keyframes iwp-travel-x {
  0% { left: 10%; opacity: 0; }
  5% { opacity: 0.75; }
  70% { opacity: 0.75; }
  75% { left: 90%; opacity: 0; }
  100% { left: 90%; opacity: 0; }
}

/* ---- stage: pain (top) / node / name / solution (bottom) ------------- */
.iwp-stage {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 60px 68px auto auto;
  align-items: center;
  justify-items: center;
}

/* manual pain — the "before", dim and fragmented */
.iwp-pain {
  align-self: end;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding-bottom: 12px;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.5s ease var(--iwp-in-delay, 0s),
    transform 0.5s ease var(--iwp-in-delay, 0s),
    color 0.3s ease;
}

.industries-sec .service-box.workflow-expanded .iwp-pain {
  opacity: 1;
  transform: translateY(0);
}

.iwp-mark {
  flex: none;
  font-size: 10px;
  line-height: 1.5;
}

.iwp-mark-x {
  color: rgba(255, 120, 120, 0.6);
}

.iwp-mark-c {
  color: rgba(150, 240, 180, 0.9);
  font-size: 11px;
}

.iwp-stage-node {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-color: #15161b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: -0.02em;
  overflow: hidden;
  box-shadow: none;
  opacity: 0;
  transform: scale(0.62);
  transition:
    transform 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) var(--iwp-in-delay, 0s),
    opacity 0.45s ease var(--iwp-in-delay, 0s),
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
  animation-duration: var(--iwp-light-cycle, 16s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}

.industries-sec .service-box.workflow-expanded .iwp-stage-node {
  opacity: 1;
  transform: scale(1);
  animation-play-state: running;
}

/* Staggered entrance for each step column */
.iwp-stage:nth-child(2) { --iwp-in-delay: 0.1s; }
.iwp-stage:nth-child(3) { --iwp-in-delay: 0.18s; }
.iwp-stage:nth-child(4) { --iwp-in-delay: 0.26s; }
.iwp-stage:nth-child(5) { --iwp-in-delay: 0.34s; }
.iwp-stage:nth-child(6) { --iwp-in-delay: 0.42s; }

.iwp-stage-name,
.iwp-divtodiv-pill {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.5s ease var(--iwp-in-delay, 0s),
    transform 0.5s ease var(--iwp-in-delay, 0s),
    border-color 0.3s ease,
    background 0.3s ease,
    color 0.3s ease;
}

.industries-sec .service-box.workflow-expanded .iwp-stage-name,
.industries-sec .service-box.workflow-expanded .iwp-divtodiv-pill {
  opacity: 1;
  transform: translateY(0);
}

/* The orb counts as the first grid child, so node fills target nth-child 2..6 */
.iwp-stage:nth-child(2) .iwp-stage-node { animation-name: iwp-fill-1; }
.iwp-stage:nth-child(3) .iwp-stage-node { animation-name: iwp-fill-2; }
.iwp-stage:nth-child(4) .iwp-stage-node { animation-name: iwp-fill-3; }
.iwp-stage:nth-child(5) .iwp-stage-node { animation-name: iwp-fill-4; }
.iwp-stage:nth-child(6) .iwp-stage-node { animation-name: iwp-fill-5; }

@keyframes iwp-fill-1 {
  0% { background-color: rgba(255,255,255,0.86); border-color: rgba(255,255,255,0.75); color:#1c1c1c; }
  6%, 94% { background-color:#15161b; border-color:rgba(255,255,255,0.18); color:rgba(255,255,255,0.85); }
  100% { background-color: rgba(255,255,255,0.86); border-color: rgba(255,255,255,0.75); color:#1c1c1c; }
}
@keyframes iwp-fill-2 {
  0%, 12.75%, 24.75%, 100% { background-color:#15161b; border-color:rgba(255,255,255,0.18); color:rgba(255,255,255,0.85); }
  18.75% { background-color: rgba(255,255,255,0.86); border-color: rgba(255,255,255,0.75); color:#1c1c1c; }
}
@keyframes iwp-fill-3 {
  0%, 31.5%, 43.5%, 100% { background-color:#15161b; border-color:rgba(255,255,255,0.18); color:rgba(255,255,255,0.85); }
  37.5% { background-color: rgba(255,255,255,0.86); border-color: rgba(255,255,255,0.75); color:#1c1c1c; }
}
@keyframes iwp-fill-4 {
  0%, 50.25%, 62.25%, 100% { background-color:#15161b; border-color:rgba(255,255,255,0.18); color:rgba(255,255,255,0.85); }
  56.25% { background-color: rgba(255,255,255,0.86); border-color: rgba(255,255,255,0.75); color:#1c1c1c; }
}
@keyframes iwp-fill-5 {
  0%, 69%, 81%, 100% { background-color:#15161b; border-color:rgba(255,255,255,0.18); color:rgba(255,255,255,0.85); }
  75% { background-color: rgba(255,255,255,0.86); border-color: rgba(255,255,255,0.75); color:#1c1c1c; }
}

.iwp-stage-name {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  text-align: center;
}

/* automated solution — the "after", glowing divtodiv outcome */
.iwp-divtodiv-pill {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  align-self: start;
  margin: 12px auto 0;
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.03);
  font-size: 10.5px;
  line-height: 1.4;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

/* ---- KPIs ------------------------------------------------------------ */
.iwp-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.iwp-kpi {
  padding: 16px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease,
    background 0.3s ease;
}

.industries-sec .service-box.workflow-expanded .iwp-kpi {
  opacity: 1;
  transform: translateY(0);
}

.industries-sec .service-box.workflow-expanded .iwp-kpi:nth-child(1) { transition-delay: 0.3s; }
.industries-sec .service-box.workflow-expanded .iwp-kpi:nth-child(2) { transition-delay: 0.37s; }
.industries-sec .service-box.workflow-expanded .iwp-kpi:nth-child(3) { transition-delay: 0.44s; }
.industries-sec .service-box.workflow-expanded .iwp-kpi:nth-child(4) { transition-delay: 0.51s; }

.iwp-kpi:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.iwp-kpi-value {
  display: block;
  margin-bottom: 6px;
  font-size: 26px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #fff;
}

.iwp-kpi-label {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.5);
}

.iwp-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.iwp-hint:hover,
.iwp-hint:focus-visible {
  color: rgba(255, 255, 255, 0.72);
  outline: none;
}

.industries-sec .service-box.workflow-expanded .iwp-hint {
  opacity: 0;
  pointer-events: none;
}

.iwp-hint-arrow {
  font-size: 13px;
  line-height: 1;
}

@media (max-width: 1199px) {
  .iwp-content {
    padding: 0 40px 32px;
  }

  .iwp-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 991px) {
  .industries-sec .service-box.has-workflow-diagram {
    cursor: pointer;
  }

  .iwp-content {
    padding: 0 20px 28px;
  }

  .iwp-label {
    margin-bottom: 14px;
    font-size: 10px;
  }

  .iwp-title {
    font-size: 17px;
    line-height: 1.4;
    margin-bottom: 22px;
  }

  .iwp-edge-bottom {
    text-align: left;
  }

  .iwp-pipeline {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 22px;
  }

  .iwp-pipeline::before,
  .iwp-pipeline::after,
  .iwp-orb {
    display: none;
  }

  .iwp-stage-node {
    animation-name: iwp-node-soft-pulse;
    animation-duration: 3.4s;
    animation-timing-function: ease-in-out;
  }

  .iwp-stage:nth-child(2) .iwp-stage-node { animation-delay: 0s; }
  .iwp-stage:nth-child(3) .iwp-stage-node { animation-delay: 0.45s; }
  .iwp-stage:nth-child(4) .iwp-stage-node { animation-delay: 0.9s; }
  .iwp-stage:nth-child(5) .iwp-stage-node { animation-delay: 1.35s; }
  .iwp-stage:nth-child(6) .iwp-stage-node { animation-delay: 1.8s; }

  @keyframes iwp-node-soft-pulse {
    0%, 100% { border-color: rgba(255, 255, 255, 0.18); background-color: #15161b; }
    50% { border-color: rgba(255, 255, 255, 0.5); background-color: #1f2026; }
  }

  /* stacked rows: node on the left, pain + name + solution on the right */
  .iwp-stage {
    flex: none;
    width: 100%;
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 14px;
    row-gap: 4px;
    padding: 14px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    justify-items: start;
    align-items: center;
  }

  .iwp-stage-node {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 48px;
    height: 48px;
    margin: 0;
    font-size: 12px;
  }

  .iwp-stage-name {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    text-align: left;
    font-size: 14px;
  }

  .iwp-pain {
    grid-column: 2;
    grid-row: 2;
    align-self: auto;
    padding-bottom: 0;
    justify-content: flex-start;
    text-align: left;
  }

  .iwp-divtodiv-pill {
    grid-column: 2;
    grid-row: 3;
    margin: 4px 0 0;
    justify-content: flex-start;
    text-align: left;
  }

  .iwp-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .iwp-kpi {
    padding: 14px 12px;
  }

  .iwp-kpi-value {
    font-size: 22px;
  }
}

@media (max-width: 767px) {
  .industries-sec .service-box.has-workflow-diagram .service-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .industries-sec .service-box.has-workflow-diagram .service-inner .service-img-box:first-child {
    width: 88px;
    height: 88px;
  }

  .industries-sec .service-box.has-workflow-diagram .service-inner .service-img-box img {
    width: 88px;
    height: auto;
    position: static;
    animation: none;
  }

  .industries-sec .service-box.has-workflow-diagram .service-feature-description .title {
    margin-bottom: 12px;
    font-size: 26px;
    line-height: 1.2;
  }

  .industries-sec .service-box.has-workflow-diagram .service-feature-description p {
    max-width: none;
    font-size: 15px;
    line-height: 1.55;
  }

  .iwp-hint {
    margin-top: 14px;
    font-size: 11px;
  }

  .industries-sec .service-box.has-workflow-diagram.workflow-expanded .service-inner .service-img-box {
    display: none;
  }

  .industries-sec .service-box.has-workflow-diagram.workflow-expanded .service-inner {
    gap: 0;
    padding-bottom: 8px;
  }

  .iwp-content {
    padding: 0 20px 24px;
    width: 100%;
    box-sizing: border-box;
  }

  .iwp-kpis {
    grid-template-columns: 1fr;
  }

  .iwp-kpi-value {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .industry-workflow-panel,
  .iwp-content,
  .industries-sec .service-box.has-workflow-diagram .service-inner {
    transition: none;
  }

  .iwp-pipeline::after,
  .iwp-cursor-glow,
  .iwp-stage-node,
  .iwp-orb {
    animation: none !important;
  }

  .iwp-pipeline::after,
  .iwp-cursor-glow,
  .iwp-orb {
    display: none;
  }

  .iwp-pipeline::before,
  .iwp-stage-node,
  .iwp-stage-name,
  .iwp-pain,
  .iwp-divtodiv-pill,
  .iwp-edge,
  .iwp-kpi {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
