/* THE FIRST SCREEN: the figure, the headline either side of him, and the signature along the bottom. */

/* The figure and the headline are one picture, set in the middle of the room under the bar.
   --nav  where the bar ends.
   --top  the top of the drawing's box, placed so that he (hair to the tips of the loose ends) has the same room above as below.
   --ax   the upright line the screen is centred on, as a share of the drawing's width: between his head and the middle of his body.
   --fs   the headline's size; the script sets it to suit the room beside him.
   --base where the last line of the headline ("behind them") stands, as a share of the drawing's height: on his far shoulder, so the word sits behind his lines. */
.stage.story {
  touch-action: none;
} /* inside the story a swipe is a step, not a scroll: see ONE SCROLL, ONE STEP in the script */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  touch-action: pan-y;
  --nav: 72px;
  --h: min(65vh, 40vw);
  --w: calc(var(--h) * 1.0434);
  --ax: 0.43;
  --top: calc(var(--nav) + (100vh - var(--nav) - var(--h) * 1.067) / 2 - var(--h) * 0.023);
  --fs: clamp(26px, 4.4vw, 86px);
  --lh: 0.98;
  --base: 0.66;
}
.fig {
  position: absolute;
  height: var(--h);
  top: var(--top);
  aspect-ratio: 1540/1476;
  left: calc(50% - var(--w) * var(--ax));
}
.fig img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  visibility: hidden;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
} /* the whole screen, so loose threads have room; it lies over the headline, so his lines cross the words they touch */
.plain .fig img {
  visibility: visible;
  filter: brightness(0);
  -webkit-mask-image: radial-gradient(ellipse 70% 64% at 45% 36%, #000 60%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 64% at 45% 36%, #000 60%, transparent 100%);
}
.plain canvas {
  display: none;
}
/* the headline: three rows. "I design" / "products and" on his left, "the decisions" / "behind them" on his right, one row lower,
   so "products and" and "the decisions" read straight across on the same line */
.head {
  position: absolute;
  inset: 0;
  margin: 0;
  font: inherit;
} /* a box the size of the screen, so the two halves can be swept outward together when the eye dives */
.h {
  position: absolute;
  display: block;
  white-space: nowrap;
  color: var(--blue);
  font:
    800 var(--fs) / var(--lh) Archivo,
    'Arial Narrow',
    Arial,
    sans-serif;
  font-stretch: 112%;
  letter-spacing: -0.035em;
}
.h.l {
  right: calc(50% + var(--w) * (var(--ax) - 0.09));
  top: calc(var(--top) + var(--h) * var(--base) - var(--fs) * (0.824 + 2 * var(--lh)));
  text-align: right;
}
.h.r {
  left: calc(50% + var(--w) * (0.71 - var(--ax)));
  top: calc(var(--top) + var(--h) * var(--base) - var(--fs) * (0.824 + var(--lh)));
}
.h.measure {
  left: 0;
  right: auto;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  font-size: 100px;
}
/* the bottom of the first screen: only the nudge to scroll, in the bottom right (not on a phone), so his loose threads hang into clear space. They come in once he has finished building himself and slip away as the dive begins */
.foot {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  padding: 0 max(24px, 2.6vw, env(safe-area-inset-right, 0px)) 0 max(24px, 2.6vw, env(safe-area-inset-left, 0px));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font:
    400 13px/1.45 'Geist Mono',
    ui-monospace,
    Menlo,
    Consolas,
    monospace;
  color: var(--ink);
  letter-spacing: 0.01em;
  pointer-events: none;
}
.foot > * {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.foot.in > * {
  opacity: 1;
}
/* who he is: one plain line under "products and", ending where the headline's left half ends. A soft patch of paper sits under it,
   so his threads fade out before they reach the words instead of running through them */
.byw {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}
.by {
  position: absolute;
  margin: 0;
  right: calc(50% + var(--w) * (var(--ax) - 0.09));
  top: calc(var(--top) + var(--h) * var(--base) - var(--fs) * 0.824 + var(--fs) * 0.62);
  white-space: nowrap;
  text-align: right;
  font:
    400 15.5px/1.55 'Geist Mono',
    ui-monospace,
    Menlo,
    Consolas,
    monospace;
  letter-spacing: -0.005em;
  color: #3a3b40;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 0 16px 14px var(--paper);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.byw.in .by {
  opacity: 1;
}
.by b {
  font-weight: 500;
  color: var(--ink);
}
.foot .cue {
  all: unset;
  margin-left: auto;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  pointer-events: auto;
  padding: 10px 0 10px 14px;
  margin-top: -10px;
  margin-bottom: -10px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    color 0.2s;
}
.foot.in .cue {
  opacity: 1;
  transform: none;
}
.foot .cue::after {
  content: '\2193';
  display: inline-block;
  margin-left: 0.6em;
  transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.2, 1);
} /* a small arrow; pressing the words plays the dive for you */
.foot .cue:hover {
  color: var(--blue);
}
@media (max-width: 760px) {
  .foot .cue {
    display: none;
  }
} /* no nudge on a phone: a thumb scrolls anyway */
.foot .cue:hover::after {
  transform: translateY(3px);
}
.foot .cue:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (max-width: 760px) {
  .foot {
    font-size: 11.5px;
    white-space: nowrap;
  }
  .by {
    right: auto;
    left: max(16px, env(safe-area-inset-left, 0px));
    top: auto;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 48px);
    white-space: normal;
    text-align: left;
    font-size: 12.5px;
  }
  .by .lb {
    display: none;
  } /* on a phone the headline sits above him with no room beside it: the line goes along the bottom, under his loose threads */
}
@media (max-width: 760px) {
  /* phone: the four lines stacked above him, and the two together in the middle of the room under the bar */
  .stage {
    --nav: 60px;
    --h: min(46vh, 84vw);
    --fs: 9.5vw;
    --gap: 2.5vh;
    --hd: calc(4 * var(--lh) * var(--fs));
    --y0: calc(var(--nav) + (100vh - var(--nav) - var(--hd) - var(--gap) - var(--h) * 1.067) / 2);
    --top: calc(var(--y0) + var(--hd) + var(--gap) - var(--h) * 0.023);
  }
  .h {
    left: 16px;
    right: 16px;
    text-align: center;
  }
  .h.l {
    top: var(--y0);
    right: 16px;
    left: 16px;
    text-align: center;
  }
  .h.r {
    top: calc(var(--y0) + 2 * var(--lh) * var(--fs));
    left: 16px;
  }
  .h.measure {
    left: 0;
    right: auto;
    top: 0;
  }
}
