/* Steps: phone with a changing screen + three step buttons.
   Mobile first, portrait: phone on top, the three cards compact below so both fit one screen. */
.steps__layout { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.steps__phone { flex: none; touch-action: pan-y; }
/* Phone width: 50vw between 176 and 210px, capped so phone height <= 54% of the visible height; never below 170px. */
.steps .steps__frame { width: max(170px, min(clamp(176px, 50vw, 210px), calc((100vh - var(--size-header-h)) * 0.54 * 9 / 19))); }
@supports (height: 1svh) {
  .steps .steps__frame { width: max(170px, min(clamp(176px, 50vw, 210px), calc((100svh - var(--size-header-h)) * 0.54 * 9 / 19))); }
}
.steps__frame .phone__screen { container-type: inline-size; }

.steps__list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 8px; }
.steps__item {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; margin: 0;
  padding: 10px 14px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--color-bg); border: 1px solid var(--color-line); border-radius: var(--size-radius);
  transition: border-color var(--dur-base) var(--ease-soft), transform var(--dur-base) var(--ease-out);
}
/* Soft shadow of the active card: its own layer fades in (no box-shadow animation). */
.steps__item::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: var(--shadow-card); opacity: 0; transition: opacity var(--dur-base) var(--ease-soft);
}
.steps__item.is-active { border-color: var(--color-accent); transform: translateY(-2px); }
.steps__item.is-active::after { opacity: 1; }
.steps__item:active { transform: scale(.985); }
.steps__item.is-active:active { transform: translateY(-2px) scale(.985); }
@media (hover: hover) {
  .steps__item:hover { border-color: var(--color-mute); }
  .steps__item.is-active:hover { border-color: var(--color-accent); }
  .steps__item:not(.is-active):hover .steps__num { background: var(--color-pink); }
}
.steps__num {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-warm); color: var(--color-ink); font-weight: 800; font-size: 17px; line-height: 1;
  transition: background var(--dur-base) var(--ease-soft), color var(--dur-base) var(--ease-soft);
}
.steps__item.is-active .steps__num { background: var(--color-accent-text); color: var(--color-white); }
.steps__body { display: flex; flex-direction: column; min-width: 0; }
.steps__label { font-size: var(--size-text-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-mute); line-height: 1.3; }
.steps__title { font-family: var(--font-body); font-weight: 700; font-size: var(--size-h3); line-height: 1.25; color: var(--color-ink); }
.steps__text { font-size: var(--size-text-sm); line-height: 1.45; color: var(--color-ink-2); }

/* Auto-play progress of the active card (JS only; see steps.js). */
.steps__timer {
  position: absolute; left: 14px; right: 14px; bottom: 5px; height: 3px; border-radius: var(--size-radius-pill);
  background: var(--color-accent); transform: scaleX(0); transform-origin: left center; opacity: 0; pointer-events: none;
}
.steps--js.is-playing .steps__item.is-active .steps__timer { opacity: 1; animation: steps-timer 4200ms linear forwards; }
.steps--js.is-playing.is-paused .steps__item.is-active .steps__timer { animation-play-state: paused; }
@keyframes steps-timer { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Phone screens: stacked. The incoming one slides in from the side, the outgoing one slips away. */
.steps__frame { --steps-in: 16px; --steps-out: -12px; }
.steps__frame[data-dir="back"] { --steps-in: -16px; --steps-out: 12px; }
.steps__screen {
  position: absolute; inset: 0; z-index: 0;
  opacity: 0; visibility: hidden; transform: translate3d(var(--steps-out), 0, 0);
  transition: opacity var(--dur-base) var(--ease-soft), transform var(--dur-base) var(--ease-soft), visibility 0s linear var(--dur-base);
  background: var(--color-paper);
}
.steps__screen.is-active { z-index: 1; opacity: 1; visibility: visible; transform: none; transition: none; }
.steps--moved .steps__screen.is-active { animation: steps-screen-in var(--dur-slow) var(--ease-out) both; }
@keyframes steps-screen-in { from { opacity: 0; transform: translate3d(var(--steps-in), 0, 0) scale(.985); } to { opacity: 1; transform: none; } }

.steps__scr { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4cqw; padding: 0 5cqw 5cqw; color: var(--color-ink); line-height: 1.3; background: linear-gradient(180deg, var(--color-accent-soft) 0, var(--color-paper) 34cqw); font-size: 5cqw; }
.steps__st { flex: none; display: flex; align-items: center; justify-content: space-between; height: 10cqw; margin: 0 -1cqw; padding: 3.4cqw 2cqw 0; font-size: 3.7cqw; line-height: 1; }
.steps__st svg { width: 11cqw; height: 4.4cqw; display: block; }
.steps__ico { fill: currentColor; }
.steps__tick { stroke-width: 3; }
.steps__hd { margin: 1cqw 1cqw 0; font-size: 8cqw; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.steps__pill { align-self: flex-start; display: inline-flex; margin: 0 1cqw; padding: 2cqw 4cqw; border-radius: var(--size-radius-pill); background: var(--color-accent-soft); color: var(--color-accent-text); font-weight: 800; font-size: 4.2cqw; line-height: 1; }

/* 1 idea: AI-suggested topics, one picked */
.steps__chips { list-style: none; margin: 1cqw 0 0; padding: 0; display: flex; flex-direction: column; gap: 4cqw; }
.steps__chip { position: relative; padding: 4cqw 4.2cqw; border-radius: 4cqw; background: var(--color-white); border: .8cqw solid var(--color-line); font-weight: 700; font-size: 5cqw; line-height: 1.2; box-shadow: var(--shadow-card); }
.steps__sel { position: absolute; inset: -.8cqw; border: 1cqw solid var(--color-accent); border-radius: 4.4cqw; pointer-events: none; opacity: 0; }
.steps__flag { position: absolute; right: 3.5cqw; top: -3.4cqw; display: inline-flex; align-items: center; gap: 1cqw; padding: 1cqw 2.6cqw 1cqw 1.6cqw; border-radius: var(--size-radius-pill); background: var(--color-accent-text); color: var(--color-white); font-size: 3.6cqw; font-weight: 800; line-height: 1; opacity: 0; }
.steps__flag svg { width: 3.8cqw; height: 3.8cqw; display: block; }
.steps__tap { position: absolute; right: 9cqw; top: 50%; width: 13cqw; height: 13cqw; margin-top: -6.5cqw; border-radius: 50%; border: 1cqw solid var(--color-accent); background: var(--color-accent-soft); opacity: 0; pointer-events: none; }
.steps__chip.is-picked { opacity: 1; }
/* Without motion the picked topic is shown as chosen from the start. */
.steps__chip.is-picked .steps__sel, .steps__chip.is-picked .steps__flag { opacity: 1; }
.steps__screen.is-active .steps__chip { animation: steps-rise var(--dur-slow) var(--ease-out) both; }
.steps__screen.is-active .steps__chip:nth-child(2) { animation-delay: .12s; }
.steps__screen.is-active .steps__chip:nth-child(3) { animation-delay: .24s; }
.steps__screen.is-active .steps__chip:nth-child(4) { animation-delay: .36s; }
.steps__screen.is-active .steps__chip.is-picked .steps__sel { animation: steps-fade .35s 1.3s var(--ease-soft) both; }
.steps__screen.is-active .steps__chip.is-picked .steps__flag { animation: steps-pop .4s 1.45s var(--ease-out) both; }
.steps__screen.is-active .steps__chip.is-picked .steps__tap { animation: steps-tap .7s 1.1s ease-out both; }
@keyframes steps-rise { from { opacity: 0; transform: translateY(2.2cqw); } to { opacity: 1; transform: none; } }
@keyframes steps-fade { from { opacity: 0; } }
@keyframes steps-pop { from { opacity: 0; transform: scale(.5); } 60% { transform: scale(1.12); } }
@keyframes steps-tap { 0% { opacity: .9; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.5); } }

/* 2 generate: script, scenes and voice get made one after another, the bar fills. */
.steps__gen { list-style: none; margin: 1cqw 0 0; padding: 0; display: flex; flex-direction: column; gap: 4cqw; }
.steps__gen-row { position: relative; display: flex; align-items: center; gap: 3.6cqw; padding: 3.4cqw 4cqw; border: .8cqw solid var(--color-line); border-radius: 4.4cqw; background: var(--color-white); box-shadow: var(--shadow-card); }
.steps__gen-art { flex: none; width: 15cqw; height: 12cqw; border-radius: 2.4cqw; padding: 1.8cqw; display: grid; gap: 1cqw; overflow: hidden; }
.steps__gen-art i { display: block; }
.steps__gen-art--script { background: var(--color-lavender); align-content: center; }
.steps__gen-art--script i { height: .9cqw; border-radius: 1cqw; background: var(--color-ink-2); transform-origin: left center; }
.steps__gen-art--script i:last-child { width: 55%; }
.steps__gen-art--scenes { background: var(--color-peach); grid-template-columns: 1fr 1fr; }
.steps__gen-art--scenes i { border-radius: 1cqw; background: var(--color-white); }
.steps__gen-art--voice { background: var(--color-pink); grid-auto-flow: column; align-items: center; gap: .8cqw; }
.steps__gen-art--voice i { width: 1.1cqw; height: 80%; border-radius: 1cqw; background: var(--color-accent); justify-self: center; transform-origin: center; }
.steps__gen-art--voice i:nth-child(2n) { height: 45%; }
.steps__gen-art--voice i:nth-child(3n) { height: 62%; }
.steps__gen-label { flex: 1; min-width: 0; font-weight: 800; font-size: 5.4cqw; }
.steps__gen-wait { flex: none; display: none; gap: 1.4cqw; }
.steps__gen-wait i { width: 2cqw; height: 2cqw; border-radius: 50%; background: var(--color-ink-2); }
.steps__gen-check { flex: none; display: grid; place-items: center; width: 8.4cqw; height: 8.4cqw; border-radius: 50%; background: var(--color-accent); color: var(--color-white); }
.steps__gen-check svg { width: 62%; height: 62%; display: block; }
.steps__progress { margin: auto 1cqw 3cqw; height: 2.4cqw; border-radius: var(--size-radius-pill); background: var(--color-line); overflow: hidden; }
.steps__progress-bar { display: block; height: 100%; background: var(--color-accent); transform-origin: left center; }
/* Sequence (runs each time the step opens): row 1 appears, its lines are written, check; then row 2, row 3. The bar fills across all three. */
.steps__screen.is-active .steps__gen-row { animation: steps-rise .45s var(--ease-out) both; }
.steps__screen.is-active .steps__gen-row--2 { animation-delay: 1.1s; }
.steps__screen.is-active .steps__gen-row--3 { animation-delay: 2.2s; }
.steps__screen.is-active .steps__gen-wait { display: flex; animation: steps-out .01s 1s both; }
.steps__screen.is-active .steps__gen-row--2 .steps__gen-wait { animation-delay: 2.1s; }
.steps__screen.is-active .steps__gen-row--3 .steps__gen-wait { animation-delay: 3.2s; }
.steps__screen.is-active .steps__gen-wait i { animation: steps-dot 1s ease-in-out infinite; }
.steps__screen.is-active .steps__gen-wait i:nth-child(2) { animation-delay: .15s; }
.steps__screen.is-active .steps__gen-wait i:nth-child(3) { animation-delay: .3s; }
.steps__screen.is-active .steps__gen-check { animation: steps-pop .35s var(--ease-out) both; animation-delay: 1s; }
.steps__screen.is-active .steps__gen-row--2 .steps__gen-check { animation-delay: 2.1s; }
.steps__screen.is-active .steps__gen-row--3 .steps__gen-check { animation-delay: 3.2s; }
.steps__screen.is-active .steps__gen-art--script i { animation: steps-write .5s var(--ease-out) both; }
.steps__screen.is-active .steps__gen-art--script i:nth-child(2) { animation-delay: .15s; }
.steps__screen.is-active .steps__gen-art--script i:nth-child(3) { animation-delay: .3s; }
.steps__screen.is-active .steps__gen-art--script i:nth-child(4) { animation-delay: .45s; }
.steps__screen.is-active .steps__gen-art--scenes i { animation: steps-pop .35s var(--ease-out) both; animation-delay: 1.3s; }
.steps__screen.is-active .steps__gen-art--scenes i:nth-child(2) { animation-delay: 1.5s; }
.steps__screen.is-active .steps__gen-art--scenes i:nth-child(3) { animation-delay: 1.7s; }
.steps__screen.is-active .steps__gen-art--scenes i:nth-child(4) { animation-delay: 1.9s; }
.steps__screen.is-active .steps__gen-art--voice i { animation: steps-wave .6s ease-in-out 2.4s 3 alternate both; }
.steps__screen.is-active .steps__progress-bar { animation: steps-fill 3.2s var(--ease-soft) .2s both; }
@keyframes steps-out { to { opacity: 0; } }
@keyframes steps-dot { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-1.2cqw); opacity: 1; } }
@keyframes steps-write { from { transform: scaleX(0); } }
@keyframes steps-wave { from { transform: scaleY(1); } to { transform: scaleY(.4); } }
@keyframes steps-fill { from { transform: scaleX(0); } }

/* 3 post: the finished video (drawn reel while the file is missing) with a post bar. */
.steps__scr--final { padding: 0; gap: 0; background: var(--color-phone); }
.steps__video, .steps__reel { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.steps__final-bar { position: absolute; left: 5cqw; right: 5cqw; bottom: 5cqw; z-index: 2; display: flex; align-items: center; gap: 3cqw; padding: 2.4cqw 2.4cqw 2.4cqw 4.4cqw; border-radius: 4.4cqw; background: var(--color-white); box-shadow: var(--shadow-card); }
.steps__final-title { flex: 1; min-width: 0; margin: 0; font-weight: 800; font-size: 4.6cqw; line-height: 1.2; }
.steps__post { flex: none; display: inline-flex; align-items: center; min-height: 11cqw; padding: 0 5.4cqw; border-radius: var(--size-radius-pill); background: var(--color-accent-text); color: var(--color-white); font-weight: 800; font-size: 4.6cqw; }
.steps__screen.is-active .steps__final-bar { animation: steps-rise .5s .4s var(--ease-out) both; }
.steps__screen.is-active .steps__post { animation: steps-pop .5s 1.2s var(--ease-out) both; }

/* Reduced motion: instant switch, no timers, every drawn state shown as finished. */
@media (prefers-reduced-motion: reduce) {
  .steps__screen, .steps__item, .steps__item::after, .steps__num { transition: none; }
  .steps__screen { transform: none; }
  .steps__screen *, .steps__screen.is-active { animation: none !important; }
  .steps__item.is-active, .steps__item:active, .steps__item.is-active:active { transform: none; }
  .steps__timer, .steps__gen-wait { display: none !important; }
}

/* Landscape phones: row layout, small phone on the left. */
@media (max-width: 1023px) and (max-height: 520px) and (orientation: landscape) {
  .steps__layout { flex-direction: row; justify-content: center; align-items: center; gap: 24px; }
  .steps .steps__frame { width: clamp(140px, calc((100vh - var(--size-header-h) - 40px) * 9 / 19), 200px); }
  .steps__list { flex: 1; min-width: 0; width: auto; max-width: 480px; }
}
@supports (height: 1svh) {
  @media (max-width: 1023px) and (max-height: 520px) and (orientation: landscape) {
    .steps .steps__frame { width: clamp(140px, calc((100svh - var(--size-header-h) - 40px) * 9 / 19), 200px); }
  }
}

/* Desktop: row layout, roomier cards. */
@media (min-width: 1024px) {
  .steps__layout { flex-direction: row; justify-content: center; align-items: center; gap: clamp(48px, 7vw, 96px); }
  .steps .steps__frame { width: var(--size-phone-lg); }
  .steps__list { max-width: 520px; gap: 12px; }
  .steps__item { align-items: flex-start; padding: 18px 22px; gap: 18px; }
  .steps__timer { left: 22px; right: 22px; bottom: 8px; }
}
