/*
  HOW IT WORKS: THE PICTURE BESIDE EACH STEP  (the final section: class "hw hw--final")

  The section is the landing page's own, layout st--timeline (landing.css), unchanged: the centre
  line that fills as you scroll, the numbers and sentences that light up. This file adds one
  picture to each step and nothing else:

      wide screens   the picture takes the empty side of its step: left, right, left
      phones         the picture sits under its own step

  Each picture is a mock product screen drawn in HTML and CSS (no image files). It is an
  illustration: the page reads it out as one sentence (role="img" on .hw__pic) and nothing inside
  it can be tabbed to or pressed. The insides are marked aria-hidden="true".

  ONE SET. The three pictures share everything:
      the frame      a white card, a hairline (--cr-line), corners --cr-radius-md, no shadow
                     (the system is flat), the same padding and gaps, and one height on wide screens
      the pieces     grey tiles with corners --cr-radius-sm; a picked thing has the accent ring and
                     a tick; a finished thing has a tick and a word; reels are 9:16 in the site's
                     reel gradient; one label style; placeholder lines in --cr-line
      the arrival    each comes in from its own side as its step lights (how-final.js adds is-shown):
                     --hw-far in --lv-rise with --lv-ease. Then two beats, the same in each:
                     --hw-beat-1  a tick pops (the idea is picked / the style is picked / the reel is ready)
                     --hw-beat-2  what follows drops in (the hook into the script box / the two
                                  approvals / the time it is scheduled for)

  A picture waits out of sight only when the page has its "js" class and motion is allowed, so
  without script, or with "reduce motion" on, every picture is simply there, finished.
  Design tokens only. Sizes inside a picture are in em, so the whole screen scales with its room.
*/

/* ---------- Where the picture sits ---------- */
.hw { overflow-x: hidden; overflow-x: clip; }   /* a picture coming in from the side never widens the page */
.hw__pic { position: relative; grid-column: 2; grid-row: 2; width: 100%; max-width: 26rem; margin-top: var(--cr-space-5); container-type: inline-size; }
@media (min-width: 760px) {
  .hw .hw__pic { grid-column: 1; grid-row: 1; justify-self: end; margin-top: 0; }
  .hw .st__list > li:nth-child(even) .hw__pic { grid-column: 3; justify-self: start; }
}
@media (min-width: 1000px) { .hw.st--timeline .st__list { gap: var(--cr-space-22); } }

/* ---------- The frame, the same for all three ---------- */
/* 1em inside a picture is about 11px in a phone's column and 13px in a wide one */
.hw__screen { font: var(--cr-weight-regular) 11px/var(--cr-leading-snug) var(--cr-font); font-size: clamp(10.5px, 3.8cqw, 13px); letter-spacing: var(--cr-tracking-body); text-align: left; color: var(--cr-ink); -webkit-user-select: none; user-select: none; cursor: default; }
.hw__screen i, .hw__screen b { font-style: normal; font-weight: inherit; }
.hw-card { display: grid; align-content: space-between; gap: 1.1em; min-width: 0; padding: 1.4em; border: var(--cr-border) solid var(--cr-line); border-radius: var(--cr-radius-md); background: var(--cr-white); }
@media (min-width: 760px) { .hw-card { min-height: 27.7em; } }   /* one height beside the steps, so the three rows sit evenly */

/* ---------- The pieces, the same in all three ---------- */
.hw-part { display: grid; gap: .6em; min-width: 0; }
.hw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.hw-label { font-size: .9em; font-weight: var(--cr-weight-semibold); color: var(--cr-grey); }

/* A reel: 9:16, the site's reel gradient, two caption bars on the large one */
.hw-reel { position: relative; display: block; flex: none; width: 2em; aspect-ratio: 9 / 16; border-radius: .45em; background: var(--cr-reel-fallback); overflow: hidden; }
.hw-reel--2 { background: linear-gradient(200deg, var(--cr-grad-2), var(--cr-grad-3)); }
.hw-reel--3 { background: linear-gradient(140deg, var(--cr-grad-1), var(--cr-grad-2)); }
.hw-reel--big { width: auto; border-radius: var(--cr-radius-sm); }
.hw-reel b { position: absolute; left: 14%; bottom: 22%; width: 58%; height: 4.5%; border-radius: var(--cr-radius-pill); background: var(--cr-white); opacity: .92; }
.hw-reel b + b { bottom: 14%; width: 40%; }

/* A tile, and a row on a tile: a reel, words, and a tick when it is the picked one */
.hw-list { display: grid; gap: .45em; }
.hw-row, .hw-pane { position: relative; min-width: 0; border-radius: var(--cr-radius-sm); background: var(--cr-tile); }
.hw-row { display: flex; align-items: center; gap: .8em; padding: .5em .8em .5em .6em; }
.hw-row__text { flex: 1 1 auto; display: grid; gap: .3em; min-width: 0; }
.hw-row__name { font-weight: var(--cr-weight-semibold); line-height: 1.25; }
.hw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25em .55em; font-size: .9em; line-height: 1.25; color: var(--cr-grey); }
.hw-nums { color: var(--cr-ink); white-space: nowrap; }
.hw-eg { padding: .05em .5em; border-radius: var(--cr-radius-pill); box-shadow: inset 0 0 0 1px var(--cr-line); font-size: .95em; font-weight: var(--cr-weight-semibold); white-space: nowrap; }   /* "Example": the figures are made up */

/* Picked: white, the accent ring, a tick.  Finished: a tick and a word. */
.hw-row.is-on { background: var(--cr-white); }
.hw-row.is-on::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--cr-accent); pointer-events: none; }
.hw-tick { flex: none; display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--cr-accent); }
.hw-tick::after { content: ""; width: .7em; height: .38em; border: solid var(--cr-white); border-width: 0 0 .17em .17em; transform: translateY(-.07em) rotate(-45deg); }
.hw-ok { justify-self: start; display: inline-flex; align-items: center; gap: .55em; font-weight: var(--cr-weight-semibold); line-height: 1.2; }

/* The script box: a field with the cursor in it */
.hw-field { display: flex; align-items: center; min-height: 3.5em; padding: .8em 1.1em; border: var(--cr-border) solid var(--cr-accent-ink); border-radius: var(--cr-radius-sm); background: var(--cr-white); box-shadow: var(--cr-shadow-focus); font-size: 1.1em; font-weight: var(--cr-weight-semibold); line-height: 1.25; }
.hw-caret { flex: none; width: 1.5px; height: 1.25em; margin-left: 2px; background: var(--cr-accent-ink); }
.hw-drop { display: inline-block; }   /* something that drops into place on the second beat */

/* Step 2: the script and the graphics side by side, then the brand style */
.hw-duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45em; }
.hw-pane { display: grid; align-content: space-between; gap: .75em; padding: .85em; }
.hw-lines { display: grid; gap: .7em; }
.hw-lines i { display: block; width: var(--w, 100%); height: .6em; border-radius: var(--cr-radius-pill); background: var(--cr-line); }
.hw-minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4em; }
.hw-minis .hw-reel { width: auto; }
.hw-line { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding-top: .8em; border-top: var(--cr-border) solid var(--cr-line); font-weight: var(--cr-weight-semibold); }
.hw-line small { display: block; font-size: .9em; font-weight: var(--cr-weight-regular); color: var(--cr-grey); }
.hw-swatches { display: flex; gap: .35em; }
.hw-swatches i { width: 1.35em; height: 1.35em; border-radius: 50%; background: var(--cr-ink); box-shadow: inset 0 0 0 1px var(--cr-header-line); }
.hw-swatches i:nth-child(2) { background: var(--cr-grad-2); }
.hw-swatches i:nth-child(3) { background: var(--cr-tile); }

/* Step 3: the finished reel, large, beside what is known about it */
.hw-card--reel { grid-template-columns: minmax(0, 42%) minmax(0, 1fr); align-content: center; align-items: center; column-gap: 1.6em; }
@media (min-width: 760px) { .hw-card--reel { grid-template-columns: minmax(0, 47.5%) minmax(0, 1fr); } }   /* the reel fills the card's height beside the step */
.hw-side { display: grid; gap: 1.1em; min-width: 0; }
.hw-when { font-size: 1.3em; font-weight: var(--cr-weight-semibold); line-height: 1.2; letter-spacing: var(--cr-tracking-tight); }

/* ---------- Arriving: one way, for all three ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hw--final { --hw-far: var(--lv-shift); --hw-dx: 0px; --hw-dy: var(--hw-far); --hw-beat-1: .6s; --hw-beat-2: .9s; }
  .hw-caret { animation: hw-blink 1.1s steps(1) infinite; }

  /* out of sight until its turn; each move is a keyframe that holds its first frame through its wait */
  .js .hw--final .hw__pic:not(.is-shown),
  .js .hw--final .hw__pic:not(.is-shown) .hw-b1::after,
  .js .hw--final .hw__pic:not(.is-shown) .hw-b1 > .hw-tick,
  .js .hw--final .hw__pic:not(.is-shown) .hw-b1 > .hw-word,
  .js .hw--final .hw__pic:not(.is-shown) .hw-b2 { opacity: 0; }
  .js .hw--final .hw__pic.is-shown { animation: hw-arrive var(--lv-rise) var(--lv-ease) both; }
  .js .hw--final .is-shown .hw-b1::after { animation: hw-in .3s var(--cr-ease) var(--hw-beat-1) both; }
  .js .hw--final .is-shown .hw-b1 > .hw-tick { animation: hw-pop .45s cubic-bezier(.3, 1.5, .5, 1) var(--hw-beat-1) both; }
  .js .hw--final .is-shown .hw-b1 > .hw-word { animation: hw-in .3s var(--cr-ease) var(--hw-beat-1) both; }
  .js .hw--final .is-shown .hw-b2 { animation: hw-drop .5s var(--lv-ease) var(--hw-beat-2) both; }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 760px) {
  /* beside the step: from the left for steps 1 and 3, from the right for step 2 */
  .hw--final { --hw-far: var(--cr-space-8); }
  .hw--final .hw__pic { --hw-dx: calc(-1 * var(--hw-far)); --hw-dy: 0px; }
  .hw--final .st__list > li:nth-child(even) .hw__pic { --hw-dx: var(--hw-far); }
}
@keyframes hw-arrive { from { opacity: 0; transform: translate(var(--hw-dx), var(--hw-dy)); } }
@keyframes hw-in { from { opacity: 0; } }
@keyframes hw-pop { from { opacity: 0; transform: scale(.4); } }
@keyframes hw-drop { from { opacity: 0; transform: translateY(-.9em); } }
@keyframes hw-blink { 50% { opacity: 0; } }
