/* ==========================================================================
   Vanguard Avionics — hero scene
   The animated Earth sits on the left, the copy on the right. It stands in
   for a background video — see assets/js/globe.js — so nothing here is
   interactive: no drag cursor, no click targets, no HUD. On narrow screens
   it simply moves above the copy.
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: calc(var(--nav-h) + var(--s-6)) var(--s-7);
  overflow: hidden;
  background:
    radial-gradient(110% 90% at 22% 42%, rgba(0, 53, 167, 0.32), transparent 62%),
    radial-gradient(80% 80% at 92% 8%, rgba(0, 22, 116, 0.4), transparent 60%),
    var(--ink-950);
}

/* Two soft, slow-drifting light blobs behind everything else. Very low
   amplitude on purpose — this reads as depth and atmosphere, not as motion
   you consciously notice. */
.hero__aurora {
  position: absolute;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 18% 28%, rgba(61, 116, 240, 0.32), transparent 70%),
    radial-gradient(30% 40% at 82% 78%, rgba(0, 34, 132, 0.4), transparent 72%);
  filter: blur(6px);
  animation: aurora-drift 26s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(2.5%, -3%) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__aurora { animation: none; }
}

/* A radar-style beam that sweeps through, once every cycle, and is gone for
   most of it — an occasional flourish rather than constant motion. */
.hero__sweep {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.hero__sweep::before {
  content: "";
  position: absolute;
  inset-block: -10%;
  inset-inline-start: -18%;
  width: 14%;
  background: linear-gradient(100deg, transparent, rgba(110, 155, 255, 0.1) 45%, rgba(168, 196, 255, 0.16) 50%, rgba(110, 155, 255, 0.1) 55%, transparent);
  transform: translateX(-20%) skewX(-12deg);
  animation: hero-sweep 9s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  animation-delay: 2.5s;
}

@keyframes hero-sweep {
  0%, 18% { transform: translateX(-20%) skewX(-12deg); }
  38%, 100% { transform: translateX(620%) skewX(-12deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__sweep::before { animation: none; display: none; }
}

/* A soft light that follows the cursor across the hero — desktop only (JS
   never sets --sx/--sy on a coarse pointer, so this stays fully transparent
   everywhere else). Independent of the aurora drift: this one tracks input,
   the aurora drifts on its own clock. */
.hero__spotlight {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms var(--ease-out-quart);
  background: radial-gradient(
    440px circle at var(--sx, 50%) var(--sy, 40%),
    rgba(110, 155, 255, 0.09),
    transparent 70%
  );
}

.hero.is-tracking .hero__spotlight {
  opacity: 1;
}

/* Faint instrument grid behind everything. */
.hero__grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: linear-gradient(rgba(110, 155, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 155, 255, 0.045) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(100% 75% at 30% 50%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(100% 75% at 30% 50%, #000 10%, transparent 78%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  display: grid;
  /* The copy sits in the right-hand column. The left column is deliberately
     left empty: the scene is not a grid item any more, it is a full-bleed
     layer behind this one, and the empty column is what keeps the text clear
     of it. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4.5rem);
}

.hero__copy {
  grid-column: 2;
}

/* --------------------------------------------------------------------------
   Stage
   -------------------------------------------------------------------------- */

/* Cinematic framing: the sphere is sized against the viewport, not against a
   column, and is pulled left far enough that roughly a third of it runs off
   the edge of the screen. .hero clips the overflow, so nothing here can
   introduce a horizontal scrollbar. */
.globe {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0;
  width: min(132svh, 78vw);
  aspect-ratio: 1 / 1;
  transform: translate(-33%, -50%);
  pointer-events: none;
}

.globe__stage {
  position: absolute;
  inset: 0;
}

.globe__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Poster shown until WebGL is up, and permanently if it never is — the
   equivalent of a <video>'s poster attribute. */
.globe__poster {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 900ms var(--ease-out-quart);
}

.globe.is-live .globe__poster {
  opacity: 0;
  pointer-events: none;
}

.globe__poster svg {
  width: 82%;
  height: auto;
  opacity: 0.55;
}

/* Soft atmosphere bloom under the sphere. */
.globe__stage::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(0, 53, 167, 0.3), transparent 66%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 0;
}

/* Live indicator dot, reused on the HQ coordinate line below. */
.pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vg-300);
  box-shadow: 0 0 0 0 rgba(110, 155, 255, 0.6);
  animation: pip 2.4s var(--ease-out-quart) infinite;
  flex: none;
}

@keyframes pip {
  0% { box-shadow: 0 0 0 0 rgba(110, 155, 255, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(110, 155, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 155, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .pip { animation: none; }
}

/* --------------------------------------------------------------------------
   Hero copy
   -------------------------------------------------------------------------- */

.hero__copy {
  display: grid;
  gap: var(--s-5);
  max-width: 34rem;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vg-300);
}

.hero__eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--vg-400);
}

.hero__title {
  font-size: var(--t-display);
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: -0.042em;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 0 60px rgba(61, 116, 240, 0.35);
}

/* The second line drops to the brand blue — one word carrying the palette. */
.hero__title em {
  font-style: normal;
  display: block;
  background: linear-gradient(96deg, var(--vg-200) 0%, var(--vg-400) 52%, var(--vg-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Word-by-word entrance. The h1 itself opts out of the generic [data-reveal]
   fade (it stays visible immediately — hero content shouldn't hide behind
   the same slow scroll-reveal as everything below the fold) and instead
   each word carries its own quick, staggered reveal, keyed off the same
   .is-in class the IntersectionObserver already adds to the parent. The
   selector is one class + one attribute (0,0,2,0), which beats the generic
   [data-reveal] rule's (0,0,1,0) regardless of source order. */
.hero__title[data-reveal] {
  opacity: 1;
  transform: none;
  transition: none;
}

.hero__title .word {
  display: inline-block;
}

.hero__title .word,
.hero__title em {
  /* em keeps its own display: block from the gradient-text rule above —
     redeclaring it here would cancel the forced line break before
     "electronics fail." */
  opacity: 0;
  transform: translateY(0.5em);
  transition: opacity 640ms var(--ease-out-expo), transform 640ms var(--ease-out-expo);
}

.hero__title.is-in .word,
.hero__title.is-in em {
  opacity: 1;
  transform: none;
}

.hero__title .word:nth-of-type(1) { transition-delay: 40ms; }
.hero__title .word:nth-of-type(2) { transition-delay: 130ms; }
.hero__title .word:nth-of-type(3) { transition-delay: 220ms; }
.hero__title em { transition-delay: 330ms; }

@media (prefers-reduced-motion: reduce) {
  .hero__title .word,
  .hero__title em {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* If JS never runs, .is-in is never added and nothing would ever reveal
   these — matching the same .no-js escape hatch the generic [data-reveal]
   rule uses elsewhere, just written out explicitly here since .word/em
   don't carry the data-reveal attribute themselves (only their h1 parent
   does), so the generic .no-js [data-reveal] rule can't reach them. */
.no-js .hero__title .word,
.no-js .hero__title em {
  opacity: 1;
  transform: none;
}

.hero__lede {
  font-size: var(--t-lead);
  line-height: 1.6;
  color: var(--ink-300);
  max-width: 46ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: var(--s-2);
}

/* Small ledger of live figures under the CTAs. */
.hero__ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  margin-block-start: var(--s-5);
  padding-block-start: var(--s-5);
  border-block-start: 1px solid var(--rule);
}

.hero__ledger dt {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin-block-end: 0.35rem;
}

.hero__ledger dd {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

/* The one place on the page that states the HQ coordinates plainly — a
   small, precise detail that backs up "make a statement" with a fact rather
   than an adjective. */
.hero__coord {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-block-start: var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}

.hero__scroll {
  position: absolute;
  z-index: 3;
  inset-block-end: var(--s-5);
  inset-inline-start: 50%;
  translate: -50% 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-400);
  transition: color var(--dur) var(--ease-out-quart);
}

.hero__scroll:hover {
  color: var(--vg-300);
}

.hero__scroll .ico {
  width: 15px;
  height: 15px;
  animation: nudge 2.6s var(--ease-in-out) infinite;
}

@keyframes nudge {
  0%, 62%, 100% { transform: translateY(0); opacity: 0.55; }
  78% { transform: translateY(5px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__scroll .ico { animation: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .hero__inner {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  }
  .globe {
    width: min(124svh, 84vw);
    transform: translate(-36%, -50%);
  }
}

@media (max-width: 980px) {
  .hero {
    min-height: 100svh;
    padding-block: calc(var(--nav-h) + var(--s-5)) var(--s-8);
  }

  /* Same cinematic treatment as desktop rather than a stacked one: the scene
     stays an absolute full-bleed layer running a third of the way off the
     left edge, and the copy sits on top of it instead of below it. */
  .hero__inner {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }

  .globe {
    width: min(150svh, 168vw);
    transform: translate(-33%, -50%);
  }

  .hero__copy {
    grid-column: 1;
    max-width: none;
  }

  /* The copy now sits over the sphere, so it needs its own ground to stay
     legible — a soft vertical scrim rather than a hard panel, so the globe
     still reads through it above the text.

     The stops are set by measurement, not taste. Sampling the rendered globe
     behind the text across 12 rotations: the lede started at 2.75:1, under
     the 4.5:1 AA floor, because --ink-300 over a bright limb is not enough.
     These values plus the --ink-200 step below land on 6.81:1 for the
     headline and 4.59:1 for the lede — deliberately just over the line, so
     as much of the sphere shows through as accessibility allows. Lightening
     them further fails: 0.86 at the middle stop measured 4.02:1. */
  .hero__inner::before {
    content: "";
    position: absolute;
    inset: -12% -50vw;
    z-index: -1;
    background: linear-gradient(
      180deg,
      transparent,
      rgba(5, 8, 15, 0.45) 18%,
      rgba(5, 8, 15, 0.9) 46%,
      rgba(5, 8, 15, 0.94)
    );
    pointer-events: none;
  }

  /* A step up the neutral ramp, for the same reason. */
  .hero__lede {
    color: var(--ink-200);
  }

  .hero__scroll { display: none; }
}

@media (max-width: 560px) {
  .hero__ledger {
    grid-template-columns: 1fr 1fr;
    row-gap: var(--s-4);
  }
  .hero__ledger > div:last-child { grid-column: span 2; }
  .hero__actions .btn { flex: 1 1 100%; }
}
