/* ═══════════════════════════════════════════════════════════
   SPACE.CSS  —  "People currently in space" section
   ═══════════════════════════════════════════════════════════ */

#space {
  position: relative;
  z-index: 10;
  padding: 5rem 0.5rem 6rem 1.5rem;
  overflow: visible; /* moon bleeds off right edge; body clips horizontally */
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(15, 10, 40, 0.35) 40%,
    transparent 100%
  );
}

/* Radial violet glow — shifted right toward the moon column */
#space-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 60% 70% at 78% 55%,
    rgba(139, 92, 246, 0.10) 0%,
    transparent 68%
  );
}

/* ── Two-column layout ──────────────────────────────────── */
.space-inner {
  position: relative;
  z-index: 10;
  max-width: 78rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 2rem;
  align-items: center;
}

/* Left column */
.space-content {
  display: flex;
  flex-direction: column;
}

/* Right column: moon canvas */
.space-moon-col {
  position: relative;
  min-height: 1050px;
  overflow: visible;
}

#moon-canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  /* width/height set programmatically by Three.js renderer.setSize() */
}

/* Mobile: single column, moon below content */
@media (max-width: 767px) {
  .space-inner {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .space-moon-col {
    min-height: 630px;
  }
}

/* ── Section header ─────────────────────────────────────── */
.space-header {
  text-align: left;
  margin-bottom: 2.5rem;
}

.space-header-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.08);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #34d399;
  margin-bottom: 1.1rem;
}
.space-header-tag-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #34d399;
}

.space-heading {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.space-subheading {
  font-size: 0.95rem;
  color: #475569;
}
.space-subheading a {
  color: #a78bfa;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-base);
}
.space-subheading a:hover { color: #c4b5fd; }

/* ── Big count ──────────────────────────────────────────── */
.space-count-wrap {
  text-align: left;
  margin-bottom: 2.5rem;
}

.space-count-number {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;

  /* Violet gradient */
  background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 45%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

  filter:
    drop-shadow(0 0 20px rgba(139, 92, 246, 0.7))
    drop-shadow(0 0 50px rgba(139, 92, 246, 0.3));
}

.space-count-label {
  margin-top: 0.75rem;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 300;
  color: #94a3b8;
  letter-spacing: 0.03em;
}

/* ── Craft cards grid ───────────────────────────────────── */
.space-crafts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 560px) {
  .space-crafts { grid-template-columns: repeat(2, 1fr); }
}

/* ── Individual craft card ──────────────────────────────── */
.craft-card {
  border-radius: 1rem;
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  transition: transform 0.22s ease, border-color 0.22s ease;
}
.craft-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
}

/* Craft-specific accent colours */
.craft-card--iss      { border-color: rgba(59, 130, 246, 0.22); background: rgba(59, 130, 246, 0.05); }
.craft-card--tiangong { border-color: rgba(239, 68, 68, 0.22);  background: rgba(239, 68, 68, 0.05); }
.craft-card--other    { border-color: rgba(52, 211, 153, 0.22); background: rgba(52, 211, 153, 0.05); }

.craft-card--iss      .craft-accent { color: #60a5fa; }
.craft-card--tiangong .craft-accent { color: #f87171; }
.craft-card--other    .craft-accent { color: #34d399; }

/* Card header */
.craft-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.craft-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.craft-card--iss      .craft-icon { background: rgba(59, 130, 246, 0.15); }
.craft-card--tiangong .craft-icon { background: rgba(239, 68, 68, 0.15); }
.craft-card--other    .craft-icon { background: rgba(52, 211, 153, 0.15); }

.craft-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
}
.craft-count {
  font-size: 0.75rem;
  color: #475569;
  margin-top: 0.1rem;
}

/* Astronaut list */
.astronaut-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.astronaut-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.83rem;
  color: #94a3b8;
  flex-wrap: nowrap;
}
.astronaut-item::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.5;
}

/* ── Loading / error / meta states ─────────────────────── */
.space-loading,
.space-error {
  text-align: center;
  padding: 3rem 1rem;
  color: #475569;
  font-size: 0.9rem;
}

.space-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.space-error-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.space-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: #334155;
  margin-top: 1.5rem;
}
.space-meta-dot { color: #1e293b; }

.space-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-pill);
  color: #a78bfa;
  font-size: 0.72rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.space-refresh-btn:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.5);
}
.space-refresh-btn svg {
  width: 0.75rem;
  height: 0.75rem;
}
.space-refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}
