/* ── SpaceX Design System: Astronomical Zodiac ── */
/* Space Black + Spectral White. Photographic, cinematic, minimal. */

:root {
  color-scheme: dark;
  --void: #000000;
  --spectral: #f0f0fa;
  --spectral-muted: rgba(240, 240, 250, 0.52);
  --ghost-bg: rgba(240, 240, 250, 0.06);
  --ghost-border: rgba(240, 240, 250, 0.18);
  --ghost-hover: rgba(240, 240, 250, 0.12);
  --sun: #ffd166;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--void);
  background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('./stars.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--spectral);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

/* ── Layout ── */

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  position: relative;
}

/* ── Top Bar (transparent overlay) ── */

.topbar {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(14px, 3vw, 36px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

h1 {
  margin: 0 0 2px;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--spectral);
}

/* ── Source line ── */

#sourceText {
  color: var(--spectral-muted);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#sourceText a {
  color: var(--spectral-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#sourceText a:hover {
  color: var(--spectral);
}

/* ── Date Form ── */

.date-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.date-form input {
  min-height: 36px;
  color: var(--spectral);
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 32px;
  padding: 0 18px;
  outline: none;
  transition: border-color 200ms, background 200ms;
}

.date-form input:focus {
  border-color: rgba(240, 240, 250, 0.38);
  background: rgba(240, 240, 250, 0.10);
}

/* ── Ghost Button ── */

button {
  min-height: 36px;
  border: 1px solid var(--ghost-border);
  border-radius: 32px;
  padding: 0 22px;
  color: var(--spectral);
  background: var(--ghost-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 200ms, border-color 200ms;
}

button:hover {
  background: var(--ghost-hover);
  border-color: rgba(240, 240, 250, 0.35);
}

/* ── Stage ── */

.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

#skyCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Loading Panel ── */

.loading-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: var(--spectral);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 14px;
}

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

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 2px solid rgba(240, 240, 250, 0.14);
  border-top-color: rgba(240, 240, 250, 0.55);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

progress {
  width: min(360px, 68vw);
  height: 3px;
  accent-color: var(--spectral);
  border: none;
  border-radius: 2px;
}

progress::-webkit-progress-bar {
  background: rgba(240, 240, 250, 0.08);
  border-radius: 2px;
}

progress::-webkit-progress-value {
  background: var(--spectral-muted);
  border-radius: 2px;
}

/* ── Timeline (floating ghost bar) ── */

.timeline {
  padding: 6px clamp(14px, 3vw, 36px) 8px;
  border-top: 1px solid rgba(240, 240, 250, 0.08);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
}

.timeline-controls {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 86px;
  align-items: center;
  gap: 10px;
}

/* ── Slider ── */

#timeSlider {
  width: 100%;
  accent-color: var(--spectral-muted);
  height: 3px;
}

#timeSlider::-webkit-slider-runnable-track {
  background: rgba(240, 240, 250, 0.08);
  border-radius: 2px;
  height: 3px;
}

#timeSlider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--spectral);
  border: none;
  margin-top: -6px;
}

/* ── Year Input ── */

.year-input {
  width: 86px;
  min-height: 34px;
  color: var(--spectral);
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 32px;
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 200ms, background 200ms;
}

.year-input:focus {
  border-color: rgba(240, 240, 250, 0.38);
  background: rgba(240, 240, 250, 0.10);
}

/* ── Progress ── */

#playProgress {
  width: 100%;
  height: 2px;
  margin: 4px 0;
  accent-color: var(--spectral-muted);
  border: none;
}

#playProgress::-webkit-progress-bar {
  background: rgba(240, 240, 250, 0.08);
  border-radius: 2px;
}

#playProgress::-webkit-progress-value {
  background: var(--spectral-muted);
  border-radius: 2px;
}

/* ── Subtitle ── */

#subtitle {
  min-height: 18px;
  font-size: clamp(13px, 1.6vw, 18px);
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--spectral);
  margin: 0;
}

.psych-note {
  max-width: 52rem;
  margin: 10px auto 0;
  padding: 0 clamp(12px, 3vw, 24px);
  text-align: left;
  color: var(--spectral-muted);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.psych-note summary {
  cursor: pointer;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--spectral-muted);
  list-style: none;
  padding: 4px 0;
}

.psych-note summary::-webkit-details-marker {
  display: none;
}

.psych-note[open] summary {
  color: var(--spectral);
  margin-bottom: 8px;
}

.psych-note[open] .psych-note-body {
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 240, 250, 0.25) transparent;
}

.psych-note-lead {
  font-size: 14px;
  line-height: 1.5;
  color: var(--spectral);
  margin-bottom: 14px !important;
}

.psych-note h3 {
  margin: 16px 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--spectral);
}

.psych-note h3:first-of-type {
  margin-top: 4px;
}

.psych-note p {
  margin: 0 0 10px;
}

.psych-note ul {
  margin: 0 0 12px;
  padding-left: 1.2rem;
}

.psych-note li {
  margin-bottom: 6px;
}

.psych-note li::marker {
  color: var(--spectral-muted);
}

.psych-note strong {
  color: var(--spectral);
  font-weight: 500;
}

.psych-note-source {
  font-size: 11px;
  margin-top: 12px !important;
  margin-bottom: 6px !important;
  padding-top: 10px;
  border-top: 1px solid rgba(240, 240, 250, 0.1);
}

.psych-note-source a {
  color: var(--spectral-muted);
}

.psych-note-source a:hover {
  color: var(--spectral);
}

.psych-note-video {
  margin-top: 4px;
  margin-bottom: 4px;
}

.info-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.verify-link {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--spectral-muted);
  text-decoration: none;
  margin-top: 1px;
  transition: color 200ms;
}

.verify-link:hover {
  color: var(--spectral);
}

/* ── Animations ── */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Responsive ── */

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
  }

  .date-form {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .timeline-controls {
    grid-template-columns: auto minmax(0, 1fr) 76px;
    gap: 10px;
  }

  .year-input {
    width: 76px;
  }
}

@media (max-height: 620px) {
  #sourceText {
    display: none;
  }

  .topbar {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  h1 {
    font-size: 16px;
  }

  #subtitle {
    font-size: 14px;
  }
}
