/* ---- v12: motion ---- */
/*
 * Home page life: a punch travelling up the hero's twine, a live board of punches, scroll
 * parallax, a tilt-in for the recording, self-advancing tour tabs and staggered reveals.
 * Everything here is decoration on top of content that already reads without it, and all of it
 * stops for prefers-reduced-motion (see the end of this block). Driven by /assets/js/motion.js.
 */

/* Hero: the picture and its motion layer move together on one stage. */
.hero-bg {
  container-type: size;
  /* Must match the picture's object-position below. */
  --ox: 0.7;
  --oy: 0.6;
}
.hero-stage {
  position: absolute;
  inset: 0;
  transform-origin: 75% 60%;
  translate: 0 var(--py, 0px);
  animation: drift 26s ease-in-out infinite alternate;
  will-change: transform;
}
.hero-stage img {
  animation: none;
  transform: none;
}
/* Same box as the cover-fitted picture, so SVG coordinates are picture pixels. */
.hero-fx,
.hero-board {
  --s: max(100cqw / 2400, 100cqh / 1200);
  --lx: calc((100cqw - 2400 * var(--s)) * var(--ox));
  --ly: calc((100cqh - 1200 * var(--s)) * var(--oy));
}
/* From 1280px the picture sits in its own box, cropped from the left (see site.css v12). */
@media (min-width: 1280px) {
  .hero-fx,
  .hero-board {
    --lx: max(calc(100cqw - 2400 * var(--s)), calc(-1040 * var(--s)));
  }
}
.hero-fx {
  position: absolute;
  top: var(--ly);
  left: var(--lx);
  width: calc(2400 * var(--s));
  max-width: none;
  height: calc(1200 * var(--s));
  overflow: visible;
  pointer-events: none;
}
.hero-fx * {
  transform-box: fill-box;
  transform-origin: center;
}
.fx-screen {
  fill: #fff;
  opacity: 0;
}
.fx-led {
  fill: #3ddc6f;
}
.fx-led-glow {
  fill: #3ddc6f;
  opacity: 0;
  animation: fx-breathe 2.6s ease-in-out infinite;
}
@keyframes fx-breathe {
  50% {
    opacity: 0.35;
  }
}
.fx-ring {
  fill: none;
  stroke: #1f6bff;
  stroke-width: 6;
  opacity: 0;
}
.fx-ring-phone {
  stroke-width: 5;
}
.fx-glow {
  fill: #3ddc6f;
  opacity: 0;
}
.fx-trail,
.fx-dot {
  fill: none;
  stroke-linecap: round;
  opacity: 0;
}
.fx-trail {
  stroke: #fff;
  stroke-width: 9;
  stroke-dasharray: 180 2000;
  stroke-dashoffset: 180;
}
/* A zero-length dash with a round cap is a dot that can ride the path. */
.fx-dot {
  stroke: #1f6bff;
  stroke-width: 22;
  stroke-dasharray: 0.01 2000;
  filter: drop-shadow(0 0 4px #fff);
}

/* The live board: a black pill above the cloud, mono type, split-flap digits. */
.hero-board {
  --row: 46px;
  position: absolute;
  z-index: 2;
  top: 20px;
  right: max(var(--gutter), calc((100cqw - var(--wrap)) / 2));
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--row);
  padding: 0 18px 0 16px;
  border-radius: 999px;
  background: #0a0a0a;
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.1) inset,
    0 20px 40px -20px rgb(0 0 0 / 0.65);
  color: #fff;
  font-family: var(--font-mono);
  translate: 0 var(--pyb, 0px);
  animation: hb-float 7s ease-in-out infinite;
}
@keyframes hb-float {
  50% {
    transform: translateY(-4px);
  }
}
.hb-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 9px;
  padding-right: 14px;
  border-right: 1px solid #2a2a2a;
  color: #b8b8b8;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}
.hb-lamp {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc6f;
}
.hb-lamp::after {
  position: absolute;
  inset: -4px;
  border: 2px solid #3ddc6f;
  border-radius: 50%;
  content: '';
  opacity: 0;
  animation: hb-ping 2s var(--ease) infinite;
}
@keyframes hb-ping {
  0% {
    opacity: 0.8;
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}
.hb-clock {
  display: inline-flex;
  gap: 1px;
  color: #fff;
  font-size: 12px;
  letter-spacing: 0;
}
/* One flap per digit: a dark card with a hairline across the middle. */
.hb-clock i {
  display: inline-block;
  min-width: 0.95em;
  padding: 4px 1px;
  border-radius: 3px;
  background: linear-gradient(#222 0 calc(50% - 0.5px), #000 0 calc(50% + 0.5px), #2a2a2a 0);
  font-style: normal;
  text-align: center;
}
.hb-clock i.sep {
  min-width: 0.45em;
  padding: 4px 0;
  background: none;
  color: #777;
}
.hb-clock i.flip {
  animation: hb-flip 320ms var(--ease);
}
@keyframes hb-flip {
  0% {
    transform: perspective(60px) rotateX(-80deg);
  }
  100% {
    transform: none;
  }
}
.hb-window {
  width: 300px;
  height: var(--row);
  overflow: hidden;
}
.hb-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.hb-rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--row);
  white-space: nowrap;
  transform-origin: 50% 0;
}
.hb-name {
  min-width: 0;
  overflow: hidden;
  font: 700 14px/1.2 var(--font);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}
.hb-io {
  flex: none;
  padding: 2px 6px;
  border: 1px solid #fff;
  border-radius: 4px;
  background: #fff;
  color: #000;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}
.hb-io.is-out {
  background: transparent;
  color: #fff;
}
.hb-meta {
  min-width: 0;
  overflow: hidden;
  color: #8f8f8f;
  font-size: 11px;
  text-overflow: ellipsis;
}
.hb-time {
  flex: none;
  margin-left: auto;
  color: #e9e9e9;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
/* The newest row lands like a flap falling into place. */
.hb-rows li.is-new {
  animation: hb-row-in 640ms var(--ease) both;
}
@keyframes hb-row-in {
  0% {
    opacity: 0;
    transform: perspective(300px) rotateX(-70deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
.hero-board.is-hit .hb-lamp {
  box-shadow: 0 0 0 4px rgb(61 220 111 / 0.25);
}

@media (max-width: 1100px) {
  .hb-window {
    width: 250px;
  }
  .hb-meta {
    display: none;
  }
}
@media (max-width: 860px) {
  .hero-bg {
    --ox: 0.88;
    --oy: 0.62;
  }
  .hero-stage {
    translate: none;
  }
  .hero-board {
    --row: 40px;
    top: 12px;
    right: 12px;
    left: 12px;
    gap: 10px;
    padding: 0 14px 0 12px;
    translate: none;
  }
  .hb-head {
    gap: 7px;
    padding-right: 10px;
  }
  .hb-title {
    display: none;
  }
  .hb-clock {
    font-size: 11px;
  }
  .hb-window {
    flex: 1;
    width: auto;
    min-width: 0;
  }
  .hb-name {
    font-size: 13px;
  }
}

/* Count-up numbers keep their width while they run. */
[data-countup] {
  font-variant-numeric: tabular-nums;
}

/* Reveals: a little softer and longer, and grids arrive item by item. */
.js [data-reveal] {
  transform: translate3d(0, 30px, 0);
  transition:
    opacity 900ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
}
.js [data-reveal].is-in {
  transform: none;
}
.js .spec[data-reveal] > div,
.js .trust-row[data-reveal] > p {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}
.js .spec[data-reveal].is-in > div,
.js .trust-row[data-reveal].is-in > p {
  opacity: 1;
  transform: none;
}
.js .spec[data-reveal] > div:nth-child(2),
.js .trust-row[data-reveal] > p:nth-child(2) { transition-delay: 60ms; }
.js .spec[data-reveal] > div:nth-child(3),
.js .trust-row[data-reveal] > p:nth-child(3) { transition-delay: 120ms; }
.js .spec[data-reveal] > div:nth-child(4),
.js .trust-row[data-reveal] > p:nth-child(4) { transition-delay: 180ms; }
.js .spec[data-reveal] > div:nth-child(5) { transition-delay: 240ms; }
.js .spec[data-reveal] > div:nth-child(6) { transition-delay: 300ms; }
.js .spec[data-reveal] > div:nth-child(7) { transition-delay: 360ms; }
.js .spec[data-reveal] > div:nth-child(8) { transition-delay: 420ms; }
.js .spec[data-reveal] > div:nth-child(n + 9) { transition-delay: 480ms; }
.js .spec[data-reveal] {
  transform: none;
}

/* Setup steps: the numbers fill in one after another as the steps arrive. */
.js .steps-row li::before {
  transition:
    background-color 500ms var(--ease),
    border-color 500ms var(--ease),
    color 500ms var(--ease),
    transform 500ms var(--ease);
  transition-delay: 350ms;
}
.js .steps-row li.is-in::before {
  border-color: #0a0a0a;
  background: #0a0a0a;
  color: #fff;
  animation: step-pop 560ms var(--ease) 350ms both;
}
@keyframes step-pop {
  50% {
    transform: scale(1.18);
  }
}

/* The recording tilts up into place as it scrolls in (browsers with scroll timelines). */
@supports (animation-timeline: view()) {
  .watch .frame-browser {
    transform-origin: 50% 100%;
    animation: watch-tilt linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 42%;
  }
  @keyframes watch-tilt {
    from {
      transform: perspective(1800px) rotateX(16deg) scale(0.93);
    }
    to {
      transform: none;
    }
  }
}

/* Tour: panels cross-fade, and the playing tab shows how far its recording has got. */
.tour-panel:not([hidden]) {
  animation: tour-in 520ms var(--ease) both;
}
@keyframes tour-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}
.tour-tab {
  position: relative;
  overflow: hidden;
}
.tour-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #0a0a0a;
  opacity: 0;
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  pointer-events: none;
}
.tour-tab[aria-selected='true'] .tour-bar {
  opacity: 1;
}

/* The closing map drifts like the hero. */
.closing-art {
  overflow: hidden;
  border-radius: 14px;
}
.closing-art.is-in img {
  transform-origin: 60% 50%;
  animation: drift 30s ease-in-out infinite alternate;
}

/* Videos wait for their poster without a white flash. */
.frame-screen video:not([poster]),
.phone-screen video:not([poster]),
.story-screen video:not([poster]) {
  background: #eceae4;
}

@media (prefers-reduced-motion: reduce) {
  .hero-stage,
  .hero-board,
  .hb-lamp::after,
  .hb-clock i.flip,
  .hb-rows li.is-new,
  .fx-led-glow,
  .tour-panel:not([hidden]),
  .closing-art.is-in img,
  .watch .frame-browser {
    animation: none !important;
  }
  .hero-stage,
  .hero-board {
    translate: none;
  }
  .hero-fx .fx-trail,
  .hero-fx .fx-dot,
  .hero-fx .fx-ring,
  .hero-fx .fx-glow,
  .hero-fx .fx-screen {
    display: none;
  }
  .js .spec[data-reveal] > div,
  .js .trust-row[data-reveal] > p,
  .js .steps-row li::before {
    opacity: 1;
    transform: none !important;
    transition: none;
    animation: none !important;
  }
  .tour-bar {
    display: none;
  }
}
