/* =====================================================================
 * How-it-works page: only the layout the shared design system does not
 * already cover (hero lead, numbered steps, FAQ accordion, CTA actions).
 * Everything else reuses style.css components. Depends on style.css tokens.
 * ===================================================================== */

/* The page canvas is white; light sections show through it, dark sections
 * must paint themselves (mirrors #features-matrix / #pricing-section). These
 * three carry light-on-dark default text, so they need a dark ground. */
.how-it-works-page #steps,
.how-it-works-page #integrations,
.how-it-works-page #hiw-cta,
.solutions-page #workflows,
.solutions-page #integrations,
.solutions-page #solutions-cta {
  background: #090e11;
}

/* Hero lead paragraph (on the dark inner-hero). */
.hiw-hero-desc {
  max-width: 720px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ---- Process stepper --------------------------------------------------
 * A horizontal 4-step process on the dark section (SEO doc: "Use horizontal
 * stepper or process cards"). Nodes connect left-to-right; the order carries
 * meaning, so the numbers are content, not decoration. Collapses to a vertical
 * stepper on narrow screens.
 * --------------------------------------------------------------------- */
.hiw-flow {
  list-style: none;
  margin: 3.5rem auto 0;
  padding: 0;
  max-width: 1040px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.hiw-flow-step {
  position: relative;
  padding: 0 1.1rem;
  text-align: center;
}

/* Horizontal connector from the previous node to this one (node centre 27px).
 * The node's thick dark ring (below) masks the line at each node edge. */
.hiw-flow-step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 27px;
  left: calc(-50% + 27px);
  width: calc(100% - 54px);
  height: 2px;
  background: linear-gradient(to right, transparent, var(--border-warm) 18%, var(--border-warm) 82%, transparent);
}

.hiw-flow-node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 1.25rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--tertiary);
  background: var(--primary-dim);
  border: 1px solid var(--border-warm);
  border-radius: 50%;
  /* Solid ground-coloured ring punches the connector line out at the node. */
  box-shadow: 0 0 0 6px #090e11, 0 0 0 7px rgba(69, 125, 191, 0.15);
}

.hiw-flow-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
}

.hiw-flow-desc {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.95rem;
  margin: 0;
}

/* ---- FAQ accordion (on a light section) ------------------------------ */
.hiw-faq {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hiw-faq-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  overflow: hidden;
}

.hiw-faq-item[open] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.hiw-faq-q {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--secondary);
}

.hiw-faq-q::-webkit-details-marker {
  display: none;
}

/* Plus mark that becomes a minus when the item is open. */
.hiw-faq-mark {
  flex: 0 0 auto;
  position: relative;
  width: 18px;
  height: 18px;
}

.hiw-faq-mark::before,
.hiw-faq-mark::after {
  content: "";
  position: absolute;
  background: var(--primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.hiw-faq-mark::before {
  top: 8px;
  left: 0;
  width: 18px;
  height: 2px;
}

.hiw-faq-mark::after {
  top: 0;
  left: 8px;
  width: 2px;
  height: 18px;
}

.hiw-faq-item[open] .hiw-faq-mark::after {
  transform: rotate(90deg);
  opacity: 0;
}

.hiw-faq-a {
  padding: 0 1.35rem 1.25rem;
}

.hiw-faq-a p {
  margin: 0;
  color: #475569;
  line-height: 1.7;
}

/* ---- CTA actions ------------------------------------------------------ */
.hiw-cta-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* ---- Responsive ------------------------------------------------------- */
/* Below 760px the stepper stacks into a vertical stepper: node in a left
 * column, title + description to its right, connector running down. */
@media (max-width: 760px) {
  .hiw-flow {
    grid-template-columns: 1fr;
    max-width: 480px;
  }

  .hiw-flow-step {
    display: grid;
    grid-template-columns: 54px 1fr;
    grid-template-areas:
      "node title"
      "node desc";
    column-gap: 1.25rem;
    text-align: left;
    padding: 0 0 2rem;
  }

  .hiw-flow-node {
    grid-area: node;
    align-self: start;
    margin: 0;
  }

  .hiw-flow-title {
    grid-area: title;
    align-self: center;
    margin: 0 0 0.4rem;
  }

  .hiw-flow-desc {
    grid-area: desc;
  }

  .hiw-flow-step:last-child {
    padding-bottom: 0;
  }

  /* Vertical connector down the node column, filling the inter-step gap. */
  .hiw-flow-step:not(:first-child)::before {
    top: -2rem;
    left: 26px;
    width: 2px;
    height: 2rem;
    background: linear-gradient(to bottom, transparent, var(--border-warm) 30%, var(--border-warm) 70%, transparent);
  }
}

/* Respect reduced-motion for the FAQ marker transitions. */
@media (prefers-reduced-motion: reduce) {
  .hiw-faq-mark::before,
  .hiw-faq-mark::after {
    transition: none;
  }
}
