/*
 * SYSTEM VISUALIZATION STORYBOARD
 *
 *  0% -  4%  black edge field reveals the complete aircraft
 *  0% - 12%  left black field holds the complete machine copy
 * 12% - 34%  black field shifts right as one station opens
 * 34% - 71%  black field returns left as all four stations begin
 * 71% - 100% black field shifts right as the full flight turn resolves
 */

body[data-power="22"] .h22-system {
  height: 480dvh;
  background: #020303;
}

.h22-system .hc-core__sticky {
  background: #000;
  transform: translate3d(0, calc(var(--system-release, 0) * -36dvh), 0);
  will-change: transform;
}

.h22-system__poster,
.h22-system video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  background: #000;
}

.h22-system__poster {
  z-index: -4;
  filter: contrast(1.06) saturate(.9);
  transform: translate3d(var(--system-media-x, 14vw), 0, 0);
  transition: opacity 180ms linear, transform 680ms cubic-bezier(.16, 1, .3, 1);
}

.h22-system video {
  z-index: -3;
  opacity: 0;
  filter: contrast(1.06) saturate(.9);
  transform: translate3d(var(--system-media-x, 14vw), 0, 0);
  transition: opacity 180ms linear, transform 680ms cubic-bezier(.16, 1, .3, 1);
  pointer-events: none;
  user-select: none;
}

.h22-system[data-media-state="ready"] video { opacity: 1; }
.h22-system[data-media-state="ready"] .h22-system__poster { opacity: 0; }

.h22-system .hc-core__scrim {
  z-index: 1;
  background:
    linear-gradient(90deg, rgb(0 0 0 / .99) 0 28%, rgb(0 0 0 / .9) 48%, rgb(0 0 0 / .42) 64%, transparent 78%),
    linear-gradient(0deg, rgb(0 0 0 / .82), transparent 46%);
  transition: background 180ms linear;
}

.h22-system[data-system-state="1"] .hc-core__scrim,
.h22-system[data-system-state="3"] .hc-core__scrim {
  background:
    linear-gradient(270deg, rgb(0 0 0 / .99) 0 28%, rgb(0 0 0 / .9) 48%, rgb(0 0 0 / .42) 64%, transparent 78%),
    linear-gradient(180deg, rgb(0 0 0 / .8), transparent 44%);
}

.h22-system__edge {
  position: absolute;
  z-index: 3;
  inset: 0;
  opacity: var(--system-edge, 1);
  background: #000;
  pointer-events: none;
}

.h22-system .hc-core__label {
  z-index: 4;
  top: max(92px, 11vh);
  right: max(22px, 3vw);
  color: rgb(255 255 255 / .54);
}

.h22-system .hc-core__beat {
  z-index: 4;
  right: auto;
  bottom: max(66px, 9vh);
}

.h22-system .hc-core__beat::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -56px -78px;
  background: radial-gradient(ellipse at 20% 78%, rgb(0 0 0 / .96), rgb(0 0 0 / .72) 46%, transparent 74%);
  pointer-events: none;
}

.h22-system .h22-system__beat--trail::before {
  background: radial-gradient(ellipse at 82% 18%, rgb(0 0 0 / .96), rgb(0 0 0 / .72) 46%, transparent 74%);
}

.h22-system .hc-core__beat h2 {
  max-width: 9ch;
  font-size: clamp(58px, 9.2vw, 148px);
}

.h22-system .h22-system__beat--trail {
  inset: max(104px, 13vh) max(34px, calc((100vw - min(1480px, calc(100vw - 72px))) / 2)) auto auto;
  text-align: right;
}

.h22-system .h22-system__beat--trail h2 {
  max-width: 10ch;
  font-size: clamp(52px, 7.5vw, 120px);
}

.h22-system .hc-core__meter i {
  transform: translateX(calc(var(--system-stage, 0) * 100%));
}

.h22-system .hc-core__meter { z-index: 4; }

@media (max-width: 600px) {
  body[data-power="22"] .h22-system { height: 420dvh; }

  .h22-system .hc-core__label {
    top: 82px;
    right: 18px;
    max-width: 24ch;
  }

  .h22-system .hc-core__scrim,
  .h22-system[data-system-state="1"] .hc-core__scrim,
  .h22-system[data-system-state="3"] .hc-core__scrim {
    background:
      linear-gradient(0deg, rgb(0 0 0 / .96), rgb(0 0 0 / .6) 34%, transparent 60%),
      linear-gradient(180deg, rgb(0 0 0 / .54), transparent 34%);
  }

  .h22-system video {
    transform: none;
  }

  .h22-system__poster { transform: none; }

  .h22-system .hc-core__beat,
  .h22-system .h22-system__beat--trail {
    inset: auto 18px max(72px, 10vh);
    text-align: left;
  }

  .h22-system .hc-core__beat h2 {
    max-width: 9ch;
    font-size: 14.6vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-power="22"] .h22-system { height: auto; }
  .h22-system .hc-core__sticky { position: relative; min-height: 100dvh; transform: none; }
  body[data-power] .h22-system video { display: none; }
  .h22-system__edge { display: none; }
  .h22-system__poster { opacity: 1 !important; }
  .h22-system__poster { transform: none; }
  .h22-system .hc-core__beat { display: none; }
  .h22-system .hc-core__beat:first-of-type { display: block; opacity: 1; transform: none; }
}
