*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #05050f;
  --surface: #181828;
  --surface2: #1e1e34;
  --border: #383858;
  --accent: #7c9eff;
  --accent2: #a78bfa;
  --text: #e2e8f0;
  --muted: #7a82a0;
  --card-hover-border: #5a5a90;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Starfield ── */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Layout ── */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

/* ── Header ── */
header {
  text-align: center;
  padding: 60px 24px 20px;
  position: relative;
  z-index: 1;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.logo-icon {
  font-size: 2.2rem;
  color: var(--accent);
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(124, 158, 255, 0.6));
}

.logo-text {
  font-size: 1.9rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}

.tagline {
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Card Grid ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1100px;
  width: 100%;
}

/* ── Card ── */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  position: relative;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--card-hover-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 158, 255, 0.15);
}

/* ── Card Preview Area ── */
.card-preview {
  height: 150px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.solar-system {
  background: radial-gradient(ellipse at center, #0a0a2e 0%, #000008 100%);
}

.mini-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.rocket-launches {
  background: linear-gradient(160deg, #060612 0%, #0c0c22 50%, #08081a 100%);
}

.apollo-missions {
  background: radial-gradient(ellipse at 70% 40%, #1a1a2e 0%, #000008 100%);
}

.constellations {
  background: radial-gradient(ellipse at 50% 50%, #080818 0%, #000008 100%);
}

.space-shuttle {
  background: radial-gradient(ellipse at 50% 85%, #1a0e04 0%, #000008 100%);
}

.iss {
  background: radial-gradient(ellipse at 30% 70%, #001a22 0%, #000008 100%);
}

.spacex {
  background: radial-gradient(ellipse at 50% 100%, #0a0a1a 0%, #000008 100%);
}

.moon {
  background: radial-gradient(ellipse at 60% 100%, #1a1c20 0%, #000008 100%);
}

.blueorigin {
  background: radial-gradient(ellipse at 50% 110%, #051828 0%, #000008 100%);
}

.lunarlander {
  background: radial-gradient(ellipse at 50% 100%, #0e1018 0%, #000008 100%);
}

.spaceinvaders {
  background: #000008;
}

.spacenews {
  background: radial-gradient(ellipse at 20% 100%, #060e1a 0%, #000008 100%);
}

/* Launch preview animation */
.launch-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rocket {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 16px rgba(255, 160, 80, 0.5));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.launch-lines {
  display: flex;
  gap: 6px;
}

.launch-lines span {
  display: block;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, rgba(255,180,80,0.9), transparent);
  animation: exhaust 0.6s ease-in-out infinite alternate;
}

.launch-lines span:nth-child(1) { height: 28px; animation-delay: 0s; }
.launch-lines span:nth-child(2) { height: 40px; animation-delay: 0.15s; }
.launch-lines span:nth-child(3) { height: 28px; animation-delay: 0.3s; }

@keyframes exhaust {
  from { opacity: 0.4; transform: scaleY(0.8); }
  to   { opacity: 1;   transform: scaleY(1.2); }
}

/* ── Card Body ── */
.card-body {
  padding: 16px 18px 12px;
  flex: 1;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  color: var(--text);
}

.card-desc {
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 14px;
}

.card-tag {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  margin-right: 6px;
  color: var(--muted);
}

/* ── Card Arrow ── */
.card-arrow {
  padding: 10px 22px 16px;
  font-size: 1rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

/* ── Add to Home Screen Banner ── */
#a2hs-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  justify-content: center;
  padding: 0 16px 16px;
  pointer-events: none;
}

#a2hs-content {
  position: relative;
  background: rgba(14, 14, 28, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(124, 158, 255, 0.25);
  border-radius: 18px;
  padding: 20px 24px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  pointer-events: all;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  animation: a2hs-rise 0.4s ease;
}

@keyframes a2hs-rise {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#a2hs-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

#a2hs-icon {
  font-size: 2rem;
  color: var(--accent);
  filter: drop-shadow(0 0 10px rgba(124, 158, 255, 0.5));
  margin-bottom: 6px;
}

#a2hs-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

#a2hs-steps {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

#a2hs-steps strong { color: var(--text); }

#a2hs-arrow {
  font-size: 1.1rem;
  color: var(--accent);
  margin-top: 12px;
  animation: a2hs-bounce 1.2s ease-in-out infinite;
}

@keyframes a2hs-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(5px); }
}

/* ── Responsive ── */
@media (max-width: 800px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .card-grid { grid-template-columns: 1fr; }
  .logo-text { font-size: 1.4rem; }
  header { padding-top: 40px; }
}
