html {
  scrollbar-gutter: stable;
}

html:has([data-flight-state="orbital"]) {
  background: #030912;
}

main[data-flight-state] {
  --world-width: max(100vw, calc(100dvh * 16 / 9));
  --orbit-fill: #030912;
}

html[data-flight-locked] {
  overflow: hidden;
  overscroll-behavior: none;
}

/* All coordinates are relative to the width of the 1024 × 1536 master. */
.facility {
  --deck: calc(var(--world-width) * .6015625);
  --depth: calc(var(--world-width) * 1.5);
  --flight-centre: calc(var(--world-width) * 1.203125);
  position: relative;
  isolation: isolate;
  overflow: clip;
  background: #111e2c;
}

.facility-art, .scene {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--world-width);
  translate: -50% 0;
}

.facility-art {
  display: block;
  height: auto;
  pointer-events: none;
}

.launch {
  --launch-height: var(--deck);
  position: relative;
  block-size: var(--deck);
}

.scene { height: 100%; }

.scene .hatch {
  left: 50.1%;
  top: calc(var(--world-width) * .375);
}

.launch-brief {
  position: relative;
  block-size: calc(var(--depth) - var(--deck));
}

.flight-position, .brief-copy {
  position: absolute;
  top: calc(var(--flight-centre) - var(--deck));
  left: 50%;
}

.flight-position {
  width: 0;
  height: 100dvh;
  pointer-events: none;
}

.brief-copy {
  scroll-margin-block-start: max(18px, calc(50dvh - 10rem));
  z-index: 1;
  width: min(calc(100% - 2rem), 52rem);
  padding: clamp(8px, 2vw, 30px);
  translate: -50% -50%;
  text-align: center;
  text-shadow: 0 2px 14px #020810, 0 4px 24px #020810;
  transition: opacity 220ms ease;
}

.brief-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -10% -4%;
  background: radial-gradient(ellipse at center, #030b15ed 12%, #030b15cf 46%, #030b1500 73%);
  pointer-events: none;
}

.brief-copy h2 {
  margin: .27em auto;
  font: 700 clamp(2.6rem, 5.4vw, 5.6rem)/.94 var(--display);
  letter-spacing: -.025em;
  text-wrap: balance;
}

.brief-accent {
  display: block;
  color: var(--cyan);
}

.brief-copy p {
  max-width: 54ch;
  margin: 0 auto;
  color: #e0edf4;
  font-size: clamp(.97rem, 1.4vw, 1.16rem);
  line-height: 1.6;
}

.launch-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-top: clamp(22px, 4vh, 39px);
  padding: 11px 19px 11px 12px;
  border: 1px solid #84e9fcaa;
  border-radius: 6px;
  background: linear-gradient(120deg, #163e51, #081724 79%);
  color: var(--ice);
  box-shadow: 0 0 20px #54cbf32b, inset 0 0 16px #82dfff18;
  font-weight: 700;
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.launch-button:is(:hover,:focus-visible), .return-link:is(:hover,:focus-visible) {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 26px #5ee4ff4d;
}

.pointer-motion :is(.launch-button,.return-link) {
  box-shadow: 0 0 calc(14px + 20px * var(--motion-power,0))
    rgb(102 222 255 / calc(.19 + .28 * var(--motion-power,0)));
}

.launch-signal {
  display: grid;
  place-items: center;
  flex: 0 0 1.7rem;
  aspect-ratio: 1;
  border: 1px solid #73e4fe71;
  border-radius: 50%;
  color: var(--cyan);
  animation: launch-signal 3s ease-in-out infinite;
}

@keyframes launch-signal {
  50% { box-shadow: 0 0 14px #4fdbf5a0; }
}

:is([data-flight-state="settling"], [data-flight-state="launching"], [data-flight-state="recovering"]) .brief-copy {
  opacity: 0;
}

[data-flight-state="launching"] .launch-signal { animation-play-state: paused; }

.launch-film, .cinema-scene {
  position: fixed;
  inset: 0 0 auto;
  height: 100dvh;
}

.launch-film {
  z-index: 20;
  touch-action: none;
  overscroll-behavior: none;
}

.cinema-scene {
  overflow: hidden;
  pointer-events: none;
}

.cinema-plate {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--world-width);
  height: auto;
  aspect-ratio: 16 / 9;
  translate: -50% -50%;
}

.launch-film .cinema-plate { opacity: 0; }
.launch-film[data-playing] .cinema-plate { opacity: 1; }

.film-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.orbit {
  isolation: isolate;
  min-height: 100dvh;
  overflow: clip;
  background: #030912;
}

.orbit-scene {
  position: fixed;
  z-index: -1;
  background: var(--orbit-fill);
}

.orbit-content {
  position: relative;
  width: min(100% - 2 * clamp(21px, 7vw, 118px), 1240px);
  margin: 0 auto;
  padding: clamp(24px, 5.5vh, 60px) 0 28px;
}

.return-link {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #6fb8cf76;
  border-radius: 6px;
  background: #081320e8;
  color: #e6f7fc;
  font-size: .88rem;
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.return-link > span:first-child { color: var(--cyan); }

.orbit h2 {
  width: fit-content;
  max-width: 100%;
  margin: clamp(36px, 8vh, 86px) 0 clamp(24px, 4vw, 50px);
  font: 700 clamp(3.6rem, 8vw, 8.5rem)/.87 var(--display);
  letter-spacing: -.025em;
  text-wrap: balance;
}

.orbit .projects { gap: clamp(12px, 2vw, 26px); }

.orbit .project {
  border-color: #6095aa8f;
  border-radius: 9px;
  background: linear-gradient(140deg, #122d3de8, #07131fee 70%);
  box-shadow: 0 15px 36px #000b, 0 0 20px #459dbd21, inset 0 0 0 1px #acc8e01a;
}

.orbit .project-copy i { font-family: system-ui, sans-serif; }

.orbit a.project:is(:hover,:focus-visible) {
  border-color: var(--cyan);
  box-shadow: 0 14px 38px #000d, 0 0 28px #62caf63d;
}

.orbit[data-reveal] .orbit-content > :is(.return-link, h2, footer),
.orbit[data-reveal] .project {
  animation: orbital-arrival 540ms cubic-bezier(.18,.74,.24,1) backwards;
}

.orbit[data-reveal] .project { animation-delay: calc(90ms + var(--reveal-index,0) * 64ms); }
.orbit[data-reveal] .orbit-content > footer { animation-delay: 400ms; }

@keyframes orbital-arrival {
  from { opacity: 0; translate: 0 16px; scale: .965; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

.orbit[data-reveal="recovery"] .orbit-scene {
  animation: orbit-recovery 360ms ease-out backwards;
}

@keyframes orbit-recovery {
  from { opacity: .15; }
  to { opacity: 1; }
}

@media (max-width: 760px) and (orientation: portrait) {
  .brief-copy { width: min(calc(100% - 2rem), 31rem); }
  .brief-copy::before { inset: -18% -27%; }
  .orbit h2 { font-size: clamp(3.2rem, 13vw, 5.9rem); }
}

@media (max-height: 480px) and (orientation: landscape) {
  .brief-copy { padding-block: 4px; }
  .brief-copy h2 { font-size: clamp(1.85rem, 8.2vh, 3.65rem); }
  .brief-copy p { line-height: 1.35; font-size: .93rem; }
  .launch-button { margin-top: 12px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .orbit a.project:is(:hover,:focus-visible,:active) { transform: none; }
}
