/* Scroll-driven story hero */

.story-hero {
  --story-accent: var(--page-library);
  position: relative;
}

.story-hero[data-step="1"],
.story-hero[data-step="2"],
.story-hero[data-step="3"] {
  --story-accent: var(--page-imports);
}

.story-hero[data-step="4"] {
  --story-accent: var(--page-library);
}

.story-track {
  display: flex;
  flex-direction: column;
  max-width: calc(var(--max-width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 900px) {
  .story-track {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: clamp(32px, 4vw, 56px);
    align-items: start;
  }
}

/* ---- Left: hook + pipeline steps as one column ---- */

.story-copy {
  order: 2;
  padding-top: 0;
  padding-bottom: 48px;
}

@media (min-width: 900px) {
  .story-copy {
    order: unset;
    padding-top: 96px;
  }
}

.story-step {
  min-height: 70vh;
  min-height: 70dvh;
  display: flex;
  align-items: center;
  padding: 28px 0 40px;
  scroll-margin-top: 88px;
}

.story-step--hook {
  min-height: calc(100vh - 96px);
  min-height: calc(100dvh - 96px);
  padding-top: 24px;
  padding-bottom: 48px;
}

.story-step-copy {
  opacity: 0.28;
  transform: translateY(12px);
  transition:
    opacity 520ms var(--ease-out),
    transform 520ms var(--ease-out);
}

.story-step.is-active .story-step-copy {
  opacity: 1;
  transform: none;
}

.story-hook-title {
  font-family: var(--page-title);
  font-size: clamp(1.55rem, 3.4vw, var(--fs-display));
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.story-hook-lead {
  font-size: var(--fs-lead);
  font-weight: 500;
  color: var(--dim);
  line-height: 1.5;
  margin-bottom: 28px;
  max-width: 42ch;
}

.story-hook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.story-hook-actions .header-lab-link--accent {
  font-size: var(--fs-body);
}

/* Pipeline group — steps sit together under one kicker */
.story-pipeline {
  margin-top: 8px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}

.story-pipeline-kicker {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--page-imports);
}

.story-pipeline .story-step {
  min-height: 58vh;
  min-height: 58dvh;
  padding: 24px 0 32px;
}

.story-step-label {
  display: inline-block;
  margin-bottom: 10px;
  font-family: var(--page-title);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--story-accent);
}

.story-step-label--stash { color: var(--page-library); }
.story-step-label--imports { color: var(--page-imports); }

.story-step-title {
  font-family: var(--page-title);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 400;
  line-height: 1.26;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.story-step-lead {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--dim);
  line-height: 1.55;
  max-width: 40ch;
}

.story-step-num {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--faint);
}

/* ---- Right: sticky faded preview ---- */

.story-visual {
  order: 1;
  position: sticky;
  top: 64px;
  z-index: 2;
  padding: 80px 0 16px;
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  background: linear-gradient(to bottom, var(--bg) 88%, transparent);
}

@media (min-width: 900px) {
  .story-visual {
    order: unset;
    top: 88px;
    height: calc(100vh - 104px);
    height: calc(100dvh - 104px);
    padding: 96px 0 24px;
    margin: 0;
    background: none;
    display: flex;
    align-items: center;
  }
}

.story-preview {
  --preview-h: 720;
  position: relative;
  width: 100%;
  min-height: 200px;
  max-height: min(52vh, 520px);
  aspect-ratio: 1024 / 720;
}

@media (min-width: 900px) {
  .story-preview {
    max-height: min(100%, 720px);
    margin-left: auto;
    margin-right: 0;
  }
}

.story-preview-fade {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--void);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.story-preview-fade.is-active {
  opacity: 0.92;
}

.story-preview .app-preview-frame {
  pointer-events: none;
}

.story-scroll-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--dim);
  letter-spacing: 0.04em;
  transition: opacity 400ms ease;
  pointer-events: none;
}

.story-scroll-hint.is-hidden {
  opacity: 0;
}

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--dim);
}

@media (prefers-reduced-motion: reduce) {
  .story-step-copy,
  .story-preview-fade {
    transition: none !important;
  }

  .story-step .story-step-copy {
    opacity: 1;
    transform: none;
  }
}
