@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg-primary:    #0a0d14;
  --bg-secondary:  #0f1520;
  --bg-card:       #131c2e;
  --accent-blue:   #4a9eff;
  --accent-glow:   #1a6bcc;
  --text-primary:  #e8eaf0;
  --text-secondary:#8892a4;
  --text-muted:    #4a5568;
  --border:        #1e2d45;
  --success:       #34d399;
  --warning:       #fbbf24;
  --danger:        #f87171;
  --font-heading:  'DM Serif Display', serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ── Header ── */
.site-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
}

.home-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  transition: color 0.2s;
  justify-self: start;
}
.home-link:hover { color: var(--accent-blue); }

.site-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  text-align: center;
}

.last-updated {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  justify-self: end;
  text-align: right;
}

/* ── Layout ── */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.upcoming-label {
  margin-top: 3rem;
}

/* ── Hero card ── */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(74, 158, 255, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.hero-card:hover {
  border-color: rgba(74, 158, 255, 0.3);
}

.hero-image {
  width: 130px;
  height: 130px;
  min-width: 130px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.hero-image-wrap {
  width: 130px;
  min-width: 130px;
  height: 130px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-image-wrap svg {
  width: 70px;
  height: 70px;
  opacity: 0.35;
}

.hero-body {
  flex: 1;
  min-width: 0;
}

.hero-vehicle {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--accent-blue);
  margin-bottom: 0.35rem;
}

.hero-mission {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  word-break: break-word;
}

.hero-location {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hero-countdown {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.hero-countdown .countdown-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 0.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.hero-net {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Watch Live button ── */
.watch-live-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, var(--accent-glow), var(--accent-blue));
  color: #fff;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 0 18px rgba(74, 158, 255, 0.25);
}
.watch-live-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(74, 158, 255, 0.4);
}
.watch-live-btn .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-go {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}
.status-go::before { background: var(--success); box-shadow: 0 0 6px var(--success); }

.status-tbd {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}
.status-tbd::before { background: var(--warning); }

.status-danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}
.status-danger::before { background: var(--danger); }

.status-default {
  color: var(--text-secondary);
  border-color: var(--border);
  background: transparent;
}
.status-default::before { background: var(--text-muted); }

/* ── Launch grid ── */
.launches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ── Launch card ── */
.launch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.launch-card:hover {
  border-color: rgba(74, 158, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.card-image-wrap {
  width: 100%;
  height: 160px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-image-wrap svg {
  width: 60px;
  height: 60px;
  opacity: 0.25;
}

.card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.card-vehicle {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--accent-blue);
}

.card-mission {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.card-location {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card-countdown {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
}

.card-watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(74, 158, 255, 0.12);
  color: var(--accent-blue);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  border: 1px solid rgba(74, 158, 255, 0.25);
  transition: background 0.2s, border-color 0.2s;
}
.card-watch-btn:hover {
  background: rgba(74, 158, 255, 0.2);
  border-color: rgba(74, 158, 255, 0.5);
}

/* ── Skeleton loading ── */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton-block {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, #1a2540 50%, var(--bg-secondary) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 6px;
}

.skeleton-hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.sk-image { width: 130px; min-width: 130px; height: 130px; border-radius: 12px; }
.skeleton-body { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.sk-title { height: 28px; width: 70%; }
.sk-subtitle { height: 14px; width: 45%; }
.sk-badge { height: 24px; width: 120px; border-radius: 20px; }
.sk-countdown { height: 40px; width: 55%; }

.skeleton-card {
  pointer-events: none;
}
.sk-card-img { width: 100%; height: 160px; border-radius: 0; }
.sk-card-body { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.sk-card-title { height: 16px; width: 80%; }
.sk-card-sub { height: 12px; width: 55%; }
.sk-card-badge { height: 22px; width: 90px; border-radius: 20px; margin-top: 0.25rem; }

/* ── Error state ── */
.error-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}
.error-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}
.error-msg {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.retry-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.retry-btn:hover {
  border-color: var(--accent-blue);
  background: rgba(74, 158, 255, 0.08);
}

/* ── Footer ── */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer a:hover { color: var(--accent-blue); }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .site-header {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0.4rem;
    padding: 1rem;
  }
  .site-title {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
    font-size: 1.15rem;
  }
  .home-link { grid-row: 2; font-size: 0.75rem; }
  .last-updated { grid-row: 2; font-size: 0.68rem; }

  .hero-card {
    flex-direction: column;
    padding: 1.25rem;
    gap: 1.25rem;
  }
  .hero-image-wrap, .sk-image { width: 100%; min-width: unset; height: 200px; border-radius: 10px; }
  .hero-image { width: 100%; height: 200px; min-width: unset; border-radius: 10px; }
  .hero-mission { font-size: 1.3rem; }
  .hero-countdown { font-size: 1.35rem; }

  .launches-grid {
    grid-template-columns: 1fr;
  }

  .container { padding: 1.5rem 1rem 3rem; }
}

@media (min-width: 701px) and (max-width: 900px) {
  .launches-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
