/* ==========================================================================
   Home page layout (1728 x 1117 Figma frame)

   - 1024px and up : pixel-faithful replica of the Figma frame. Every length is a
                     design pixel multiplied by --u (viewport width / 1728).
   - below 1024px  : reflowed single column using the same components.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
.page {
  position: relative;
  overflow: clip;
  background: var(--black);
  container-type: inline-size;
}

/* Registered so --u is resolved once, against .page - not re-resolved against the
   nearer .brand/.app containers where it is used. */
@property --u {
  syntax: "<length>";
  inherits: true;
  initial-value: 0.5787px;
}

.stage {
  --u: calc(100vw / 1728);           /* fallback */
  position: relative;
}
@supports (width: 1cqw) {
  .stage { --u: calc(100cqw / 1728); }
}

.sky, .fade, .earth__img { position: absolute; pointer-events: none; user-select: none; }
.sky { will-change: translate; }
.bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .75; object-fit: cover; }
.fade { width: 100%; object-fit: fill; }
.earth__img { object-fit: cover; }

/* --------------------------------------------------------------------------
   Apps
   -------------------------------------------------------------------------- */
.app {
  container-type: inline-size;
  display: grid;
  justify-items: center;
  align-content: start;
}
.app .mark { width: 41.21cqw; --blur: 2.64cqw; }
.app__name {
  width: 100%;
  margin-top: 0;
  text-align: center;
  font-weight: 274;
  letter-spacing: -.5277cqw;
  font-size: 21.11cqw;
  line-height: 1.2;
  white-space: nowrap;
}
.app__name--hidden {
  height: auto;
  overflow: visible;
  fill: #fff;
  font-family: var(--font);
  font-weight: 274;
  font-size: 32px;          /* viewBox units */
  letter-spacing: -1px;
}

.uturn { display: inline-block; width: .708em; height: 1em; vertical-align: -.2em; margin-left: .12em; overflow: visible; }

/* --------------------------------------------------------------------------
   Scroll cue
   -------------------------------------------------------------------------- */
.cue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3em;
  color: var(--cue);
  font-weight: 110;
  line-height: 1;
  white-space: nowrap;
}
.cue__arrow { width: .7em; height: .8em; flex: none; }

/* ==========================================================================
   < 1024px - reflowed layout
   ========================================================================== */
.stage {
  --pad: clamp(22px, 6vw, 64px);
  --earth-h: clamp(640px, 118vw, 1000px);
  display: flow-root;
}

.sky { left: calc(50% - max(50%, 550px)); top: 0; width: max(100%, 1100px); height: 100%; --ss: 22px; --sky-shift: 60px; }
.fade {
  left: 0; right: 0;
  bottom: calc(var(--earth-h) - 2px);
  height: clamp(90px, 14vw, 168px);
}
.earth__img {
  left: 0; bottom: 0;
  width: 100%; height: var(--earth-h);
  object-position: 74% 100%;
}

.content { position: relative; }

.hero {
  display: grid;
  justify-items: center;
  gap: clamp(36px, 7vw, 64px);
  padding: calc(env(safe-area-inset-top, 0px) + clamp(44px, 9vw, 88px)) var(--pad) clamp(56px, 10vw, 96px);
}

.brand { width: min(74vw, 380px); }

.showcase {
  width: min(100%, 760px);
  display: grid;
  gap: clamp(36px, 7vw, 56px);
}

.intro { display: grid; gap: clamp(14px, 3vw, 22px); }
.intro__title {
  font-size: clamp(27px, 6.6vw, 40px);
  font-weight: 590;
  line-height: 1.18;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.intro__copy {
  font-size: clamp(17px, 4.3vw, 24px);
  line-height: 1.75;
  max-width: 34em;
  color: rgb(255 255 255 / .95);
}

.apps {
  display: grid;
  width: min(100%, 570px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  row-gap: clamp(10px, 2vw, 16px);
}
.apps__title {
  grid-column: 1 / -1;
  font-size: clamp(27px, 6.6vw, 40px);
  font-weight: 590;
  line-height: 1.18;
}
.apps__soon {
  grid-column: 2 / -1;
  text-align: center;
  color: var(--muted);
  font-size: clamp(14px, 3.4vw, 20px);
  font-weight: 100;
  letter-spacing: .06em;
}
.apps__list { grid-column: 1 / -1; display: grid; grid-template-columns: inherit; gap: 0; }
.app__name--hidden { width: 100%; }

.cue { font-size: clamp(18px, 4.8vw, 30px); }

.earth {
  position: relative;
  height: var(--earth-h);
  padding: clamp(44px, 12vw, 120px) var(--pad) 0;
}
.actions { display: grid; gap: clamp(16px, 3.4vw, 28px); width: min(100%, 440px); margin-inline: auto; }
.btn {
  height: clamp(64px, 15vw, 96px);
  font-size: clamp(22px, 5.4vw, 36px);
}

/* Entrance - settles into the exact Figma composition */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
  }
  @keyframes drift {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(4px); }
  }
  /* Leaves only: glass (marks, buttons) must never sit inside a faded parent. */
  .brand .mark > *, .brand__name, .intro__title, .intro__copy, .apps__title, .apps__soon,
  .app .mark > *, .app__name, .cue, .btn__glass, .btn__label {
    animation: rise 1s var(--ease) backwards;
    animation-delay: var(--d, 0s);
  }
  .brand { --d: .05s; }
  .intro { --d: .22s; }
  .apps  { --d: .34s; }
  .cue   { --d: .5s; }
  .cue__arrow { animation: drift 2.6s ease-in-out 1.6s infinite; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .btn__glass { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .mark__glass, .btn__glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ==========================================================================
   ≥ 1024px - pixel-faithful Figma frame (1 design px = var(--u))
   ========================================================================== */
@media (min-width: 1024px) {
  .stage { display: block; height: calc(2507 * var(--u)); }

  .sky {
    left: calc(-1295 * var(--u)); top: 0;
    width: calc(4308 * var(--u)); height: calc(2415 * var(--u));
    --ss: calc(30 * var(--u));
    --sky-shift: calc(110 * var(--u));
  }
  .fade {
    left: 0; right: auto; bottom: auto;
    top: calc(982 * var(--u));
    width: 100%; height: calc(168 * var(--u));
  }
  .earth__img {
    left: calc(-456 * var(--u)); bottom: auto;
    top: calc(1145 * var(--u));
    width: calc(2421 * var(--u)); height: calc(1362 * var(--u));
    object-position: 50% 50%;
  }

  .content { position: absolute; inset: 0; }
  .hero, .earth { position: absolute; left: 0; width: 100%; padding: 0; display: block; }
  .hero { top: 0; height: calc(1117 * var(--u)); }
  .earth { top: 0; height: calc(2507 * var(--u)); pointer-events: none; }
  .earth .btn { pointer-events: auto; }

  /* helper: place a box in design pixels */
  .brand, .intro__title, .intro__copy, .apps__title, .apps__soon, .app, .cue, .btn {
    position: absolute;
    left: calc(var(--x) * var(--u));
    top: calc(var(--y) * var(--u));
    width: calc(var(--w) * var(--u));
    height: calc(var(--h) * var(--u));
  }
  .showcase, .intro, .apps, .apps__list, .actions { display: contents; }

  /* Unyte logo */
  .brand { --x: 627; --y: 65; --w: 473.05; --h: 350.71; display: block; }
  .brand .mark { position: absolute; left: 50%; top: 0; translate: -50% 0; }
  .brand__name {
    position: absolute; left: 0; right: 0;
    top: calc(226.74 * var(--u)); height: calc(123.97 * var(--u));
    display: flex; align-items: center; justify-content: center;
    font-size: calc(96 * var(--u));
    letter-spacing: calc(-1 * var(--u));
    line-height: calc(18 * var(--u));
  }

  /* Headline + copy */
  .intro__title, .apps__title {
    display: flex; align-items: center;
    font-size: calc(48 * var(--u));
    line-height: calc(18 * var(--u));
    letter-spacing: 0;
    text-wrap: nowrap;
  }
  .intro__title { --x: 144; --y: 489; --w: 705; --h: 100; justify-content: center; }
  .apps__title  { --x: 879; --y: 489; --w: 705; --h: 100; justify-content: flex-start; }
  .apps__title .uturn { margin-left: calc(12 * var(--u)); width: calc(33 * var(--u)); height: calc(46 * var(--u)); vertical-align: baseline; }
  .intro__copy {
    --x: 165; --y: 589; --w: 663; --h: 254;
    font-size: calc(32 * var(--u));
    line-height: calc(60 * var(--u));
    max-width: none;
    color: var(--white);
  }
  .apps__soon {
    --x: 1189; --y: 561; --w: 218; --h: 28;
    display: flex; align-items: center; justify-content: center;
    font-size: calc(32 * var(--u));
    line-height: calc(18 * var(--u));
    letter-spacing: calc(2 * var(--u));
    font-weight: 110;
  }

  /* App icons */
  .app { --y: 597; --w: 189.489; --h: 140.483; display: block; }
  .app--a { --x: 870; }
  .app--b { --x: 1088; }
  .app--c { --x: 1306; }
  .app .mark { position: absolute; left: 50%; top: 0; translate: -50% 0; }
  .app__name {
    position: absolute; left: 0;
    top: calc(90.82 * var(--u)); height: calc(49.66 * var(--u));
    display: flex; align-items: center; justify-content: center;
    line-height: calc(18 * var(--u));
  }
  .app__name--hidden { display: block; }
  .app--c .app__name { top: calc(89 * var(--u)); }

  /* Scroll cue */
  .cue {
    --x: 586; --y: 917; --w: 556; --h: 41;
    font-size: calc(40 * var(--u));
    line-height: calc(18 * var(--u));
    gap: calc(12 * var(--u));
  }
  .cue__arrow { width: calc(28 * var(--u)); height: calc(32 * var(--u)); }

  /* Buttons */
  .btn { --w: 497; --h: 114; --x: 112; border-radius: calc(64 * var(--u)); font-size: calc(40 * var(--u)); }
  .btn--login  { --y: 1399; }
  .btn--signup { --y: 1556; }
  .btn__label { transform: translateX(calc(-11 * var(--u))); }
  .btn__glass { -webkit-backdrop-filter: blur(calc(6 * var(--u))) saturate(1.5) brightness(1.08); backdrop-filter: blur(calc(6 * var(--u))) saturate(1.5) brightness(1.08); }

  @media (prefers-reduced-motion: no-preference) {
    /* Desktop: pure fades, on leaves only (see the note in app.css) */
    .brand .mark > *, .brand__name, .intro__title, .intro__copy, .apps__title, .apps__soon,
  .app .mark > *, .app__name, .cue, .btn__glass, .btn__label { animation: fade 1.1s var(--ease) backwards; animation-delay: var(--d, 0s); }
    .btn { --d: .6s; }
    .btn--signup { --d: .72s; }
    .brand { --d: .05s; }
    .intro__title, .intro__copy { --d: .22s; }
    .apps__title, .apps__soon, .app { --d: .34s; }
    .cue { --d: .5s; }
    @keyframes fade { from { opacity: 0; } }
  }
}


/* ==========================================================================
   Life in the sky: twinkling stars that wake up near the cursor, a faint constellation that
   draws itself between them, and a slow depth drift while scrolling. Everything here is
   transform or opacity only, so it stays on the compositor.
   ========================================================================== */
.spark {
  position: absolute;
  width: var(--ss, 22px);
  height: var(--ss, 22px);
  translate: -50% -50%;
  scale: calc(.85 + var(--k, 0) * .9);
  pointer-events: none;
}
.spark::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 6%, rgb(255 255 255 / .95) 50%, transparent 94%) center / 100% 1.5px no-repeat,
    linear-gradient(0deg,  transparent 6%, rgb(255 255 255 / .95) 50%, transparent 94%) center / 1.5px 100% no-repeat,
    radial-gradient(circle, #fff 0 7%, transparent 24%);
  opacity: .3;
}
.spark::after {
  content: "";
  position: absolute;
  inset: -70%;
  background: radial-gradient(circle, rgb(190 215 255 / .5), transparent 62%);
  opacity: calc(var(--k, 0) * .9);
}
.s1 { left: 38.77%; top: 3.66%;  --tw: 5.2s; --td: -1.1s; }
.s2 { left: 32.03%; top: 6.79%;  --tw: 6.4s; --td: -3.4s; }
.s3 { left: 49.32%; top: 10.98%; --tw: 4.6s; --td: -.4s; }
.s4 { left: 35.35%; top: 25.96%; --tw: 7.1s; --td: -2.2s; }
.s5 { left: 64.26%; top: 5.4%;   --tw: 5.8s; --td: -4.6s; }
.s6 { left: 39.45%; top: 16.9%;  --tw: 6.9s; --td: -1.9s; }
.s7 { left: 40.62%; top: 27.87%; --tw: 5.5s; --td: -3.1s; }
.s8 { left: 46.88%; top: 28.22%; --tw: 6.2s; --td: -.8s; }
.s9 { left: 61.13%; top: 28.4%;  --tw: 4.9s; --td: -2.7s; }

.sky__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sky__lines line {
  stroke: rgb(190 215 255);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  opacity: 0;
}

/* Soft ambient glow behind the hero mark */
.brand { isolation: isolate; }
.brand::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -22%;
  width: 190%;
  aspect-ratio: 1;
  translate: -50% 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgb(0 153 255 / .17), rgb(0 153 255 / .06) 55%, transparent 76%);
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes twinkle { 0%, 100% { opacity: .28; } 50% { opacity: 1; } }
  @keyframes breathe { 0%, 100% { opacity: .75; scale: 1; } 50% { opacity: 1; scale: 1.07; } }
  .spark::before { animation: twinkle var(--tw, 6s) ease-in-out var(--td, 0s) infinite; }
  .brand::before { animation: breathe 9s ease-in-out infinite; }
}

/* Scroll-linked touches where the browser supports scroll-driven animations */
@supports (animation-timeline: scroll()) {
  @keyframes sky-drift { to { transform: translateY(var(--sky-shift, 80px)); } }
  @keyframes cue-out   { to { opacity: 0; } }
  @keyframes btn-in    { from { opacity: 0; translate: 0 38px; } }

  @media (prefers-reduced-motion: no-preference) {
    /* Stars drift slower than the page: depth */
    .sky { animation: sky-drift linear both; animation-timeline: scroll(root); }
    /* "Scroll down" hands over once you have scrolled */
    .cue {
      animation: fade 1.1s var(--ease) var(--d, .5s) backwards, cue-out linear both;
      animation-timeline: auto, scroll(root);
      animation-range: normal, 0 240px;
    }
    /* Buttons rise into place as they come into view */
    .btn__glass, .btn__label {
      animation: btn-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 85%;
    }
  }
}
