:root {
  --slate: #30343d;
  --teal: #06bfc7;
  --coral: #ea6854;
  --amber: #f6b04a;
  --magenta: #b8338f;
  --wood: #d9b27a;
  --ink: #f5f6f8;
  --muted: #9aa6b4;
  --display: "Manrope", system-ui, sans-serif;
  --body: "Mulish", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--slate);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.rail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 60;
}

.rail__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  transition: width 0.08s linear;
}

.hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  font: 700 12px/1 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s;
}

.hint span {
  display: inline-block;
  animation: nudge 1.6s ease-in-out infinite;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

.track {
  position: relative;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.strip {
  display: flex;
  height: 100%;
  width: max-content;
  will-change: transform;
}

.frame {
  position: relative;
  height: 100vh;
  flex: 0 0 100vw;
  width: 100vw;
  display: flex;
  align-items: center;
}

.frame--flight {
  flex-basis: 380vw;
  width: 380vw;
}

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14vh;
  height: 3px;
  background: var(--ink);
  opacity: 0.85;
  border-radius: 2px;
  z-index: 1;
  transition: opacity 0.4s;
}

.stage.in-space .floor {
  opacity: 0;
}

.copy {
  position: absolute;
  left: 7vw;
  top: 15vh;
  max-width: 28ch;
  z-index: 8;
}

.eyebrow {
  font: 700 13px/1 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin: 0 0 14px;
}

.eyebrow::before {
  content: "";
  width: 34px;
  height: 2px;
  background: var(--coral);
}

.copy h2 {
  font: 800 clamp(40px, 6.5vw, 84px) / 0.95 var(--display);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.copy p {
  font: 400 clamp(15px, 1.2vw, 18px) / 1.55 var(--body);
  color: var(--muted);
  margin: 0;
  max-width: 32ch;
}

.composite {
  position: absolute;
  bottom: 14vh;
  right: 8vw;
  height: 54vh;
  z-index: 5;
}

.cen {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.composite svg.solo {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* ===== Build frame tuning ================================================
   Inspector: select  section.frame.frame--build
   Rocket + cogs share .build-stage (scale together via %).
   Crane + wire use viewport units — tune as a set. */
/* Layout numbers live in config/build-layout.json (injected on .frame--build). */
.frame--build {
  --build-body-h: 45vh;
  --build-floor-lift: 2.8vh;
  --build-stage-extra: 0.42;
  --build-stage-x: 0vw;
  --build-rocket-x: 0px;
  --build-rocket-y: 0px;
  --build-nose-start: calc(var(--build-body-h) * -0.22);
  --build-nose-overlap: 0.15vh;
  --build-nose-t0: 0;
  --build-nose-t1: 0.85;
  --build-cog-x: 52%;
  --build-cog-y: 13.05vh;
  --build-cog-size: 8.25vh;
  --build-crane-right: 28vw;
  --build-crane-bottom: 14vh;
  --build-crane-h: 72vh;
  --build-wire-width: 10px;
  --build-wire-left: 56vw;
  --build-wire-top: 16vh;
  --build-wire-height: 11vh;
}

/* Shared stage — rocket + cogs move as one when resized */
.build-stage {
  position: absolute;
  left: calc(50% + var(--build-stage-x, 0vw));
  bottom: calc(14vh + var(--build-floor-lift, 0));
  transform: translateX(-50%);
  width: calc(var(--build-body-h) * var(--build-body-ar, 0.78) * 2.4);
  height: calc(var(--build-body-h) * (1 + var(--build-stage-extra, 0.42)));
  z-index: 5;
  pointer-events: none;
}

.build-rocket {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(calc(-50% + var(--build-rocket-x, 0px)), var(--build-rocket-y, 0px));
  z-index: 1;
}

.build-rocket__stack {
  position: relative;
}

.build-rocket__body {
  height: var(--build-body-h, 45vh);
  width: calc(var(--build-body-h, 45vh) * var(--build-body-ar, 0.78));
}

.build-rocket__body svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.build-rocket__nose-mount {
  position: absolute;
  left: 50%;
  bottom: calc(100% - var(--build-nose-overlap, 0.15vh));
  transform: translateX(-50%);
  width: calc(var(--build-body-h, 45vh) * var(--build-nose-ratio, 0.195) * var(--build-nose-ar, 1.64));
  height: calc(var(--build-body-h, 45vh) * var(--build-nose-ratio, 0.195));
  z-index: 2;
}

.build-rocket__nose {
  width: 100%;
  height: 100%;
  --fx: 0px;
  --tx: 0px;
  --fy: var(--build-nose-start);
  --ty: 0px;
  --t0: var(--build-nose-t0, 0);
  --t1: var(--build-nose-t1, 0.85);
}

.build-rocket__nose svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.frame--build .cog-rig {
  --cx: var(--build-cog-x, 54%);
  --cy: var(--build-cog-y, 62%);
  --csize: var(--build-cog-size, 17%);
  z-index: 3;
}

.frame--build .cranerig {
  right: var(--build-crane-right, 28vw);
  bottom: var(--build-crane-bottom, 14vh);
  height: var(--build-crane-h, 72vh);
  left: auto;
}

.frame--build .build-wire {
  position: absolute;
  left: var(--build-wire-left, 56vw);
  top: var(--build-wire-top, 16vh);
  width: var(--build-wire-width, 10px);
  height: var(--build-wire-height, 11vh);
  background: #fff;
  border-radius: 3px;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
}

.lyr {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.el {
  position: absolute;
}

.el svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.anim {
  --a: clamp(
    0,
    calc((var(--fa, 1) - var(--t0, 0)) / (var(--t1, 1) - var(--t0, 0))),
    1
  );
  transform: translate(
      calc(var(--fx, 0px) + (var(--tx, 0px) - var(--fx, 0px)) * var(--a)),
      calc(var(--fy, 0px) + (var(--ty, 0px) - var(--fy, 0px)) * var(--a))
    )
    rotate(calc(var(--fr, 0deg) + (var(--tr, 0deg) - var(--fr, 0deg)) * var(--a)))
    scale(calc(var(--fs, 1) + (var(--ts, 1) - var(--fs, 1)) * var(--a)));
  opacity: calc(var(--fo, 1) + (var(--to, 1) - var(--fo, 1)) * var(--a));
  transform-origin: var(--origin, center);
}

.pulse {
  opacity: clamp(
    0,
    min(calc(var(--a) / var(--in, 0.25)), calc((1 - var(--a)) / var(--out, 0.25))),
    1
  );
}

.fbeats {
  position: absolute;
  left: 50%;
  top: 15vh;
  transform: translateX(-50%);
  width: min(46ch, 82vw);
  text-align: center;
  z-index: 8;
  pointer-events: none;
}

.fbeat {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  opacity: 0;
  will-change: opacity, transform;
}

.fbeat .eyebrow {
  justify-content: center;
  color: var(--amber);
}

.fbeat h3 {
  font: 800 clamp(26px, 3.6vw, 48px) / 1 var(--display);
  margin: 0 0 12px;
  text-transform: uppercase;
}

.fbeat p {
  font: 400 clamp(15px, 1.4vw, 19px) / 1.55 var(--body);
  color: var(--muted);
  margin: 0 auto;
  max-width: 34ch;
}

/* ===== COG RIG (real artwork) ============================================
   Clipped rounded square; large cog CW, two small cogs CCW.
   Optional .gated + data-spin-at pauses until frame progress (Support). */
.cog-rig {
  position: absolute;
  z-index: 6;
  left: var(--cx, 50%);
  bottom: var(--cy, 30vh);
  width: var(--csize, 5vh);
  height: var(--csize, 5vh);
  transform: translateX(-50%);
}

.cog-rig__clip {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 14%;
  background: #191919;
}

.cog-rig__gear {
  position: absolute;
  display: block;
  transform-origin: center center;
  pointer-events: none;
}

.cog-rig__gear--lg {
  width: 94.4%;
  left: -26.2%;
  top: 16.8%;
  animation: cog-cw var(--cog-dur-lg, 12s) linear infinite;
}

.cog-rig__gear--sm {
  width: 61%;
}

.cog-rig__gear--sm1 {
  right: -16%;
  top: -20%;
  animation: cog-ccw var(--cog-dur-sm, 7s) linear infinite;
}

.cog-rig__gear--sm2 {
  right: -23%;
  bottom: -16%;
  animation: cog-ccw var(--cog-dur-sm, 7s) linear infinite;
}

@keyframes cog-cw {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cog-ccw {
  to {
    transform: rotate(-360deg);
  }
}

.cog-rig.gated .cog-rig__gear {
  animation-play-state: paused;
}

.cog-rig.gated.go .cog-rig__gear {
  animation-play-state: running;
}

/* Legacy placeholder cogs — removed; kept empty to avoid stale refs */
.cogbox {
  display: none;
}

.cranerig {
  position: absolute;
  bottom: 14vh;
  right: 4vw;
  height: 72vh;
  z-index: 6;
}

.cranerig .crane-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.guideline {
  position: absolute;
  left: var(--linex, 21%);
  top: var(--linetop, 6%);
  height: calc(var(--linebot, 55%) - var(--linetop, 6%));
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  z-index: 1;
}

.cone {
  position: absolute;
  left: var(--linex, 21%);
  top: var(--conetop, 7%);
  height: var(--coneh, 13%);
  z-index: 2;
}

.cone svg {
  height: 100%;
  width: auto;
  display: block;
  overflow: visible;
}

.slot {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
}

.rk-flight {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  transition: opacity 0.4s;
  animation: bob 3.2s ease-in-out infinite;
}

.rk-flight svg {
  width: 54vh;
  height: auto;
  display: block;
  overflow: visible;
}

@keyframes bob {
  0%,
  100% {
    transform: translate(-50%, calc(-50% - 12px));
  }
  50% {
    transform: translate(-50%, calc(-50% + 12px));
  }
}

.stick {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translateX(-50%);
  width: 11px;
  height: 90vh;
  background: var(--wood);
  border-radius: 6px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.slot.r-flight .rk-flight {
  opacity: 1;
}

.slot.r-flight .stick {
  opacity: 1;
  animation: bobstick 3.2s ease-in-out infinite;
}

@keyframes bobstick {
  0%,
  100% {
    transform: translateX(-50%) translateY(-12px);
  }
  50% {
    transform: translateX(-50%) translateY(12px);
  }
}

.stars {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.planet {
  position: absolute;
  z-index: 2;
}

.hero,
.cta {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 0 8vw;
}

.hero .logo {
  width: min(420px, 60vw);
  height: auto;
}

.cta .logo {
  width: min(300px, 46vw);
  height: auto;
}

.logo {
  overflow: visible;
}

.hero h1 {
  font: 800 clamp(40px, 7vw, 92px) / 0.98 var(--display);
  margin: 0;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.sub {
  color: var(--muted);
  font-size: clamp(16px, 1.5vw, 20px);
  max-width: 46ch;
  margin: 0 auto;
}

.btn {
  display: inline-block;
  margin-top: 6px;
  padding: 14px 28px;
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  font: 800 13px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 6px 0 #c44e3c;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #c44e3c;
}

.m-rk,
.m-beats,
.m-progress {
  display: none;
}

/* ===== Mobile ===== */
@media (max-width: 860px) {
  .track {
    height: auto !important;
  }

  .stage {
    position: static;
    height: auto;
    overflow: visible;
  }

  .strip {
    flex-direction: column;
    width: 100%;
    transform: none !important;
  }

  .frame,
  .frame--flight {
    width: 100%;
    flex: none;
    height: auto;
    min-height: auto;
    padding: 13vh 7vw 10vh;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    border-left: 4px solid var(--accent, var(--teal));
    opacity: 0;
    transform: translateX(-28px);
    transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .frame.in {
    opacity: 1;
    transform: none;
  }

  .frame.in .copy {
    animation: m-copy-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
  }

  .frame.in .m-rk {
    animation: m-rk-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both;
  }

  @keyframes m-copy-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes m-rk-in {
    from {
      opacity: 0;
      transform: translateY(24px) scale(0.94);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes m-float {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-8px);
    }
  }

  .slot,
  .floor,
  .cranerig,
  .build-stage,
  .build-wire,
  .hint,
  .stick,
  .composite,
  .build-rocket,
  .cog-rig,
  .clip,
  .el,
  .fbeats {
    display: none;
  }

  .copy {
    position: static;
    max-width: none;
    margin-bottom: 4vh;
  }

  .planet,
  .stars {
    display: none;
  }

  .m-rk {
    display: block;
    margin: 2vh auto 0;
  }

  .m-rk svg {
    display: block;
    height: auto;
    width: min(62vw, 300px);
  }

  .frame.in .m-rk svg {
    animation: m-float 4s ease-in-out 1.1s infinite;
  }

  .m-rk.wide svg {
    width: min(78vw, 360px);
  }

  .m-rk-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .m-rk-stack svg {
    width: min(62vw, 300px);
    height: auto;
  }

  .hero,
  .cta {
    text-align: center;
    align-items: center;
    border-left: none;
  }

  .hero.in .logo,
  .cta.in .logo {
    animation: m-rk-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  /* Flight beats as stacked cards on mobile */
  .m-beats {
    display: flex;
    flex-direction: column;
    gap: 4vh;
    width: 100%;
    margin-top: 4vh;
  }

  .m-beat {
    padding: 3vh 4vw;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }

  .frame.in .m-beat {
    opacity: 1;
    transform: none;
  }

  .frame.in .m-beat:nth-child(1) {
    transition-delay: 0.1s;
  }
  .frame.in .m-beat:nth-child(2) {
    transition-delay: 0.2s;
  }
  .frame.in .m-beat:nth-child(3) {
    transition-delay: 0.3s;
  }
  .frame.in .m-beat:nth-child(4) {
    transition-delay: 0.4s;
  }

  .m-beat .eyebrow {
    color: var(--amber);
  }

  .m-beat .eyebrow::before {
    display: none;
  }

  .m-beat h3 {
    font: 800 clamp(22px, 5vw, 32px) / 1 var(--display);
    margin: 0 0 10px;
    text-transform: uppercase;
  }

  .m-beat p {
    font: 400 16px/1.55 var(--body);
    color: var(--muted);
    margin: 0;
  }

  /* Step progress rail */
  .m-progress {
    display: flex;
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 8px;
    z-index: 70;
    padding: 10px 6px;
    border-radius: 20px;
    background: rgba(48, 52, 61, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .m-progress__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, background 0.3s ease;
  }

  .m-progress__dot.is-active {
    background: var(--teal);
    transform: scale(1.35);
    box-shadow: 0 0 0 3px rgba(6, 191, 199, 0.25);
  }

  .m-progress__dot.is-done {
    background: var(--coral);
  }

  .hint {
    display: block;
    bottom: auto;
    top: 14px;
    font-size: 10px;
    letter-spacing: 0.2em;
  }

  .rail {
    top: 0;
    bottom: auto;
    height: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rk-flight,
  .slot.r-flight .stick,
  .cog-rig__gear,
  .m-rk svg,
  .hint span {
    animation: none !important;
  }

  .frame {
    opacity: 1;
    transform: none;
  }

  .m-beat {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
