/* Solution */

#how-it-works {
  position: relative;
  isolation: isolate;
  --solution-progress: 0;
  --solution-overview-progress: 0;
  --solution-cta-progress: 0;
  min-height: auto;
}

#how-it-works::before {
  content: '';
  position: absolute;
  inset: 8% 0 auto;
  height: clamp(18rem, 30vw, 24rem);
  background:
    radial-gradient(circle at 48% 10%, rgba(var(--brand-color-rgb), 0.14), transparent 54%),
    linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.05), transparent 74%);
  pointer-events: none;
  z-index: -1;
}

.solution-story {
  position: relative;
  min-height: inherit;
}

.solution-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(21rem, 29vw, 26rem);
  column-gap: clamp(1rem, 2.2vw, 1.8rem);
  min-height: clamp(41rem, 50vw, 46rem);
  align-items: start;
  padding: clamp(1.2rem, 2.4vw, 1.7rem);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.solution-side {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: calc(var(--header-height) + clamp(1rem, 2vw, 1.35rem));
  align-self: start;
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - clamp(2rem, 4vw, 3rem));
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: clamp(0.7rem, 1.6vw, 0.95rem);
  width: 100%;
  padding-top: clamp(0.35rem, 0.8vw, 0.55rem);
}

.solution-intro {
  margin-bottom: 0;
  text-align: right;
  align-self: flex-end;
  overflow: visible;
}

.solution-intro h2 {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  max-width: none;
  margin: 0 0 0.8rem auto;
  text-align: right;
}

.solution-intro__title-line {
  display: block;
  width: 100%;
  white-space: nowrap;
  text-align: right;
}

.solution-intro p {
  margin-bottom: 0;
  max-width: 29ch;
  margin-left: auto;
  text-align: right;
}

.solution-flow,
.solution-overview {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.8rem, 1.4vw, 1rem);
  padding: 0 0 clamp(2rem, 4vw, 2.6rem) 0;
}

.solution-flow {
  opacity: 1;
  transform: none;
  transition: none;
}

.solution-flow__step,
.solution-overview__item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 0.85rem;
  row-gap: 0.7rem;
  overflow: hidden;
  min-width: 0;
  min-height: clamp(9.9rem, 14vw, 11.8rem);
  width: clamp(20rem, calc(100% - 5rem), 44rem);
  padding: clamp(1.05rem, 2vw, 1.35rem) clamp(1rem, 2.2vw, 1.35rem);
  border: 1px solid rgba(var(--brand-color-rgb), 0.14);
  border-radius: calc(var(--radius-md) + 0.1rem);
  background:
    linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.09), rgba(255, 255, 255, 0.015) 38%),
    var(--panel-bg);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  transform: none;
  transition:
    transform var(--transition-med),
    border-color var(--transition-med),
    box-shadow var(--transition-med),
    background var(--transition-med),
    opacity var(--transition-med);
  will-change: transform;
}

.solution-flow__step:nth-child(1),
.solution-overview__item:nth-child(1) {
  margin-left: 0;
}

.solution-flow__step:nth-child(2),
.solution-overview__item:nth-child(2) {
  margin-left: clamp(5rem, 10vw, 9rem);
}

.solution-flow__step:nth-child(3),
.solution-overview__item:nth-child(3) {
  margin-left: clamp(10rem, 21vw, 18rem);
}

.solution-flow__step:nth-child(4),
.solution-overview__item:nth-child(4) {
  margin-left: clamp(15rem, 32vw, 27rem);
}

.solution-flow__step::before,
.solution-overview__item::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, rgba(var(--brand-color-rgb), 0.92), rgba(var(--brand-color-deep-rgb), 0.54), transparent 88%);
  opacity: 0.46;
  transform: scaleX(0.28);
  transform-origin: left center;
  transition: transform var(--transition-med), opacity var(--transition-med);
}

.solution-flow__step::after,
.solution-overview__item::after {
  content: '';
  position: absolute;
  inset: auto auto 1.05rem 1.05rem;
  width: clamp(2.4rem, 5vw, 3.8rem);
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--brand-color-rgb), 0.42), transparent);
  opacity: 0.56;
}

.solution-flow__step:hover,
.solution-flow__step.is-active,
.solution-overview__item.is-current {
  border-color: rgba(var(--brand-color-rgb), 0.28);
  box-shadow: 0 24px 44px rgba(var(--brand-color-rgb), 0.16);
  background:
    linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.15), rgba(255, 255, 255, 0.03) 42%),
    var(--panel-bg-hover);
}

.solution-flow__step:hover::before,
.solution-flow__step.is-active::before,
.solution-overview__item.is-current::before {
  transform: scaleX(1);
  opacity: 1;
}

.solution-flow__step.is-active {
  transform: none;
  z-index: 3;
}

.solution-flow__step.is-before {
  transform: none;
}

.solution-flow__step.is-after {
  transform: none;
}

.solution-flow__step.is-inactive {
  opacity: 1;
}

.solution-overview {
  display: none;
  position: relative;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0s linear;
}

#how-it-works.is-overview .solution-overview {
  display: none;
  opacity: 0;
  pointer-events: none;
}

#how-it-works.is-overview .solution-flow {
  opacity: 1;
  pointer-events: auto;
}

.solution-overview__item.is-complete {
  opacity: 1;
}

.solution-overview__item.is-upcoming {
  opacity: 0.78;
}

.solution-flow__index,
.solution-overview__index,
.solution-overview__item .solution-flow__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: 0;
  padding-inline: 0;
  border-radius: 0;
  background: var(--accent-gradient);
  color: var(--bg-page);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 26px rgba(var(--brand-color-rgb), 0.28);
  position: relative;
  z-index: 1;
}

.solution-flow__index.is-active,
.solution-overview__item.is-current .solution-flow__index,
.solution-overview__item.is-current .solution-overview__index {
  box-shadow: 0 15px 30px rgba(var(--brand-color-rgb), 0.36);
}

.solution-flow__index.is-inactive {
  opacity: 0.54;
}

.solution-flow__step h3,
.solution-overview__item h3 {
  align-self: center;
  max-width: none;
  margin-bottom: 0;
  font-size: clamp(1.04rem, 0.96rem + 0.42vw, 1.32rem);
  line-height: 1.18;
}

.solution-flow__step p,
.solution-overview__item p {
  grid-column: 1 / -1;
  margin-bottom: 0;
  max-width: 40ch;
  font-size: clamp(0.9rem, 0.88rem + 0.1vw, 0.98rem);
  line-height: 1.68;
  color: var(--text-secondary);
}

.solution-overview__item p {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.solution-outro {
  position: relative;
  width: 100%;
  text-align: right;
  max-width: none;
  margin: 0;
  padding-top: 0.1rem;
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: none;
}

.solution-outro .btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.22rem;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22rem;
  white-space: nowrap;
  transition: color var(--transition-fast), letter-spacing var(--transition-fast), transform var(--transition-fast);
}

.solution-outro .btn:hover {
  transform: translateX(0.18rem);
  background: transparent;
  box-shadow: none;
  color: var(--accent-1);
  letter-spacing: 0.01em;
}

#how-it-works.is-outro-visible .solution-outro {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 1180px) {
  .solution-flow__step,
    .solution-overview__item {
      min-height: 11.6rem;
    }

  .solution-shell {
      grid-template-columns: minmax(0, 1fr) clamp(19rem, 27vw, 22rem);
      min-height: clamp(38rem, 48vw, 43rem);
    }

  .solution-flow__step:nth-child(2),
    .solution-overview__item:nth-child(2) {
      margin-left: clamp(4rem, 9vw, 7rem);
    }

  .solution-flow__step:nth-child(3),
    .solution-overview__item:nth-child(3) {
      margin-left: clamp(8rem, 18vw, 13rem);
    }

  .solution-flow__step:nth-child(4),
    .solution-overview__item:nth-child(4) {
      margin-left: clamp(12rem, 26vw, 19rem);
    }
}

@media (max-width: 960px) {
  #how-it-works {
      min-height: auto;
    }

  .solution-shell {
      grid-template-columns: 1fr;
      min-height: auto;
      padding: 1rem;
    }

  .solution-side {
      grid-column: 1;
      grid-row: auto;
      position: relative;
      top: auto;
      max-height: none;
      align-items: flex-end;
      gap: 1rem;
      margin-bottom: 1rem;
      width: 100%;
      padding-top: 0;
    }

  .solution-intro,
    .solution-outro {
      width: 100%;
      max-width: none;
      text-align: right;
    }

  .solution-intro h2,
    .solution-intro p {
      margin-left: auto;
      max-width: none;
      text-align: right;
    }

  .solution-outro .btn {
      justify-content: flex-end;
    }

  .solution-flow,
    .solution-overview {
      grid-column: 1;
      grid-row: auto;
      padding: 0;
      display: grid;
      width: 100%;
      justify-items: stretch;
    }

  .solution-flow__step,
    .solution-overview__item {
      min-height: auto;
      width: 100%;
      grid-template-columns: auto minmax(0, 1fr);
      transform: none !important;
      opacity: 1 !important;
      filter: none !important;
      margin-left: 0 !important;
    }

  .solution-flow__step::after,
    .solution-overview__item::after {
      display: none;
    }

  .solution-overview {
      display: none !important;
    }

  .solution-overview__item p {
      -webkit-line-clamp: 5;
    }
}

@media (max-width: 768px) {
  .solution-flow,
    .solution-overview {
      gap: 0.9rem;
    }

  .solution-flow__step,
    .solution-overview__item {
      row-gap: 0.6rem;
    }

  .solution-flow__step h3,
    .solution-overview__item h3 {
      max-width: none;
    }

  .solution-outro {
      margin-top: 1rem;
    }
}

:root[data-theme="light"] #how-it-works::before {
  background:
    radial-gradient(circle at 48% 10%, rgba(var(--brand-color-rgb), 0.1), transparent 54%),
    linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.04), transparent 74%);
}

:root[data-theme="light"] .solution-flow__step,
:root[data-theme="light"] .solution-overview__item {
  background:
    linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.07), rgba(255, 255, 255, 0.98) 46%),
    #ffffff;
  box-shadow: 0 18px 34px rgba(22, 29, 37, 0.08);
}

:root[data-theme="light"] .solution-flow__step:hover,
:root[data-theme="light"] .solution-flow__step.is-active,
:root[data-theme="light"] .solution-overview__item.is-current {
  border-color: rgba(var(--brand-color-rgb), 0.24);
  box-shadow: 0 22px 40px rgba(var(--brand-color-rgb), 0.14);
  background:
    linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.12), rgba(255, 255, 255, 1) 50%),
    #ffffff;
}

:root[data-theme="light"] .solution-outro .btn {
  color: var(--text-primary);
}

.solution-steps {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 3rem;
}

@media (max-width: 1024px) {
  .solution-steps {
      flex-direction: column;
    }
}
