/* ============================================
   How it works — page-specific styles
   Hero + 4 step sections with paired text/visual
   blocks. Visuals are CSS-only animations except
   for step 2 which reuses the inline SVG graph.
   ============================================ */

/* ---------- Hero ---------- */
.hiw-hero {
  padding: 11rem 20px 5rem;
  background: var(--off-white);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hiw-hero::before {
  content: '';
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(600px 360px at 30% 20%, rgba(var(--accent-rgb), 0.08), transparent 70%),
    radial-gradient(560px 380px at 75% 30%, rgba(var(--accent-rgb), 0.06), transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.hiw-hero .container {
  position: relative;
  z-index: 1;
}
.hiw-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  margin: 0 auto 1.5rem;
}
.hiw-title {
  font-size: clamp(2.5rem, 5.6vw, 4.5rem);
  letter-spacing: -0.032em;
  line-height: 1.06;
  margin: 0 auto 1.5rem;
  max-width: 880px;
}
.hiw-subtitle {
  font-size: 1.5rem;
  line-height: 1.55;
  color: var(--warm-gray-600);
  max-width: 1040px;
  margin: 0 auto 3rem;
  text-wrap: balance;
}

/* Step pill nav */
.hiw-stepnav {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: var(--white);
  border: var(--border-hairline);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(11, 11, 10, 0.04);
}
.hiw-stepnav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--warm-gray-700);
  border-radius: 999px;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.hiw-stepnav-item:hover {
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--black);
}
.hiw-stepnav-num {
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Step shell ---------- */
.hiw-step {
  padding: 7rem 0;
  scroll-margin-top: 100px;
}

/* Dark variant — applied to Step 2 (Commercial Graph) for visual rhythm. */
.hiw-step-dark {
  background: linear-gradient(135deg, #0b0b0a 0%, #1a1a18 100%);
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.hiw-step-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 400px at 25% 30%, rgba(var(--accent-rgb), 0.18), transparent 70%),
    radial-gradient(500px 360px at 80% 70%, rgba(var(--accent-rgb), 0.12), transparent 75%);
  pointer-events: none;
}
.hiw-step-dark .container {
  position: relative;
  z-index: 1;
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}
.hiw-step-dark .hiw-step-num { color: #c5b9d6; }
.hiw-step-dark .hiw-step-eyebrow { color: rgba(255, 255, 255, 0.78); }
.hiw-step-dark .hiw-step-heading { color: var(--white); }
.hiw-step-dark .hiw-step-body { color: rgba(255, 255, 255, 0.92); }
.hiw-step-dark .hiw-step-body strong { color: #c5b9d6; font-weight: 600; }
.hiw-step-dark .hiw-step-visual-graph .commercial-graph-wrap {
  /* Lift the graph card off the dark background — softer, more centered
     shadow so the card doesn't visually anchor to the bottom. */
  background: var(--white);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.hiw-step-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  min-width: 0;
}
.hiw-step-text,
.hiw-step-visual {
  min-width: 0;
}
.hiw-step-num {
  font-family: 'Fraunces', 'Zen Kaku Gothic New', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(4.5rem, 7vw, 7rem);
  line-height: 0.9;
  color: var(--accent);
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}
.hiw-step-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--warm-gray-700);
  margin: 0 0 1rem;
}
.hiw-step-heading {
  font-size: clamp(2rem, 3.5vw, 2.85rem);
  letter-spacing: -0.024em;
  line-height: 1.14;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}
.hiw-step-body {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--warm-gray-700);
  margin: 0 0 1rem;
  max-width: 540px;
}
.hiw-step-body strong {
  color: var(--accent);
  font-weight: 600;
}
.hiw-step-body:last-child {
  margin-bottom: 0;
}

/* ---------- Step 1 visual: Ingestion flow ---------- */
.hiw-ingest {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 80px 180px;
  align-items: center;
  gap: 1rem;
  padding: 2.25rem 1.75rem;
  background: var(--white);
  border: var(--border-hairline);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(11, 11, 10, 0.04);
  min-height: 320px;
}
.hiw-ingest-sources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 275px;
}
.hiw-ingest-src {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--off-white);
  border: 1px solid rgba(11, 11, 10, 0.06);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--warm-gray-700);
  position: relative;
  animation: hiwIngestRowGlow 4.4s ease-in-out infinite;
}
.hiw-ingest-src:nth-child(1) { animation-delay: 0s; }
.hiw-ingest-src:nth-child(2) { animation-delay: 0.88s; }
.hiw-ingest-src:nth-child(3) { animation-delay: 1.76s; }
.hiw-ingest-src:nth-child(4) { animation-delay: 2.64s; }
.hiw-ingest-src:nth-child(5) { animation-delay: 3.52s; }
@keyframes hiwIngestRowGlow {
  0%, 100% { border-color: rgba(11, 11, 10, 0.06); box-shadow: none; }
  6% { border-color: rgba(var(--accent-rgb), 0.4); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08); }
  20% { border-color: rgba(11, 11, 10, 0.06); box-shadow: none; }
}
.hiw-ingest-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.15rem 0.45rem;
  background: rgba(var(--accent-rgb), 0.10);
  color: var(--accent);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hiw-ingest-name {
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--warm-gray-800);
}
.hiw-ingest-flow {
  position: relative;
  height: 100%;
  min-height: 240px;
  overflow: visible;
}
.hiw-ingest-flow::before {
  /* Dashed guideline visible faintly behind packets — sits within the
     flow column with breathing room on both ends so it never touches
     the source or target boxes. */
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 0;
  border-top: 1px dashed rgba(var(--accent-rgb), 0.35);
}
.hiw-ingest-packet {
  position: absolute;
  left: -6%;
  top: var(--from);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18), 0 0 14px rgba(var(--accent-rgb), 0.55);
  opacity: 0;
  animation: hiwIngestTravel 4.4s cubic-bezier(0.55, 0, 0.35, 1) infinite;
  animation-delay: var(--delay);
}
@keyframes hiwIngestTravel {
  0% { left: -8%; top: var(--from); opacity: 0; transform: scale(0.6); }
  10% { opacity: 1; transform: scale(1); }
  60% { left: 60%; top: 50%; opacity: 1; }
  90% { left: 100%; top: 50%; opacity: 0.7; transform: scale(0.7); }
  100% { left: 110%; top: 50%; opacity: 0; transform: scale(0.4); }
}

.hiw-ingest-target {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  background: linear-gradient(135deg, #1a1a18 0%, #0b0b0a 100%);
  color: var(--white);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(11, 11, 10, 0.18);
}
.hiw-ingest-target img {
  filter: invert(1) brightness(2);
  position: relative;
  z-index: 1;
}
.hiw-ingest-target-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 1;
}
.hiw-ingest-pulse {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), 0.6) 0%, transparent 60%);
  opacity: 0;
  animation: hiwIngestAbsorb 4.4s cubic-bezier(0.55, 0, 0.35, 1) infinite;
}
@keyframes hiwIngestAbsorb {
  0%, 50%, 100% { opacity: 0; }
  60% { opacity: 0.55; }
  75% { opacity: 0; }
}

/* ---------- Step 2 visual: Commercial Graph ---------- */
/* Most styling inherits from existing .commercial-graph-wrap. Slight
   adjustment: tighter top margin since it's not the only section element. */
/* Step 2 — commercial graph gets a wider column and stretches so the
   graph card sits visually centered relative to the text column. */
#step-2 .hiw-step-grid {
  grid-template-columns: 1.9fr 0.9fr;
  max-width: 1280px;
  align-items: stretch;
}

/* Step 1 — slightly wider visual column so the source-name rows
   ('Google Drive, OneDrive') don't wrap inside the boxes. */
#step-1 .hiw-step-grid {
  grid-template-columns: 0.85fr 1.2fr;
  max-width: 1280px;
}

/* Step 3 — Custom Screen visual wants extra horizontal room so the
   table breathes; text column is on the left and stays compact. */
#step-3 .hiw-step-grid {
  grid-template-columns: 0.9fr 1.6fr;
  max-width: 1280px;
}

/* Step 4 — visual still left-aligned but trimmed ~20% narrower than
   Step 3's studio so the action card doesn't dominate the row. */
#step-4 .hiw-step-grid {
  grid-template-columns: 1.05fr 1fr;
  max-width: 1280px;
}
#step-2 .hiw-step-visual-graph {
  display: flex;
  align-items: center;
}
#step-2 .hiw-step-visual-graph .commercial-graph-wrap {
  width: 100%;
}
.hiw-step-visual-graph {
  position: relative;
  padding: 0;
  border-radius: 16px;
  /* No overflow:hidden — the scaled SVG was clipping. The scan sweep
     is bounded internally by the wrap below. */
}
.hiw-step-visual-graph .commercial-graph-wrap {
  margin: 0;
  max-width: none;
  position: relative;
  z-index: 0;
  border-radius: 14px;
  overflow: hidden;
}
.hiw-step-visual-graph .commercial-graph-wrap::after {
  /* Scanning sweep — bounded inside the wrap so it doesn't escape. */
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(var(--accent-rgb), 0.10) 40%,
    rgba(var(--accent-rgb), 0.20) 50%,
    rgba(var(--accent-rgb), 0.10) 60%,
    transparent 100%
  );
  mix-blend-mode: multiply;
  animation: hiwGraphScan 6.5s linear infinite;
  z-index: 1;
}
@keyframes hiwGraphScan {
  0% { left: -25%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

/* Auto-linked badges flash as the scan sweep passes their position. */
.cg-auto-rect {
  animation: hiwBadgeRect 6.5s ease-in-out infinite;
}
.cg-auto-badge {
  animation: hiwBadgeGlow 6.5s ease-in-out infinite;
}
.cg-auto-badge text {
  animation: hiwBadgeText 6.5s ease-in-out infinite;
}
.cg-auto-badge--left,
.cg-auto-badge--left .cg-auto-rect,
.cg-auto-badge--left text { animation-delay: 1.6s; }
.cg-auto-badge--right,
.cg-auto-badge--right .cg-auto-rect,
.cg-auto-badge--right text { animation-delay: 5.4s; }
@keyframes hiwBadgeRect {
  0%, 14%, 100% { opacity: 0.10; fill: #9689A4; }
  3%, 8% { opacity: 0.95; fill: #9689A4; }
}
@keyframes hiwBadgeText {
  0%, 14%, 100% { fill: #9689A4; }
  3%, 8% { fill: #ffffff; }
}
@keyframes hiwBadgeGlow {
  0%, 14%, 100% { filter: none; }
  3%, 8% { filter: drop-shadow(0 0 8px rgba(150, 137, 164, 0.55)); }
}

/* Node boxes pulse as the scan sweep crosses their x-position. Delays are
   approximate offsets that match the scan timing (6.5s loop, scan center
   moves linearly across the visible width). */
.cg-node rect {
  animation: hiwNodePulse 6.5s ease-in-out infinite;
}
.cg-node:nth-child(2) rect { animation-delay: 1.53s; } /* Pricing Update — left */
.cg-node:nth-child(3) rect { animation-delay: 5.07s; } /* Rate Card — right */
.cg-node:nth-child(4) rect { animation-delay: 5.34s; } /* PO — far right */
.cg-node:nth-child(5) rect { animation-delay: 4.47s; } /* INV — right-center */
.cg-node:nth-child(6) rect { animation-delay: 2.31s; } /* Credit Note — left-center */
.cg-node:nth-child(7) rect { animation-delay: 1.27s; } /* Service Terms — far left */
.cg-node:nth-child(8) rect { animation-delay: 3.37s; } /* Rebate — center */
.cg-node:nth-child(9) rect { animation-delay: 3.05s; } /* Email Thread — center, fires just before Rebate */
@keyframes hiwNodePulse {
  0%, 14%, 100% { stroke: #eae9e6; stroke-width: 1.4; }
  3%, 8% { stroke: var(--accent); stroke-width: 2.6; }
}

/* ---------- Step 3 visual: Workflow Studio (custom ERP-style screen) ---------- */
.hiw-studio {
  background: var(--white);
  border: var(--border-hairline);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(11, 11, 10, 0.04);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}
.hiw-studio-hdr {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  background: var(--off-white);
  border-bottom: 1px solid rgba(11, 11, 10, 0.06);
}
.hiw-studio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(11, 11, 10, 0.18);
}
.hiw-studio-dot:first-child { background: rgba(var(--accent-rgb), 0.45); }
.hiw-studio-title {
  flex: 1;
  margin-left: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--warm-gray-700);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hiw-studio-title strong {
  font-weight: 700;
  color: var(--black);
}
.hiw-studio-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.hiw-studio-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: hiwStudioPulse 1.4s ease-in-out infinite;
}
@keyframes hiwStudioPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18); }
}

/* Tab strip */
.hiw-studio-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(11, 11, 10, 0.06);
  background: var(--white);
  overflow-x: auto;
}
.hiw-studio-tab {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--warm-gray-600);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.4s var(--ease-soft), border-color 0.4s var(--ease-soft);
  animation: hiwTabCycle 9.6s ease-in-out infinite;
}
.hiw-studio-tab:nth-child(1) { animation-delay: 0s; }
.hiw-studio-tab:nth-child(2) { animation-delay: 2.4s; }
.hiw-studio-tab:nth-child(3) { animation-delay: 4.8s; }
.hiw-studio-tab:nth-child(4) { animation-delay: 7.2s; }
@keyframes hiwTabCycle {
  0%, 25%, 100% {
    color: var(--warm-gray-600);
    border-bottom-color: transparent;
  }
  4%, 18% {
    color: var(--black);
    border-bottom-color: var(--accent);
  }
}

/* Data table */
.hiw-studio-table {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  min-width: 0;
}
.hiw-studio-row {
  display: grid;
  grid-template-columns: 1.7fr 0.55fr 0.7fr 0.85fr 0.7fr;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(11, 11, 10, 0.05);
  align-items: center;
  position: relative;
  color: var(--warm-gray-700);
}
.hiw-studio-row > span:nth-child(3),
.hiw-studio-row > span:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hiw-studio-row > span:last-child {
  text-align: right;
}
.hiw-studio-row-head {
  background: var(--off-white);
  color: var(--warm-gray-500);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hiw-studio-row[data-row]::before {
  /* Active-row indicator that cycles through rows */
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  animation: hiwStudioRowFocus 8s ease-in-out infinite;
}
.hiw-studio-row[data-row]::after {
  /* Soft accent fill of the focused row */
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(var(--accent-rgb), 0.05);
  opacity: 0;
  animation: hiwStudioRowFocus 8s ease-in-out infinite;
  pointer-events: none;
}
.hiw-studio-row[data-row="0"]::before,
.hiw-studio-row[data-row="0"]::after { animation-delay: 0s; }
.hiw-studio-row[data-row="1"]::before,
.hiw-studio-row[data-row="1"]::after { animation-delay: 2s; }
.hiw-studio-row[data-row="2"]::before,
.hiw-studio-row[data-row="2"]::after { animation-delay: 4s; }
.hiw-studio-row[data-row="3"]::before,
.hiw-studio-row[data-row="3"]::after { animation-delay: 6s; }
@keyframes hiwStudioRowFocus {
  0%, 25%, 100% { opacity: 0; }
  4%, 18% { opacity: 1; }
}

/* Status badges */
.hiw-studio-status {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.10em;
}
.hiw-studio-flag {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}
.hiw-studio-ok {
  background: rgba(11, 11, 10, 0.06);
  color: var(--warm-gray-600);
}

/* Footer summary */
.hiw-studio-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--off-white);
  border-top: 1px solid rgba(11, 11, 10, 0.06);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--warm-gray-600);
}
.hiw-studio-foot-flag {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Step 4 visual: Agentic action card (reuses .resolution-card) ---------- */
.hiw-action-card { max-width: none; }

/* ---------- Step 4 legacy pipeline (kept for reference) ---------- */
.hiw-action {
  background: var(--white);
  border: var(--border-hairline);
  border-radius: 14px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 6px 24px rgba(11, 11, 10, 0.04);
}
.hiw-action-pipe {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}
.hiw-action-pipe::before {
  /* Connecting hairline */
  content: '';
  position: absolute;
  top: 16px;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(to right, rgba(var(--accent-rgb), 0.20), rgba(var(--accent-rgb), 0.45) 40%, rgba(var(--accent-rgb), 0.45) 60%, rgba(var(--accent-rgb), 0.20));
}
.hiw-action-pipe::after {
  /* Animated traveling dot */
  content: '';
  position: absolute;
  top: 13px;
  left: 12%;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: hiwActionTravel 4.2s var(--ease-soft) infinite;
}
.hiw-action-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}
.hiw-action-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  color: var(--accent);
  border-radius: 50%;
  transition: background 0.3s var(--ease-soft), color 0.3s var(--ease-soft), transform 0.3s var(--ease-soft);
}
.hiw-action-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm-gray-700);
  transition: color 0.3s var(--ease-soft);
}
/* Each stage's icon glows in sequence as the dot travels the pipe. */
.hiw-action-stage > .hiw-action-icon {
  animation: hiwActionIcon 4.2s ease-in-out infinite;
}
.hiw-action-stage:nth-child(1) > .hiw-action-icon { animation-delay: 0s; }
.hiw-action-stage:nth-child(2) > .hiw-action-icon { animation-delay: 0.85s; }
.hiw-action-stage:nth-child(3) > .hiw-action-icon { animation-delay: 1.7s; }
.hiw-action-stage:nth-child(4) > .hiw-action-icon { animation-delay: 2.55s; }
.hiw-action-stage:nth-child(5) > .hiw-action-icon { animation-delay: 3.4s; }
@keyframes hiwActionIcon {
  0%, 100% {
    background: var(--white);
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.30);
    transform: scale(1);
  }
  6% {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.45);
  }
  18% {
    background: var(--white);
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1);
  }
}
.hiw-action-tasks {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0;
  border-top: 1px dashed rgba(11, 11, 10, 0.10);
}
.hiw-action-task {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--warm-gray-700);
  opacity: 0;
  animation: hiwTaskFade 6s var(--ease-soft) infinite;
}
.hiw-action-task::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--accent);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 700;
}
.hiw-action-task[data-task="0"] { animation-delay: 0s; }
.hiw-action-task[data-task="1"] { animation-delay: 0.55s; }
.hiw-action-task[data-task="2"] { animation-delay: 1.1s; }
.hiw-action-task[data-task="3"] { animation-delay: 1.65s; }
@keyframes hiwActionTravel {
  0% { left: 12%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 88%; opacity: 0; }
}
@keyframes hiwTaskFade {
  0% { opacity: 0; transform: translateX(-6px); }
  10% { opacity: 1; transform: translateX(0); }
  85% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-6px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hiw-step-grid,
  #step-1 .hiw-step-grid,
  #step-2 .hiw-step-grid,
  #step-3 .hiw-step-grid,
  #step-4 .hiw-step-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    max-width: 100%;
    min-width: 0;
  }
  .hiw-step-text-right .hiw-step-grid {
    /* On mobile, restack so text always reads first */
    direction: ltr;
  }
  .hiw-step-text-right .hiw-step-text { order: -1; }
  .hiw-step-text-right .hiw-step-visual { order: 1; }
  .hiw-ingest {
    grid-template-columns: 1fr 60px 1fr;
    padding: 1.5rem 1rem;
  }
}
@media (max-width: 720px) {
  .hiw-step .container,
  .hiw-hero .container {
    min-width: 0;
  }

  .hiw-hero {
    padding: 8rem 20px 4rem;
  }
  .hiw-subtitle {
    font-size: 1.125rem;
  }
  /* Drop the pill-container chrome on mobile — too wide at 100% with
     uneven labels. Items become a 2x2 grid of compact chips instead. */
  .hiw-stepnav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  .hiw-stepnav-item {
    display: grid;
    grid-template-columns: max-content max-content;
    align-items: center;
    justify-content: center;
    column-gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0 0.9rem;
    font-size: 0.8125rem;
    line-height: 1;
    background: var(--white);
    border: var(--border-hairline);
    border-radius: 999px;
  }
  .hiw-stepnav-num {
    line-height: 1;
  }
  .hiw-step { padding: 4.5rem 0; }
  .hiw-step-num {
    font-size: clamp(4rem, 21vw, 6rem);
  }

  .hiw-step-heading {
    font-size: clamp(1.9rem, 9vw, 2.55rem);
    text-wrap: auto;
  }

  .hiw-step-body { font-size: 1rem; }
  .hiw-step-body,
  .hiw-step-heading {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .hiw-ingest,
  .hiw-action,
  .hiw-studio,
  .hiw-step-visual-graph .commercial-graph-wrap {
    width: 100%;
    max-width: 100%;
  }

  .hiw-studio-hdr,
  .hiw-studio-tabs,
  .hiw-studio-foot {
    min-width: 0;
  }

  .hiw-studio-pill {
    display: none;
  }

  .hiw-studio-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hiw-studio-row {
    min-width: 620px;
  }

  .hiw-action-pipe {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
  }
  .hiw-action-icon { width: 28px; height: 28px; }
  .hiw-action-label { font-size: 0.625rem; }
}
