/* Scrollytelling layout shared by the pipeline and the vision.
   Desktop: steps scroll on the left while the visual stays pinned on the
   right. Tablet/phone: the visual pins to the top and the steps scroll up
   beneath it. The same element is sticky in both layouts. */
.story {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 0 72px;
  margin-top: clamp(56px, 8vh, 96px);
}
.story-visual {
  grid-column: 2; grid-row: 1;
  position: sticky; top: calc(var(--header-h) + 24px);
  align-self: start;
  height: calc(100svh - var(--header-h) - 48px);
  max-height: 820px;
  display: flex; align-items: center;
}
.steps { grid-column: 1; grid-row: 1; list-style: none; margin: 0; padding: 0; }
.step {
  min-height: 78svh;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  padding: 48px 0;
  opacity: .32;
  transition: opacity .5s var(--ease);
}
.step:first-child { min-height: 60svh; justify-content: flex-start; padding-top: 10svh; }
.step:last-child { min-height: 70svh; }
.step.is-active { opacity: 1; }
.step-no { font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }

.stat { display: flex; align-items: baseline; gap: 16px; margin: 12px 0 0; padding-top: 20px; border-top: 1px solid var(--line); max-width: 44ch; }
.stat b { font: 600 clamp(48px, 5vw, 72px)/0.9 var(--display); letter-spacing: -0.04em; color: var(--fg); font-variant-numeric: tabular-nums; }
.stat > span { color: var(--fg-muted); font-size: 15px; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .step { opacity: 1; }
}

/* ── tablet & phone (portrait): visual pinned on top, steps beneath ──
   Only when the screen is also tall enough: a phone held sideways is wide
   but short, and keeps the side-by-side layout instead. src/lib/motion.js
   uses the same query. */
@media (max-width: 900px) and (min-height: 501px) {
  .story { display: block; margin-top: 40px; }
  .story-visual {
    top: var(--header-h);
    z-index: 2;
    height: auto; max-height: none;
    padding: 12px 0 20px;
    /* opaque, so steps scrolling up underneath never show through the
       visual; the fade sits below it instead */
    background: var(--canvas);
    margin: 0 calc(var(--gutter) * -1);
    padding-left: var(--gutter); padding-right: var(--gutter);
  }
  .story-visual::after {
    content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 32px;
    background: linear-gradient(var(--canvas), transparent);
    pointer-events: none;
  }
  .step { min-height: 62svh; justify-content: flex-end; padding: 32px 0 12svh; opacity: .35; }
  .step:first-child { min-height: 48svh; padding-top: 32px; justify-content: flex-end; }
  .step:last-child { min-height: 0; padding-bottom: 40px; }
  .stat b { font-size: 48px; }
}

/* ── short screens (a phone held sideways): side by side, but the visual
   takes more of the width and nearly all of the height ─────────────── */
@media (max-height: 500px) and (min-width: 521px) {
  .story { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 0 32px; margin-top: 32px; }
  .story-visual { top: calc(var(--header-h) + 8px); height: calc(100svh - var(--header-h) - 16px); }
  .step { min-height: 90svh; }
}
