/* ============================================
   Realistic Futures of AI — Custom Styles
   "The Observatory" design system
   ============================================ */

/* --- Color Palette (CSS Custom Properties) --- */
:root {
  /* Base */
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-border: #E2E8F0;

  /* Primary: Teal */
  --color-primary: #0D9488;
  --color-primary-light: #14B8A6;
  --color-primary-dark: #0F766E;

  /* Accent: Amber */
  --color-accent: #D97706;
  --color-accent-light: #F59E0B;

  /* Scenario colors */
  --color-scenario-teal: #0D9488;
  --color-scenario-amber: #D97706;
  --color-scenario-blue: #2563EB;
  --color-scenario-violet: #7C3AED;
  --color-scenario-red: #DC2626;

  /* Scrollbar */
  --color-scrollbar: #CBD5E1;

  /* Category badge colors */
  --color-cat-agi: #0D9488;
  --color-cat-asi: #D97706;
  --color-cat-singularity: #7C3AED;
  --color-cat-other: #64748B;
}

.dark {
  --color-bg: #0C1222;
  --color-surface: #1A2332;
  --color-text: #E2E8F0;
  --color-text-muted: #94A3B8;
  --color-border: #2D3A4D;
  --color-scrollbar: #475569;
}

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

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--color-scrollbar);
  border-radius: 20px;
}

/* --- Typography enhancements --- */
.prose h2 {
  scroll-margin-top: 5rem;
}
.prose h3 {
  scroll-margin-top: 5rem;
}

/* --- Tables --- */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.prose thead th {
  background-color: #ffffff;
}

.dark .prose thead th {
  background-color: #1A2332;
}

.prose tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

.dark .prose tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.prose tbody tr:hover {
  background-color: rgba(13, 148, 136, 0.05);
}

/* Mobile table scroll */
@media (max-width: 768px) {
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- TOC sidebar --- */
.toc-sidebar {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.toc-sidebar::-webkit-scrollbar {
  width: 4px;
}

.toc-link {
  display: block;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.toc-link:hover {
  color: var(--color-primary);
}

.toc-link.active {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 500;
}

.toc-link.toc-h3 {
  padding-left: 1.5rem;
  font-size: 0.75rem;
}

/* --- Milestone Track --- */
.milestone-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 0.75rem 3.25rem;
}

.milestone-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-border);
  transform: translateY(-50%);
}

.milestone-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 5.75rem;
  z-index: 1;
}

.milestone-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  transition: all 0.3s ease;
}

.milestone-dot.achieved {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.milestone-dot.current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2);
  animation: pulse-glow 2s ease-in-out infinite;
}

.milestone-dot.future {
  background: var(--color-surface);
  border-color: var(--color-border);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0.1); }
}

.milestone-year {
  margin-top: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.milestone-label {
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-align: center;
  width: 5.75rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* --- Prediction Chart --- */
.prediction-chart {
  position: relative;
  overflow-x: auto;
}

.prediction-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.prediction-label {
  flex: 0 0 10rem;
  font-size: 0.8125rem;
  font-weight: 500;
  padding-right: 1rem;
}

.prediction-source {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.prediction-bar-area {
  flex: 1;
  position: relative;
  height: 1.5rem;
}

.prediction-bar {
  position: absolute;
  height: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 0.25rem;
  opacity: 0.8;
}

.prediction-bar.agi { background: var(--color-cat-agi); }
.prediction-bar.asi { background: var(--color-cat-asi); }
.prediction-bar.singularity { background: var(--color-cat-singularity); }
.prediction-bar.other { background: var(--color-cat-other); }

.prediction-dot {
  position: absolute;
  width: 0.625rem;
  height: 0.625rem;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.prediction-dot.agi { background: var(--color-cat-agi); }
.prediction-dot.asi { background: var(--color-cat-asi); }
.prediction-dot.singularity { background: var(--color-cat-singularity); }
.prediction-dot.other { background: var(--color-cat-other); }

/* Year axis */
.year-axis {
  display: flex;
  border-top: 1px solid var(--color-border);
  padding-top: 0.5rem;
}

.year-axis-label-area {
  flex: 0 0 10rem;
}

.year-axis-ticks {
  flex: 1;
  position: relative;
  height: 1.5rem;
}

.year-tick {
  position: absolute;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

/* --- Scenario Cards --- */
.scenario-card {
  border-left: 4px solid;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scenario-card:hover {
  transform: translateY(-2px);
}

.scenario-card.teal { border-left-color: var(--color-scenario-teal); }
.scenario-card.amber { border-left-color: var(--color-scenario-amber); }
.scenario-card.blue { border-left-color: var(--color-scenario-blue); }
.scenario-card.violet { border-left-color: var(--color-scenario-violet); }

/* --- Update Cards --- */
.update-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.update-card:hover {
  transform: translateY(-2px);
}

/* --- Hero section --- */
.hero-gradient {
  background: linear-gradient(135deg, #0C1222 0%, #162032 50%, #0F766E 100%);
}

/* --- Category badges --- */
.cat-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

/* --- Last Updated badge --- */
.last-updated {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

/* --- Print styles --- */
@media print {
  .toc-sidebar,
  .navbar,
  .mobile-menu,
  footer,
  .dark-toggle {
    display: none !important;
  }

  .prose {
    max-width: 100% !important;
  }

  body {
    color: #000 !important;
    background: #fff !important;
  }
}
