/* =============================================================================
   13. SITE — HOW IT WORKS
   Centered narrative + a staggered-height, connector-linked 4-stage
   workflow (Observe → Understand → Decide → Automate).
   ============================================================================= */
/* Depends on: tokens.css, base/utilities.css (.section-intro), base/motion.css (float-a/b, dot-travel, icon-spin keyframes). */
.how-it-works {
  position: relative;
  overflow: hidden;
}

.how-it-works__heading {
  font-size: var(--text-heading-md);
  line-height: var(--lh-heading-snug);
}

.how-it-works__lead {
  font-size: var(--text-lead-sm);
  line-height: var(--lh-body);
  max-width: 52ch;
}

.how-it-works__dot {
  position: absolute;
  border-radius: 50%;
}

.how-it-works__dot--a {
  top: 8%;
  left: 6%;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  animation: float-a 7s ease-in-out infinite;
}

.how-it-works__dot--b {
  bottom: 12%;
  right: 8%;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--color-accent-strong);
  animation: float-b 8s ease-in-out infinite;
}

.how-it-works__dot--c {
  top: 22%;
  right: 14%;
  width: 5px;
  height: 5px;
  background: var(--color-highlight);
  animation: float-a 6.5s 1s ease-in-out infinite;
}

.section-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  max-width: 700px;
  margin-inline: auto;
  text-align: center;
}

.workflow {
  position: relative;
  max-width: var(--container-max-width);
  margin: var(--space-content-gap) auto 0;
  display: flex;
  align-items: flex-end;
  gap: var(--space-1);
}

.workflow__card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  /* `opacity` is included here (not just in the .reveal utility) so the
     scroll-reveal fade-in and this hover transition share one list
     instead of one clobbering the other. */
  transition: opacity 0.7s var(--ease-out-expo), transform var(--transition-card), box-shadow var(--transition-card);
}

.workflow__card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}

/* Staggered card heights, exactly as approved. */
.workflow__card--observe { height: 210px; }
.workflow__card--understand { height: 248px; }
.workflow__card--decide { height: 284px; }

.workflow__card--automate {
  height: 318px;
  border-color: var(--color-accent-border);
  box-shadow: var(--shadow-card-accent);
}

.workflow__card--automate:hover {
  box-shadow: var(--shadow-card-accent-hover);
}

.workflow__card-glow {
  position: absolute;
  top: -20%;
  right: -20%;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent-soft) 0%, transparent 75%);
  opacity: 0.6;
}

.workflow__card--automate .workflow__card-glow {
  width: 70%;
  height: 70%;
  opacity: 0.8;
}

.workflow__card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  flex-shrink: 0;
}

.workflow__card-title {
  font-size: var(--text-heading-card);
}

.workflow__card-body {
  font-size: var(--text-xs);
  line-height: var(--lh-body-sm);
}

.workflow__card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
}

.workflow__card-meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-highlight);
  flex-shrink: 0;
}

.workflow__card-meta-label {
  font-family: var(--font-mono);
  font-size: var(--text-label-md);
  letter-spacing: var(--ls-label-sm);
  color: var(--color-text-tertiary);
}

/* --- Bespoke stage icons (CSS shapes, matching the approved glyphs) ------- */
.workflow__icon-observe {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-accent-strong);
  border-radius: 50%;
  position: relative;
}

.workflow__icon-observe::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-accent-strong);
  transform: translate(-50%, -50%);
}

.workflow__icon-understand {
  position: relative;
  width: 22px;
  height: 16px;
}

.workflow__icon-understand span {
  position: absolute;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent-strong);
}

.workflow__icon-understand span:first-child {
  left: 0;
  opacity: 0.9;
}

.workflow__icon-understand span:last-child {
  left: 8px;
  border-color: var(--color-accent);
  opacity: 0.6;
}

.workflow__icon-decide {
  position: relative;
  width: 18px;
  height: 18px;
}

.workflow__icon-decide span {
  position: absolute;
  background: var(--color-accent-strong);
}

.workflow__icon-decide span:nth-child(1) {
  bottom: 0;
  left: 50%;
  width: 1.5px;
  height: 10px;
  transform: translateX(-50%);
}

.workflow__icon-decide span:nth-child(2) {
  bottom: 6px;
  left: 50%;
  width: 9px;
  height: 1.5px;
  transform-origin: left center;
  transform: rotate(-35deg);
}

.workflow__icon-decide span:nth-child(3) {
  bottom: 6px;
  left: 50%;
  width: 9px;
  height: 1.5px;
  transform-origin: left center;
  transform: rotate(35deg);
}

.workflow__icon-automate {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px dashed var(--color-accent-strong);
  animation: icon-spin 12s linear infinite;
}

/* --- Connectors: horizontal traveling-dot line (desktop), arrow (stacked) - */
.workflow__connector {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  flex-shrink: 0;
  align-self: center;
  position: relative;
}

.workflow__connector-line {
  position: relative;
  width: 100%;
  height: 1px;
  background: var(--color-border);
  display: block;
}

.workflow__connector-dot {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-accent);
  transform: translateY(-50%);
  animation: dot-travel 4s ease-in-out infinite;
}

.workflow__connector--2 .workflow__connector-dot {
  animation-duration: 4.6s;
  animation-delay: 0.6s;
}

.workflow__connector--3 .workflow__connector-dot {
  animation-duration: 5.2s;
  animation-delay: 1.1s;
}

.workflow__connector-arrow {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--color-accent-strong);
  font-size: var(--text-base);
}

:root[data-theme="dark"] .workflow__connector-line {
  background: color-mix(in oklch, var(--color-glow), transparent 76%);
}

:root[data-theme="dark"] .workflow__connector-dot {
  background: var(--color-glow);
  box-shadow: 0 0 7px oklch(68% 0.18 215 / 0.42);
}

:root[data-theme="dark"] .workflow__connector-arrow {
  color: var(--color-glow);
  text-shadow: 0 0 8px oklch(68% 0.18 215 / 0.28);
}

.workflow__footer {
  display: flex;
  justify-content: center;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

@media (max-width: 899px) {
  .workflow {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .workflow__card {
    height: auto;
    min-height: 180px;
  }

  .workflow__connector {
    width: auto;
    height: 28px;
  }

  .workflow__connector-line {
    display: none;
  }

  .workflow__connector-arrow {
    display: flex;
  }
}
