/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #080c14;
  --bg-dark:    #050810;
  --bg-card:    #0d1424;
  --border:     rgba(255,255,255,0.07);
  --accent:     #3b82f6;
  --accent-dim: rgba(59,130,246,0.15);
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;
  --font:       'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 32px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.accent { color: var(--accent); }

/* ─── Nav ───────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,12,20,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav__brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.nav__logo { font-size: 1.4rem; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav__links a { color: var(--text-dim); font-size: 0.9rem; font-weight: 500; }
.nav__links a:hover { color: var(--text); opacity: 1; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: #2563eb; opacity: 1; }

.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn--ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.2); opacity: 1; }

.btn--lg { padding: 14px 28px; font-size: 1rem; }

/* ─── Hero ──────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 120px 0 80px;
  overflow: hidden;
  text-align: center;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(59,130,246,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 80% 60%, rgba(99,102,241,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero__inner { position: relative; }

.badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid rgba(59,130,246,0.4);
  background: rgba(59,130,246,0.08);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 28px;
  font-family: var(--font-mono);
}

.hero__title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: #f1f5f9;
  margin-bottom: 24px;
}

.hero__subtitle {
  max-width: 640px;
  margin: 0 auto 40px;
  font-size: 1.1rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.hero__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 64px;
}

.hero__stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  max-width: 560px;
  margin: 0 auto;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 40px;
  flex: 1;
}

.stat__value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.stat__divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}

/* ─── Sections ──────────────────────────────────────────────── */
.section { padding: 96px 0; }
.section--dark { background: var(--bg-dark); }

.section__header {
  text-align: center;
  margin-bottom: 56px;
}

.section__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

.section__title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #f1f5f9;
  margin-bottom: 16px;
}

.section__desc {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ─── Feature Cards ─────────────────────────────────────────── */
.features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color var(--transition), transform var(--transition);
}

.feature-card:hover {
  border-color: rgba(59,130,246,0.3);
  transform: translateY(-2px);
}

.feature-card__icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ─── Emulation Section ─────────────────────────────────────── */
.emulation__layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: stretch;
}

.emulation-scene {
  /* Geometry: Earth far-left, relay near Mars (far-right) */
  --earth-x: 12%;
  --relay-x: 73%;
  --mars-x: 90%;
  --lane-y: 50%;
  position: relative;
  min-height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 14% 30%, rgba(59,130,246,0.20), transparent 36%),
    radial-gradient(circle at 86% 65%, rgba(239,68,68,0.14), transparent 30%),
    linear-gradient(180deg, #070d1a 0%, #050810 100%);
  overflow: hidden;
}

.emulation-scene__glow {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(226,232,240,0.32) 0.8px, transparent 0.8px);
  background-size: 20px 20px;
  opacity: 0.12;
  pointer-events: none;
}

/* ── Planets ─────────────────────────────────────────────────── */
.node {
  position: absolute;
  top: var(--lane-y);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.node::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px dashed rgba(148,163,184,0.2);
  animation: node-ring 12s linear infinite;
}

.node--earth {
  left: var(--earth-x);
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at 35% 35%, #7dd3fc 0%, #1d4ed8 65%, #1e3a8a 100%);
}

/* Mars radius is ~53% of Earth's — visually proportional */
.node--mars {
  left: var(--mars-x);
  width: 52px;
  height: 52px;
  background: radial-gradient(circle at 32% 32%, #fca5a5 0%, #dc2626 58%, #7f1d1d 100%);
}

.node__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.node__sub {
  margin-top: 2px;
  font-size: 0.55rem;
  color: #cbd5e1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Relay Satellite (small orbiter positioned near Mars) ─────── */
.relay-sat {
  position: absolute;
  left: var(--relay-x);
  top: var(--lane-y);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 3px;
  animation: relay-buffering 12s linear infinite;
}

.relay-sat__body {
  width: 52px;
  height: 30px;
  border-radius: 4px;
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  border: 1.5px solid rgba(59,130,246,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

/* Solar panel wings */
.relay-sat__panel {
  display: block;
  width: 22px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2563eb 0%, #1e40af 100%);
  flex-shrink: 0;
}

/* "BUFFERING" label fades in while relay is holding a bundle */
.relay-sat__buffer {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fbbf24;
  white-space: nowrap;
  opacity: 0;
  animation: relay-buffer-label 12s linear infinite;
}

/* ── Links (blink to show contact-window availability) ────────── */
.link {
  position: absolute;
  top: var(--lane-y);
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(59,130,246,0.15) 0%, rgba(59,130,246,0.60) 50%, rgba(59,130,246,0.15) 100%);
  opacity: 0;
}

/* Long link: Earth → Relay (most of the scene width) */
.link--earth-relay {
  left: calc(var(--earth-x) + 5.3%);
  width: calc(var(--relay-x) - var(--earth-x) - 8.7%);
  animation: link-window-er 12s linear infinite;
}

/* Short link: Relay → Mars (tight gap near Mars) */
.link--relay-mars {
  left: calc(var(--relay-x) + 3.3%);
  width: calc(var(--mars-x) - var(--relay-x) - 5.5%);
  animation: link-window-rm 12s linear infinite;
}

.link-badge {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.28);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ── Packets ─────────────────────────────────────────────────── */
.packet {
  position: absolute;
  top: calc(var(--lane-y) - 7px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

/* Forward bundles: white/blue */
.packet--fwd-1,
.packet--fwd-2 {
  background: #e2e8f0;
  box-shadow: 0 0 10px rgba(226,232,240,0.7);
  border: 1px solid rgba(226,232,240,0.4);
}

/* Return telemetry: amber — visually distinct from forward bundles */
.packet--ret-1,
.packet--ret-2 {
  background: #fcd34d;
  box-shadow: 0 0 10px rgba(252,211,77,0.7);
  border: 1px solid rgba(252,211,77,0.4);
}

.packet--fwd-1 { animation: packet-fwd-1 12s linear infinite; }
.packet--fwd-2 { animation: packet-fwd-2 12s linear infinite; }
.packet--ret-1 { animation: packet-ret-1 12s linear infinite; }
.packet--ret-2 { animation: packet-ret-2 12s linear infinite; }

.delay-badge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.10);
  color: #bfdbfe;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.emulation__notes {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.emulation-note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.emulation-note h3 {
  font-size: 0.9rem;
  color: #f1f5f9;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.emulation-note p {
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── Keyframes: 12 s cycle ───────────────────────────────────── */

@keyframes node-ring {
  to { transform: rotate(360deg); }
}

/*
 * Earth-Relay link: UP for fwd journey (2%–36%), gap, UP again for return (62%–94%).
 * This correctly shows that a new contact window opens for the return telemetry.
 */
@keyframes link-window-er {
  0%    { opacity: 0; }
  2%    { opacity: 1; }
  34%   { opacity: 1; }
  38%   { opacity: 0; }
  60%   { opacity: 0; }
  63%   { opacity: 1; }
  91%   { opacity: 1; }
  94%   { opacity: 0; }
  100%  { opacity: 0; }
}

/*
 * Relay-Mars link: UP 42%–67%, covering both the fwd short-hop and the return short-hop.
 */
@keyframes link-window-rm {
  0%, 40%  { opacity: 0; }
  43%      { opacity: 1; }
  65%      { opacity: 1; }
  68%      { opacity: 0; }
  100%     { opacity: 0; }
}

/*
 * Relay glows amber while holding bundle in custody (34%–43%).
 * filter applied to entire .relay-sat so panels glow too.
 */
@keyframes relay-buffering {
  0%, 32%  { filter: none; }
  35%      { filter: drop-shadow(0 0 7px #f59e0b) brightness(1.15); }
  42%      { filter: drop-shadow(0 0 7px #f59e0b) brightness(1.15); }
  46%      { filter: none; }
  100%     { filter: none; }
}

/* "BUFFERING" text visible only during custody hold phase */
@keyframes relay-buffer-label {
  0%, 33%  { opacity: 0; }
  36%      { opacity: 1; }
  43%      { opacity: 1; }
  46%      { opacity: 0; }
  100%     { opacity: 0; }
}

/*
 * All packet positions use left: <% of scene> so the 12s timing drives each leg cleanly.
 * Earth right edge ≈ 20%, relay left edge ≈ 69%, relay right edge ≈ 77%, Mars left edge ≈ 86%.
 */

/* Forward bundle: Earth → Relay (long interplanetary leg) */
@keyframes packet-fwd-1 {
  0%, 4%   { left: 20%; opacity: 0; }
  6%       { left: 20%; opacity: 1; }
  33%      { left: 69%; opacity: 1; }
  36%      { left: 69%; opacity: 0; }
  100%     { left: 69%; opacity: 0; }
}

/* Forward bundle: Relay → Mars (short orbital leg) */
@keyframes packet-fwd-2 {
  0%, 41%  { left: 77%; opacity: 0; }
  43%      { left: 77%; opacity: 1; }
  51%      { left: 86%; opacity: 1; }
  53%      { left: 86%; opacity: 0; }
  100%     { left: 86%; opacity: 0; }
}

/* Return telemetry: Mars → Relay (short orbital leg, rightward→leftward) */
@keyframes packet-ret-1 {
  0%, 53%  { left: 86%; opacity: 0; }
  55%      { left: 86%; opacity: 1; }
  62%      { left: 77%; opacity: 1; }
  64%      { left: 77%; opacity: 0; }
  100%     { left: 77%; opacity: 0; }
}

/* Return telemetry: Relay → Earth (long interplanetary leg, rightward→leftward) */
@keyframes packet-ret-2 {
  0%, 63%  { left: 69%; opacity: 0; }
  65%      { left: 69%; opacity: 1; }
  91%      { left: 20%; opacity: 1; }
  94%      { left: 20%; opacity: 0; }
  100%     { left: 20%; opacity: 0; }
}

/* ─── Architecture ──────────────────────────────────────────── */
.arch__components {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 32px;
}

.arch__component {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  flex: 1;
  min-width: 180px;
  max-width: 220px;
  text-align: center;
  transition: border-color var(--transition);
}

.arch__component:hover { border-color: rgba(59,130,246,0.3); }

.arch__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.arch__component p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.arch__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.4rem;
  padding: 0 8px;
  flex-shrink: 0;
}

.arch__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.tag {
  padding: 6px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ─── NASA Section ──────────────────────────────────────────── */
.nasa__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.nasa__problem,
.nasa__solution {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}

.nasa__problem { border-left: 3px solid #ef4444; }
.nasa__solution { border-left: 3px solid #22c55e; }

.nasa__problem h3,
.nasa__solution h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.nasa__problem ul,
.nasa__solution ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nasa__problem li::before { content: "✕  "; color: #ef4444; font-weight: 700; }
.nasa__solution li::before { content: "✓  "; color: #22c55e; font-weight: 700; }

.nasa__problem li,
.nasa__solution li {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ─── Partners ──────────────────────────────────────────────── */
.partners__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
}

.partner-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 36px;
  min-width: 280px;
  max-width: 400px;
  transition: border-color var(--transition);
}

.partner-card:hover { border-color: rgba(59,130,246,0.3); }

.partner-card__logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.partner-card__initials {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.3;
}

.partner-card__body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.partner-card__body p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ─── CTA Section ───────────────────────────────────────────── */
.cta-section {
  background: linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(99,102,241,0.05) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cta__inner { text-align: center; }

.cta__title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #f1f5f9;
  margin-bottom: 12px;
}

.cta__desc {
  color: var(--text-dim);
  margin-bottom: 36px;
  font-size: 1.05rem;
}

.cta__actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ─── Footer ────────────────────────────────────────────────── */
.footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text-dim); opacity: 1; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav__links { gap: 16px; }
  .nav__links li:not(:last-child) { display: none; }

  .hero { padding: 80px 0 60px; }

  .hero__stats { flex-direction: column; }
  .stat__divider { width: 80%; height: 1px; }

  .arch__components { flex-direction: column; align-items: center; }
  .arch__arrow { transform: rotate(90deg); padding: 4px 0; }

  .nasa__grid { grid-template-columns: 1fr; }
  .emulation__layout { grid-template-columns: 1fr; }
  .emulation-scene {
    min-height: 260px;
    --earth-x: 13%;
    --relay-x: 73%;
    --mars-x: 90%;
  }
  .delay-badge {
    white-space: normal;
    text-align: center;
    max-width: 90%;
    font-size: 0.62rem;
  }

  .footer__inner { justify-content: center; text-align: center; }
}

@media (max-width: 480px) {
  .features__grid { grid-template-columns: 1fr; }
  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { text-align: center; }
  .node--earth { width: 72px; height: 72px; }
  .node--mars { width: 38px; height: 38px; }
  .relay-sat__body { width: 40px; height: 24px; }
  .relay-sat__panel { width: 14px; }
  .node__sub { display: none; }
  .delay-badge { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .node::after,
  .relay-sat,
  .relay-sat__buffer,
  .link--earth-relay,
  .link--relay-mars,
  .packet--fwd-1,
  .packet--fwd-2,
  .packet--ret-1,
  .packet--ret-2 {
    animation: none !important;
  }

  /* Static fallback: show links and one packet per direction */
  .link--earth-relay,
  .link--relay-mars { opacity: 0.65; }
  .packet--fwd-1 { left: 42%; opacity: 0.85; }
  .packet--ret-2 { left: 55%; opacity: 0.85; }
}
