.how-it-works {
  --accent: #deff00;
  --muted: #aeb9cc;
  background:
    linear-gradient(180deg, #070b11, #070b1120 24%, #070b1120 82%, #070b11),
    url("how-it-works-backdrop.webp") center / cover no-repeat #080d15;
  border-top: 1px solid #b4c4d61c;
  padding-block: clamp(64px, 8vw, 116px);
  scroll-margin-top: 24px;
}

.how-it-works-intro { margin-bottom: clamp(28px, 5vw, 56px); }
.how-it-works-intro h2 {
  margin: 0;
  font-size: clamp(3rem, 6.2vw, 5.6rem);
  font-weight: 850;
  font-style: italic;
  line-height: .95;
}
.how-it-works-intro h2 em,
.trade-example h3 em { color: var(--accent); }
.how-it-works-intro p {
  max-width: 650px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.35;
}

.how-it-works-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(22px, 3vw, 40px);
}
.trade-example { min-width: 0; }
.trade-example h3 {
  margin: 0 0 12px 2px;
  font-size: clamp(1.4rem, 2.35vw, 2rem);
  line-height: 1.05;
}
.trade-example h3 em {
  font-size: 1.14em;
  font-weight: 850;
}
.how-it-works .trade-story-visual {
  width: 100%;
  max-width: none;
  line-height: 1.5;
  font-family: "Eina01", sans-serif;
}
.how-it-works .trade-story-visual :is(h4, p) { margin-bottom: 0; }
.how-it-works .authentic-thesis h4 {
  margin-top: 0;
  font-weight: 600;
  line-height: 1.24;
  text-wrap: balance;
}
.how-it-works .authentic-levels b { font-weight: 600; }
.how-it-works .authentic-levels div:not(:first-child) b,
.how-it-works .authentic-grade span b {
  font-family: "Geist Mono", monospace;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.how-it-works .autopilot-story-message p { margin-top: 0; }
.how-it-works .autopilot-trail-action { opacity: 1; transform: none; }
.how-it-works .autopilot-progress i { width: 72%; }

.workflow-start {
  width: fit-content;
  max-width: 100%;
  margin: clamp(36px, 6vw, 76px) auto 0;
  padding: 14px clamp(12px, 3vw, 48px);
  text-align: center;
  background: linear-gradient(90deg, transparent, #15343366 50%, transparent);
}
.workflow-start p {
  margin: 0;
  font-size: clamp(1.2rem, 2.45vw, 1.85rem);
  font-weight: 710;
  line-height: 1.2;
  text-wrap: balance;
}
.workflow-start strong { color: var(--accent); font-weight: 850; }
.workflow-start span { color: #c4d2d8; white-space: nowrap; }
.workflow-start::after {
  display: block;
  width: min(64%, 280px);
  height: 2px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, #deff00ab 50%, transparent);
  content: "";
}

@media (max-width: 1080px) {
  .how-it-works-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .how-it-works .trade-example { max-width: 740px; width: 100%; }
}

@media (max-width: 640px) {
  .how-it-works .autopilot-confidence span {
    margin-top: .24rem;
    font-size: .47rem;
    line-height: 1.1;
    letter-spacing: .07em;
  }
}

@property --idea-arc {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 88%;
}

@media (prefers-reduced-motion: no-preference) {
  .has-scroll-sequence {
    --scene-ease: cubic-bezier(.22, .72, .25, 1);
  }

  .has-scroll-sequence [data-scroll-scene] { --scene-play: paused; }
  .has-scroll-sequence [data-scroll-scene].is-revealed { --scene-play: running; }

  .has-scroll-sequence .how-it-works-intro h2,
  .has-scroll-sequence .how-it-works-intro p,
  .has-scroll-sequence .workflow-start p,
  .has-scroll-sequence .trade-example > h3,
  .has-scroll-sequence .trade-example > h3 em,
  .has-scroll-sequence .trade-story-visual,
  .has-scroll-sequence .authentic-grade::after,
  .has-scroll-sequence .authentic-grade > div,
  .has-scroll-sequence .authentic-thesis h4,
  .has-scroll-sequence .authentic-levels > div,
  .has-scroll-sequence .authentic-thesis p,
  .has-scroll-sequence .autopilot-story-governor,
  .has-scroll-sequence .autopilot-confidence .autopilot-ring-value,
  .has-scroll-sequence .autopilot-confidence :is(strong, span),
  .has-scroll-sequence .autopilot-progress i,
  .has-scroll-sequence .autopilot-progress .autopilot-trail-marker,
  .has-scroll-sequence .autopilot-trail-action {
    animation: var(--motion, workflow-enter) var(--run, 600ms) var(--ease, var(--scene-ease))
      calc(var(--offset, 0ms) + var(--cue, 0ms)) both var(--scene-play);
  }

  .has-scroll-sequence .how-it-works-intro p { --cue: 120ms; }
  .has-scroll-sequence .workflow-start::after {
    animation: workflow-start-sweep 2s ease-in-out 220ms 2 alternate both var(--scene-play);
  }
  .has-scroll-sequence .trade-example > h3 em {
    --motion: workflow-emphasis;
    --cue: 65ms;
    display: inline-block;
  }
  .has-scroll-sequence .trade-story-visual { --cue: 200ms; }

  /* Sweep a mask over the original ring so its gradient and gap stay fixed. */
  .has-scroll-sequence .authentic-grade { background: none; }
  .has-scroll-sequence .authentic-grade::before { z-index: 1; }
  .has-scroll-sequence .authentic-grade::after {
    --motion: workflow-draw-idea;
    --cue: var(--idea-cue, 90ms);
    --run: 870ms;
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--grade-gradient);
    mask-image: conic-gradient(from 220deg, #000 var(--idea-arc), transparent var(--idea-arc));
  }
  .has-scroll-sequence .authentic-grade > div { --cue: calc(var(--idea-cue, 90ms) + 300ms); }
  .has-scroll-sequence .authentic-thesis h4 { --cue: var(--thesis-cue, 80ms); }
  .has-scroll-sequence .authentic-levels > div:nth-child(1) { --cue: calc(var(--thesis-cue, 80ms) + 120ms); }
  .has-scroll-sequence .authentic-levels > div:nth-child(2) { --cue: calc(var(--thesis-cue, 80ms) + 185ms); }
  .has-scroll-sequence .authentic-levels > div:nth-child(3) { --cue: calc(var(--thesis-cue, 80ms) + 250ms); }
  .has-scroll-sequence .authentic-thesis p { --cue: calc(var(--thesis-cue, 80ms) + 330ms); }

  .has-scroll-sequence .autopilot-management {
    --governor-cue: 100ms;
    --progress-cue: calc(var(--governor-cue) + 470ms);
    --travel-time: 960ms;
    /* The 72% fill reaches the 54% marker three quarters of the way through. */
    --trail-cue: calc(var(--progress-cue) + var(--travel-time) * .75);
  }
  .has-scroll-sequence .autopilot-story-governor { --cue: var(--governor-cue); }
  .has-scroll-sequence .autopilot-confidence .autopilot-ring-value {
    --motion: workflow-draw-autopilot;
    --cue: calc(var(--governor-cue) + 120ms);
    --run: 720ms;
  }
  .has-scroll-sequence .autopilot-confidence :is(strong, span) { --cue: calc(var(--governor-cue) + 270ms); }
  .has-scroll-sequence .autopilot-progress i {
    --motion: workflow-fill-progress;
    --cue: var(--progress-cue);
    --run: var(--travel-time);
    --ease: linear;
    transform-origin: left;
  }
  .has-scroll-sequence .autopilot-progress .autopilot-trail-marker {
    --motion: workflow-place-marker;
    --cue: var(--trail-cue);
    --run: 380ms;
  }
  .has-scroll-sequence .autopilot-trail-action {
    --motion: workflow-set-stop;
    --cue: calc(var(--trail-cue) + 180ms);
    --run: 760ms;
  }
}

@media (min-width: 1081px) and (prefers-reduced-motion: no-preference) {
  .has-scroll-sequence .authentic-grade { --idea-cue: 340ms; }
  .has-scroll-sequence .authentic-thesis { --thesis-cue: 680ms; }
  .has-scroll-sequence .trade-example:nth-child(2) { --offset: 1160ms; }
  .has-scroll-sequence .autopilot-management { --governor-cue: 415ms; }
}

@keyframes workflow-enter {
  from { opacity: 0; transform: translateY(12px); }
}
@keyframes workflow-emphasis {
  from { opacity: .2; transform: translateY(5px); }
}
@keyframes workflow-draw-idea {
  from { --idea-arc: 0%; }
  to { --idea-arc: 88%; }
}
@keyframes workflow-draw-autopilot {
  from { stroke-dasharray: 0 100; opacity: 0; }
  12% { opacity: 1; }
}
@keyframes workflow-fill-progress {
  from { transform: scaleX(0); }
}
@keyframes workflow-place-marker {
  from { opacity: 0; transform: translate(-50%, -9px) scale(.88); }
}
@keyframes workflow-set-stop {
  from { opacity: 0; transform: translateY(9px); }
  35% { box-shadow: 0 0 21px rgba(40, 206, 193, .19); }
}
@keyframes workflow-start-sweep {
  from { opacity: .45; transform: translateX(-24%); }
  55% { opacity: 1; }
  to { opacity: .45; transform: translateX(24%); }
}
