/*
  home page styles. Hero and floating scene: Senior Engineer (THR-31).
  Loaded only on that page (BG and EN). Use the tokens and classes from base.css;
  do not override header/footer styles here.
  Animations are only defined inside "no-preference", so the default (and reduced
  motion, and no JS) is the finished, fully visible page. Only transform/opacity move.
*/

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(3rem, 1rem + 9vw, 8rem) var(--section-y); }
.hero__inner { position: relative; display: grid; gap: var(--s-6); justify-items: start; }
.hero__glow {
  position: absolute;
  top: -30%;
  left: 50%;
  width: min(60rem, 140vw);
  aspect-ratio: 1;
  margin-left: calc(min(60rem, 140vw) / -2);
  background: radial-gradient(closest-side, rgba(110, 168, 254, 0.22), rgba(167, 139, 250, 0.1) 55%, transparent 100%);
  pointer-events: none;
}
.hero-mark { width: min(20rem, 70vw); height: auto; overflow: visible; }
.hero-viti { stroke: var(--c-text); }
.hero-dev { stroke: var(--c-accent); }
.hero__title { font-size: var(--fs-3xl); }
.hero__line { display: block; }
.hero__lead { font-size: var(--fs-lg); }

/* ---------- Floating scene (float-scene.js) ----------
   Decoration only (aria-hidden). Each .floater / .spark is placed by CSS; float-scene.js
   moves the outer span (mouse/touch/scroll/tilt parallax and push), CSS gently bobs the
   inner picture. Phones: the objects float in a band under the buttons, plus two peeking
   at the top corner. Desktop: they fill the right side around the headline.
   Checked for no overlap with the text at 360-1920 px (tools: see README). */
.hero__inner { z-index: 1; }
.hero { padding-bottom: calc(var(--section-y) + 15rem); }
.float-scene { position: absolute; inset: 0; pointer-events: none; }
.floater { position: absolute; display: block; will-change: transform; }
.floater img { width: 100%; height: auto; }
.spark { position: absolute; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c-accent); opacity: 0.6; will-change: transform; }
/* Soft light that follows the mouse (shown by float-scene.js on mouse devices only). */
.float-spot {
  position: absolute;
  top: 0;
  left: 0;
  width: 36rem;
  height: 36rem;
  margin: -18rem 0 0 -18rem;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(143, 188, 255, 0.16), rgba(167, 139, 250, 0.06) 60%, transparent);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  will-change: transform;
}
.float-scene.is-pointer .float-spot { opacity: 1; }

/* Starry sky: two layers of the same star tile, the second one twinkles (motion block below). */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/space/starfield.svg") 0 0 / 30rem 30rem;
  opacity: 0.55;
  pointer-events: none;
}
.hero { isolation: isolate; }
.hero::before, .hero::after { z-index: -2; } /* behind the Earth photo (z-index -1) */
.hero::after { background-position: 13rem 9rem; background-size: 22rem 22rem; opacity: 0.35; }
.spark { width: 0.1875rem; height: 0.1875rem; background: #fff; opacity: 0.8; box-shadow: 0 0 0.375rem 0.1rem rgba(185, 212, 255, 0.5); }

/* Real NASA photos (public domain): Earth at night from the ISS (iss039e009160) along the
   bottom, Saturn from Cassini (PIA05389) and the Moon (GSFC) floating on the right.
   Saturn and the Moon have the black sky made transparent (alpha baked into the WebP). */
.hero__earth {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 80%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 80%, transparent);
}
.hero__earth img { width: 100%; height: 100%; object-fit: cover; }

/* Phones (from 360 px): the Earth's horizon in the band under the buttons, Saturn above it. */
.hero__earth { height: 12rem; }
.hero__earth img { object-position: 30% 12%; }
.floater--saturn { width: 13rem; bottom: 8.5rem; right: -2.5rem; }
.floater--moon { width: 3rem; bottom: 10.5rem; left: 10%; }
.spark--1 { top: 1.5rem; left: 55%; }
.spark--2 { bottom: 13.5rem; left: 40%; }
.spark--3 { top: 6rem; right: 6%; }
.spark--4 { bottom: 10rem; left: 30%; }

/* Tablets (from 768 px): a wider band. */
@media (min-width: 48rem) {
  .hero { padding-bottom: calc(var(--section-y) + 12rem); }
  .hero__earth { height: 15rem; }
  .hero__earth img { object-position: 50% 10%; }
  .floater--saturn { width: 15rem; bottom: 10.5rem; right: 3%; }
  .floater--moon { width: 3.5rem; bottom: 11.5rem; left: 46%; }
  .spark--2 { bottom: 12rem; }
}

/* Desktop (from 1024 px): text on the left, Saturn and the Moon on the right,
   the Earth's horizon curving under everything. From 1440 px the scene lines up with the
   content column, so every wide screen gets the same composition. */
@media (min-width: 64rem) {
  .hero { padding-bottom: calc(var(--section-y) + 11rem); min-height: 50rem; }
  .hero__lead { max-width: 34rem; }
  .hero__title { font-size: min(var(--fs-3xl), 5.2vw, 4.7rem); } /* keep the right side free for the objects */
  .hero__earth { height: clamp(20rem, 24vw, 28rem); }
  .hero__earth img { object-position: 50% 18%; }
  .float-scene { inset-inline: max(0px, (100% - var(--container)) / 2 - var(--gutter)); }
  .floater--saturn { width: 27rem; top: 6%; bottom: auto; right: -6rem; }
  .floater--moon { width: 5rem; top: 47%; bottom: auto; left: auto; right: 6%; }
  .spark--1 { top: 18%; left: 64%; }
  .spark--2 { top: 62%; bottom: auto; left: 72%; }
  .spark--3 { top: 4%; right: auto; left: 56%; }
  .spark--4 { top: 40%; bottom: auto; left: 80%; }
}

/* ---------- Sections ---------- */
.home-more { margin-top: var(--s-6); }
.home-cta {
  display: grid;
  gap: var(--s-5);
  justify-items: start;
  padding: clamp(1.5rem, 1rem + 3vw, 4rem);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(110, 168, 254, 0.14), rgba(167, 139, 250, 0.08)), var(--c-bg-raised);
}
.home-cta .call-btn { min-height: 4rem; padding-inline: var(--s-6); font-size: var(--fs-md); }
.home-cta .call-btn__number { font-size: var(--fs-base); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Short intro: the headline is fully in by ~1 s and the buttons by ~1.2 s (fast LCP);
     the wordmark keeps drawing alongside. */
  .hero-viti, .hero-dev { stroke-dasharray: 1; stroke-dashoffset: 1; animation: hero-draw 1.2s var(--ease-out) forwards; }
  .hero-dev { animation-delay: 0.35s; }
  .hero__line, .hero__lead, .hero__actions { opacity: 0; transform: translateY(1rem); animation: hero-in 0.6s var(--ease-out) forwards; }
  .hero__line:nth-child(1) { animation-delay: 0.15s; }
  .hero__line:nth-child(2) { animation-delay: 0.25s; }
  .hero__line:nth-child(3) { animation-delay: 0.35s; }
  .hero__lead { animation-delay: 0.45s; }
  .hero__actions { animation-delay: 0.55s; }
  .hero__glow { animation: hero-glow 14s ease-in-out infinite alternate; }
  /* Slow and calm: the photos only drift a little, the Earth breathes, the stars twinkle. */
  .floater img { animation: fade-in 2s var(--ease-out) both, drift var(--bob, 12s) ease-in-out infinite alternate; }
  .floater--saturn img { --bob: 14s; animation-delay: 0.3s, -4s; }
  .floater--moon img { --bob: 10s; animation-delay: 0.6s, -2s; }
  .hero__earth img { animation: fade-in 2.4s var(--ease-out) both, earth 40s ease-in-out infinite alternate; }
  .spark { animation: twinkle 3.2s ease-in-out infinite alternate; }
  .spark--2 { animation-delay: -1.1s; }
  .spark--3 { animation-delay: -2.3s; animation-duration: 4.1s; }
  .spark--4 { animation-delay: -0.6s; animation-duration: 2.7s; }
  .hero::after { animation: twinkle 5s ease-in-out infinite alternate; }
}
@keyframes hero-draw { to { stroke-dashoffset: 0; } }
@keyframes hero-in { to { opacity: 1; transform: none; } }
@keyframes hero-glow {
  from { opacity: 0.6; transform: translate3d(-6%, 0, 0) scale(1); }
  to { opacity: 1; transform: translate3d(6%, 4%, 0) scale(1.12); }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes drift {
  from { translate: 0 -0.35rem; }
  to { translate: 0 0.35rem; }
}
@keyframes earth {
  from { transform: scale(1); }
  to { transform: scale(1.06) translateY(-1%); }
}
@keyframes twinkle {
  from { opacity: 0.25; }
  to { opacity: 1; }
}
