/* ===================================
   Space Daily Digest — styles.css
   =================================== */

:root {
  --bg-deep:    #050810;
  --bg-mid:     #0a0f1e;
  --bg-card:    #0f1628;
  --bg-hover:   #1a2240;
  --border:     rgba(255,255,255,0.08);
  --border-hover: rgba(79,156,249,0.5);
  --text:       #e8eaf0;
  --text-dim:   #8892a4;
  --text-muted: #4a5568;
  --accent:     #4f9cf9;
  --accent-glow: rgba(79,156,249,0.15);
  --orange:     #ff6b35;
  --green:      #2dd4a0;
  --gold:       #f5c842;
  --red:        #ff4757;
  --teal:       #1ab8c4;
  --font-head:  'Space Grotesk', sans-serif;
  --font-body:  'Space Grotesk', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
  --ease:       cubic-bezier(0.645, 0.045, 0.355, 1);
  --nav-h:      68px;
  --r:          8px;
  --r-lg:       16px;
  --max-w:      1200px;
}

/* ── Reset ────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
.mono { font-family: var(--font-mono); }

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

/* ── Navigation ───────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(5, 8, 16, 0.0);
  backdrop-filter: blur(0px);
  transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease), border-bottom 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

#nav.scrolled {
  background: rgba(5, 8, 16, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.nav-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-left: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: all 0.3s var(--ease);
}

/* ── Hero ─────────────────────────── */
#hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 24px 80px;
}

.hero-content {
  max-width: 720px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(52px, 10vw, 96px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -2px;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 40px;
}

.hero-cta {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #050810;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--r);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  letter-spacing: 0.3px;
}

.hero-cta:hover {
  background: #6badff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79,156,249,0.35);
}

.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-indicator {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--text-muted));
  animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ── Sections ─────────────────────── */
section {
  position: relative;
  z-index: 1;
  padding: 100px 24px;
}

section:nth-child(even) {
  background: rgba(10, 15, 30, 0.6);
}

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-header {
  margin-bottom: 56px;
}

.section-label {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-head);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 12px;
}

.section-desc {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 520px;
}

/* ── Reveal Animation ─────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Digest Cards ─────────────────── */
.digest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 24px;
}

.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 0.5s var(--ease) forwards;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.story-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 16px 48px rgba(0,0,0,0.6);
  transform: translateY(-4px);
}

/* ── Card Hero Image ──────────────── */
.card-hero {
  width: 100%;
  height: 220px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-mid);
}

.card-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s var(--ease);
}

.story-card:hover .card-hero-img {
  transform: scale(1.05);
}

.card-hero-fallback {
  background: linear-gradient(135deg,
    rgba(79,156,249,0.15) 0%,
    var(--bg-mid) 100%
  );
}

/* ── Card Content ─────────────────── */
.card-content {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agency-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 4px;
  text-transform: uppercase;
}

.category-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-headline {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.3px;
}

.card-body {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.7;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.card-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.card-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: #050810;
  background: var(--accent);
  padding: 7px 14px;
  border-radius: 6px;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.2px;
}

.card-link:hover {
  background: #6badff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,156,249,0.4);
}

.digest-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Archive ──────────────────────── */
.archive-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.archive-nav-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.archive-nav-btn:hover {
  color: var(--accent);
  border-color: rgba(79,156,249,0.4);
  background: var(--accent-glow);
}

.archive-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.archive-month {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}

.archive-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 48px;
  max-width: 560px;
}

.day-header {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
  letter-spacing: 1px;
}

.day-pill {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  border: 1px solid transparent;
  gap: 2px;
}

.day-pill.empty {
  visibility: hidden;
}

.day-pill.no-digest {
  color: var(--text-muted);
  background: transparent;
  cursor: default;
}

.day-pill.has-digest {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
  cursor: pointer;
}

.day-pill.has-digest:hover {
  background: var(--bg-hover);
  border-color: rgba(79,156,249,0.4);
  color: var(--accent);
}

.day-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #050810;
}

.day-pill .pill-count {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.7;
}

.archive-viewing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.archive-viewing-bar .mono {
  font-size: 13px;
  color: var(--accent);
}

.back-to-today-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: color 0.2s, border-color 0.2s;
}

.back-to-today-btn:hover {
  color: var(--accent);
  border-color: rgba(79,156,249,0.4);
}

/* ── Rocket Chart ─────────────────── */
.rocket-chart-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 40px;
}

.rocket-chart-scroll {
  overflow-x: auto;
  padding: 40px 32px 24px;
  -webkit-overflow-scrolling: touch;
}

.rocket-chart-scroll::-webkit-scrollbar {
  height: 4px;
}
.rocket-chart-scroll::-webkit-scrollbar-track {
  background: var(--bg-mid);
}
.rocket-chart-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

#rocket-svg {
  display: block;
  min-width: 900px;
}

.rocket-label-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text);
  text-anchor: middle;
}

.rocket-label-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
}

.rocket-label-payload {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--accent);
  text-anchor: middle;
}

.height-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

/* ── Specs Table ──────────────────── */
.specs-table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.specs-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 14px 16px;
  text-align: left;
  background: var(--bg-mid);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.specs-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}

.specs-table tr:last-child td {
  border-bottom: none;
}

.specs-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.specs-table td:first-child {
  color: var(--text);
  font-weight: 600;
}

.specs-table td:nth-child(2) {
  font-family: var(--font-mono);
  font-size: 11px;
}

.specs-table .status-operational {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 11px;
}

.specs-table .status-development {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 11px;
}

.specs-table .status-retired {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Agencies Grid ────────────────── */
.agencies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.agency-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 0.5s var(--ease) forwards;
}

.agency-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.agency-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 12px 40px rgba(0,0,0,0.4);
  transform: translateY(-4px);
}

.agency-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.agency-flag {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.agency-title {
  flex: 1;
}

.agency-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
}

.agency-full-name {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.agency-country {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.agency-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  flex: 1;
}

.agency-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  align-self: flex-start;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.agency-link-btn:hover {
  color: var(--accent);
  border-color: rgba(79,156,249,0.4);
  background: var(--accent-glow);
}

/* ── Footer ───────────────────────── */
#footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 48px 24px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

.footer-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.8;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ── Responsive ───────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(5,8,16,0.97);
    backdrop-filter: blur(20px);
    padding: 20px 24px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    z-index: 99;
  }
  .nav-toggle { display: flex; }
  .nav-date { display: none; }

  section { padding: 72px 20px; }

  .archive-days { max-width: 100%; }

  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

@media (max-width: 480px) {
  .digest-grid { grid-template-columns: 1fr; }
  .agencies-grid { grid-template-columns: 1fr; }
  .archive-days { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .day-pill { font-size: 11px; }
  .archive-month { font-size: 16px; min-width: 140px; }
}
