/* The path scene (path.js): an app's four steps, the one that eats the
   weekend, then that step sorted for every next app. Sizes hang off the
   variables below, so the rows' heights are known without measuring. */

.path {
  height: 480vh;
  --box: 44px;
  --gap: 20px;
  --textw: 292px;
  --cell: 80px;
  --dot: 28px;
  --pad: 12px;
  --name: 38px;
  --note: 17px;
  --note-lh: 24px;
  --row: calc(var(--pad) * 2 + var(--box) + 2px + var(--note-lh));
  --row-tall: calc(var(--row) + var(--note-lh));
  --edge: 16px;
  --track: #e3e3e8;
  --ring: #d2d2d7;
  --ink-green: color-mix(in srgb, var(--green) 80%, #000);
  --tint: color-mix(in srgb, var(--green) 13%, var(--bg));
}

.path-frame { position: absolute; inset: 60px 0 0; display: grid; place-items: center; padding: 12px clamp(16px, 4vw, 32px); }
.path-comp { display: grid; justify-items: center; gap: clamp(20px, 4.6vh, 44px); width: 100%; max-width: 1056px; will-change: transform; }

/* MARK: The words on top: one at a time, in the same spot */

.path-heads { display: grid; width: 100%; text-align: center; }
.path-head { grid-area: 1 / 1; align-self: end; margin: 0; opacity: 0; }
.path-head[data-head="1"] { opacity: 1; }
.path-h { font: 750 clamp(29px, 4.6vw, 50px)/1.08 var(--display); letter-spacing: -0.032em; text-wrap: balance; }
.path-close h2 { font-size: clamp(33px, 4.3vw, 56px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.04; text-wrap: balance; }
.path-close .lede { max-width: 620px; margin-top: 14px; text-wrap: balance; }

/* MARK: The checklist */

.path-board { position: relative; width: fit-content; will-change: transform; }
.path-list { position: relative; }
.path-steps { margin: 0; padding: 0; list-style: none; }

.step { position: relative; display: flex; align-items: flex-start; gap: 28px; height: var(--h); padding: var(--pad) 0; --h: var(--row); }
.step.shots { --h: var(--row-tall); }
.step-main { display: flex; align-items: flex-start; gap: var(--gap); flex: none; width: calc(var(--box) + var(--gap) + var(--textw)); }

/* The line from this step's box down to the next one's, and the part of it done. */
.seg { position: absolute; left: calc(var(--box) / 2 - 1px); top: calc(var(--pad) + var(--box) / 2); width: 2px; height: var(--h); background: var(--track); transform-origin: 50% 0; transform: scaleY(0); }
.seg i { position: absolute; inset: 0; background: var(--green); transform-origin: 50% 0; transform: scaleY(0); }

.box { position: relative; z-index: 1; flex: none; width: var(--box); height: var(--box); border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px var(--ring); }
.disc { position: absolute; inset: 0; border-radius: 50%; background: var(--green); transform: scale(0); }
.box svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 2.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.box svg path { stroke-dasharray: 1; stroke-dashoffset: 1; }
/* Where it sticks: a dark ring, and a slow pulse while it's stuck. */
.ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2.5px var(--text); opacity: 0; }
.ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--text); opacity: 0; }
.path.stuck .ring::after { animation: path-pulse 1.8s ease-out infinite; }
@keyframes path-pulse {
  0% { transform: scale(1); opacity: 0.32; }
  100% { transform: scale(1.85); opacity: 0; }
}

.step-text { flex: 1; min-width: 0; }
.step-name { display: block; font: 750 var(--name)/var(--box) var(--display); letter-spacing: -0.03em; white-space: nowrap; }
.step-note { display: block; margin-top: 2px; font: 400 var(--note)/var(--note-lh) var(--body); color: var(--muted); white-space: nowrap; }

/* Screenshots has two notes in the same spot: the truth, then "sorted". */
.step-notes { position: relative; display: block; height: calc(var(--note-lh) * 2); margin-top: 2px; }
.step-notes .step-note { position: absolute; left: 0; top: 0; margin: 0; }
.two { position: relative; display: inline-block; }
.two::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 58%;
  height: 2.5px;
  border-radius: 2px;
  background: #ff3b30;
  transform-origin: 0 50%;
  transform: rotate(-3.5deg) scaleX(var(--strike, 0));
}
.real { display: block; font-weight: 650; color: var(--text); opacity: 0; }
.note-sorted { opacity: 0; }
.done { display: block; font-weight: 650; color: var(--ink-green); }
.again { display: block; opacity: 0; }

/* Behind the Screenshots row: grey while it's stuck, green once it's sorted,
   then the green runs off to the right under the next apps. The pill and the
   band are the same flat colour, so one can hand over to the other unseen. */
.path-hl, .path-band { position: absolute; left: calc(var(--edge) * -1); top: calc(var(--row) * 2 + 3px); height: calc(var(--row-tall) - 6px); pointer-events: none; }
.path-hl { width: calc(var(--box) + var(--gap) + var(--textw) + var(--edge) * 2); border-radius: 20px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--line); opacity: 0; }
.path-hl.ok { background: var(--tint); box-shadow: none; }
.path-band { width: calc(100% + var(--edge) + 130px); overflow: hidden; border-radius: 20px 0 0 20px; }
.path-band i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--tint) 0%, var(--tint) 58%, var(--bg) 100%); transform: translateX(-101%); }

/* MARK: You are here */

.here { position: absolute; z-index: 3; right: calc(100% + var(--edge) + 14px); top: var(--pad); display: flex; align-items: center; height: var(--box); margin: 0; opacity: 0; transform-origin: 100% 50%; }
.here-pill { position: relative; display: block; height: 50px; padding: 0 20px 0 54px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px var(--line), var(--lift); font: 650 16px/50px var(--body); letter-spacing: -0.01em; white-space: nowrap; }
.here-pill::after { content: ""; position: absolute; right: -5px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 0 3px 0 0; background: #fff; box-shadow: 1px -1px 0 0 var(--line); transform: rotate(45deg); }
.here-icon { position: absolute; left: 6px; top: 50%; width: 38px; height: 38px; margin-top: -19px; border-radius: 22.5%; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.16); }

/* MARK: The next apps: a column each, one cell per step */

.cells { display: flex; flex: none; height: var(--box); }
.cells i, .cells b { position: relative; flex: none; width: var(--cell); opacity: 0; }
.cells i { display: grid; place-items: center; height: var(--box); }
.cells i::before { content: ""; position: relative; z-index: 1; width: var(--dot); height: var(--dot); border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1.5px var(--ring); }
.cells i::after { content: ""; position: absolute; left: calc(50% - 0.75px); top: 50%; width: 1.5px; height: var(--h); background: var(--track); }
.step:last-child .cells i::after { display: none; }
.step.shots .cells i::before {
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 12.7l3.7 3.7 7.3-8' fill='none' stroke='white' stroke-width='2.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
  box-shadow: none;
}
/* Further away, smaller. */
.cells i:nth-child(2)::before { transform: scale(0.95); }
.cells i:nth-child(3)::before { transform: scale(0.9); }
.cells i:nth-child(4)::before { transform: scale(0.85); }
.cells i:nth-child(5)::before { transform: scale(0.8); }

.path-cols { display: flex; align-items: flex-end; gap: 28px; height: 24px; margin-bottom: 2px; font: 600 12.5px/1.2 var(--body); letter-spacing: 0.01em; color: var(--faint); white-space: nowrap; }
.col-this { flex: none; width: calc(var(--box) + var(--gap) + var(--textw)); opacity: 0; }
.path-cols .cells { height: auto; }
.cells b { font-weight: 600; text-align: center; }
/* On phones the first app's number rolls through the next apps, slot-machine style. */
.n-roll { display: none; }

/* MARK: Smaller screens: the next apps sit at the right end of each row */

@media (max-width: 859px) {
  .path {
    --box: 34px;
    --gap: 12px;
    --cell: 56px;
    --dot: 20px;
    --pad: 9px;
    --name: clamp(22px, 7vw, 26px);
    --note: 15px;
    --note-lh: 21px;
    --edge: 8px;
  }
  .path-frame { padding: 8px 16px; }
  .path-comp { gap: clamp(16px, 3.4vh, 28px); }
  .path-h { font-size: clamp(25px, 7.4vw, 36px); }
  .path-close .lede { font-size: 16px; margin-top: 10px; }
  .path-board { width: min(100%, 440px); }
  .step-main { flex: 1; width: auto; min-width: 0; }
  .step .cells { position: absolute; right: 0; top: var(--pad); }
  /* One column of next apps: "App #2", its number rolling on to #10 and round again. */
  .cells i:nth-child(n + 2), .cells b:nth-child(n + 2), .n-now { display: none; }
  .n-roll { display: inline-block; height: 1.2em; overflow: hidden; vertical-align: bottom; }
  .n-roll > span { display: grid; animation: app-roll 13.5s infinite; }
  .n-roll .n { display: block; height: 1.2em; line-height: 1.2em; }
  .path-cols { justify-content: space-between; height: 20px; font-size: 12px; }
  .col-this { width: auto; }
  .path-hl { width: calc(100% + var(--edge) * 2); border-radius: 16px; }
  .path-band { width: calc(100% + var(--edge) + 16px); border-radius: 16px 0 0 16px; }
  .path-band i { background: linear-gradient(90deg, var(--tint) 0%, var(--tint) 66%, var(--bg) 100%); }
  .cells i::after { display: none; }

  .here { right: 0; transform-origin: 0 50%; }
  .here-pill { height: 32px; padding: 0 11px 0 33px; font-size: 12.5px; line-height: 32px; }
  .here-pill::after { right: auto; left: -4px; width: 10px; height: 10px; margin-top: -5px; border-radius: 0 0 0 3px; box-shadow: -1px 1px 0 0 var(--line); }
  .here-icon { left: 4px; width: 24px; height: 24px; margin-top: -12px; }
}

/* Short windows */

@media (max-height: 760px) and (min-width: 860px) {
  .path { --box: 38px; --name: 32px; --pad: 9px; --note: 16px; --note-lh: 22px; }
  .path-h { font-size: clamp(28px, 3.8vw, 42px); }
  .path-close h2 { font-size: clamp(30px, 3.8vw, 46px); }
}

.reduced .path.stuck .ring::after { animation: none; }

@keyframes app-roll {
  0.000% { transform: translateY(-0.0em); animation-timing-function: linear; }
  8.148% { transform: translateY(-0.0em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  11.111% { transform: translateY(-1.2em); animation-timing-function: linear; }
  19.259% { transform: translateY(-1.2em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  22.222% { transform: translateY(-2.4em); animation-timing-function: linear; }
  30.370% { transform: translateY(-2.4em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  33.333% { transform: translateY(-3.6em); animation-timing-function: linear; }
  41.481% { transform: translateY(-3.6em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  44.444% { transform: translateY(-4.8em); animation-timing-function: linear; }
  52.593% { transform: translateY(-4.8em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  55.556% { transform: translateY(-6.0em); animation-timing-function: linear; }
  63.704% { transform: translateY(-6.0em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  66.667% { transform: translateY(-7.2em); animation-timing-function: linear; }
  74.815% { transform: translateY(-7.2em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  77.778% { transform: translateY(-8.4em); animation-timing-function: linear; }
  85.926% { transform: translateY(-8.4em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  88.889% { transform: translateY(-9.6em); animation-timing-function: linear; }
  97.037% { transform: translateY(-9.6em); animation-timing-function: cubic-bezier(0.3, 1.45, 0.55, 1); }
  100% { transform: translateY(-10.8em); }
}
@media (prefers-reduced-motion: reduce) { .n-roll > span { animation: none; } }
