/* === Design System: Mission Control === */

:root {
  /* Backgrounds */
  --bg-void:        #0a0e17;
  --bg-surface:     #111827;
  --bg-elevated:    #1a2332;

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #8896ab;
  --text-muted:     #4a5568;

  /* Status */
  --go:             #22c55e;
  --maybe:          #f59e0b;
  --nogo:           #ef4444;

  /* Kp scale */
  --kp-low:         #22c55e;
  --kp-mid:         #eab308;
  --kp-high:        #dc2626;

  /* Accent */
  --accent:         #38bdf8;
  --accent-dim:     #1e3a5f;

  /* Utility */
  --border:         #1e293b;
  --glow-sun:       #fbbf24;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  background: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* Subtle space atmosphere */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 20% 10%,
    rgba(56, 189, 248, 0.03) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, .badge-label {
  font-family: "Outfit", system-ui, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Panel === */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.panel-header {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

/* === Landing Page === */
.landing {
  max-width: 700px;
  margin: 0 auto;
  padding: 4rem 1rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.landing-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.landing-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 3rem;
}

.view-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 500px) {
  .view-cards {
    grid-template-columns: 1fr;
  }
}

.view-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.view-card:hover {
  text-decoration: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.08);
}

.view-card-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
}

.view-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.view-card p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* === Go/No-Go Badge === */
.go-nogo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  border-radius: 6px;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid;
}

.go-nogo-badge::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}

.go-nogo-badge[data-status="go"] {
  color: var(--go);
  border-color: var(--go);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.15),
              inset 0 0 20px rgba(34, 197, 94, 0.05);
}

.go-nogo-badge[data-status="maybe"] {
  color: var(--maybe);
  border-color: var(--maybe);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15),
              inset 0 0 20px rgba(245, 158, 11, 0.05);
}

.go-nogo-badge[data-status="nogo"] {
  color: var(--nogo);
  border-color: var(--nogo);
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15),
              inset 0 0 20px rgba(239, 68, 68, 0.05);
}

.go-nogo-subtitle {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

@media (max-width: 500px) {
  .go-nogo-badge {
    font-size: 2.25rem;
    padding: 0.75rem 1.5rem;
  }
}

/* === Stargazer Layout === */
.stargazer-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  position: relative;
  z-index: 1;
}

.stargazer-hero {
  text-align: center;
  padding: 2rem 0;
}

.stargazer-hero h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stargazer-hero .location {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.stargazer-panels {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .stargazer-panels {
    grid-template-columns: 1fr 1fr;
  }
}

.panel--full {
  grid-column: 1 / -1;
}

/* === Weather Timeline === */
.timeline {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.timeline::-webkit-scrollbar {
  height: 4px;
}
.timeline::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.hour-card {
  flex: 0 0 auto;
  width: 80px;
  scroll-snap-align: start;
  background: var(--bg-elevated);
  border-radius: 6px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-size: 0.75rem;
}

.hour-card .hour-time {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
}

.hour-card .hour-value {
  font-size: 1rem;
  font-weight: 600;
}

.hour-card .hour-label {
  color: var(--text-muted);
  font-size: 0.625rem;
  margin-top: 0.125rem;
}

.hour-value--good { color: var(--go); }
.hour-value--ok   { color: var(--maybe); }
.hour-value--bad  { color: var(--nogo); }

/* === Moon Phase === */
.moon-display {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.moon-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--text-primary);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.moon-icon::after {
  content: '';
  position: absolute;
  top: -1px;
  width: 48px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-surface);
}

.moon-info {
  font-size: 0.875rem;
}

.moon-info .moon-phase-name {
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.moon-info .moon-detail {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* === Planets List === */
.planet-list {
  list-style: none;
}

.planet-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.planet-item:last-child {
  border-bottom: none;
}

.planet-name {
  font-weight: 600;
}

.planet-direction {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* === Error / Loading States === */
.loading-msg {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem;
}

.stale-indicator {
  display: inline-block;
  font-size: 0.625rem;
  color: var(--maybe);
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--maybe);
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.error-placeholder {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-style: italic;
  padding: 1rem 0;
}

/* === Nav Bar === */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.nav-bar a {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.nav-bar a:hover {
  color: var(--text-primary);
}

.nav-title {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
}

/* === Overlay Panels (Cosmic View) === */
.overlay-panel {
  position: fixed;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  color: var(--text-primary);
  font-size: 0.8125rem;
  z-index: 10;
  max-height: 60vh;
  overflow-y: auto;
}

.overlay-panel::-webkit-scrollbar { width: 4px; }
.overlay-panel::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 2px;
}

.spacecraft-panel {
  top: 1rem;
  right: 1rem;
  width: 220px;
}

.space-weather-panel {
  bottom: 1rem;
  left: 1rem;
  width: 260px;
}

.info-panel {
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 2rem));
}

.info-panel .object-name {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.info-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.75rem;
}
.info-panel dt { color: var(--text-secondary); }
.info-panel dd { font-family: "IBM Plex Mono", monospace; }

/* Overlay collapse for mobile */
.overlay-panel .panel-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  font-size: 0.75rem;
  font-family: "IBM Plex Mono", monospace;
}

.overlay-panel[aria-expanded="false"] .panel-body {
  display: none;
}

/* Spacecraft checkboxes */
.spacecraft-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  cursor: pointer;
  font-size: 0.75rem;
}

.spacecraft-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.spacecraft-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

/* Kp value */
.kp-value {
  font-size: 1.5rem;
  font-weight: 700;
}
.kp-value[data-level="low"]  { color: var(--kp-low); }
.kp-value[data-level="mid"]  { color: var(--kp-mid); }
.kp-value[data-level="high"] { color: var(--kp-high); }

/* === Cosmic View === */
.cosmic-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.cosmic-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-void);
  z-index: 20;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.cosmic-loading.hidden {
  display: none;
}

/* Label styles for CSS2DRenderer */
.label-2d {
  pointer-events: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: #c8d6e5;
  background: rgba(10, 14, 23, 0.5);
  padding: 2px 5px;
  border-radius: 2px;
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

/* === Focus Controls === */
.focus-select {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  background: rgba(10, 14, 23, 0.85);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.focus-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.focus-select option,
.focus-select optgroup {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.focus-btn {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.375rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
}
.focus-btn:hover {
  background: rgba(56, 189, 248, 0.2);
}
